Fix:Support negative parameters in Affine Cipher
This commit is contained in:
parent
2a1294f1c0
commit
f8341115de
@ -28,7 +28,7 @@ export function affineEncode(input, args) {
|
|||||||
b = args[1];
|
b = args[1];
|
||||||
let output = "";
|
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.");
|
throw new OperationError("The values of a and b can only be integers.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user