From 547f65025b594206457171c6739fe9b39220cd7e Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Tue, 13 Aug 2024 15:07:31 -0700 Subject: [PATCH] move to 96 bits --- src/runtime/keyed-crypto.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/runtime/keyed-crypto.ts b/src/runtime/keyed-crypto.ts index 93b47e99..fdd32a06 100644 --- a/src/runtime/keyed-crypto.ts +++ b/src/runtime/keyed-crypto.ts @@ -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();