From e1e88c35eff175e4f90c16a2ddc57e0abbc3b9f9 Mon Sep 17 00:00:00 2001 From: Barry Brown Date: Fri, 14 Jun 2024 02:40:24 +0000 Subject: [PATCH] affineDecrypt accepts either null or undefined from modInv --- src/core/lib/Ciphers.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/Ciphers.mjs b/src/core/lib/Ciphers.mjs index fe40677a..aaa24232 100644 --- a/src/core/lib/Ciphers.mjs +++ b/src/core/lib/Ciphers.mjs @@ -172,7 +172,7 @@ export function affineDecrypt(input, a, b, alphabet="a-z") { const aInv = Utils.modInv(a, 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 + "."); else return affineApplication(input, aInv, bInv, alphabet, decryptFn); }