From b46462fa87aa949777b68b9e8bcba93c1c1d06b1 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 14 Aug 2025 06:56:44 -0700 Subject: [PATCH] Declare once and set in loop instead of redeclaring every time. --- src/lib/crypto/nano-nacl.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/nano-nacl.ts b/src/lib/crypto/nano-nacl.ts index b00a017..0e86748 100644 --- a/src/lib/crypto/nano-nacl.ts +++ b/src/lib/crypto/nano-nacl.ts @@ -270,12 +270,13 @@ export class NanoNaCl { } static scalarmult (p: BigInt64Array[], q: BigInt64Array[], s: Uint8Array): void { + let b: bigint p[0].fill(0n) p[1].fill(0n).set([1n], 0) p[2].fill(0n).set([1n], 0) p[3].fill(0n) for (let i = 255; i >= 0; --i) { - const b: bigint = (BigInt(s[(i / 8) | 0]) >> (BigInt(i) & 7n)) & 1n + b = (BigInt(s[(i / 8) | 0]) >> (BigInt(i) & 7n)) & 1n this.cswap(p, q, b) this.add(q, p) this.add(p, p) -- 2.47.3