From d4ea37ecc3dec4d09fabc897b52b35a4a654a41b Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 28 Aug 2026 21:51:34 -0700 Subject: [PATCH] Fix unit test for equalbytes. --- src/assembly/utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 } -- 2.52.0