Naming fix

This commit is contained in:
morrigan 2019-11-07 17:21:03 +01:00
parent 529389651a
commit b9f66bcb8e

View File

@ -81,8 +81,8 @@ export class XXHandshake {
} }
private nonceToBytes(n: uint32) : bytes { private nonceToBytes(n: uint32) : bytes {
const nonce = Buffer.alloc(12, 0x00); const nonce = Buffer.alloc(12);
nonce.writeUInt32LE(n, 4, true); nonce.writeUInt32LE(n, 4);
return nonce; return nonce;
} }
@ -101,11 +101,11 @@ export class XXHandshake {
private decrypt(k: bytes32, n: uint32, ad: bytes, ciphertext: bytes) : bytes { private decrypt(k: bytes32, n: uint32, ad: bytes, ciphertext: bytes) : bytes {
const nonce = this.nonceToBytes(n); const nonce = this.nonceToBytes(n);
const aead = new AEAD(); const ctx = new AEAD();
aead.init(k, nonce); ctx.init(k, nonce);
aead.aad(ad); ctx.aad(ad);
aead.decrypt(ciphertext); ctx.decrypt(ciphertext);
// Decryption is done on the sent reference // Decryption is done on the sent reference
return ciphertext; return ciphertext;