From: Chris Duncan Date: Sat, 29 Aug 2026 04:51:34 +0000 (-0700) Subject: Fix unit test for equalbytes. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=d4ea37ecc3dec4d09fabc897b52b35a4a654a41b;p=nano25519.git Fix unit test for equalbytes. --- diff --git a/src/assembly/utils.ts b/src/assembly/utils.ts index 27690e3..d8cb54f 100644 --- a/src/assembly/utils.ts +++ b/src/assembly/utils.ts @@ -81,9 +81,9 @@ export function sodium_is_zero (n: StaticArray, nlen: i32): u8 { const testbytesA = new StaticArray(32).fill(0) const testbytesB = new StaticArray(32).fill(0) for (let i = 0; i < 32; i++) { - testbytesA[i] = 1 - if (equalbytes(testbytesA, testbytesB, 32)) { - throw new Error('equalbytes failed unit test') + for (let j: u8 = 0; j < 8; j++) { + testbytesA[i] = 1 << j + if (equalbytes(testbytesA, testbytesB, 32)) { throw new Error('equalbytes failed unit test') } + testbytesA[i] = 0 } - testbytesA[i] = 0 }