From 16b31b90876698d7a02cc1f1058b53b70ede6f92 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Sun, 23 Apr 2023 18:28:47 +0000 Subject: [PATCH] edwards: use bitmask instead of exp --- src/abstract/edwards.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/abstract/edwards.ts b/src/abstract/edwards.ts index f785ede..3eae5f3 100644 --- a/src/abstract/edwards.ts +++ b/src/abstract/edwards.ts @@ -102,7 +102,7 @@ export function twistedEdwards(curveDef: CurveType): CurveFn { nByteLength, h: cofactor, } = CURVE; - const MASK = _2n ** BigInt(nByteLength * 8); + const MASK = _2n << (BigInt(nByteLength * 8) - _1n); const modP = Fp.create; // Function overrides // sqrt(u/v)