Merge 2672b1dfad1f85b342691be370d671ab370e2414 into 002ed911b1a39f303b70246ac0ebf455a91c6d0f
This commit is contained in:
commit
cd6630d6b3
@ -51,6 +51,11 @@ class BLAKE3 extends Operation {
|
||||
run(input, args) {
|
||||
const key = args[1];
|
||||
const size = args[0];
|
||||
|
||||
if (!Number.isInteger(size) || size < 0) {
|
||||
throw new OperationError("Size must be a non-negative integer");
|
||||
}
|
||||
|
||||
const opts = { dkLen: size };
|
||||
const inputBytes = new Uint8Array(Utils.strToArrayBuffer(input));
|
||||
if (key !== "") {
|
||||
|
||||
@ -34,6 +34,24 @@ TestRegister.addTests([
|
||||
"args": [32, ""] }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "BLAKE3: negative size",
|
||||
input: "hello",
|
||||
expectedOutput: "Size must be a non-negative integer",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE3",
|
||||
"args": [-6, ""] }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "BLAKE3: fractional size",
|
||||
input: "hello",
|
||||
expectedOutput: "Size must be a non-negative integer",
|
||||
recipeConfig: [
|
||||
{ "op": "BLAKE3",
|
||||
"args": [1.2, ""] }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "BLAKE3: Key Test",
|
||||
input: "Hello world",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user