mirror of
https://github.com/gchq/CyberChef
synced 2025-01-12 04:28:53 +00:00
Change SIZE field type
This commit is contained in:
parent
a477f47aec
commit
6500d05bf3
2 changed files with 16 additions and 4 deletions
|
@ -32,8 +32,10 @@ class BLAKE2b extends Operation {
|
|||
this.args = [
|
||||
{
|
||||
"name": "Size",
|
||||
"type": "option",
|
||||
"value": ["512", "384", "256", "160", "128"]
|
||||
"type": "number",
|
||||
"value": 256,
|
||||
"min": 8,
|
||||
"max": 512
|
||||
}, {
|
||||
"name": "Output Encoding",
|
||||
"type": "option",
|
||||
|
@ -61,6 +63,10 @@ class BLAKE2b extends Operation {
|
|||
throw new OperationError(["Key cannot be greater than 64 bytes", "It is currently " + key.length + " bytes."].join("\n"));
|
||||
}
|
||||
|
||||
if (outSize % 8 !== 0 || outSize < 8 || outSize > 512) {
|
||||
throw new OperationError("Size has to be between 8 to 512 and multiple of 8.");
|
||||
}
|
||||
|
||||
input = new Uint8Array(input);
|
||||
switch (outFormat) {
|
||||
case "Hex":
|
||||
|
|
|
@ -32,8 +32,10 @@ class BLAKE2s extends Operation {
|
|||
this.args = [
|
||||
{
|
||||
"name": "Size",
|
||||
"type": "option",
|
||||
"value": ["256", "160", "128"]
|
||||
"type": "number",
|
||||
"value": 256,
|
||||
"min": 8,
|
||||
"max": 256
|
||||
}, {
|
||||
"name": "Output Encoding",
|
||||
"type": "option",
|
||||
|
@ -62,6 +64,10 @@ class BLAKE2s extends Operation {
|
|||
throw new OperationError(["Key cannot be greater than 32 bytes", "It is currently " + key.length + " bytes."].join("\n"));
|
||||
}
|
||||
|
||||
if (outSize % 8 !== 0 || outSize < 8 || outSize > 256) {
|
||||
throw new OperationError("Size has to be between 8 to 256 and multiple of 8.");
|
||||
}
|
||||
|
||||
input = new Uint8Array(input);
|
||||
switch (outFormat) {
|
||||
case "Hex":
|
||||
|
|
Loading…
Reference in a new issue