INNER CODE UNIT · TypeScript
ciphertext
paulmillr/noble-ciphers · benchmark/thirdparty/index.ts:45
const ciphertext = buf.slice(0, -16);
const authTag = buf.slice(-16);
const decipher = createDecipheriv(name, opts.key, opts.iv);
if (opts.aad) c.setAAD(opts.aad);
decipher.setAuthTag(authTag);
return concatBytes(
...[decipher.update(ciphertext), decipher.final()].map((i) => Uint8Array.from(i))
);
},
};
};
const nodeAES = (name, pcks7 = true) => {
return {
encrypt: (buf, opts) => {
const res = [];
const c = createCipheriv(name, opts.key, opts.iv);
c.setAutoPadding(pcks7); // disable pkcs7Padding