affineDecrypt accepts either null or undefined from modInv
This commit is contained in:
parent
1017294942
commit
e1e88c35ef
@ -172,7 +172,7 @@ export function affineDecrypt(input, a, b, alphabet="a-z") {
|
|||||||
|
|
||||||
const aInv = Utils.modInv(a, m);
|
const aInv = Utils.modInv(a, m);
|
||||||
const bInv = (m - b) % m;
|
const bInv = (m - b) % m;
|
||||||
if (aInv === null)
|
if (aInv === null || aInv === undefined)
|
||||||
throw new OperationError("The value of `a` (" + a + ") must be coprime to " + m + ".");
|
throw new OperationError("The value of `a` (" + a + ") must be coprime to " + m + ".");
|
||||||
else return affineApplication(input, aInv, bInv, alphabet, decryptFn);
|
else return affineApplication(input, aInv, bInv, alphabet, decryptFn);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user