bip151: fix aead aad etm.
This commit is contained in:
parent
08bc5ba0a8
commit
f837317ffd
@ -202,8 +202,9 @@ BIP151Stream.prototype.getPublicKey = function getPublicKey() {
|
|||||||
BIP151Stream.prototype.encryptSize = function encryptSize(size) {
|
BIP151Stream.prototype.encryptSize = function encryptSize(size) {
|
||||||
var data = new Buffer(4);
|
var data = new Buffer(4);
|
||||||
data.writeUInt32LE(size, 0, true);
|
data.writeUInt32LE(size, 0, true);
|
||||||
|
this.chacha.encrypt(data);
|
||||||
this.aead.aad(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) {
|
BIP151Stream.prototype.decryptSize = function decryptSize(data) {
|
||||||
data = data.slice(0, 4);
|
data = data.slice(0, 4);
|
||||||
this.chacha.encrypt(data);
|
|
||||||
this.aead.aad(data);
|
this.aead.aad(data);
|
||||||
|
this.chacha.encrypt(data);
|
||||||
return data.readUInt32LE(0, true);
|
return data.readUInt32LE(0, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user