Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/salsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ export const xsalsa20poly1305: TRet<ARXCipher> = /* @__PURE__ */ wrapCipher(
clean(tmp);
const authKey = xsalsa20(key, nonce, tmp, tmp);
const tag = poly1305(ciphPlaintext, authKey);
if (!equalBytes(passedTag, tag)) throw new Error('invalid tag');
if (!equalBytes(passedTag, tag)) {
clean(tmp, passedTag, tag);
Comment thread
ChALkeR marked this conversation as resolved.
Outdated
throw new Error('invalid tag');
}
// output = stream ^ output[16..]
xsalsa20(key, nonce, output.subarray(16), output.subarray(16));
clean(tmp, passedTag, tag);
Expand Down
Loading