Fix:Support negative parameters in Affine Cipher

This commit is contained in:
Thanatos 2025-10-03 17:11:22 +08:00
parent 2a1294f1c0
commit f8341115de

View File

@ -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.");
}