This commit is contained in:
Indra 2025-04-03 08:20:11 +01:00 committed by GitHub
commit 41f07eb579
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 281 additions and 1 deletions

View file

@ -174,6 +174,7 @@ import "./tests/JSONtoYAML.mjs";
import "./tests/YARA.mjs";
import "./tests/ParseCSR.mjs";
import "./tests/XXTEA.mjs";
import "./tests/FNV.mjs";
const testStatus = {
allTestsPassing: true,

View file

@ -0,0 +1,100 @@
/**
* FNV tests
*
* @author TheIndra55 [theindra@protonmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "FNV-1: 32-bit",
input: "Hello, World",
expectedOutput: "57c1791d",
recipeConfig: [
{
op: "FNV-1",
args: ["32"]
}
]
},
{
name: "FNV-1: 64-bit",
input: "Hello, World",
expectedOutput: "7b7fdc56f6a11b3d",
recipeConfig: [
{
op: "FNV-1",
args: ["64"]
}
]
},
{
name: "FNV-1: 128-bit",
input: "Hello, World",
expectedOutput: "19922cf5ab67a18bcfb7e8f3c7ccd435",
recipeConfig: [
{
op: "FNV-1",
args: ["128"]
}
]
},
{
name: "FNV-1: 256-bit",
input: "Hello, World",
expectedOutput: "3e3bfd5f1d1c0be4887134fce95e52c0f33f2931081c26330bdd7780eeb2ead",
recipeConfig: [
{
op: "FNV-1",
args: ["256"]
}
]
},
{
name: "FNV-1a: 32-bit",
input: "Hello, World",
expectedOutput: "66d37c5d",
recipeConfig: [
{
op: "FNV-1a",
args: ["32"]
}
]
},
{
name: "FNV-1a: 64-bit",
input: "Hello, World",
expectedOutput: "a28e0387da37a07d",
recipeConfig: [
{
op: "FNV-1a",
args: ["64"]
}
]
},
{
name: "FNV-1a: 128-bit",
input: "Hello, World",
expectedOutput: "5c9ecbd668e872034facb07b72b3a0c5",
recipeConfig: [
{
op: "FNV-1a",
args: ["128"]
}
]
},
{
name: "FNV-1a: 256-bit",
input: "Hello, World",
expectedOutput: "f7ce17afba5b7d52d482b4fce95e52c0f3400d0d29ad18dce0651d6d1cd936d",
recipeConfig: [
{
op: "FNV-1a",
args: ["256"]
}
]
}
]);