Add integer check for alphabet size (#2458)
Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com>
This commit is contained in:
parent
7f0544e1c6
commit
91178a8e6f
@ -50,6 +50,14 @@ class GenerateDeBruijnSequence extends Operation {
|
|||||||
throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive).");
|
throw new OperationError("Invalid alphabet size, required to be between 2 and 9 (inclusive).");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Number.isInteger(k)) {
|
||||||
|
throw new OperationError("Invalid alphabet size, required to be integer.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number.isInteger(n)) {
|
||||||
|
throw new OperationError("Invalid key length, required to be integer.");
|
||||||
|
}
|
||||||
|
|
||||||
if (n < 2) {
|
if (n < 2) {
|
||||||
throw new OperationError("Invalid key length, required to be at least 2.");
|
throw new OperationError("Invalid key length, required to be at least 2.");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user