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