From 95c0a39bc0a13a7246c11b51dc7c2427501d8b9d Mon Sep 17 00:00:00 2001 From: nir11 Date: Tue, 22 Aug 2023 18:31:53 +0300 Subject: [PATCH 1/2] Replace 'shrn' with 'iushrn' to perform an in-place unsigned right-shift operation --- src/js/signature.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/signature.ts b/src/js/signature.ts index fc7fb91..d01fb7b 100644 --- a/src/js/signature.ts +++ b/src/js/signature.ts @@ -94,7 +94,7 @@ function pedersen(input: Array) { if (x.and(oneBn).toNumber() !== 0) { point = point.add(pt); } - x = x.shrn(1); + x.iushrn(1); } } return point.getX().toString(16); From 3efec101ad61efd753b6add9abbd651eeb1119c2 Mon Sep 17 00:00:00 2001 From: DanZ Date: Tue, 14 Nov 2023 14:00:48 +0200 Subject: [PATCH 2/2] Update signature.ts --- src/js/signature.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/signature.ts b/src/js/signature.ts index d01fb7b..d45eb1b 100644 --- a/src/js/signature.ts +++ b/src/js/signature.ts @@ -86,7 +86,7 @@ function hasHexPrefix(str: string) { function pedersen(input: Array) { let point = shiftPoint; for (let i = 0; i < input.length; i++) { - let x = new BN(input[i], 16); + const x = new BN(input[i], 16); assert(x.gte(zeroBn) && x.lt(prime), 'Invalid input: ' + input[i]); for (let j = 0; j < 252; j++) { const pt = constantPoints[2 + i * 252 + j];