bip151: fix aead aad etm.

This commit is contained in:
Christopher Jeffrey 2016-07-26 23:39:21 -07:00
parent 08bc5ba0a8
commit f837317ffd
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -202,8 +202,9 @@ BIP151Stream.prototype.getPublicKey = function getPublicKey() {
BIP151Stream.prototype.encryptSize = function encryptSize(size) {
var data = new Buffer(4);
data.writeUInt32LE(size, 0, true);
this.chacha.encrypt(data);
this.aead.aad(data);
return this.chacha.encrypt(data);
return data;
};
/**
@ -214,8 +215,8 @@ BIP151Stream.prototype.encryptSize = function encryptSize(size) {
BIP151Stream.prototype.decryptSize = function decryptSize(data) {
data = data.slice(0, 4);
this.chacha.encrypt(data);
this.aead.aad(data);
this.chacha.encrypt(data);
return data.readUInt32LE(0, true);
};