From: Chris Duncan Date: Thu, 14 Aug 2025 13:56:44 +0000 (-0700) Subject: Declare once and set in loop instead of redeclaring every time. X-Git-Tag: v0.10.5~41^2~98 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=b46462fa87aa949777b68b9e8bcba93c1c1d06b1;p=libnemo.git Declare once and set in loop instead of redeclaring every time. --- 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)