Skip to content

Commit 8ad6b7e

Browse files
committed
ed25519: Fix carry bug
See dchest/tweetnacl-js#187
1 parent 95694e3 commit 8ad6b7e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/ed25519/ed25519.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ function modL(r: Uint8Array, x: Float64Array) {
704704
carry = 0;
705705
for (j = i - 32, k = i - 12; j < k; ++j) {
706706
x[j] += carry - 16 * x[i] * L[j - (i - 32)];
707-
carry = (x[j] + 128) >> 8;
707+
carry = Math.floor((x[j] + 128) / 256);
708708
x[j] -= carry * 256;
709709
}
710710
x[j] += carry;

0 commit comments

Comments
 (0)