Skip to content

Commit

Permalink
move to 96 bits
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Aug 13, 2024
1 parent 0392c73 commit 547f650
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/runtime/keyed-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ export class BlockIvKeyIdCodec implements BlockCodec<0x300539, Uint8Array> {
let hashArray;
if (!this.iv) {
const hash = await hasher.digest(data);
const doubleHash = await hasher.digest(hash.bytes);
hashArray = new Uint8Array(doubleHash.bytes);
const hashBytes = new Uint8Array(hash.bytes);
hashArray = new Uint8Array(12); // 96 bits = 12 bytes
for (let i = 0; i < hashBytes.length; i++) {
hashArray[i % 12] ^= hashBytes[i];
}
}
const { iv } = this.ko.algo(this.iv || hashArray);
const fprt = await this.ko.fingerPrint();
Expand Down

0 comments on commit 547f650

Please sign in to comment.