You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function modInverse(thisNumber, thisMod) {
let thatNumber = thisNumber % thisMod;
let x = 0;
for (x = 1; x < thisMod; x++) {
if ((thatNumber * x) % thisMod === 1) {
return x;
}
}
// FIXME: should never get here, in this case I do not know what to return
return 0;
}
I tested the function, it works, it is just a matter of adding BigNumber into the function which I did below and also tested it.
function modInverse(thisNumber, thisMod) {
let thatNumber = new BigNumberJs.BigNumber(thisNumber);
thatNumber = thatNumber.modulo(thisMod);
let x = 0;
for (x = 1; x < thisMod; x++) {
if (thatNumber.times(x).modulo(thisMod).toString() === "1") {
return x;
}
}
// FIXME: should never get here, in this case I do not know what to return
return 0;
}
as the title
The text was updated successfully, but these errors were encountered: