mod the input
This commit is contained in:
parent
3f7519bed4
commit
f38c0f5063
|
|
@ -164,6 +164,11 @@ function modsqrt(n, modulus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add special case for modulus = 3 (mod 4)
|
// TODO: add special case for modulus = 3 (mod 4)
|
||||||
|
|
||||||
|
n %= modulus;
|
||||||
|
if (n < 0n) {
|
||||||
|
n += modulus;
|
||||||
|
}
|
||||||
|
|
||||||
if (n % modulus === 0n) {
|
if (n % modulus === 0n) {
|
||||||
return 0n;
|
return 0n;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue