From: Chris Duncan Date: Fri, 5 Dec 2025 16:20:30 +0000 (-0800) Subject: Remove paramenter since unsafe multiplication was deprecated. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=10c497a2ed09feae4e01b47c10a2fab9e0ad8c0b;p=libnemo.git Remove paramenter since unsafe multiplication was deprecated. --- diff --git a/src/lib/crypto/secp256k1.ts b/src/lib/crypto/secp256k1.ts index 9c95e4d..0d56660 100644 --- a/src/lib/crypto/secp256k1.ts +++ b/src/lib/crypto/secp256k1.ts @@ -19,7 +19,7 @@ type Point = { negate: () => Point double: () => Point add: (other: Point) => Point - multiply: (n: bigint, safe?: boolean) => Point + multiply: (n: bigint) => Point toAffine: () => AffinePoint assertValidity: () => Point toBytes: (isCompressed?: boolean) => Bytes @@ -224,10 +224,8 @@ export class Secp256k1 { * @param n scalar by which point is multiplied * @param safe safe mode guards against timing attacks; unsafe mode is faster */ - multiply (n: bigint, safe = true): Point { - if (!safe && n === 0n) return secp256k1.I - secp256k1.bigintInRange(n, 1n, secp256k1.N) - if (n === 1n) return this + multiply (n: bigint): Point { + if (secp256k1.bigintInRange(n, 1n, secp256k1.N) === 1n) return this if (this.equals(secp256k1.G)) return secp256k1.wNAF(n).p // init result point & fake point let p = secp256k1.I @@ -236,7 +234,7 @@ export class Secp256k1 { // if bit is present, add to point // if not present, add to fake, for timing safety if (n & 1n) p = p.add(d) - else if (safe) f = f.add(d) + else f = f.add(d) } return p },