From f8341115deaf299923e5d2ae4b7f8ce8556e2e20 Mon Sep 17 00:00:00 2001 From: Thanatos <574401159@qq.com> Date: Fri, 3 Oct 2025 17:11:22 +0800 Subject: [PATCH] Fix:Support negative parameters in Affine Cipher --- 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 6266a8e1de..069f41028b 100644 --- a/src/core/lib/Ciphers.mjs +++ b/src/core/lib/Ciphers.mjs @@ -28,7 +28,7 @@ export function affineEncode(input, args) { b = args[1]; let output = ""; - if (!/^\+?(0|[1-9]\d*)$/.test(a) || !/^\+?(0|[1-9]\d*)$/.test(b)) { + if (!/^[+-]?(0|[1-9]\d*)$/.test(a) || !/^[+-]?(0|[1-9]\d*)$/.test(b)) { throw new OperationError("The values of a and b can only be integers."); }