add formatter

This commit is contained in:
Hare Sudhan 2024-02-24 22:59:51 -05:00
parent c4e7c41a6e
commit ce30989adc
693 changed files with 51226 additions and 26671 deletions

View file

@ -11,10 +11,7 @@
* @license Apache-2.0
*/
import {
setLongTestFailure,
logTestReport,
} from "../lib/utils.mjs";
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
import TestRegister from "../lib/TestRegister.mjs";
import "./tests/AESKeyWrap.mjs";
@ -148,14 +145,14 @@ const testStatus = {
allTestsPassing: true,
counts: {
total: 0,
}
},
};
setLongTestFailure();
const logOpsTestReport = logTestReport.bind(null, testStatus);
(async function() {
(async function () {
const results = await TestRegister.runTests();
logOpsTestReport(results);
})();

View file

@ -7,316 +7,400 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 128-bit KEK",
"input": "00112233445566778899aabbccddeeff",
"expectedOutput": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
"recipeConfig": [
name: "AES Key Wrap: RFC Test Vector, 128-bit data, 128-bit KEK",
input: "00112233445566778899aabbccddeeff",
expectedOutput: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 192-bit KEK",
"input": "00112233445566778899aabbccddeeff",
"expectedOutput": "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
"recipeConfig": [
name: "AES Key Wrap: RFC Test Vector, 128-bit data, 192-bit KEK",
input: "00112233445566778899aabbccddeeff",
expectedOutput: "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: RFC Test Vector, 128-bit data, 256-bit KEK",
"input": "00112233445566778899aabbccddeeff",
"expectedOutput": "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
"recipeConfig": [
name: "AES Key Wrap: RFC Test Vector, 128-bit data, 256-bit KEK",
input: "00112233445566778899aabbccddeeff",
expectedOutput: "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 192-bit KEK",
"input": "00112233445566778899aabbccddeeff0001020304050607",
"expectedOutput": "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
"recipeConfig": [
name: "AES Key Wrap: RFC Test Vector, 192-bit data, 192-bit KEK",
input: "00112233445566778899aabbccddeeff0001020304050607",
expectedOutput:
"031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: RFC Test Vector, 192-bit data, 256-bit KEK",
"input": "00112233445566778899aabbccddeeff0001020304050607",
"expectedOutput": "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
"recipeConfig": [
name: "AES Key Wrap: RFC Test Vector, 192-bit data, 256-bit KEK",
input: "00112233445566778899aabbccddeeff0001020304050607",
expectedOutput:
"a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: RFC Test Vector, 256-bit data, 256-bit KEK",
"input": "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
"expectedOutput": "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
"recipeConfig": [
name: "AES Key Wrap: RFC Test Vector, 256-bit data, 256-bit KEK",
input: "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
expectedOutput:
"28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 128-bit KEK",
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
"expectedOutput": "00112233445566778899aabbccddeeff",
"recipeConfig": [
name: "AES Key Unwrap: RFC Test Vector, 128-bit data, 128-bit KEK",
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
expectedOutput: "00112233445566778899aabbccddeeff",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 192-bit KEK",
"input": "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
"expectedOutput": "00112233445566778899aabbccddeeff",
"recipeConfig": [
name: "AES Key Unwrap: RFC Test Vector, 128-bit data, 192-bit KEK",
input: "96778b25ae6ca435f92b5b97c050aed2468ab8a17ad84e5d",
expectedOutput: "00112233445566778899aabbccddeeff",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: RFC Test Vector, 128-bit data, 256-bit KEK",
"input": "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
"expectedOutput": "00112233445566778899aabbccddeeff",
"recipeConfig": [
name: "AES Key Unwrap: RFC Test Vector, 128-bit data, 256-bit KEK",
input: "64e8c3f9ce0f5ba263e9777905818a2a93c8191e7d6e8ae7",
expectedOutput: "00112233445566778899aabbccddeeff",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 192-bit KEK",
"input": "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
"expectedOutput": "00112233445566778899aabbccddeeff0001020304050607",
"recipeConfig": [
name: "AES Key Unwrap: RFC Test Vector, 192-bit data, 192-bit KEK",
input: "031d33264e15d33268f24ec260743edce1c6c7ddee725a936ba814915c6762d2",
expectedOutput: "00112233445566778899aabbccddeeff0001020304050607",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f1011121314151617"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f1011121314151617",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: RFC Test Vector, 192-bit data, 256-bit KEK",
"input": "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
"expectedOutput": "00112233445566778899aabbccddeeff0001020304050607",
"recipeConfig": [
name: "AES Key Unwrap: RFC Test Vector, 192-bit data, 256-bit KEK",
input: "a8f9bc1612c68b3ff6e6f4fbe30e71e4769c8b80a32cb8958cd5d17d6b254da1",
expectedOutput: "00112233445566778899aabbccddeeff0001020304050607",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: RFC Test Vector, 256-bit data, 256-bit KEK",
"input": "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
"expectedOutput": "00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
"recipeConfig": [
name: "AES Key Unwrap: RFC Test Vector, 256-bit data, 256-bit KEK",
input: "28c9f404c4b810f4cbccb35cfb87f8263f5786e2d80ed326cbc7f0e71a99f43bfb988b9b7a02dd21",
expectedOutput:
"00112233445566778899aabbccddeeff000102030405060708090a0b0c0d0e0f",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: invalid KEK length",
"input": "00112233445566778899aabbccddeeff",
"expectedOutput": "KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
"recipeConfig": [
name: "AES Key Wrap: invalid KEK length",
input: "00112233445566778899aabbccddeeff",
expectedOutput:
"KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "00010203040506070809"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{ option: "Hex", string: "00010203040506070809" },
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: invalid IV length",
"input": "00112233445566778899aabbccddeeff",
"expectedOutput": "IV must be 8 bytes (currently 6 bytes)",
"recipeConfig": [
name: "AES Key Wrap: invalid IV length",
input: "00112233445566778899aabbccddeeff",
expectedOutput: "IV must be 8 bytes (currently 6 bytes)",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: input length not multiple of 8",
"input": "00112233445566778899aabbccddeeff0102",
"expectedOutput": "input must be 8n (n>=2) bytes (currently 18 bytes)",
"recipeConfig": [
name: "AES Key Wrap: input length not multiple of 8",
input: "00112233445566778899aabbccddeeff0102",
expectedOutput: "input must be 8n (n>=2) bytes (currently 18 bytes)",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Wrap: input too short",
"input": "0011223344556677",
"expectedOutput": "input must be 8n (n>=2) bytes (currently 8 bytes)",
"recipeConfig": [
name: "AES Key Wrap: input too short",
input: "0011223344556677",
expectedOutput: "input must be 8n (n>=2) bytes (currently 8 bytes)",
recipeConfig: [
{
"op": "AES Key Wrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Wrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: invalid KEK length",
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
"expectedOutput": "KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
"recipeConfig": [
name: "AES Key Unwrap: invalid KEK length",
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
expectedOutput:
"KEK must be either 16, 24, or 32 bytes (currently 10 bytes)",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "00010203040506070809"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{ option: "Hex", string: "00010203040506070809" },
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: invalid IV length",
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
"expectedOutput": "IV must be 8 bytes (currently 6 bytes)",
"recipeConfig": [
name: "AES Key Unwrap: invalid IV length",
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5",
expectedOutput: "IV must be 8 bytes (currently 6 bytes)",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: input length not multiple of 8",
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5e621",
"expectedOutput": "input must be 8n (n>=3) bytes (currently 26 bytes)",
"recipeConfig": [
name: "AES Key Unwrap: input length not multiple of 8",
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe5e621",
expectedOutput: "input must be 8n (n>=3) bytes (currently 26 bytes)",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: input too short",
"input": "1fa68b0a8112b447aef34bd8fb5a7b82",
"expectedOutput": "input must be 8n (n>=3) bytes (currently 16 bytes)",
"recipeConfig": [
name: "AES Key Unwrap: input too short",
input: "1fa68b0a8112b447aef34bd8fb5a7b82",
expectedOutput: "input must be 8n (n>=3) bytes (currently 16 bytes)",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],
},
{
"name": "AES Key Unwrap: corrupted input",
"input": "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe6",
"expectedOutput": "IV mismatch",
"recipeConfig": [
name: "AES Key Unwrap: corrupted input",
input: "1fa68b0a8112b447aef34bd8fb5a7b829d3e862371d2cfe6",
expectedOutput: "IV mismatch",
recipeConfig: [
{
"op": "AES Key Unwrap",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c0d0e0f"},
{"option": "Hex", "string": "a6a6a6a6a6a6a6a6"},
"Hex", "Hex"
op: "AES Key Unwrap",
args: [
{
option: "Hex",
string: "000102030405060708090a0b0c0d0e0f",
},
{ option: "Hex", string: "a6a6a6a6a6a6a6a6" },
"Hex",
"Hex",
],
},
],

View file

@ -16,8 +16,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Avro to JSON",
args: [true]
}
args: [true],
},
],
},
{
@ -27,40 +27,42 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Avro to JSON",
args: [false]
}
args: [false],
},
],
},
{
name: "Avro to JSON: small (force JSON true)",
input: "\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
input:
"\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
"\x63\x6f\x72\x64\x22\x2c\x22\x6e\x61\x6d\x65\x22\x3a\x22\x73\x6d\x61\x6c\x6c\x22\x2c\x22\x66\x69\x65\x6c\x64\x73\x22\x3a" +
"\x5b\x7b\x22\x6e\x61\x6d\x65\x22\x3a\x22\x6e\x61\x6d\x65\x22\x2c\x22\x74\x79\x70\x65\x22\x3a\x22\x73\x74\x72\x69\x6e\x67" +
"\x22\x7d\x5d\x7d\x14\x61\x76\x72\x6f\x2e\x63\x6f\x64\x65\x63\x08\x6e\x75\x6c\x6c\x00\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7" +
"\x5c\xda\xb9\xa6\x2f\x15\x41\x02\x0e\x0c\x6d\x79\x6e\x61\x6d\x65\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7\x5c\xda\xb9\xa6\x2f" +
"\x15\x41",
expectedOutput: "{\n \"name\": \"myname\"\n}",
expectedOutput: '{\n "name": "myname"\n}',
recipeConfig: [
{
op: "Avro to JSON",
args: [true]
}
args: [true],
},
],
},
{
name: "Avro to JSON: small (force JSON false)",
input: "\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
input:
"\x4f\x62\x6a\x01\x04\x16\x61\x76\x72\x6f\x2e\x73\x63\x68\x65\x6d\x61\x96\x01\x7b\x22\x74\x79\x70\x65\x22\x3a\x22\x72\x65" +
"\x63\x6f\x72\x64\x22\x2c\x22\x6e\x61\x6d\x65\x22\x3a\x22\x73\x6d\x61\x6c\x6c\x22\x2c\x22\x66\x69\x65\x6c\x64\x73\x22\x3a" +
"\x5b\x7b\x22\x6e\x61\x6d\x65\x22\x3a\x22\x6e\x61\x6d\x65\x22\x2c\x22\x74\x79\x70\x65\x22\x3a\x22\x73\x74\x72\x69\x6e\x67" +
"\x22\x7d\x5d\x7d\x14\x61\x76\x72\x6f\x2e\x63\x6f\x64\x65\x63\x08\x6e\x75\x6c\x6c\x00\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7" +
"\x5c\xda\xb9\xa6\x2f\x15\x41\x02\x0e\x0c\x6d\x79\x6e\x61\x6d\x65\x4e\x02\x47\x63\x2e\x37\x02\xe5\xb7\x5c\xda\xb9\xa6\x2f" +
"\x15\x41",
expectedOutput: "{\"name\":\"myname\"}\n",
expectedOutput: '{"name":"myname"}\n',
recipeConfig: [
{
op: "Avro to JSON",
args: [false]
}
args: [false],
},
],
}
},
]);

View file

@ -14,21 +14,22 @@ TestRegister.addTests([
expectedOutput: "0000",
recipeConfig: [
{
"op": "To BCD",
"args": ["8 4 2 1", true, false, "Nibbles"]
}
]
op: "To BCD",
args: ["8 4 2 1", true, false, "Nibbles"],
},
],
},
{
name: "To BCD: unpacked nibbles",
input: "1234567890",
expectedOutput: "0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 0000",
expectedOutput:
"0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 0000",
recipeConfig: [
{
"op": "To BCD",
"args": ["8 4 2 1", false, false, "Nibbles"]
}
]
op: "To BCD",
args: ["8 4 2 1", false, false, "Nibbles"],
},
],
},
{
name: "To BCD: packed, signed bytes",
@ -36,21 +37,22 @@ TestRegister.addTests([
expectedOutput: "00000001 00100011 01000101 01100111 10001001 00001100",
recipeConfig: [
{
"op": "To BCD",
"args": ["8 4 2 1", true, true, "Bytes"]
}
]
op: "To BCD",
args: ["8 4 2 1", true, true, "Bytes"],
},
],
},
{
name: "To BCD: packed, signed nibbles, 8 4 -2 -1",
input: "-1234567890",
expectedOutput: "0000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 1101",
expectedOutput:
"0000 0111 0110 0101 0100 1011 1010 1001 1000 1111 0000 1101",
recipeConfig: [
{
"op": "To BCD",
"args": ["8 4 -2 -1", true, true, "Nibbles"]
}
]
op: "To BCD",
args: ["8 4 -2 -1", true, true, "Nibbles"],
},
],
},
{
name: "From BCD: default 0",
@ -58,10 +60,10 @@ TestRegister.addTests([
expectedOutput: "0",
recipeConfig: [
{
"op": "From BCD",
"args": ["8 4 2 1", true, false, "Nibbles"]
}
]
op: "From BCD",
args: ["8 4 2 1", true, false, "Nibbles"],
},
],
},
{
name: "From BCD: packed, signed bytes",
@ -69,10 +71,10 @@ TestRegister.addTests([
expectedOutput: "-1234567890",
recipeConfig: [
{
"op": "From BCD",
"args": ["8 4 2 1", true, true, "Bytes"]
}
]
op: "From BCD",
args: ["8 4 2 1", true, true, "Bytes"],
},
],
},
{
name: "From BCD: Excess-3, unpacked, unsigned",
@ -80,10 +82,10 @@ TestRegister.addTests([
expectedOutput: "1234567890",
recipeConfig: [
{
"op": "From BCD",
"args": ["Excess-3", false, false, "Nibbles"]
}
]
op: "From BCD",
args: ["Excess-3", false, false, "Nibbles"],
},
],
},
{
name: "BCD: raw 4 2 2 1, packed, signed",
@ -91,13 +93,13 @@ TestRegister.addTests([
expectedOutput: "1234567890",
recipeConfig: [
{
"op": "To BCD",
"args": ["4 2 2 1", true, true, "Raw"]
op: "To BCD",
args: ["4 2 2 1", true, true, "Raw"],
},
{
"op": "From BCD",
"args": ["4 2 2 1", true, true, "Raw"]
}
]
op: "From BCD",
args: ["4 2 2 1", true, true, "Raw"],
},
],
},
]);

View file

@ -11,46 +11,63 @@ TestRegister.addTests([
{
name: "BLAKE2b: 512 - Hello World",
input: "Hello World",
expectedOutput: "4386a08a265111c9896f56456e2cb61a64239115c4784cf438e36cc851221972da3fb0115f73cd02486254001f878ab1fd126aac69844ef1c1ca152379d0a9bd",
expectedOutput:
"4386a08a265111c9896f56456e2cb61a64239115c4784cf438e36cc851221972da3fb0115f73cd02486254001f878ab1fd126aac69844ef1c1ca152379d0a9bd",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["512", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2b",
args: ["512", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2b: 384 - Hello World",
input: "Hello World",
expectedOutput: "4d388e82ca8f866e606b6f6f0be910abd62ad6e98c0adfc27cf35acf948986d5c5b9c18b6f47261e1e679eb98edf8e2d",
expectedOutput:
"4d388e82ca8f866e606b6f6f0be910abd62ad6e98c0adfc27cf35acf948986d5c5b9c18b6f47261e1e679eb98edf8e2d",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["384", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2b",
args: ["384", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2b: 256 - Hello World",
input: "Hello World",
expectedOutput: "1dc01772ee0171f5f614c673e3c7fa1107a8cf727bdf5a6dadb379e93c0d1d00",
expectedOutput:
"1dc01772ee0171f5f614c673e3c7fa1107a8cf727bdf5a6dadb379e93c0d1d00",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["256", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2b",
args: ["256", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2b: 160 - Hello World",
input: "Hello World",
expectedOutput: "6a8489e6fd6e51fae12ab271ec7fc8134dd5d737",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["160", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2b",
args: ["160", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2b: Key Test",
input: "message data",
expectedOutput: "3d363ff7401e02026f4a4687d4863ced",
recipeConfig: [
{ "op": "BLAKE2b",
"args": ["128", "Hex", {string: "pseudorandom key", option: "UTF8"}] }
]
}
{
op: "BLAKE2b",
args: [
"128",
"Hex",
{ string: "pseudorandom key", option: "UTF8" },
],
},
],
},
]);

View file

@ -11,37 +11,46 @@ TestRegister.addTests([
{
name: "BLAKE2s: 256 - Hello World",
input: "Hello World",
expectedOutput: "7706af019148849e516f95ba630307a2018bb7bf03803eca5ed7ed2c3c013513",
expectedOutput:
"7706af019148849e516f95ba630307a2018bb7bf03803eca5ed7ed2c3c013513",
recipeConfig: [
{ "op": "BLAKE2s",
"args": ["256", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2s",
args: ["256", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2s: 160 - Hello World",
input: "Hello World",
expectedOutput: "0e4fcfc2ee0097ac1d72d70b595a39e09a3c7c7e",
recipeConfig: [
{ "op": "BLAKE2s",
"args": ["160", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2s",
args: ["160", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2s: 128 - Hello World",
input: "Hello World",
expectedOutput: "9964ee6f36126626bf864363edfa96f6",
recipeConfig: [
{ "op": "BLAKE2s",
"args": ["128", "Hex", {string: "", option: "UTF8"}] }
]
{
op: "BLAKE2s",
args: ["128", "Hex", { string: "", option: "UTF8" }],
},
],
},
{
name: "BLAKE2s: Key Test",
input: "Hello World",
expectedOutput: "9964ee6f36126626bf864363edfa96f6",
recipeConfig: [
{ "op": "BLAKE2s",
"args": ["128", "Hex", {string: "", option: "UTF8"}] }
]
}
{
op: "BLAKE2s",
args: ["128", "Hex", { string: "", option: "UTF8" }],
},
],
},
]);

View file

@ -22,8 +22,9 @@ TestRegister.addTests([
},
{
name: "BSON serialise: basic",
input: "{\"hello\":\"world\"}",
expectedOutput: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
input: '{"hello":"world"}',
expectedOutput:
"\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
recipeConfig: [
{
op: "BSON serialise",
@ -45,7 +46,7 @@ TestRegister.addTests([
{
name: "BSON deserialise: basic",
input: "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00",
expectedOutput: "{\n \"hello\": \"world\"\n}",
expectedOutput: '{\n "hello": "world"\n}',
recipeConfig: [
{
op: "BSON deserialise",

View file

@ -6,7 +6,10 @@
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
import { BACON_ALPHABETS, BACON_TRANSLATIONS } from "../../../src/core/lib/Bacon.mjs";
import {
BACON_ALPHABETS,
BACON_TRANSLATIONS,
} from "../../../src/core/lib/Bacon.mjs";
const alphabets = Object.keys(BACON_ALPHABETS);
const translations = BACON_TRANSLATIONS;
@ -19,8 +22,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[0], false]
}
args: [alphabets[0], translations[0], false],
},
],
},
{
@ -30,8 +33,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[0], false]
}
args: [alphabets[0], translations[0], false],
},
],
},
{
@ -41,8 +44,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[0], true]
}
args: [alphabets[0], translations[0], true],
},
],
},
{
@ -52,8 +55,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], false]
}
args: [alphabets[0], translations[1], false],
},
],
},
{
@ -63,8 +66,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], true]
}
args: [alphabets[0], translations[1], true],
},
],
},
{
@ -74,8 +77,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], false]
}
args: [alphabets[0], translations[1], false],
},
],
},
{
@ -85,8 +88,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[1], true]
}
args: [alphabets[0], translations[1], true],
},
],
},
{
@ -96,8 +99,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[2], false]
}
args: [alphabets[0], translations[2], false],
},
],
},
{
@ -107,8 +110,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[2], true]
}
args: [alphabets[0], translations[2], true],
},
],
},
{
@ -118,8 +121,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[3], false]
}
args: [alphabets[0], translations[3], false],
},
],
},
{
@ -129,8 +132,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[0], translations[3], true]
}
args: [alphabets[0], translations[3], true],
},
],
},
{
@ -140,8 +143,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[0], false]
}
args: [alphabets[1], translations[0], false],
},
],
},
{
@ -151,8 +154,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[0], true]
}
args: [alphabets[1], translations[0], true],
},
],
},
{
@ -162,8 +165,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], false]
}
args: [alphabets[1], translations[1], false],
},
],
},
{
@ -173,8 +176,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], true]
}
args: [alphabets[1], translations[1], true],
},
],
},
{
@ -184,8 +187,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], false]
}
args: [alphabets[1], translations[1], false],
},
],
},
{
@ -195,8 +198,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[1], true]
}
args: [alphabets[1], translations[1], true],
},
],
},
{
@ -206,8 +209,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[2], false]
}
args: [alphabets[1], translations[2], false],
},
],
},
{
@ -217,8 +220,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[2], true]
}
args: [alphabets[1], translations[2], true],
},
],
},
{
@ -228,8 +231,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[3], false]
}
args: [alphabets[1], translations[3], false],
},
],
},
{
@ -239,8 +242,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Decode",
args: [alphabets[1], translations[3], true]
}
args: [alphabets[1], translations[3], true],
},
],
},
{
@ -250,184 +253,200 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[0], false, false]
}
args: [alphabets[0], translations[0], false, false],
},
],
},
{
name: "Bacon Encode: reduced alphabet 0/1",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "10010 00111 00100 10000 00100 10001 00000 00101 01101 10101 00000 01100 00011 01000 10010 01000 10011 01011 01110 10001 01101 10011 00100 10000 10010 00111 00100 00101 00100 01100 00010 00100",
expectedOutput:
"10010 00111 00100 10000 00100 10001 00000 00101 01101 10101 00000 01100 00011 01000 10010 01000 10011 01011 01110 10001 01101 10011 00100 10000 10010 00111 00100 00101 00100 01100 00010 00100",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[0], false, false]
}
args: [alphabets[0], translations[0], false, false],
},
],
},
{
name: "Bacon Encode: reduced alphabet 0/1 inverse",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "01101 11000 11011 01111 11011 01110 11111 11010 10010 01010 11111 10011 11100 10111 01101 10111 01100 10100 10001 01110 10010 01100 11011 01111 01101 11000 11011 11010 11011 10011 11101 11011",
expectedOutput:
"01101 11000 11011 01111 11011 01110 11111 11010 10010 01010 11111 10011 11100 10111 01101 10111 01100 10100 10001 01110 10010 01100 11011 01111 01101 11000 11011 11010 11011 10011 11101 11011",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[0], false, true]
}
args: [alphabets[0], translations[0], false, true],
},
],
},
{
name: "Bacon Encode: reduced alphabet 0/1, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "1001000111001001000000100'10001 00000 001010110110101, 000000110000011 0100010010 0100010011010110111010001 01101100110010010000 100100011100100 0010100100011000001000100.",
expectedOutput:
"1001000111001001000000100'10001 00000 001010110110101, 000000110000011 0100010010 0100010011010110111010001 01101100110010010000 100100011100100 0010100100011000001000100.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[0], true, false]
}
args: [alphabets[0], translations[0], true, false],
},
],
},
{
name: "Bacon Encode: reduced alphabet 0/1 inverse, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "0110111000110110111111011'01110 11111 110101001001010, 111111001111100 1011101101 1011101100101001000101110 10010011001101101111 011011100011011 1101011011100111110111011.",
expectedOutput:
"0110111000110110111111011'01110 11111 110101001001010, 111111001111100 1011101101 1011101100101001000101110 10010011001101101111 011011100011011 1101011011100111110111011.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[0], true, true]
}
args: [alphabets[0], translations[0], true, true],
},
],
},
{
name: "Bacon Encode: reduced alphabet A/B",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "BAABA AABBB AABAA BAAAA AABAA BAAAB AAAAA AABAB ABBAB BABAB AAAAA ABBAA AAABB ABAAA BAABA ABAAA BAABB ABABB ABBBA BAAAB ABBAB BAABB AABAA BAAAA BAABA AABBB AABAA AABAB AABAA ABBAA AAABA AABAA",
expectedOutput:
"BAABA AABBB AABAA BAAAA AABAA BAAAB AAAAA AABAB ABBAB BABAB AAAAA ABBAA AAABB ABAAA BAABA ABAAA BAABB ABABB ABBBA BAAAB ABBAB BAABB AABAA BAAAA BAABA AABBB AABAA AABAB AABAA ABBAA AAABA AABAA",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[1], false, false]
}
args: [alphabets[0], translations[1], false, false],
},
],
},
{
name: "Bacon Encode: reduced alphabet A/B inverse",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "ABBAB BBAAA BBABB ABBBB BBABB ABBBA BBBBB BBABA BAABA ABABA BBBBB BAABB BBBAA BABBB ABBAB BABBB ABBAA BABAA BAAAB ABBBA BAABA ABBAA BBABB ABBBB ABBAB BBAAA BBABB BBABA BBABB BAABB BBBAB BBABB",
expectedOutput:
"ABBAB BBAAA BBABB ABBBB BBABB ABBBA BBBBB BBABA BAABA ABABA BBBBB BAABB BBBAA BABBB ABBAB BABBB ABBAA BABAA BAAAB ABBBA BAABA ABBAA BBABB ABBBB ABBAB BBAAA BBABB BBABA BBABB BAABB BBBAB BBABB",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[1], false, true]
}
args: [alphabets[0], translations[1], false, true],
},
],
},
{
name: "Bacon Encode: reduced alphabet A/B, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "BAABAAABBBAABAABAAAAAABAA'BAAAB AAAAA AABABABBABBABAB, AAAAAABBAAAAABB ABAAABAABA ABAAABAABBABABBABBBABAAAB ABBABBAABBAABAABAAAA BAABAAABBBAABAA AABABAABAAABBAAAAABAAABAA.",
expectedOutput:
"BAABAAABBBAABAABAAAAAABAA'BAAAB AAAAA AABABABBABBABAB, AAAAAABBAAAAABB ABAAABAABA ABAAABAABBABABBABBBABAAAB ABBABBAABBAABAABAAAA BAABAAABBBAABAA AABABAABAAABBAAAAABAAABAA.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[1], true, false]
}
args: [alphabets[0], translations[1], true, false],
},
],
},
{
name: "Bacon Encode: reduced alphabet A/B inverse, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "ABBABBBAAABBABBABBBBBBABB'ABBBA BBBBB BBABABAABAABABA, BBBBBBAABBBBBAA BABBBABBAB BABBBABBAABABAABAAABABBBA BAABAABBAABBABBABBBB ABBABBBAAABBABB BBABABBABBBAABBBBBABBBABB.",
expectedOutput:
"ABBABBBAAABBABBABBBBBBABB'ABBBA BBBBB BBABABAABAABABA, BBBBBBAABBBBBAA BABBBABBAB BABBBABBAABABAABAAABABBBA BAABAABBAABBABBABBBB ABBABBBAAABBABB BBABABBABBBAABBBBBABBBABB.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[0], translations[1], true, true]
}
args: [alphabets[0], translations[1], true, true],
},
],
},
{
name: "Bacon Encode: complete alphabet 0/1",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "10011 00111 00100 10001 00100 10010 00000 00101 01110 10111 00000 01101 00011 01000 10011 01001 10100 01100 01111 10010 01110 10101 00100 10001 10011 00111 00100 00101 00100 01101 00010 00100",
expectedOutput:
"10011 00111 00100 10001 00100 10010 00000 00101 01110 10111 00000 01101 00011 01000 10011 01001 10100 01100 01111 10010 01110 10101 00100 10001 10011 00111 00100 00101 00100 01101 00010 00100",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[0], false, false]
}
args: [alphabets[1], translations[0], false, false],
},
],
},
{
name: "Bacon Encode: complete alphabet 0/1 inverse",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "01100 11000 11011 01110 11011 01101 11111 11010 10001 01000 11111 10010 11100 10111 01100 10110 01011 10011 10000 01101 10001 01010 11011 01110 01100 11000 11011 11010 11011 10010 11101 11011",
expectedOutput:
"01100 11000 11011 01110 11011 01101 11111 11010 10001 01000 11111 10010 11100 10111 01100 10110 01011 10011 10000 01101 10001 01010 11011 01110 01100 11000 11011 11010 11011 10010 11101 11011",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[0], false, true]
}
args: [alphabets[1], translations[0], false, true],
},
],
},
{
name: "Bacon Encode: complete alphabet 0/1, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "1001100111001001000100100'10010 00000 001010111010111, 000000110100011 0100010011 0100110100011000111110010 01110101010010010001 100110011100100 0010100100011010001000100.",
expectedOutput:
"1001100111001001000100100'10010 00000 001010111010111, 000000110100011 0100010011 0100110100011000111110010 01110101010010010001 100110011100100 0010100100011010001000100.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[0], true, false]
}
args: [alphabets[1], translations[0], true, false],
},
],
},
{
name: "Bacon Encode: complete alphabet 0/1 inverse, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "0110011000110110111011011'01101 11111 110101000101000, 111111001011100 1011101100 1011001011100111000001101 10001010101101101110 011001100011011 1101011011100101110111011.",
expectedOutput:
"0110011000110110111011011'01101 11111 110101000101000, 111111001011100 1011101100 1011001011100111000001101 10001010101101101110 011001100011011 1101011011100101110111011.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[0], true, true]
}
args: [alphabets[1], translations[0], true, true],
},
],
},
{
name: "Bacon Encode: complete alphabet A/B",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "BAABB AABBB AABAA BAAAB AABAA BAABA AAAAA AABAB ABBBA BABBB AAAAA ABBAB AAABB ABAAA BAABB ABAAB BABAA ABBAA ABBBB BAABA ABBBA BABAB AABAA BAAAB BAABB AABBB AABAA AABAB AABAA ABBAB AAABA AABAA",
expectedOutput:
"BAABB AABBB AABAA BAAAB AABAA BAABA AAAAA AABAB ABBBA BABBB AAAAA ABBAB AAABB ABAAA BAABB ABAAB BABAA ABBAA ABBBB BAABA ABBBA BABAB AABAA BAAAB BAABB AABBB AABAA AABAB AABAA ABBAB AAABA AABAA",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[1], false, false]
}
args: [alphabets[1], translations[1], false, false],
},
],
},
{
name: "Bacon Encode: complete alphabet A/B inverse",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "ABBAA BBAAA BBABB ABBBA BBABB ABBAB BBBBB BBABA BAAAB ABAAA BBBBB BAABA BBBAA BABBB ABBAA BABBA ABABB BAABB BAAAA ABBAB BAAAB ABABA BBABB ABBBA ABBAA BBAAA BBABB BBABA BBABB BAABA BBBAB BBABB",
expectedOutput:
"ABBAA BBAAA BBABB ABBBA BBABB ABBAB BBBBB BBABA BAAAB ABAAA BBBBB BAABA BBBAA BABBB ABBAA BABBA ABABB BAABB BAAAA ABBAB BAAAB ABABA BBABB ABBBA ABBAA BBAAA BBABB BBABA BBABB BAABA BBBAB BBABB",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[1], false, true]
}
args: [alphabets[1], translations[1], false, true],
},
],
},
{
name: "Bacon Encode: complete alphabet A/B, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "BAABBAABBBAABAABAAABAABAA'BAABA AAAAA AABABABBBABABBB, AAAAAABBABAAABB ABAAABAABB ABAABBABAAABBAAABBBBBAABA ABBBABABABAABAABAAAB BAABBAABBBAABAA AABABAABAAABBABAAABAAABAA.",
expectedOutput:
"BAABBAABBBAABAABAAABAABAA'BAABA AAAAA AABABABBBABABBB, AAAAAABBABAAABB ABAAABAABB ABAABBABAAABBAAABBBBBAABA ABBBABABABAABAABAAAB BAABBAABBBAABAA AABABAABAAABBABAAABAAABAA.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[1], true, false]
}
args: [alphabets[1], translations[1], true, false],
},
],
},
{
name: "Bacon Encode: complete alphabet A/B inverse, keeping extra characters",
input: "There's a fox, and it jumps over the fence.",
expectedOutput: "ABBAABBAAABBABBABBBABBABB'ABBAB BBBBB BBABABAAABABAAA, BBBBBBAABABBBAA BABBBABBAA BABBAABABBBAABBBAAAAABBAB BAAABABABABBABBABBBA ABBAABBAAABBABB BBABABBABBBAABABBBABBBABB.",
expectedOutput:
"ABBAABBAAABBABBABBBABBABB'ABBAB BBBBB BBABABAAABABAAA, BBBBBBAABABBBAA BABBBABBAA BABBAABABBBAABBBAAAAABBAB BAAABABABABBABBABBBA ABBAABBAAABBABB BBABABBABBBAABABBBABBBABB.",
recipeConfig: [
{
op: "Bacon Cipher Encode",
args: [alphabets[1], translations[1], true, true]
}
args: [alphabets[1], translations[1], true, true],
},
],
},
]);

View file

@ -16,7 +16,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
args: [
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
],
},
],
},
@ -27,7 +29,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
args: [
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
],
},
],
},
@ -38,7 +42,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
args: [
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
],
},
],
},
@ -49,7 +55,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
args: [
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
],
},
],
},
@ -60,7 +68,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
args: [
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
],
},
],
},
@ -71,7 +81,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
args: [
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
],
},
],
},
@ -82,7 +94,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base58",
args: ["123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],
args: [
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
],
},
],
},
@ -93,7 +107,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Base58",
args: ["rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"],
args: [
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
],
},
],
},

View file

@ -75,5 +75,5 @@ TestRegister.addTests([
args: ["0-9A-Za-z"],
},
],
}
},
]);

View file

@ -64,7 +64,8 @@ TestRegister.addTests([
{
name: "To Base64: All bytes",
input: ALL_BYTES,
expectedOutput: "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==",
expectedOutput:
"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==",
recipeConfig: [
{
op: "To Base64",

View file

@ -8,63 +8,52 @@
import TestRegister from "../../lib/TestRegister.mjs";
// Example from Wikipedia
const wpExample = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
const wpExample =
"Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
// Escape newline, quote & backslash
const wpOutput = "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,O<\
const wpOutput =
"9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,O<\
DJ+*.@<*K0@<6L(Df-\\0Ec5e;DffZ(EZee.Bl.9pF\"AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKYi(\
DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIal(\
DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G>u\
D.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c";
const allZeroExample = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
const allZeroExample =
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
const allZeroOutput = "zz!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm5X@_(6q'R884cEH9MJ8X:f1+h<)lt#=BSg3>[:ZC?t!MSA7]@cBPD3sCi+'.E,fo>FEMbNG^4U^I!pHnJ:W<)KS>/9Ll%\"IN/`jYOHG]iPa.Q$R$jD4S=Q7DTV8*TUnsrdW2ZetXKAY/Yd(L?['d?O\\@K2_]Y2%o^qmn*`5Ta:aN;TJbg\"GZd*^:jeCE.%f\\,!5gtgiEi8N\\UjQ5OekiqBum-X60nF?)@o_%qPq\"ad`r;HWp";
const allZeroOutput =
"zz!!*-'\"9eu7#RLhG$k3[W&.oNg'GVB\"(`=52*$$(B+<_pR,UFcb-n-Vr/1iJ-0JP==1c70M3&s#]4?Ykm5X@_(6q'R884cEH9MJ8X:f1+h<)lt#=BSg3>[:ZC?t!MSA7]@cBPD3sCi+'.E,fo>FEMbNG^4U^I!pHnJ:W<)KS>/9Ll%\"IN/`jYOHG]iPa.Q$R$jD4S=Q7DTV8*TUnsrdW2ZetXKAY/Yd(L?['d?O\\@K2_]Y2%o^qmn*`5Ta:aN;TJbg\"GZd*^:jeCE.%f\\,!5gtgiEi8N\\UjQ5OekiqBum-X60nF?)@o_%qPq\"ad`r;HWp";
TestRegister.addTests([
{
name: "To Base85",
input: wpExample,
expectedOutput: wpOutput,
recipeConfig: [
{ "op": "To Base85",
"args": ["!-u"] }
]
recipeConfig: [{ op: "To Base85", args: ["!-u"] }],
},
{
name: "From Base85",
input: wpOutput + "\n",
expectedOutput: wpExample,
recipeConfig: [
{ "op": "From Base85",
"args": ["!-u", true] }
]
recipeConfig: [{ op: "From Base85", args: ["!-u", true] }],
},
{
name: "From Base85",
input: wpOutput + "v",
expectedError: true,
expectedOutput: "From Base85 - Invalid character 'v' at index 337",
recipeConfig: [
{ "op": "From Base85",
"args": ["!-u", false] }
]
recipeConfig: [{ op: "From Base85", args: ["!-u", false] }],
},
{
name: "To Base85",
input: allZeroExample,
expectedOutput: allZeroOutput,
recipeConfig: [
{ "op": "To Base85",
"args": ["!-u"] }
]
recipeConfig: [{ op: "To Base85", args: ["!-u"] }],
},
{
name: "From Base85",
input: allZeroOutput,
expectedOutput: allZeroExample,
recipeConfig: [
{ "op": "From Base85",
"args": ["!-u", true, "z"] }
]
recipeConfig: [{ op: "From Base85", args: ["!-u", true, "z"] }],
},
]);

View file

@ -11,40 +11,34 @@ TestRegister.addTests([
{
name: "Bit shift left",
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
expectedOutput: "10101010 01010100 11111110 00000000 11100000 00011110 01100110 10011000",
expectedOutput:
"10101010 01010100 11111110 00000000 11100000 00011110 01100110 10011000",
recipeConfig: [
{ "op": "From Binary",
"args": ["Space"] },
{ "op": "Bit shift left",
"args": [1] },
{ "op": "To Binary",
"args": ["Space"] }
]
{ op: "From Binary", args: ["Space"] },
{ op: "Bit shift left", args: [1] },
{ op: "To Binary", args: ["Space"] },
],
},
{
name: "Bit shift right: Logical shift",
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
expectedOutput: "00101010 01010101 01111111 00000000 01111000 00000111 00011001 01100110",
expectedOutput:
"00101010 01010101 01111111 00000000 01111000 00000111 00011001 01100110",
recipeConfig: [
{ "op": "From Binary",
"args": ["Space"] },
{ "op": "Bit shift right",
"args": [1, "Logical shift"] },
{ "op": "To Binary",
"args": ["Space"] }
]
{ op: "From Binary", args: ["Space"] },
{ op: "Bit shift right", args: [1, "Logical shift"] },
{ op: "To Binary", args: ["Space"] },
],
},
{
name: "Bit shift right: Arithmetic shift",
input: "01010101 10101010 11111111 00000000 11110000 00001111 00110011 11001100",
expectedOutput: "00101010 11010101 11111111 00000000 11111000 00000111 00011001 11100110",
expectedOutput:
"00101010 11010101 11111111 00000000 11111000 00000111 00011001 11100110",
recipeConfig: [
{ "op": "From Binary",
"args": ["Space"] },
{ "op": "Bit shift right",
"args": [1, "Arithmetic shift"] },
{ "op": "To Binary",
"args": ["Space"] }
]
{ op: "From Binary", args: ["Space"] },
{ op: "Bit shift right", args: [1, "Arithmetic shift"] },
{ op: "To Binary", args: ["Space"] },
],
},
]);

View file

@ -11,98 +11,113 @@ TestRegister.addTests([
// Plugboard for this test is BO LC KE GA
name: "Bombe: 3 rotor (self-stecker)",
input: "BBYFLTHHYIJQAYBBYS",
expectedMatch: /<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
expectedMatch:
/<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTMESSAGE", 0, false
]
}
]
"THISISATESTMESSAGE",
0,
false,
],
},
],
},
{
// This test produces a menu that doesn't use the first letter, which is also a good test
name: "Bombe: 3 rotor (other stecker)",
input: "JBYALIHDYNUAAVKBYM",
expectedMatch: /<td>LGA<\/td> {2}<td>AG<\/td> {2}<td>QFIMUMAFKMQSKMYNGW<\/td>/,
expectedMatch:
/<td>LGA<\/td> {2}<td>AG<\/td> {2}<td>QFIMUMAFKMQSKMYNGW<\/td>/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTMESSAGE", 0, false
]
}
]
"THISISATESTMESSAGE",
0,
false,
],
},
],
},
{
name: "Bombe: crib offset",
input: "AAABBYFLTHHYIJQAYBBYS", // first three chars here are faked
expectedMatch: /<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
expectedMatch:
/<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTMESSAGE", 3, false
]
}
]
"THISISATESTMESSAGE",
3,
false,
],
},
],
},
{
name: "Bombe: multiple stops",
input: "BBYFLTHHYIJQAYBBYS",
expectedMatch: /<td>LGA<\/td> {2}<td>TT<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
expectedMatch:
/<td>LGA<\/td> {2}<td>TT<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTM", 0, false
]
}
]
"THISISATESTM",
0,
false,
],
},
],
},
{
name: "Bombe: checking machine",
input: "BBYFLTHHYIJQAYBBYS",
expectedMatch: /<td>LGA<\/td> {2}<td>TT AG BO CL EK FF HH II JJ SS YY<\/td> {2}<td>THISISATESTMESSAGE<\/td>/,
expectedMatch:
/<td>LGA<\/td> {2}<td>TT AG BO CL EK FF HH II JJ SS YY<\/td> {2}<td>THISISATESTMESSAGE<\/td>/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTM", 0, true
]
}
]
"THISISATESTM",
0,
true,
],
},
],
},
// Takes a while to run, so disabling for general purpose testing. Re-enable if modifying this operation.
// {
@ -130,18 +145,20 @@ TestRegister.addTests([
expectedMatch: /Crib cannot be empty/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"", 0, false
]
}
]
"",
0,
false,
],
},
],
},
{
name: "Bombe: short crib",
@ -149,18 +166,20 @@ TestRegister.addTests([
expectedMatch: /Crib is too short/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"A", 0, false
]
}
]
"A",
0,
false,
],
},
],
},
{
name: "Bombe: invalid crib",
@ -168,18 +187,20 @@ TestRegister.addTests([
expectedMatch: /Invalid crib: .* in both ciphertext and crib/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"AAAAAAAA", 0, false
]
}
]
"AAAAAAAA",
0,
false,
],
},
],
},
{
name: "Bombe: long crib",
@ -187,18 +208,20 @@ TestRegister.addTests([
expectedMatch: /Crib overruns supplied ciphertext/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"CCCCCCCCCCCCCCCCCCCCCC", 0, false
]
}
]
"CCCCCCCCCCCCCCCCCCCCCC",
0,
false,
],
},
],
},
{
name: "Bombe: really long crib",
@ -206,18 +229,20 @@ TestRegister.addTests([
expectedMatch: /Crib is too long/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"AAAAAAAAAAAAAAAAAAAAAAAAAA", 0, false
]
}
]
"AAAAAAAAAAAAAAAAAAAAAAAAAA",
0,
false,
],
},
],
},
{
name: "Bombe: negative offset",
@ -225,18 +250,20 @@ TestRegister.addTests([
expectedMatch: /Offset cannot be negative/,
recipeConfig: [
{
"op": "Bombe",
"args": [
op: "Bombe",
args: [
"3-rotor",
"",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R", // I
"AJDKSIRUXBLHWTMCQGZNPYFVOE<F", // II
"BDFHJLCPRTXVZNYEIWGAKMUSQO<W", // III
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"BBBBB", -1, false
]
}
]
"BBBBB",
-1,
false,
],
},
],
},
// Enigma tests cover validation of rotors and reflector
]);

View file

@ -33,10 +33,10 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "To Octal",
"args": ["Space"]
}
]
op: "To Octal",
args: ["Space"],
},
],
},
{
name: "From Octal: nothing",
@ -44,10 +44,10 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "From Octal",
"args": ["Space"]
}
]
op: "From Octal",
args: ["Space"],
},
],
},
{
name: "To Octal: hello world",
@ -55,10 +55,10 @@ TestRegister.addTests([
expectedOutput: "150 145 154 154 157 40 167 157 162 154 144",
recipeConfig: [
{
"op": "To Octal",
"args": ["Space"]
}
]
op: "To Octal",
args: ["Space"],
},
],
},
{
name: "From Octal: hello world",
@ -66,21 +66,22 @@ TestRegister.addTests([
expectedOutput: "hello world",
recipeConfig: [
{
"op": "From Octal",
"args": ["Space"]
}
]
op: "From Octal",
args: ["Space"],
},
],
},
{
name: "To Octal: Γειά σου",
input: "Γειά σου", // [206,147,206,181,206,185,206,172,32,207,131,206,191,207,133],
expectedOutput: "316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
expectedOutput:
"316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
recipeConfig: [
{
"op": "To Octal",
"args": ["Space"]
}
]
op: "To Octal",
args: ["Space"],
},
],
},
{
name: "From Octal: Γειά σου",
@ -88,10 +89,10 @@ TestRegister.addTests([
expectedOutput: "Γειά σου",
recipeConfig: [
{
"op": "From Octal",
"args": ["Space"]
}
]
op: "From Octal",
args: ["Space"],
},
],
},
{
name: "To Hex: nothing",
@ -100,31 +101,33 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hex",
args: ["Space"]
args: ["Space"],
},
]
],
},
{
name: "To Hex: All bytes",
input: ALL_BYTES,
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
expectedOutput:
"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
recipeConfig: [
{
op: "To Hex",
args: ["Space"]
args: ["Space"],
},
]
],
},
{
name: "To Hex: UTF-8",
input: "ნუ პანიკას",
expectedOutput: "e1839ce183a320e1839ee18390e1839ce18398e18399e18390e183a1",
expectedOutput:
"e1839ce183a320e1839ee18390e1839ce18398e18399e18390e183a1",
recipeConfig: [
{
op: "To Hex",
args: ["None"]
args: ["None"],
},
]
],
},
{
name: "From Hex: nothing",
@ -133,9 +136,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["Space"]
}
]
args: ["Space"],
},
],
},
{
name: "From Hex: All bytes",
@ -144,9 +147,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["Space"]
}
]
args: ["Space"],
},
],
},
{
name: "From Hex: UTF-8",
@ -155,9 +158,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
{
name: "To Charcode: nothing",
@ -166,20 +169,21 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Charcode",
args: ["Space", 16]
args: ["Space", 16],
},
]
],
},
{
name: "To Charcode: All bytes",
input: ALL_BYTES,
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
expectedOutput:
"00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff",
recipeConfig: [
{
op: "To Charcode",
args: ["Space", 16]
args: ["Space", 16],
},
]
],
},
{
name: "To Charcode: UTF-8",
@ -188,9 +192,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Charcode",
args: ["Space", 16]
args: ["Space", 16],
},
]
],
},
{
name: "From Charcode: nothing",
@ -199,9 +203,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Charcode",
args: ["Space", 16]
}
]
args: ["Space", 16],
},
],
},
{
name: "From Charcode: All bytes",
@ -210,9 +214,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Charcode",
args: ["Space", 16]
}
]
args: ["Space", 16],
},
],
},
{
name: "From Charcode: UTF-8",
@ -221,8 +225,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Charcode",
args: ["Space", 16]
}
]
args: ["Space", 16],
},
],
},
]);

View file

@ -16,13 +16,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Decode: Can decode decimal",
@ -31,28 +31,28 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
}
]
args: [],
},
],
},
{
name: "From Hex: Can decode text",
input: "64 54 65 78 74",
expectedOutput: "\"Text\"",
expectedOutput: '"Text"',
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
}
]
args: [],
},
],
},
{
name: "From Hex: Can decode boolean true",
@ -61,13 +61,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
}
]
args: [],
},
],
},
{
name: "From Hex: Can decode boolean false",
@ -76,32 +76,32 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
}
]
args: [],
},
],
},
{
name: "From Hex: Can decode map",
input: "a3 61 61 01 61 62 02 61 63 03",
expectedOutput: JSON.stringify({a: 1, b: 2, c: 3}),
expectedOutput: JSON.stringify({ a: 1, b: 2, c: 3 }),
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
args: [],
},
{
op: "JSON Minify",
args: []
}
]
args: [],
},
],
},
{
name: "From Hex: Can decode list",
@ -110,35 +110,35 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
args: [],
},
{
op: "JSON Minify",
args: []
}
]
args: [],
},
],
},
{
name: "From Hex: Can round trip with encode",
input: JSON.stringify({a: 1, b: false, c: [1, 2, 3]}),
expectedOutput: JSON.stringify({a: 1, b: false, c: [1, 2, 3]}),
input: JSON.stringify({ a: 1, b: false, c: [1, 2, 3] }),
expectedOutput: JSON.stringify({ a: 1, b: false, c: [1, 2, 3] }),
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "CBOR Decode",
args: []
args: [],
},
{
op: "JSON Minify",
args: []
}
]
}
args: [],
},
],
},
]);

View file

@ -16,13 +16,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Decode: Can encode decimal",
@ -31,28 +31,28 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Encode: Can encode text",
input: "\"Text\"",
input: '"Text"',
expectedOutput: "64 54 65 78 74",
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Encode: Can encode boolean true",
@ -61,13 +61,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Encode: Can encode boolean false",
@ -76,28 +76,28 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Encode: Can encode map",
input: JSON.stringify({a: 1, b: 2, c: 3}),
input: JSON.stringify({ a: 1, b: 2, c: 3 }),
expectedOutput: "a3 61 61 01 61 62 02 61 63 03",
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
args: [],
},
],
},
{
name: "CBOR Encode: Can encode list",
@ -106,12 +106,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CBOR Encode",
args: []
args: [],
},
{
op: "To Hex",
args: []
}
]
}
args: [],
},
],
},
]);

View file

@ -10,305 +10,439 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
"name": "CMAC-AES128 NIST's CSRC Example #1",
"input": "",
"expectedOutput": "bb1d6929e95937287fa37d129b756746",
"recipeConfig": [
name: "CMAC-AES128 NIST's CSRC Example #1",
input: "",
expectedOutput: "bb1d6929e95937287fa37d129b756746",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "2b7e151628aed2a6abf7158809cf4f3c",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES128 NIST's CSRC Example #2",
"input": "6bc1bee22e409f96e93d7e117393172a",
"expectedOutput": "070a16b46b4d4144f79bdd9dd04a287c",
"recipeConfig": [
name: "CMAC-AES128 NIST's CSRC Example #2",
input: "6bc1bee22e409f96e93d7e117393172a",
expectedOutput: "070a16b46b4d4144f79bdd9dd04a287c",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "2b7e151628aed2a6abf7158809cf4f3c",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES128 NIST's CSRC Example #3",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
"expectedOutput": "7d85449ea6ea19c823a7bf78837dfade",
"recipeConfig": [
name: "CMAC-AES128 NIST's CSRC Example #3",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
expectedOutput: "7d85449ea6ea19c823a7bf78837dfade",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "2b7e151628aed2a6abf7158809cf4f3c",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES128 NIST's CSRC Example #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"expectedOutput": "51f0bebf7e3b9d92fc49741779363cfe",
"recipeConfig": [
name: "CMAC-AES128 NIST's CSRC Example #4",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
expectedOutput: "51f0bebf7e3b9d92fc49741779363cfe",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "2b7e151628aed2a6abf7158809cf4f3c"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "2b7e151628aed2a6abf7158809cf4f3c",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES192 NIST's CSRC Example #1",
"input": "",
"expectedOutput": "d17ddf46adaacde531cac483de7a9367",
"recipeConfig": [
name: "CMAC-AES192 NIST's CSRC Example #1",
input: "",
expectedOutput: "d17ddf46adaacde531cac483de7a9367",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES192 NIST's CSRC Example #2",
"input": "6bc1bee22e409f96e93d7e117393172a",
"expectedOutput": "9e99a7bf31e710900662f65e617c5184",
"recipeConfig": [
name: "CMAC-AES192 NIST's CSRC Example #2",
input: "6bc1bee22e409f96e93d7e117393172a",
expectedOutput: "9e99a7bf31e710900662f65e617c5184",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES192 NIST's CSRC Example #3",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
"expectedOutput": "3d75c194ed96070444a9fa7ec740ecf8",
"recipeConfig": [
name: "CMAC-AES192 NIST's CSRC Example #3",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
expectedOutput: "3d75c194ed96070444a9fa7ec740ecf8",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES192 NIST's CSRC Example #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"expectedOutput": "a1d5df0eed790f794d77589659f39a11",
"recipeConfig": [
name: "CMAC-AES192 NIST's CSRC Example #4",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
expectedOutput: "a1d5df0eed790f794d77589659f39a11",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES256 NIST's CSRC Example #1",
"input": "",
"expectedOutput": "028962f61b7bf89efc6b551f4667d983",
"recipeConfig": [
name: "CMAC-AES256 NIST's CSRC Example #1",
input: "",
expectedOutput: "028962f61b7bf89efc6b551f4667d983",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES256 NIST's CSRC Example #2",
"input": "6bc1bee22e409f96e93d7e117393172a",
"expectedOutput": "28a7023f452e8f82bd4bf28d8c37c35c",
"recipeConfig": [
name: "CMAC-AES256 NIST's CSRC Example #2",
input: "6bc1bee22e409f96e93d7e117393172a",
expectedOutput: "28a7023f452e8f82bd4bf28d8c37c35c",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES256 NIST's CSRC Example #3",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
"expectedOutput": "156727dc0878944a023c1fe03bad6d93",
"recipeConfig": [
name: "CMAC-AES256 NIST's CSRC Example #3",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
expectedOutput: "156727dc0878944a023c1fe03bad6d93",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-AES256 NIST's CSRC Example #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
"expectedOutput": "e1992190549f6ed5696a2c056c315410",
"recipeConfig": [
name: "CMAC-AES256 NIST's CSRC Example #4",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
expectedOutput: "e1992190549f6ed5696a2c056c315410",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-TDES (1) NIST's CSRC Sample #1",
"input": "",
"expectedOutput": "7db0d37df936c550",
"recipeConfig": [
name: "CMAC-TDES (1) NIST's CSRC Sample #1",
input: "",
expectedOutput: "7db0d37df936c550",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (1) NIST's CSRC Sample #2",
"input": "6bc1bee22e409f96e93d7e117393172a",
"expectedOutput": "30239cf1f52e6609",
"recipeConfig": [
name: "CMAC-TDES (1) NIST's CSRC Sample #2",
input: "6bc1bee22e409f96e93d7e117393172a",
expectedOutput: "30239cf1f52e6609",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (1) NIST's CSRC Sample #3",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
"expectedOutput": "6c9f3ee4923f6be2",
"recipeConfig": [
name: "CMAC-TDES (1) NIST's CSRC Sample #3",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
expectedOutput: "6c9f3ee4923f6be2",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (1) NIST's CSRC Sample #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
"expectedOutput": "99429bd0bf7904e5",
"recipeConfig": [
name: "CMAC-TDES (1) NIST's CSRC Sample #4",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
expectedOutput: "99429bd0bf7904e5",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef01456789abcdef0123"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef01456789abcdef0123",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (2) NIST's CSRC Sample #1",
"input": "",
"expectedOutput": "79ce52a7f786a960",
"recipeConfig": [
name: "CMAC-TDES (2) NIST's CSRC Sample #1",
input: "",
expectedOutput: "79ce52a7f786a960",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef010123456789abcdef",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (2) NIST's CSRC Sample #2",
"input": "6bc1bee22e409f96e93d7e117393172a",
"expectedOutput": "cc18a0b79af2413b",
"recipeConfig": [
name: "CMAC-TDES (2) NIST's CSRC Sample #2",
input: "6bc1bee22e409f96e93d7e117393172a",
expectedOutput: "cc18a0b79af2413b",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef010123456789abcdef",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (2) NIST's CSRC Sample #3",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a57",
"expectedOutput": "c06d377ecd101969",
"recipeConfig": [
name: "CMAC-TDES (2) NIST's CSRC Sample #3",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a57",
expectedOutput: "c06d377ecd101969",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef010123456789abcdef",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-TDES (2) NIST's CSRC Sample #4",
"input": "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
"expectedOutput": "9cd33580f9b64dfb",
"recipeConfig": [
name: "CMAC-TDES (2) NIST's CSRC Sample #4",
input: "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51",
expectedOutput: "9cd33580f9b64dfb",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "0123456789abcdef23456789abcdef010123456789abcdef"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "0123456789abcdef23456789abcdef010123456789abcdef",
},
"Triple DES",
],
},
]
],
},
{
"name": "CMAC-AES: invalid key length",
"input": "",
"expectedOutput": "The key for AES must be either 16, 24, or 32 bytes (currently 20 bytes)",
"recipeConfig": [
name: "CMAC-AES: invalid key length",
input: "",
expectedOutput:
"The key for AES must be either 16, 24, or 32 bytes (currently 20 bytes)",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "00112233445566778899aabbccddeeff01234567"}, "AES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "00112233445566778899aabbccddeeff01234567",
},
"AES",
],
},
]
],
},
{
"name": "CMAC-TDES: invalid key length",
"input": "",
"expectedOutput": "The key for Triple DES must be 16 or 24 bytes (currently 20 bytes)",
"recipeConfig": [
name: "CMAC-TDES: invalid key length",
input: "",
expectedOutput:
"The key for Triple DES must be 16 or 24 bytes (currently 20 bytes)",
recipeConfig: [
{
"op": "CMAC",
"args": [{"option": "Hex", "string": "00112233445566778899aabbccddeeff01234567"}, "Triple DES"]
op: "CMAC",
args: [
{
option: "Hex",
string: "00112233445566778899aabbccddeeff01234567",
},
"Triple DES",
],
},
]
],
},
]);

View file

@ -19,161 +19,113 @@ TestRegister.addTests([
{
name: "CSV to JSON: Array of dictionaries",
input: EXAMPLE_CSV,
expectedOutput: JSON.stringify([
{
"A": "1",
"B": "2",
"C": "3",
"D": "4",
"E": "5",
"F": "6"
},
{
"A": ",",
"B": ";",
"C": "'",
"D": "\"",
"E": "",
"F": ""
},
{
"A": "\"hello\"",
"B": "a\"1",
"C": "multi\r\nline",
"D": "",
"E": "",
"F": "end"
}
], null, 4),
expectedOutput: JSON.stringify(
[
{
A: "1",
B: "2",
C: "3",
D: "4",
E: "5",
F: "6",
},
{
A: ",",
B: ";",
C: "'",
D: '"',
E: "",
F: "",
},
{
A: '"hello"',
B: 'a"1',
C: "multi\r\nline",
D: "",
E: "",
F: "end",
},
],
null,
4,
),
recipeConfig: [
{
op: "CSV to JSON",
args: [",", "\r\n", "Array of dictionaries"],
}
},
],
},
{
name: "CSV to JSON: Array of arrays",
input: EXAMPLE_CSV,
expectedOutput: JSON.stringify([
expectedOutput: JSON.stringify(
[
"A",
"B",
"C",
"D",
"E",
"F"
["A", "B", "C", "D", "E", "F"],
["1", "2", "3", "4", "5", "6"],
[",", ";", "'", '"', "", ""],
['"hello"', 'a"1', "multi\r\nline", "", "", "end"],
],
[
"1",
"2",
"3",
"4",
"5",
"6"
],
[
",",
";",
"'",
"\"",
"",
""
],
[
"\"hello\"",
"a\"1",
"multi\r\nline",
"",
"",
"end"
]
], null, 4),
null,
4,
),
recipeConfig: [
{
op: "CSV to JSON",
args: [",", "\r\n", "Array of arrays"],
}
},
],
},
{
name: "JSON to CSV: Array of dictionaries",
input: JSON.stringify([
{
"A": "1",
"B": "2",
"C": "3",
"D": "4",
"E": "5",
"F": "6"
A: "1",
B: "2",
C: "3",
D: "4",
E: "5",
F: "6",
},
{
"A": ",",
"B": ";",
"C": "'",
"D": "\"",
"E": "",
"F": ""
A: ",",
B: ";",
C: "'",
D: '"',
E: "",
F: "",
},
{
"A": "\"hello\"",
"B": "a\"1",
"C": "multi\r\nline",
"D": "",
"E": "",
"F": "end"
}
A: '"hello"',
B: 'a"1',
C: "multi\r\nline",
D: "",
E: "",
F: "end",
},
]),
expectedOutput: EXAMPLE_CSV,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\r\n"],
}
},
],
},
{
name: "JSON to CSV: Array of arrays",
input: JSON.stringify([
[
"A",
"B",
"C",
"D",
"E",
"F"
],
[
"1",
"2",
"3",
"4",
"5",
"6"
],
[
",",
";",
"'",
"\"",
"",
""
],
[
"\"hello\"",
"a\"1",
"multi\r\nline",
"",
"",
"end"
]
["A", "B", "C", "D", "E", "F"],
["1", "2", "3", "4", "5", "6"],
[",", ";", "'", '"', "", ""],
['"hello"', 'a"1', "multi\r\nline", "", "", "end"],
]),
expectedOutput: EXAMPLE_CSV,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\r\n"],
}
},
],
},
]);

View file

@ -41,5 +41,5 @@ TestRegister.addTests([
args: ["4"],
},
],
}
},
]);

View file

@ -27,7 +27,8 @@ TestRegister.addTests([
*/
name: "Caret/M-decode: Full set",
input: "^@^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\\^]^^^_ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\\M-^]M-^^M-^_M- M-!M-\"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9M-:M-;M-<M-=M->M-?M-@M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[M-\\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?",
expectedOutput: "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x1f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\x8d\x2d\x5f\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
expectedOutput:
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x1f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\x8d\x2d\x5f\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
recipeConfig: [
{
op: "Caret/M-decode",
@ -36,4 +37,3 @@ TestRegister.addTests([
],
},
]);

View file

@ -12,7 +12,8 @@ TestRegister.addTests([
{
name: "Cartesian Product",
input: "1 2 3 4 5\n\na b c d e",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
expectedOutput:
"(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
recipeConfig: [
{
op: "Cartesian Product",
@ -23,7 +24,8 @@ TestRegister.addTests([
{
name: "Cartesian Product: too many on left",
input: "1 2 3 4 5 6\n\na b c d e",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)",
expectedOutput:
"(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e) (6,a) (6,b) (6,c) (6,d) (6,e)",
recipeConfig: [
{
op: "Cartesian Product",
@ -34,7 +36,8 @@ TestRegister.addTests([
{
name: "Cartesian Product: too many on right",
input: "1 2 3 4 5\n\na b c d e f",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)",
expectedOutput:
"(1,a) (1,b) (1,c) (1,d) (1,e) (1,f) (2,a) (2,b) (2,c) (2,d) (2,e) (2,f) (3,a) (3,b) (3,c) (3,d) (3,e) (3,f) (4,a) (4,b) (4,c) (4,d) (4,e) (4,f) (5,a) (5,b) (5,c) (5,d) (5,e) (5,f)",
recipeConfig: [
{
op: "Cartesian Product",
@ -45,7 +48,8 @@ TestRegister.addTests([
{
name: "Cartesian Product: item delimiter",
input: "1-2-3-4-5\n\na-b-c-d-e",
expectedOutput: "(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)",
expectedOutput:
"(1,a)-(1,b)-(1,c)-(1,d)-(1,e)-(2,a)-(2,b)-(2,c)-(2,d)-(2,e)-(3,a)-(3,b)-(3,c)-(3,d)-(3,e)-(4,a)-(4,b)-(4,c)-(4,d)-(4,e)-(5,a)-(5,b)-(5,c)-(5,d)-(5,e)",
recipeConfig: [
{
op: "Cartesian Product",
@ -56,7 +60,8 @@ TestRegister.addTests([
{
name: "Cartesian Product: sample delimiter",
input: "1 2 3 4 5_a b c d e",
expectedOutput: "(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
expectedOutput:
"(1,a) (1,b) (1,c) (1,d) (1,e) (2,a) (2,b) (2,c) (2,d) (2,e) (3,a) (3,b) (3,c) (3,d) (3,e) (4,a) (4,b) (4,c) (4,d) (4,e) (5,a) (5,b) (5,c) (5,d) (5,e)",
recipeConfig: [
{
op: "Cartesian Product",

View file

@ -15,8 +15,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Cetacean Cipher Decode",
args: []
args: [],
},
],
}
},
]);

View file

@ -11,12 +11,13 @@ TestRegister.addTests([
{
name: "Cetacean Cipher Encode",
input: "a b c で",
expectedOutput: "EEEEEEEEEeeEEEEe EEEEEEEEEeeEEEeE EEEEEEEEEeeEEEee EEeeEEEEEeeEEeee",
expectedOutput:
"EEEEEEEEEeeEEEEe EEEEEEEEEeeEEEeE EEEEEEEEEeeEEEee EEeeEEEEEeeEEeee",
recipeConfig: [
{
op: "Cetacean Cipher Encode",
args: []
args: [],
},
],
}
},
]);

View file

@ -17,13 +17,16 @@ TestRegister.addTests([
ChaCha uses a key of 16 or 32 bytes (128 or 256 bits).`,
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
0, "20", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{ option: "Hex", string: "" },
{ option: "Hex", string: "" },
0,
"20",
"Hex",
"Hex",
],
},
],
},
{
@ -34,118 +37,176 @@ ChaCha uses a key of 16 or 32 bytes (128 or 256 bits).`,
ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).`,
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": ""},
0, "20", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "" },
0,
"20",
"Hex",
"Hex",
],
},
],
},
{
name: "ChaCha: RFC8439",
input: "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.",
expectedOutput: "6e 2e 35 9a 25 68 f9 80 41 ba 07 28 dd 0d 69 81 e9 7e 7a ec 1d 43 60 c2 0a 27 af cc fd 9f ae 0b f9 1b 65 c5 52 47 33 ab 8f 59 3d ab cd 62 b3 57 16 39 d6 24 e6 51 52 ab 8f 53 0c 35 9f 08 61 d8 07 ca 0d bf 50 0d 6a 61 56 a3 8e 08 8a 22 b6 5e 52 bc 51 4d 16 cc f8 06 81 8c e9 1a b7 79 37 36 5a f9 0b bf 74 a3 5b e6 b4 0b 8e ed f2 78 5e 42 87 4d",
expectedOutput:
"6e 2e 35 9a 25 68 f9 80 41 ba 07 28 dd 0d 69 81 e9 7e 7a ec 1d 43 60 c2 0a 27 af cc fd 9f ae 0b f9 1b 65 c5 52 47 33 ab 8f 59 3d ab cd 62 b3 57 16 39 d6 24 e6 51 52 ab 8f 53 0c 35 9f 08 61 d8 07 ca 0d bf 50 0d 6a 61 56 a3 8e 08 8a 22 b6 5e 52 bc 51 4d 16 cc f8 06 81 8c e9 1a b7 79 37 36 5a f9 0b bf 74 a3 5b e6 b4 0b 8e ed f2 78 5e 42 87 4d",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10:11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f"},
{"option": "Hex", "string": "00:00:00:00:00:00:00:4a:00:00:00:00"},
1, "20", "Raw", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10:11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f",
},
{
option: "Hex",
string: "00:00:00:00:00:00:00:4a:00:00:00:00",
},
1,
"20",
"Raw",
"Hex",
],
},
],
},
{
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.1",
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
expectedOutput: "29 56 0d 28 0b 45 28 40 0a 8f 4b 79 53 69 fb 3a 01 10 55 99 e9 f1 ed 58 27 9c fc 9e ce 2d c5 f9 9f 1c 2e 52 c9 82 38 f5 42 a5 c0 a8 81 d8 50 b6 15 d3 ac d9 fb db 02 6e 93 68 56 5d a5 0e 0d 49 dd 5b e8 ef 74 24 8b 3e 25 1d 96 5d 8f cb 21 e7 cf e2 04 d4 00 78 06 fb ee 3c e9 4c 74 bf ba d2 c1 1c 62 1b a0 48 14 7c 5c aa 94 d1 82 cc ff 6f d5 cf 44 ad f9 6e 3d 68 28 1b b4 96 76 af 87 e7",
expectedOutput:
"29 56 0d 28 0b 45 28 40 0a 8f 4b 79 53 69 fb 3a 01 10 55 99 e9 f1 ed 58 27 9c fc 9e ce 2d c5 f9 9f 1c 2e 52 c9 82 38 f5 42 a5 c0 a8 81 d8 50 b6 15 d3 ac d9 fb db 02 6e 93 68 56 5d a5 0e 0d 49 dd 5b e8 ef 74 24 8b 3e 25 1d 96 5d 8f cb 21 e7 cf e2 04 d4 00 78 06 fb ee 3c e9 4c 74 bf ba d2 c1 1c 62 1b a0 48 14 7c 5c aa 94 d1 82 cc ff 6f d5 cf 44 ad f9 6e 3d 68 28 1b b4 96 76 af 87 e7",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"},
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
0, "8", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff",
},
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
0,
"8",
"Hex",
"Hex",
],
},
],
},
{
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.2",
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
expectedOutput: "5e dd c2 d9 42 8f ce ee c5 0a 52 a9 64 ea e0 ff b0 4b 2d e0 06 a9 b0 4c ff 36 8f fa 92 11 16 b2 e8 e2 64 ba bd 2e fa 0d e4 3e f2 e3 b6 d0 65 e8 f7 c0 a1 78 37 b0 a4 0e b0 e2 c7 a3 74 2c 87 53 ed e5 f3 f6 d1 9b e5 54 67 5e 50 6a 77 5c 63 f0 94 d4 96 5c 31 93 19 dc d7 50 6f 45 7b 11 7b 84 b1 0b 24 6e 95 6c 2d a8 89 8a 65 6c ee f3 f7 b7 16 45 b1 9f 70 1d b8 44 85 ce 51 21 f0 f6 17 ef",
expectedOutput:
"5e dd c2 d9 42 8f ce ee c5 0a 52 a9 64 ea e0 ff b0 4b 2d e0 06 a9 b0 4c ff 36 8f fa 92 11 16 b2 e8 e2 64 ba bd 2e fa 0d e4 3e f2 e3 b6 d0 65 e8 f7 c0 a1 78 37 b0 a4 0e b0 e2 c7 a3 74 2c 87 53 ed e5 f3 f6 d1 9b e5 54 67 5e 50 6a 77 5c 63 f0 94 d4 96 5c 31 93 19 dc d7 50 6f 45 7b 11 7b 84 b1 0b 24 6e 95 6c 2d a8 89 8a 65 6c ee f3 f7 b7 16 45 b1 9f 70 1d b8 44 85 ce 51 21 f0 f6 17 ef",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"},
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
0, "12", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff",
},
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
0,
"12",
"Hex",
"Hex",
],
},
],
},
{
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.3",
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
expectedOutput: "d1 ab f6 30 46 7e b4 f6 7f 1c fb 47 cd 62 6a ae 8a fe db be 4f f8 fc 5f e9 cf ae 30 7e 74 ed 45 1f 14 04 42 5a d2 b5 45 69 d5 f1 81 48 93 99 71 ab b8 fa fc 88 ce 4a c7 fe 1c 3d 1f 7a 1e b7 ca e7 6c a8 7b 61 a9 71 35 41 49 77 60 dd 9a e0 59 35 0c ad 0d ce df aa 80 a8 83 11 9a 1a 6f 98 7f d1 ce 91 fd 8e e0 82 80 34 b4 11 20 0a 97 45 a2 85 55 44 75 d1 2a fc 04 88 7f ef 35 16 d1 2a 2c",
expectedOutput:
"d1 ab f6 30 46 7e b4 f6 7f 1c fb 47 cd 62 6a ae 8a fe db be 4f f8 fc 5f e9 cf ae 30 7e 74 ed 45 1f 14 04 42 5a d2 b5 45 69 d5 f1 81 48 93 99 71 ab b8 fa fc 88 ce 4a c7 fe 1c 3d 1f 7a 1e b7 ca e7 6c a8 7b 61 a9 71 35 41 49 77 60 dd 9a e0 59 35 0c ad 0d ce df aa 80 a8 83 11 9a 1a 6f 98 7f d1 ce 91 fd 8e e0 82 80 34 b4 11 20 0a 97 45 a2 85 55 44 75 d1 2a fc 04 88 7f ef 35 16 d1 2a 2c",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"},
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
0, "20", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff",
},
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
0,
"20",
"Hex",
"Hex",
],
},
],
},
{
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.4",
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
expectedOutput: "db 43 ad 9d 1e 84 2d 12 72 e4 53 0e 27 6b 3f 56 8f 88 59 b3 f7 cf 6d 9d 2c 74 fa 53 80 8c b5 15 7a 8e bf 46 ad 3d cc 4b 6c 7d ad de 13 17 84 b0 12 0e 0e 22 f6 d5 f9 ff a7 40 7d 4a 21 b6 95 d9 c5 dd 30 bf 55 61 2f ab 9b dd 11 89 20 c1 98 16 47 0c 7f 5d cd 42 32 5d bb ed 8c 57 a5 62 81 c1 44 cb 0f 03 e8 1b 30 04 62 4e 06 50 a1 ce 5a fa f9 a7 cd 81 63 f6 db d7 26 02 25 7d d9 6e 47 1e",
expectedOutput:
"db 43 ad 9d 1e 84 2d 12 72 e4 53 0e 27 6b 3f 56 8f 88 59 b3 f7 cf 6d 9d 2c 74 fa 53 80 8c b5 15 7a 8e bf 46 ad 3d cc 4b 6c 7d ad de 13 17 84 b0 12 0e 0e 22 f6 d5 f9 ff a7 40 7d 4a 21 b6 95 d9 c5 dd 30 bf 55 61 2f ab 9b dd 11 89 20 c1 98 16 47 0c 7f 5d cd 42 32 5d bb ed 8c 57 a5 62 81 c1 44 cb 0f 03 e8 1b 30 04 62 4e 06 50 a1 ce 5a fa f9 a7 cd 81 63 f6 db d7 26 02 25 7d d9 6e 47 1e",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00"},
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
0, "8", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00",
},
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
0,
"8",
"Hex",
"Hex",
],
},
],
},
{
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.5",
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
expectedOutput: "7e d1 2a 3a 63 91 2a e9 41 ba 6d 4c 0d 5e 86 2e 56 8b 0e 55 89 34 69 35 50 5f 06 4b 8c 26 98 db f7 d8 50 66 7d 8e 67 be 63 9f 3b 4f 6a 16 f9 2e 65 ea 80 f6 c7 42 94 45 da 1f c2 c1 b9 36 50 40 e3 2e 50 c4 10 6f 3b 3d a1 ce 7c cb 1e 71 40 b1 53 49 3c 0f 3a d9 a9 bc ff 07 7e c4 59 6f 1d 0f 29 bf 9c ba a5 02 82 0f 73 2a f5 a9 3c 49 ee e3 3d 1c 4f 12 af 3b 42 97 af 91 fe 41 ea 9e 94 a2",
expectedOutput:
"7e d1 2a 3a 63 91 2a e9 41 ba 6d 4c 0d 5e 86 2e 56 8b 0e 55 89 34 69 35 50 5f 06 4b 8c 26 98 db f7 d8 50 66 7d 8e 67 be 63 9f 3b 4f 6a 16 f9 2e 65 ea 80 f6 c7 42 94 45 da 1f c2 c1 b9 36 50 40 e3 2e 50 c4 10 6f 3b 3d a1 ce 7c cb 1e 71 40 b1 53 49 3c 0f 3a d9 a9 bc ff 07 7e c4 59 6f 1d 0f 29 bf 9c ba a5 02 82 0f 73 2a f5 a9 3c 49 ee e3 3d 1c 4f 12 af 3b 42 97 af 91 fe 41 ea 9e 94 a2",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00"},
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
0, "12", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00",
},
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
0,
"12",
"Hex",
"Hex",
],
},
],
},
{
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.6",
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",
expectedOutput: "9f ad f4 09 c0 08 11 d0 04 31 d6 7e fb d8 8f ba 59 21 8d 5d 67 08 b1 d6 85 86 3f ab bb 0e 96 1e ea 48 0f d6 fb 53 2b fd 49 4b 21 51 01 50 57 42 3a b6 0a 63 fe 4f 55 f7 a2 12 e2 16 7c ca b9 31 fb fd 29 cf 7b c1 d2 79 ed df 25 dd 31 6b b8 84 3d 6e de e0 bd 1e f1 21 d1 2f a1 7c bc 2c 57 4c cc ab 5e 27 51 67 b0 8b d6 86 f8 a0 9d f8 7e c3 ff b3 53 61 b9 4e bf a1 3f ec 0e 48 89 d1 8d a5",
expectedOutput:
"9f ad f4 09 c0 08 11 d0 04 31 d6 7e fb d8 8f ba 59 21 8d 5d 67 08 b1 d6 85 86 3f ab bb 0e 96 1e ea 48 0f d6 fb 53 2b fd 49 4b 21 51 01 50 57 42 3a b6 0a 63 fe 4f 55 f7 a2 12 e2 16 7c ca b9 31 fb fd 29 cf 7b c1 d2 79 ed df 25 dd 31 6b b8 84 3d 6e de e0 bd 1e f1 21 d1 2f a1 7c bc 2c 57 4c cc ab 5e 27 51 67 b0 8b d6 86 f8 a0 9d f8 7e c3 ff b3 53 61 b9 4e bf a1 3f ec 0e 48 89 d1 8d a5",
recipeConfig: [
{
"op": "ChaCha",
"args": [
{"option": "Hex", "string": "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00"},
{"option": "Hex", "string": "0f 1e 2d 3c 4b 5a 69 78"},
0, "20", "Hex", "Hex",
]
}
op: "ChaCha",
args: [
{
option: "Hex",
string: "00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 00",
},
{ option: "Hex", string: "0f 1e 2d 3c 4b 5a 69 78" },
0,
"20",
"Hex",
"Hex",
],
},
],
},
]);

View file

@ -18,7 +18,8 @@ TestRegister.addTests([
args: ["Dotted Decimal", "Hex"],
},
],
}, {
},
{
name: "Change IP format: Decimal to Dotted Decimal",
input: "3232235777",
expectedOutput: "192.168.1.1",
@ -28,7 +29,8 @@ TestRegister.addTests([
args: ["Decimal", "Dotted Decimal"],
},
],
}, {
},
{
name: "Change IP format: Hex to Octal",
input: "c0a80101",
expectedOutput: "030052000401",
@ -38,7 +40,8 @@ TestRegister.addTests([
args: ["Hex", "Octal"],
},
],
}, {
},
{
name: "Change IP format: Octal to Decimal",
input: "030052000401",
expectedOutput: "3232235777",

View file

@ -14,12 +14,12 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Encode text",
"args": ["UTF-8 (65001)"]
op: "Encode text",
args: ["UTF-8 (65001)"],
},
{
"op": "Decode text",
"args": ["UTF-8 (65001)"]
op: "Decode text",
args: ["UTF-8 (65001)"],
},
],
},
@ -29,12 +29,12 @@ TestRegister.addTests([
expectedOutput: "hello",
recipeConfig: [
{
"op": "Encode text",
"args": ["UTF-8 (65001)"]
op: "Encode text",
args: ["UTF-8 (65001)"],
},
{
"op": "Decode text",
"args": ["UTF-8 (65001)"]
op: "Decode text",
args: ["UTF-8 (65001)"],
},
],
},
@ -44,12 +44,12 @@ TestRegister.addTests([
expectedOutput: "88 85 93 93 96",
recipeConfig: [
{
"op": "Encode text",
"args": ["IBM EBCDIC International (500)"]
op: "Encode text",
args: ["IBM EBCDIC International (500)"],
},
{
"op": "To Hex",
"args": ["Space"]
op: "To Hex",
args: ["Space"],
},
],
},
@ -59,31 +59,31 @@ TestRegister.addTests([
expectedOutput: "hello",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "Decode text",
"args": ["IBM EBCDIC International (500)"]
op: "Decode text",
args: ["IBM EBCDIC International (500)"],
},
],
},
{
name: "Generate Base64 Windows PowerShell",
input: "ZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA==",
expectedOutput: "dir \"c:\\program files\" ",
expectedOutput: 'dir "c:\\program files" ',
recipeConfig: [
{
"op": "From Base64",
"args": ["A-Za-z0-9+/=", true]
op: "From Base64",
args: ["A-Za-z0-9+/=", true],
},
{
"op": "Decode text",
"args": ["UTF-16LE (1200)"]
op: "Decode text",
args: ["UTF-16LE (1200)"],
},
{
"op": "Encode text",
"args": ["UTF-8 (65001)"]
op: "Encode text",
args: ["UTF-8 (65001)"],
},
],
},

View file

@ -14,9 +14,18 @@ TestRegister.addTests([
expectedMatch: /^<svg width/,
recipeConfig: [
{
"op": "Scatter chart",
"args": ["Line feed", "Space", false, "time", "stress", "black", 5, false]
}
op: "Scatter chart",
args: [
"Line feed",
"Space",
false,
"time",
"stress",
"black",
5,
false,
],
},
],
},
{
@ -25,9 +34,21 @@ TestRegister.addTests([
expectedMatch: /^<svg width/,
recipeConfig: [
{
"op": "Hex Density chart",
"args": ["Line feed", "Space", 25, 15, true, "", "", true, "white", "black", true]
}
op: "Hex Density chart",
args: [
"Line feed",
"Space",
25,
15,
true,
"",
"",
true,
"white",
"black",
true,
],
},
],
},
{
@ -36,9 +57,15 @@ TestRegister.addTests([
expectedMatch: /^<svg width/,
recipeConfig: [
{
"op": "Series chart",
"args": ["Line feed", "Space", "", 1, "mediumseagreen, dodgerblue, tomato"]
}
op: "Series chart",
args: [
"Line feed",
"Space",
"",
1,
"mediumseagreen, dodgerblue, tomato",
],
},
],
},
{
@ -47,9 +74,20 @@ TestRegister.addTests([
expectedMatch: /^<svg width/,
recipeConfig: [
{
"op": "Heatmap chart",
"args": ["Line feed", "Space", 25, 25, true, "", "", false, "white", "black"]
}
op: "Heatmap chart",
args: [
"Line feed",
"Space",
25,
25,
true,
"",
"",
false,
"white",
"black",
],
},
],
},
]);

View file

@ -7,7 +7,8 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
const BASIC_STRING = "The ships hung in the sky in much the same way that bricks don't.";
const BASIC_STRING =
"The ships hung in the sky in much the same way that bricks don't.";
const UTF8_STR = "ნუ პანიკას";
const ALL_BYTES = [
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
@ -35,10 +36,10 @@ TestRegister.addTests([
expectedOutput: "00",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8"],
},
],
},
{
name: "CRC-8: default check",
@ -46,10 +47,10 @@ TestRegister.addTests([
expectedOutput: "f4",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8"],
},
],
},
{
name: "CRC-8: CDMA2000",
@ -57,10 +58,10 @@ TestRegister.addTests([
expectedOutput: "da",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/CDMA2000"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/CDMA2000"],
},
],
},
{
name: "CRC-8: DARC",
@ -68,10 +69,10 @@ TestRegister.addTests([
expectedOutput: "15",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/DARC"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/DARC"],
},
],
},
{
name: "CRC-8: DVB-S2",
@ -79,10 +80,10 @@ TestRegister.addTests([
expectedOutput: "bc",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/DVB-S2"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/DVB-S2"],
},
],
},
{
name: "CRC-8: EBU",
@ -90,10 +91,10 @@ TestRegister.addTests([
expectedOutput: "97",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/EBU"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/EBU"],
},
],
},
{
name: "CRC-8: I-CODE",
@ -101,10 +102,10 @@ TestRegister.addTests([
expectedOutput: "7e",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/I-CODE"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/I-CODE"],
},
],
},
{
name: "CRC-8: ITU",
@ -112,10 +113,10 @@ TestRegister.addTests([
expectedOutput: "a1",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/ITU"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/ITU"],
},
],
},
{
name: "CRC-8: MAXIM",
@ -123,10 +124,10 @@ TestRegister.addTests([
expectedOutput: "a1",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/MAXIM"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/MAXIM"],
},
],
},
{
name: "CRC-8: ROHC",
@ -134,10 +135,10 @@ TestRegister.addTests([
expectedOutput: "d0",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/ROHC"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/ROHC"],
},
],
},
{
name: "CRC-8: WCDMA",
@ -145,10 +146,10 @@ TestRegister.addTests([
expectedOutput: "25",
recipeConfig: [
{
"op": "CRC-8 Checksum",
"args": ["CRC-8/WCDMA"]
}
]
op: "CRC-8 Checksum",
args: ["CRC-8/WCDMA"],
},
],
},
{
name: "CRC-16: nothing",
@ -156,10 +157,10 @@ TestRegister.addTests([
expectedOutput: "0000",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
op: "CRC-16 Checksum",
args: [],
},
],
},
{
name: "CRC-16: basic string",
@ -167,10 +168,10 @@ TestRegister.addTests([
expectedOutput: "0c70",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
op: "CRC-16 Checksum",
args: [],
},
],
},
{
name: "CRC-16: UTF-8",
@ -178,10 +179,10 @@ TestRegister.addTests([
expectedOutput: "dcf6",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
op: "CRC-16 Checksum",
args: [],
},
],
},
{
name: "CRC-16: all bytes",
@ -189,10 +190,10 @@ TestRegister.addTests([
expectedOutput: "bad3",
recipeConfig: [
{
"op": "CRC-16 Checksum",
"args": []
}
]
op: "CRC-16 Checksum",
args: [],
},
],
},
{
name: "CRC-32: nothing",
@ -200,10 +201,10 @@ TestRegister.addTests([
expectedOutput: "00000000",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
op: "CRC-32 Checksum",
args: [],
},
],
},
{
name: "CRC-32: basic string",
@ -211,10 +212,10 @@ TestRegister.addTests([
expectedOutput: "bf4b739c",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
op: "CRC-32 Checksum",
args: [],
},
],
},
{
name: "CRC-32: UTF-8",
@ -222,10 +223,10 @@ TestRegister.addTests([
expectedOutput: "87553290",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
op: "CRC-32 Checksum",
args: [],
},
],
},
{
name: "CRC-32: all bytes",
@ -233,9 +234,9 @@ TestRegister.addTests([
expectedOutput: "29058c73",
recipeConfig: [
{
"op": "CRC-32 Checksum",
"args": []
}
]
}
op: "CRC-32 Checksum",
args: [],
},
],
},
]);

View file

@ -16,7 +16,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CipherSaber2 Encrypt",
args: [{ "option": "Latin1", "string": "test" }, 20],
args: [{ option: "Latin1", string: "test" }, 20],
},
],
},
@ -27,7 +27,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CipherSaber2 Decrypt",
args: [{ "option": "Latin1", "string": "test" }, 20],
args: [{ option: "Latin1", string: "test" }, 20],
},
],
},
@ -38,7 +38,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "CipherSaber2 Encrypt",
args: [{ "option": "Latin1", "string": "" }, 20],
args: [{ option: "Latin1", string: "" }, 20],
},
],
},

View file

@ -9,7 +9,6 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Affine Encode: no input",
@ -18,8 +17,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Encode",
args: [1, 0]
}
args: [1, 0],
},
],
},
{
@ -29,8 +28,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Encode",
args: [0.1, 0.00001]
}
args: [0.1, 0.00001],
},
],
},
{
@ -40,8 +39,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Encode",
args: [1, 0]
}
args: [1, 0],
},
],
},
{
@ -51,8 +50,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Encode",
args: [23, 23]
}
args: [23, 23],
},
],
},
{
@ -62,8 +61,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Decode",
args: [1, 0]
}
args: [1, 0],
},
],
},
{
@ -73,8 +72,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Decode",
args: [0.1, 0.00001]
}
args: [0.1, 0.00001],
},
],
},
{
@ -84,8 +83,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Decode",
args: [8, 23]
}
args: [8, 23],
},
],
},
{
@ -95,8 +94,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Decode",
args: [1, 0]
}
args: [1, 0],
},
],
},
{
@ -106,8 +105,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Affine Cipher Decode",
args: [23, 23]
}
args: [23, 23],
},
],
},
{
@ -117,8 +116,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "A1Z26 Cipher Encode",
args: ["Space"]
}
args: ["Space"],
},
],
},
{
@ -128,8 +127,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "A1Z26 Cipher Decode",
args: ["Space"]
}
args: ["Space"],
},
],
},
{
@ -139,8 +138,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "A1Z26 Cipher Decode",
args: ["Space"]
}
args: ["Space"],
},
],
},
{
@ -150,8 +149,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Atbash Cipher",
args: []
}
args: [],
},
],
},
{
@ -161,8 +160,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Atbash Cipher",
args: []
}
args: [],
},
],
},
{
@ -171,42 +170,45 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Bifid Cipher Encode",
"args": ["nothing"]
}
op: "Bifid Cipher Encode",
args: ["nothing"],
},
],
},
{
name: "Bifid Cipher Encode: no key",
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
expectedOutput: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
expectedOutput:
"Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
recipeConfig: [
{
"op": "Bifid Cipher Encode",
"args": [""]
}
op: "Bifid Cipher Encode",
args: [""],
},
],
},
{
name: "Bifid Cipher Encode: invalid key (non-alphabetic)",
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
expectedOutput: "The key must consist only of letters in the English alphabet",
expectedOutput:
"The key must consist only of letters in the English alphabet",
recipeConfig: [
{
"op": "Bifid Cipher Encode",
"args": ["abc123"]
}
op: "Bifid Cipher Encode",
args: ["abc123"],
},
],
},
{
name: "Bifid Cipher Encode: normal",
input: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
expectedOutput: "Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
expectedOutput:
"Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
recipeConfig: [
{
"op": "Bifid Cipher Encode",
"args": ["Schrodinger"]
}
op: "Bifid Cipher Encode",
args: ["Schrodinger"],
},
],
},
{
@ -215,42 +217,45 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Bifid Cipher Decode",
"args": ["nothing"]
}
op: "Bifid Cipher Decode",
args: ["nothing"],
},
],
},
{
name: "Bifid Cipher Decode: no key",
input: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
expectedOutput: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
expectedOutput:
"We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
recipeConfig: [
{
"op": "Bifid Cipher Decode",
"args": [""]
}
op: "Bifid Cipher Decode",
args: [""],
},
],
},
{
name: "Bifid Cipher Decode: invalid key (non-alphabetic)",
input: "Vq daqcliho rmltofvlnc qbdhlcr nt qdq Fbm-Rdkkm vuoottnoi aitp al axf tdtmvt owppkaodtx.",
expectedOutput: "The key must consist only of letters in the English alphabet",
expectedOutput:
"The key must consist only of letters in the English alphabet",
recipeConfig: [
{
"op": "Bifid Cipher Decode",
"args": ["abc123"]
}
op: "Bifid Cipher Decode",
args: ["abc123"],
},
],
},
{
name: "Bifid Cipher Decode: normal",
input: "Wc snpsigdd cpfrrcxnfi hikdnnp dm crc Fcb-Pdeug vueageacc vtyl sa zxm crebzp lyoeuaiwpv.",
expectedOutput: "We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
expectedOutput:
"We recreate conditions similar to the Van-Allen radiation belt in our secure facilities.",
recipeConfig: [
{
"op": "Bifid Cipher Decode",
"args": ["Schrodinger"]
}
op: "Bifid Cipher Decode",
args: ["Schrodinger"],
},
],
},
{
@ -259,9 +264,9 @@ TestRegister.addTests([
expectedOutput: "PFFAJEDBOHECJEDBODEGIMCJPOFLJKDPKLAO",
recipeConfig: [
{
"op": "Citrix CTX1 Encode",
"args": []
}
op: "Citrix CTX1 Encode",
args: [],
},
],
},
{
@ -270,9 +275,9 @@ TestRegister.addTests([
expectedOutput: "Password1",
recipeConfig: [
{
"op": "Citrix CTX1 Decode",
"args": []
}
op: "Citrix CTX1 Decode",
args: [],
},
],
},
{
@ -281,9 +286,9 @@ TestRegister.addTests([
expectedOutput: "Incorrect hash length",
recipeConfig: [
{
"op": "Citrix CTX1 Decode",
"args": []
}
op: "Citrix CTX1 Decode",
args: [],
},
],
},
{
@ -292,9 +297,9 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Vigenère Encode",
"args": ["nothing"]
}
op: "Vigenère Encode",
args: ["nothing"],
},
],
},
{
@ -303,9 +308,9 @@ TestRegister.addTests([
expectedOutput: "No key entered",
recipeConfig: [
{
"op": "Vigenère Encode",
"args": [""]
}
op: "Vigenère Encode",
args: [""],
},
],
},
{
@ -314,20 +319,21 @@ TestRegister.addTests([
expectedOutput: "The key must consist only of letters",
recipeConfig: [
{
"op": "Vigenère Encode",
"args": ["abc123"]
}
op: "Vigenère Encode",
args: ["abc123"],
},
],
},
{
name: "Vigenère Encode: normal",
input: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
expectedOutput: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
expectedOutput:
"PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
recipeConfig: [
{
"op": "Vigenère Encode",
"args": ["Edward"]
}
op: "Vigenère Encode",
args: ["Edward"],
},
],
},
{
@ -336,9 +342,9 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Vigenère Decode",
"args": ["nothing"]
}
op: "Vigenère Decode",
args: ["nothing"],
},
],
},
{
@ -347,9 +353,9 @@ TestRegister.addTests([
expectedOutput: "No key entered",
recipeConfig: [
{
"op": "Vigenère Decode",
"args": [""]
}
op: "Vigenère Decode",
args: [""],
},
],
},
{
@ -358,20 +364,21 @@ TestRegister.addTests([
expectedOutput: "The key must consist only of letters",
recipeConfig: [
{
"op": "Vigenère Decode",
"args": ["abc123"]
}
op: "Vigenère Decode",
args: ["abc123"],
},
],
},
{
name: "Vigenère Decode: normal",
input: "PXCGRJIEWSVPIQPVRUIQJEJDPOEEJFEQXETOSWDEUDWHJEDLIVANVPMHOCRQFHYLFWLHZAJDPOEEJDPZWYJXWHED",
expectedOutput: "LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
expectedOutput:
"LUGGAGEBASEMENTVARENNESALLIESCANBECLOTHEDASENEMIESENEMIESCANBECLOTHEDASALLIESALWAYSUSEID",
recipeConfig: [
{
"op": "Vigenère Decode",
"args": ["Edward"]
}
op: "Vigenère Decode",
args: ["Edward"],
},
],
},
{
@ -380,9 +387,9 @@ TestRegister.addTests([
expectedOutput: "flee at once. we are discovered!",
recipeConfig: [
{
"op": "Substitute",
"args": ["", ""]
}
op: "Substitute",
args: ["", ""],
},
],
},
{
@ -391,20 +398,27 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Substitute",
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
}
op: "Substitute",
args: [
"abcdefghijklmnopqrstuvwxyz",
"zebrascdfghijklmnopqtuvwxy",
],
},
],
},
{
name: "Substitute: uneven pt/ct",
input: "flee at once. we are discovered!",
expectedOutput: "Warning: Plaintext and Ciphertext lengths differ\n\nsiaa zq lkba. va zoa rfpbluaoar!",
expectedOutput:
"Warning: Plaintext and Ciphertext lengths differ\n\nsiaa zq lkba. va zoa rfpbluaoar!",
recipeConfig: [
{
"op": "Substitute",
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwx"]
}
op: "Substitute",
args: [
"abcdefghijklmnopqrstuvwxyz",
"zebrascdfghijklmnopqtuvwx",
],
},
],
},
{
@ -413,9 +427,12 @@ TestRegister.addTests([
expectedOutput: "siaa zq lkba. va zoa rfpbluaoar!",
recipeConfig: [
{
"op": "Substitute",
"args": ["abcdefghijklmnopqrstuvwxyz", "zebrascdfghijklmnopqtuvwxy"]
}
op: "Substitute",
args: [
"abcdefghijklmnopqrstuvwxyz",
"zebrascdfghijklmnopqtuvwxy",
],
},
],
},
{
@ -424,9 +441,9 @@ TestRegister.addTests([
expectedOutput: "Cryptography is THE Art of Writing or solving codes",
recipeConfig: [
{
"op": "Rail Fence Cipher Decode",
"args": [2, 0]
}
op: "Rail Fence Cipher Decode",
args: [2, 0],
},
],
},
{
@ -435,9 +452,9 @@ TestRegister.addTests([
expectedOutput: "Key has to be bigger than 2",
recipeConfig: [
{
"op": "Rail Fence Cipher Decode",
"args": [1, 0]
}
op: "Rail Fence Cipher Decode",
args: [1, 0],
},
],
},
{
@ -446,9 +463,9 @@ TestRegister.addTests([
expectedOutput: "Key should be smaller than the cipher's length",
recipeConfig: [
{
"op": "Rail Fence Cipher Decode",
"args": [22, 0]
}
op: "Rail Fence Cipher Decode",
args: [22, 0],
},
],
},
{
@ -457,9 +474,9 @@ TestRegister.addTests([
expectedOutput: "Offset has to be a positive integer",
recipeConfig: [
{
"op": "Rail Fence Cipher Decode",
"args": [2, -1]
}
op: "Rail Fence Cipher Decode",
args: [2, -1],
},
],
},
{
@ -468,9 +485,9 @@ TestRegister.addTests([
expectedOutput: "12345678901234567890",
recipeConfig: [
{
"op": "Rail Fence Cipher Decode",
"args": [4, 2]
}
op: "Rail Fence Cipher Decode",
args: [4, 2],
},
],
},
{
@ -479,9 +496,9 @@ TestRegister.addTests([
expectedOutput: "Cytgah sTEAto rtn rsligcdsrporpyi H r fWiigo ovn oe",
recipeConfig: [
{
"op": "Rail Fence Cipher Encode",
"args": [2, 0]
}
op: "Rail Fence Cipher Encode",
args: [2, 0],
},
],
},
{
@ -490,9 +507,9 @@ TestRegister.addTests([
expectedOutput: "Key has to be bigger than 2",
recipeConfig: [
{
"op": "Rail Fence Cipher Encode",
"args": [1, 0]
}
op: "Rail Fence Cipher Encode",
args: [1, 0],
},
],
},
{
@ -501,9 +518,9 @@ TestRegister.addTests([
expectedOutput: "Key should be smaller than the plain text's length",
recipeConfig: [
{
"op": "Rail Fence Cipher Encode",
"args": [22, 0]
}
op: "Rail Fence Cipher Encode",
args: [22, 0],
},
],
},
{
@ -512,9 +529,9 @@ TestRegister.addTests([
expectedOutput: "Offset has to be a positive integer",
recipeConfig: [
{
"op": "Rail Fence Cipher Encode",
"args": [2, -1]
}
op: "Rail Fence Cipher Encode",
args: [2, -1],
},
],
},
{
@ -523,9 +540,9 @@ TestRegister.addTests([
expectedOutput: "51746026813793592840",
recipeConfig: [
{
"op": "Rail Fence Cipher Encode",
"args": [4, 2]
}
op: "Rail Fence Cipher Encode",
args: [4, 2],
},
],
},
]);

View file

@ -10,44 +10,52 @@
import TestRegister from "../../lib/TestRegister.mjs";
const JSON_TEST_DATA = {
"store": {
"book": [{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
}, {
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}, {
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
}, {
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}],
"bicycle": {
"color": "red",
"price": 19.95
store: {
book: [
{
category: "reference",
author: "Nigel Rees",
title: "Sayings of the Century",
price: 8.95,
},
{
category: "fiction",
author: "Evelyn Waugh",
title: "Sword of Honour",
price: 12.99,
},
{
category: "fiction",
author: "Herman Melville",
title: "Moby Dick",
isbn: "0-553-21311-3",
price: 8.99,
},
{
category: "fiction",
author: "J. R. R. Tolkien",
title: "The Lord of the Rings",
isbn: "0-395-19395-8",
price: 22.99,
},
],
bicycle: {
color: "red",
price: 19.95,
},
"newspaper": [{
"format": "broadsheet",
"title": "Financial Times",
"price": 2.75
}, {
"format": "tabloid",
"title": "The Guardian",
"price": 2.00
}]
}
newspaper: [
{
format: "broadsheet",
title: "Financial Times",
price: 2.75,
},
{
format: "tabloid",
title: "The Guardian",
price: 2.0,
},
],
},
};
TestRegister.addTests([
@ -57,9 +65,9 @@ TestRegister.addTests([
expectedOutput: "helloWorld",
recipeConfig: [
{
"op": "To Camel case",
"args": [false]
}
op: "To Camel case",
args: [false],
},
],
},
{
@ -68,9 +76,9 @@ TestRegister.addTests([
expectedOutput: "hello_world",
recipeConfig: [
{
"op": "To Snake case",
"args": [false]
}
op: "To Snake case",
args: [false],
},
],
},
{
@ -79,9 +87,9 @@ TestRegister.addTests([
expectedOutput: "hello-world",
recipeConfig: [
{
"op": "To Kebab case",
"args": [false]
}
op: "To Kebab case",
args: [false],
},
],
},
{
@ -93,7 +101,7 @@ TestRegister.addTests([
"$a_camel_case_variable;",
"function function_name() {",
" console.log('things inside quotes do not get broken');",
" console.log(\"things inside quotes do not get broken\");",
' console.log("things inside quotes do not get broken");',
"}",
].join("\n"),
expectedOutput: [
@ -103,14 +111,14 @@ TestRegister.addTests([
"$aCamelCaseVariable;",
"function functionName() {",
" console.log('things inside quotes do not get broken');",
" console.log(\"things inside quotes do not get broken\");",
' console.log("things inside quotes do not get broken");',
"}",
].join("\n"),
recipeConfig: [
{
"op": "To Camel case",
"args": [true]
}
op: "To Camel case",
args: [true],
},
],
},
{
@ -122,7 +130,7 @@ TestRegister.addTests([
"$aSnakeCaseVariable;",
"function functionName() {",
" console.log('things inside quotes do not get broken');",
" console.log(\"things inside quotes do not get broken\");",
' console.log("things inside quotes do not get broken");',
"}",
].join("\n"),
expectedOutput: [
@ -132,14 +140,14 @@ TestRegister.addTests([
"$a_snake_case_variable;",
"function function_name() {",
" console.log('things inside quotes do not get broken');",
" console.log(\"things inside quotes do not get broken\");",
' console.log("things inside quotes do not get broken");',
"}",
].join("\n"),
recipeConfig: [
{
"op": "To Snake case",
"args": [true]
}
op: "To Snake case",
args: [true],
},
],
},
{
@ -151,7 +159,7 @@ TestRegister.addTests([
"$aKebabCaseVariable;",
"function functionName() {",
" console.log('things inside quotes do not get broken');",
" console.log(\"things inside quotes do not get broken\");",
' console.log("things inside quotes do not get broken");',
"}",
].join("\n"),
expectedOutput: [
@ -161,14 +169,14 @@ TestRegister.addTests([
"$a-kebab-case-variable;",
"function function-name() {",
" console.log('things inside quotes do not get broken');",
" console.log(\"things inside quotes do not get broken\");",
' console.log("things inside quotes do not get broken");',
"}",
].join("\n"),
recipeConfig: [
{
"op": "To Kebab case",
"args": [true]
}
op: "To Kebab case",
args: [true],
},
],
},
{
@ -177,9 +185,9 @@ TestRegister.addTests([
expectedOutput: "Invalid input JSON: Unexpected end of JSON input",
recipeConfig: [
{
"op": "JPath expression",
"args": ["", "\n"]
}
op: "JPath expression",
args: ["", "\n"],
},
],
},
{
@ -188,126 +196,131 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "JPath expression",
"args": ["", "\n", true]
}
op: "JPath expression",
args: ["", "\n", true],
},
],
},
{
name: "JPath Expression: Fetch of values from specific object",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"\"Nigel Rees\"",
"\"Evelyn Waugh\"",
"\"Herman Melville\"",
"\"J. R. R. Tolkien\""
'"Nigel Rees"',
'"Evelyn Waugh"',
'"Herman Melville"',
'"J. R. R. Tolkien"',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$.store.book[*].author", "\n", true]
}
op: "JPath expression",
args: ["$.store.book[*].author", "\n", true],
},
],
},
{
name: "JPath Expression: Fetch of all values with matching key",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"\"Sayings of the Century\"",
"\"Sword of Honour\"",
"\"Moby Dick\"",
"\"The Lord of the Rings\"",
"\"Financial Times\"",
"\"The Guardian\""
'"Sayings of the Century"',
'"Sword of Honour"',
'"Moby Dick"',
'"The Lord of the Rings"',
'"Financial Times"',
'"The Guardian"',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$..title", "\n", true]
}
op: "JPath expression",
args: ["$..title", "\n", true],
},
],
},
{
name: "JPath Expression: All data in object",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95},{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99},{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99},{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}]",
"{\"color\":\"red\",\"price\":19.95}",
"[{\"format\":\"broadsheet\",\"title\":\"Financial Times\",\"price\":2.75},{\"format\":\"tabloid\",\"title\":\"The Guardian\",\"price\":2}]"
'[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}]',
'{"color":"red","price":19.95}',
'[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$.store.*", "\n", true]
}
op: "JPath expression",
args: ["$.store.*", "\n", true],
},
],
},
{
name: "JPath Expression: Last element in array",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: "{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}",
expectedOutput:
'{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}',
recipeConfig: [
{
"op": "JPath expression",
"args": ["$..book[-1:]", "\n", true]
}
op: "JPath expression",
args: ["$..book[-1:]", "\n", true],
},
],
},
{
name: "JPath Expression: First 2 elements in array",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}"
'{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95}',
'{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$..book[:2]", "\n", true]
}
op: "JPath expression",
args: ["$..book[:2]", "\n", true],
},
],
},
{
name: "JPath Expression: All elements in array with property",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}",
"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
'{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}',
'{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$..book[?(@.isbn)]", "\n", false]
}
op: "JPath expression",
args: ["$..book[?(@.isbn)]", "\n", false],
},
],
},
{
name: "JPath Expression: All elements in array which meet condition",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":12.99}",
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}",
"{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":22.99}"
'{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}',
'{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}',
'{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$..book[?(@.price<30 && @.category==\"fiction\")]", "\n", false]
}
op: "JPath expression",
args: [
'$..book[?(@.price<30 && @.category=="fiction")]',
"\n",
false,
],
},
],
},
{
name: "JPath Expression: All elements in object",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: [
"{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":8.95}",
"{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":8.99}"
'{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95}',
'{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}',
].join("\n"),
recipeConfig: [
{
"op": "JPath expression",
"args": ["$..book[?(@.price<10)]", "\n", false]
}
op: "JPath expression",
args: ["$..book[?(@.price<10)]", "\n", false],
},
],
},
{
@ -315,15 +328,16 @@ TestRegister.addTests([
input: "[{}]",
recipeConfig: [
{
"op": "JPath expression",
"args": [
op: "JPath expression",
args: [
"$..[?(({__proto__:[].constructor}).constructor(\"self.postMessage({action:'bakeComplete',data:{bakeId:1,dish:{type:1,value:''},duration:1,error:false,id:undefined,inputNum:2,progress:1,result:'<iframe/onload=debugger>',type: 'html'}});\")();)]",
"\n",
true
]
}
true,
],
},
],
expectedOutput: "Invalid JPath expression: Eval [?(expr)] prevented in JSONPath expression."
expectedOutput:
"Invalid JPath expression: Eval [?(expr)] prevented in JSONPath expression.",
},
{
name: "CSS selector",
@ -331,10 +345,10 @@ TestRegister.addTests([
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
recipeConfig: [
{
"op": "CSS selector",
"args": ["#test p.a", "\\n"]
}
]
op: "CSS selector",
args: ["#test p.a", "\\n"],
},
],
},
{
name: "XPath expression",
@ -342,10 +356,10 @@ TestRegister.addTests([
expectedOutput: '<p class="a">hello</p>\n<p class="a">again</p>',
recipeConfig: [
{
"op": "XPath expression",
"args": ["/div/p[@class=\"a\"]", "\\n"]
}
]
op: "XPath expression",
args: ['/div/p[@class="a"]', "\\n"],
},
],
},
{
name: "To MessagePack: no content",
@ -353,40 +367,42 @@ TestRegister.addTests([
expectedMatch: /Unexpected end of JSON input/,
recipeConfig: [
{
"op": "To MessagePack",
"args": []
}
]
op: "To MessagePack",
args: [],
},
],
},
{
name: "From MessagePack: no content",
input: "",
expectedOutput: "Could not decode MessagePack to JSON: Error: Could not parse",
expectedOutput:
"Could not decode MessagePack to JSON: Error: Could not parse",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "From MessagePack",
"args": []
}
]
op: "From MessagePack",
args: [],
},
],
},
{
name: "To MessagePack: valid json",
input: JSON.stringify(JSON_TEST_DATA),
expectedOutput: "81 a5 73 74 6f 72 65 83 a4 62 6f 6f 6b 94 84 a8 63 61 74 65 67 6f 72 79 a9 72 65 66 65 72 65 6e 63 65 a6 61 75 74 68 6f 72 aa 4e 69 67 65 6c 20 52 65 65 73 a5 74 69 74 6c 65 b6 53 61 79 69 6e 67 73 20 6f 66 20 74 68 65 20 43 65 6e 74 75 72 79 a5 70 72 69 63 65 cb 40 21 e6 66 66 66 66 66 84 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 ac 45 76 65 6c 79 6e 20 57 61 75 67 68 a5 74 69 74 6c 65 af 53 77 6f 72 64 20 6f 66 20 48 6f 6e 6f 75 72 a5 70 72 69 63 65 cb 40 29 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 af 48 65 72 6d 61 6e 20 4d 65 6c 76 69 6c 6c 65 a5 74 69 74 6c 65 a9 4d 6f 62 79 20 44 69 63 6b a4 69 73 62 6e ad 30 2d 35 35 33 2d 32 31 33 31 31 2d 33 a5 70 72 69 63 65 cb 40 21 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 b0 4a 2e 20 52 2e 20 52 2e 20 54 6f 6c 6b 69 65 6e a5 74 69 74 6c 65 b5 54 68 65 20 4c 6f 72 64 20 6f 66 20 74 68 65 20 52 69 6e 67 73 a4 69 73 62 6e ad 30 2d 33 39 35 2d 31 39 33 39 35 2d 38 a5 70 72 69 63 65 cb 40 36 fd 70 a3 d7 0a 3d a7 62 69 63 79 63 6c 65 82 a5 63 6f 6c 6f 72 a3 72 65 64 a5 70 72 69 63 65 cb 40 33 f3 33 33 33 33 33 a9 6e 65 77 73 70 61 70 65 72 92 83 a6 66 6f 72 6d 61 74 aa 62 72 6f 61 64 73 68 65 65 74 a5 74 69 74 6c 65 af 46 69 6e 61 6e 63 69 61 6c 20 54 69 6d 65 73 a5 70 72 69 63 65 cb 40 06 00 00 00 00 00 00 83 a6 66 6f 72 6d 61 74 a7 74 61 62 6c 6f 69 64 a5 74 69 74 6c 65 ac 54 68 65 20 47 75 61 72 64 69 61 6e a5 70 72 69 63 65 02",
expectedOutput:
"81 a5 73 74 6f 72 65 83 a4 62 6f 6f 6b 94 84 a8 63 61 74 65 67 6f 72 79 a9 72 65 66 65 72 65 6e 63 65 a6 61 75 74 68 6f 72 aa 4e 69 67 65 6c 20 52 65 65 73 a5 74 69 74 6c 65 b6 53 61 79 69 6e 67 73 20 6f 66 20 74 68 65 20 43 65 6e 74 75 72 79 a5 70 72 69 63 65 cb 40 21 e6 66 66 66 66 66 84 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 ac 45 76 65 6c 79 6e 20 57 61 75 67 68 a5 74 69 74 6c 65 af 53 77 6f 72 64 20 6f 66 20 48 6f 6e 6f 75 72 a5 70 72 69 63 65 cb 40 29 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 af 48 65 72 6d 61 6e 20 4d 65 6c 76 69 6c 6c 65 a5 74 69 74 6c 65 a9 4d 6f 62 79 20 44 69 63 6b a4 69 73 62 6e ad 30 2d 35 35 33 2d 32 31 33 31 31 2d 33 a5 70 72 69 63 65 cb 40 21 fa e1 47 ae 14 7b 85 a8 63 61 74 65 67 6f 72 79 a7 66 69 63 74 69 6f 6e a6 61 75 74 68 6f 72 b0 4a 2e 20 52 2e 20 52 2e 20 54 6f 6c 6b 69 65 6e a5 74 69 74 6c 65 b5 54 68 65 20 4c 6f 72 64 20 6f 66 20 74 68 65 20 52 69 6e 67 73 a4 69 73 62 6e ad 30 2d 33 39 35 2d 31 39 33 39 35 2d 38 a5 70 72 69 63 65 cb 40 36 fd 70 a3 d7 0a 3d a7 62 69 63 79 63 6c 65 82 a5 63 6f 6c 6f 72 a3 72 65 64 a5 70 72 69 63 65 cb 40 33 f3 33 33 33 33 33 a9 6e 65 77 73 70 61 70 65 72 92 83 a6 66 6f 72 6d 61 74 aa 62 72 6f 61 64 73 68 65 65 74 a5 74 69 74 6c 65 af 46 69 6e 61 6e 63 69 61 6c 20 54 69 6d 65 73 a5 70 72 69 63 65 cb 40 06 00 00 00 00 00 00 83 a6 66 6f 72 6d 61 74 a7 74 61 62 6c 6f 69 64 a5 74 69 74 6c 65 ac 54 68 65 20 47 75 61 72 64 69 61 6e a5 70 72 69 63 65 02",
recipeConfig: [
{
"op": "To MessagePack",
"args": []
op: "To MessagePack",
args: [],
},
{
"op": "To Hex",
"args": ["Space"]
}
]
op: "To Hex",
args: ["Space"],
},
],
},
{
name: "From MessagePack: valid msgpack",
@ -394,13 +410,13 @@ TestRegister.addTests([
expectedOutput: JSON.stringify(JSON_TEST_DATA, null, 4),
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "From MessagePack",
"args": []
}
]
}
op: "From MessagePack",
args: [],
},
],
},
]);

View file

@ -13,26 +13,68 @@ TestRegister.addTests([
expectedMatch: /00 00 : a30/,
recipeConfig: [
{
"op": "Colossus",
"args": [
op: "Colossus",
args: [
"",
"KH Pattern",
"Z", "", "",
"None", "Select Program", "Letter Count",
"Z",
"",
"",
"None",
"Select Program",
"Letter Count",
"",
"",
"",
"",
"",
"",
"", "", "", "", "", false, "",
"", "", "", "", "", false, "",
"", "", "", "", "", false, "",
false,
"",
false, false, false, false, false,
"", false, false, "",
"",
0, "", "",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"
]
}
]
"",
"",
"",
"",
false,
"",
"",
"",
"",
"",
"",
false,
"",
false,
"",
false,
false,
false,
false,
false,
"",
false,
false,
"",
"",
0,
"",
"",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
],
},
],
},
// Takes a while to run, so disabling for general purpose testing. Re-enable if modifying this operation.
// {

View file

@ -34,10 +34,10 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Comment",
"args": [""]
}
]
op: "Comment",
args: [""],
},
],
},
{
name: "Fork, Comment, Base64",
@ -45,18 +45,18 @@ TestRegister.addTests([
expectedOutput: "Y2F0\nc2F0\nbWF0",
recipeConfig: [
{
"op": "Fork",
"args": ["\\n", "\\n", false]
op: "Fork",
args: ["\\n", "\\n", false],
},
{
"op": "Comment",
"args": ["Testing 123"]
op: "Comment",
args: ["Testing 123"],
},
{
"op": "To Base64",
"args": ["A-Za-z0-9+/="]
}
]
op: "To Base64",
args: ["A-Za-z0-9+/="],
},
],
},
{
name: "Label, Comment: Complex content",
@ -65,12 +65,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Label",
args: [""]
args: [""],
},
{
op: "Comment",
args: [""]
}
]
}
args: [""],
},
],
},
]);

View file

@ -14,13 +14,13 @@ TestRegister.addTests([
expectedOutput: "The cat sat on the mat.",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "Bzip2 Decompress",
"args": []
}
op: "Bzip2 Decompress",
args: [],
},
],
},
{
@ -30,12 +30,12 @@ TestRegister.addTests([
expectedOutput: "The cat sat on the mat.",
recipeConfig: [
{
"op": "LZMA Compress",
"args": ["6"]
op: "LZMA Compress",
args: ["6"],
},
{
"op": "LZMA Decompress",
"args": []
op: "LZMA Decompress",
args: [],
},
],
},
@ -46,17 +46,17 @@ TestRegister.addTests([
expectedOutput: "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "LZMA Decompress",
"args": []
op: "LZMA Decompress",
args: [],
},
{
"op": "To Hex",
"args": ["Space", 0]
}
op: "To Hex",
args: ["Space", 0],
},
],
},
{
@ -66,28 +66,29 @@ TestRegister.addTests([
expectedOutput: "The cat sat on the mat.",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "LZMA Decompress",
"args": []
}
op: "LZMA Decompress",
args: [],
},
],
},
{
name: "LZ4 Compress",
input: "The cat sat on the mat.",
expectedOutput: "04224d184070df170000805468652063617420736174206f6e20746865206d61742e00000000",
expectedOutput:
"04224d184070df170000805468652063617420736174206f6e20746865206d61742e00000000",
recipeConfig: [
{
"op": "LZ4 Compress",
"args": []
op: "LZ4 Compress",
args: [],
},
{
"op": "To Hex",
"args": ["None", 0]
}
op: "To Hex",
args: ["None", 0],
},
],
},
{
@ -96,13 +97,13 @@ TestRegister.addTests([
expectedOutput: "The cat sat on the mat.",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "LZ4 Decompress",
"args": []
}
op: "LZ4 Decompress",
args: [],
},
],
},
]);

View file

@ -11,12 +11,8 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Conditional Jump: Skips 0",
input: [
"should be changed",
].join("\n"),
expectedOutput: [
"YzJodmRXeGtJR0psSUdOb1lXNW5aV1E9"
].join("\n"),
input: ["should be changed"].join("\n"),
expectedOutput: ["YzJodmRXeGtJR0psSUdOb1lXNW5aV1E9"].join("\n"),
recipeConfig: [
{
op: "Conditional Jump",
@ -34,13 +30,9 @@ TestRegister.addTests([
},
{
name: "Conditional Jump: Skips 1",
input: [
"should be changed",
].join("\n"),
input: ["should be changed"].join("\n"),
// Expecting base32, not base64 output
expectedOutput: [
"ONUG65LMMQQGEZJAMNUGC3THMVSA====",
].join("\n"),
expectedOutput: ["ONUG65LMMQQGEZJAMNUGC3THMVSA===="].join("\n"),
recipeConfig: [
{
op: "Conditional Jump",
@ -51,7 +43,8 @@ TestRegister.addTests([
args: ["A-Za-z0-9+/="],
},
{
op: "Label", args: ["skip match"],
op: "Label",
args: ["skip match"],
},
{
op: "To Base32",
@ -61,12 +54,8 @@ TestRegister.addTests([
},
{
name: "Conditional Jump: Skips backwards",
input: [
"match",
].join("\n"),
expectedOutput: [
"f7cf556f7f4fc6635db8c314f7a81f2a",
].join("\n"),
input: ["match"].join("\n"),
expectedOutput: ["f7cf556f7f4fc6635db8c314f7a81f2a"].join("\n"),
recipeConfig: [
{
op: "Label",
@ -89,5 +78,5 @@ TestRegister.addTests([
args: ["match", false, "back to the beginning", 10],
},
],
}
},
]);

View file

@ -28,7 +28,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "None", 1]
args: [
"Decimal Degrees",
"Comma",
"Degrees Minutes Seconds",
"Comma",
"None",
1,
],
},
],
},
@ -39,7 +46,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Degrees Minutes Seconds", "Comma", "Decimal Degrees", "Comma", "None", 3]
args: [
"Degrees Minutes Seconds",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
@ -50,9 +64,16 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Decimal Minutes", "Comma", "None", 2]
}
]
args: [
"Decimal Degrees",
"Comma",
"Degrees Decimal Minutes",
"Comma",
"None",
2,
],
},
],
},
{
name: "Co-ordinates: From Degrees Decimal Minutes to Decimal Degrees",
@ -61,9 +82,16 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Degrees Decimal Minutes", "Comma", "Decimal Degrees", "Comma", "None", 3]
}
]
args: [
"Degrees Decimal Minutes",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
{
name: "Co-ordinates: From Decimal Degrees to Decimal Degrees",
@ -72,9 +100,16 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
}
]
args: [
"Decimal Degrees",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
{
name: "Co-ordinates: From Decimal Degrees to Geohash",
@ -83,7 +118,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Geohash", "Comma", "None", 9]
args: [
"Decimal Degrees",
"Comma",
"Geohash",
"Comma",
"None",
9,
],
},
],
},
@ -94,7 +136,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Geohash", "Comma", "Decimal Degrees", "Comma", "None", 3]
args: [
"Geohash",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
@ -105,7 +154,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Military Grid Reference System", "Comma", "None", 10]
args: [
"Decimal Degrees",
"Comma",
"Military Grid Reference System",
"Comma",
"None",
10,
],
},
],
},
@ -116,9 +172,16 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Military Grid Reference System", "Comma", "Decimal Degrees", "Comma", "None", 3]
}
]
args: [
"Military Grid Reference System",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
{
name: "Co-ordinates: From Decimal Degrees to OSNG",
@ -127,7 +190,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Ordnance Survey National Grid", "Comma", "None", 10]
args: [
"Decimal Degrees",
"Comma",
"Ordnance Survey National Grid",
"Comma",
"None",
10,
],
},
],
},
@ -138,7 +208,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Ordnance Survey National Grid", "Comma", "Decimal Degrees", "Comma", "None", 3]
args: [
"Ordnance Survey National Grid",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
@ -149,7 +226,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Universal Transverse Mercator", "Comma", "None", 0]
args: [
"Decimal Degrees",
"Comma",
"Universal Transverse Mercator",
"Comma",
"None",
0,
],
},
],
},
@ -160,7 +244,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Universal Transverse Mercator", "Comma", "Decimal Degrees", "Comma", "None", 3]
args: [
"Universal Transverse Mercator",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
@ -171,7 +262,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "None", 3]
args: [
"Decimal Degrees",
"Comma",
"Decimal Degrees",
"Comma",
"None",
3,
],
},
],
},
@ -182,7 +280,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
args: [
"Decimal Degrees",
"Comma",
"Decimal Degrees",
"Comma",
"Before",
3,
],
},
],
},
@ -193,7 +298,14 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Decimal Degrees", "Comma", "Before", 3]
args: [
"Decimal Degrees",
"Comma",
"Decimal Degrees",
"Comma",
"Before",
3,
],
},
],
},
@ -204,8 +316,15 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert co-ordinate format",
args: ["Decimal Degrees", "Comma", "Degrees Minutes Seconds", "Comma", "Before", 3]
args: [
"Decimal Degrees",
"Comma",
"Degrees Minutes Seconds",
"Comma",
"Before",
3,
],
},
],
}
},
]);

View file

@ -14,19 +14,20 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Convert to NATO alphabet",
args: []
}
]
args: [],
},
],
},
{
name: "Convert to NATO alphabet: full alphabet with numbers",
input: "abcdefghijklmnopqrstuvwxyz0123456789,/.",
expectedOutput: "Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu Zero One Two Three Four Five Six Seven Eight Nine Comma Fraction bar Full stop ",
expectedOutput:
"Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu Zero One Two Three Four Five Six Seven Eight Nine Comma Fraction bar Full stop ",
recipeConfig: [
{
op: "Convert to NATO alphabet",
args: []
}
]
}
args: [],
},
],
},
]);

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,8 @@ TestRegister.addTests([
args: [],
},
],
}, {
},
{
name: "Defang IP: Valid IPV6",
input: "2001:0db8:85a3:0000:0000:8a2e:0370:7343",
expectedOutput: "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343",
@ -29,7 +30,8 @@ TestRegister.addTests([
args: [],
},
],
}, {
},
{
name: "Defang IP: Valid IPV6 Shorthand",
input: "2001:db8:3c4d:15::1a2f:1a2b",
expectedOutput: "2001[:]db8[:]3c4d[:]15[:][:]1a2f[:]1a2b",

View file

@ -4,12 +4,21 @@
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
import {ELF32_LE, ELF32_BE, ELF64_LE, ELF64_BE} from "../../samples/Executables.mjs";
import {
ELF32_LE,
ELF32_BE,
ELF64_LE,
ELF64_BE,
} from "../../samples/Executables.mjs";
const ELF32_LE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF32_BE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF64_LE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF64_BE_OUTPUT = "============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF32_LE_OUTPUT =
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF32_BE_OUTPUT =
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 32-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: x86\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x34\nEntry SHOFF: 0x54\nFlags: 00000000\nELF Header Size: 52 bytes\nProgram Header Size: 32 bytes\nProgram Header Entries: 1\nSection Header Size: 40 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\nFlags: Execute,Read\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 204\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 230\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 245\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF64_LE_OUTPUT =
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Little\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
const ELF64_BE_OUTPUT =
"============================== ELF Header ==============================\nMagic: \x7fELF\nFormat: 64-bit\nEndianness: Big\nVersion: 1\nABI: System V\nABI Version: 0\nType: Executable File\nInstruction Set Architecture: AMD x86-64\nELF Version: 1\nEntry Point: 0x8062150\nEntry PHOFF: 0x40\nEntry SHOFF: 0x78\nFlags: 00000000\nELF Header Size: 64 bytes\nProgram Header Size: 56 bytes\nProgram Header Entries: 1\nSection Header Size: 64 bytes\nSection Header Entries: 3\nSection Header Names: 0\n\n============================== Program Header ==============================\nProgram Header Type: Program Header Table\nFlags: Execute,Read\nOffset Of Segment: 52\nVirtual Address of Segment: 134512692\nPhysical Address of Segment: 134512692\nSize of Segment: 256 bytes\nSize of Segment in Memory: 256 bytes\n\n============================== Section Header ==============================\nType: String Table\nSection Name: .shstrab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 312\nSection Size: 28\nAssociated Section: 0\nSection Extra Information: 0\n\nType: Symbol Table\nSection Name: .symtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 336\nSection Size: 16\nAssociated Section: 0\nSection Extra Information: 0\n\nType: String Table\nSection Name: .strtab\nFlags: \nSection Vaddr in memory: 0\nOffset of the section: 361\nSection Size: 4\nAssociated Section: 0\nSection Extra Information: 0\n\n============================== Symbol Table ==============================\nSymbol Name: test";
TestRegister.addTests([
{

File diff suppressed because it is too large Load diff

View file

@ -11,44 +11,48 @@ TestRegister.addTests([
{
name: "Extract email address",
input: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com email@example.name\nemail@example.museum email@example.co.jp firstname-lastname@example.com",
expectedOutput: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
expectedOutput:
"email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
recipeConfig: [
{
"op": "Extract email addresses",
"args": [false]
op: "Extract email addresses",
args: [false],
},
],
},
{
name: "Extract email address - Display total",
input: "email@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com email@example.name\nemail@example.museum email@example.co.jp firstname-lastname@example.com",
expectedOutput: "Total found: 11\n\nemail@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
expectedOutput:
"Total found: 11\n\nemail@example.com\nfirstname.lastname@example.com\nemail@subdomain.example.com\nfirstname+lastname@example.com\n1234567890@example.com\nemail@example-one.com\n_______@example.com\nemail@example.name\nemail@example.museum\nemail@example.co.jp\nfirstname-lastname@example.com",
recipeConfig: [
{
"op": "Extract email addresses",
"args": [true]
op: "Extract email addresses",
args: [true],
},
],
},
{
name: "Extract email address (Internationalized)",
input: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9 \u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c \u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc Jos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com and Jos\u1ec5Silva@google.com\nFoO@BaR.CoM, john@192.168.10.100\ng\xf3mez@junk.br and Abc.123@example.com.\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
expectedOutput: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
expectedOutput:
"\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
recipeConfig: [
{
"op": "Extract email addresses",
"args": [false]
op: "Extract email addresses",
args: [false],
},
],
},
{
name: "Extract email address - Display total (Internationalized)",
input: "\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9 \u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c \u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc Jos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com and Jos\u1ec5Silva@google.com\nFoO@BaR.CoM, john@192.168.10.100\ng\xf3mez@junk.br and Abc.123@example.com.\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
expectedOutput: "Total found: 19\n\n\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
expectedOutput:
"Total found: 19\n\n\u4f0a\u662d\u5091@\u90f5\u4ef6.\u5546\u52d9\n\u093e\u092e@\u092e\u094b\u0939\u0928.\u0908\u0928\u094d\u092b\u094b\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nJos\u1ec5Silv\u1ec5@googl\u1ec5.com\nJos\u1ec5Silv\u1ec5@google.com\nJos\u1ec5Silva@google.com\nFoO@BaR.CoM\njohn@192.168.10.100\ng\xf3mez@junk.br\nAbc.123@example.com\nuser+mailbox/department=shipping@example.com\n\u7528\u6237@\u4f8b\u5b50.\u5e7f\u544a\n\u0909\u092a\u092f\u094b\u0917\u0915\u0930\u094d\u0924\u093e@\u0909\u0926\u093e\u0939\u0930\u0923.\u0915\u0949\u092e\n\u044e\u0437\u0435\u0440@\u0435\u043a\u0437\u0430\u043c\u043f\u043b.\u043a\u043e\u043c\n\u03b8\u03c3\u03b5\u03c1@\u03b5\u03c7\u03b1\u03bc\u03c0\u03bb\u03b5.\u03c8\u03bf\u03bc\nD\xf6rte@S\xf6rensen.example.com\n\u0430\u0434\u0436\u0430\u0439@\u044d\u043a\u0437\u0430\u043c\u043f\u043b.\u0440\u0443\u0441\ntest@xn--bcher-kva.com",
recipeConfig: [
{
"op": "Extract email addresses",
"args": [true]
op: "Extract email addresses",
args: [true],
},
],
},

View file

@ -15,19 +15,20 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fernet Decrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="],
},
],
},
{
name: "Fernet Decrypt: no secret",
input: "gAAAAABce-Tycae8klRxhDX2uenJ-uwV8-A1XZ2HRnfOXlNzkKKfRxviNLlgtemhT_fd1Fw5P_zFUAjd69zaJBQyWppAxVV00SExe77ql8c5n62HYJOnoIU=",
expectedOutput: "Error: Secret must be 32 url-safe base64-encoded bytes.",
expectedOutput:
"Error: Secret must be 32 url-safe base64-encoded bytes.",
recipeConfig: [
{
op: "Fernet Decrypt",
args: [""]
}
args: [""],
},
],
},
{
@ -37,10 +38,10 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fernet Decrypt",
args: ["VGhpc0lzVGhpcnR5VHdvQ2hhcmFjdGVyc0xvbmdLZXk="]
}
args: ["VGhpc0lzVGhpcnR5VHdvQ2hhcmFjdGVyc0xvbmdLZXk="],
},
],
}
},
]);
TestRegister.addTests([
@ -51,19 +52,20 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fernet Encrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="],
},
],
},
{
name: "Fernet Encrypt: no secret",
input: "This is a secret message.\n",
expectedOutput: "Error: Secret must be 32 url-safe base64-encoded bytes.",
expectedOutput:
"Error: Secret must be 32 url-safe base64-encoded bytes.",
recipeConfig: [
{
op: "Fernet Encrypt",
args: [""]
}
args: [""],
},
],
},
{
@ -73,8 +75,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Fernet Encrypt",
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
}
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="],
},
],
}
},
]);

View file

@ -9,14 +9,15 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
"name": "File Tree: basic example",
"input": "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt",
"expectedOutput": "test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt",
"recipeConfig": [
name: "File Tree: basic example",
input: "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt",
expectedOutput:
"test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt",
recipeConfig: [
{
"op": "File Tree",
"args": ["/", "Line feed"],
op: "File Tree",
args: ["/", "Line feed"],
},
],
}
},
]);

View file

@ -38,7 +38,8 @@ TestRegister.addTests([
{
name: "Fork, (expect) Error, Merge",
input: "1,2,3,4\n\n3,4,5,6",
expectedOutput: "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
expectedOutput:
"Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?",
recipeConfig: [
{
op: "Fork",
@ -57,25 +58,26 @@ TestRegister.addTests([
{
name: "Fork, Conditional Jump, Encodings",
input: "Some data with a 1 in it\nSome data with a 2 in it",
expectedOutput: "U29tZSBkYXRhIHdpdGggYSAxIGluIGl0\n53 6f 6d 65 20 64 61 74 61 20 77 69 74 68 20 61 20 32 20 69 6e 20 69 74",
expectedOutput:
"U29tZSBkYXRhIHdpdGggYSAxIGluIGl0\n53 6f 6d 65 20 64 61 74 61 20 77 69 74 68 20 61 20 32 20 69 6e 20 69 74",
recipeConfig: [
{"op": "Fork", "args": ["\\n", "\\n", false]},
{"op": "Conditional Jump", "args": ["1", false, "skipReturn", "10"]},
{"op": "To Hex", "args": ["Space"]},
{"op": "Return", "args": []},
{"op": "Label", "args": ["skipReturn"]},
{"op": "To Base64", "args": ["A-Za-z0-9+/="]}
]
{ op: "Fork", args: ["\\n", "\\n", false] },
{ op: "Conditional Jump", args: ["1", false, "skipReturn", "10"] },
{ op: "To Hex", args: ["Space"] },
{ op: "Return", args: [] },
{ op: "Label", args: ["skipReturn"] },
{ op: "To Base64", args: ["A-Za-z0-9+/="] },
],
},
{
name: "Fork, Partial Merge",
input: "Hello World",
expectedOutput: "48656c6c6f 576f726c64",
recipeConfig: [
{ "op": "Fork", "args": [" ", " ", false] },
{ "op": "Fork", "args": ["l", "l", false] },
{ "op": "Merge", "args": [false] },
{ "op": "To Hex", "args": ["None", 0] },
]
{ op: "Fork", args: [" ", " ", false] },
{ op: "Fork", args: ["l", "l", false] },
{ op: "Merge", args: [false] },
{ op: "To Hex", args: ["None", 0] },
],
},
]);

View file

@ -15,7 +15,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Decimal",
args: ["Space", false]
args: ["Space", false],
},
],
},
@ -26,7 +26,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Decimal",
args: ["Comma", true]
args: ["Comma", true],
},
],
},

View file

@ -21,8 +21,8 @@ TestRegister.addTests([
{
op: "GOST Encrypt",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "0011223344556677" },
{ option: "Hex", string: "00112233" },
{ option: "Hex", string: "0011223344556677" },
"Raw",
"Hex",
"GOST 28147 (Magma, 1989)",
@ -30,9 +30,9 @@ TestRegister.addTests([
"E-SC",
"OFB",
"CP",
"ZERO"
]
}
"ZERO",
],
},
],
},
{
@ -43,8 +43,11 @@ TestRegister.addTests([
{
op: "GOST Encrypt",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
{ option: "Hex", string: "00112233" },
{
option: "Hex",
string: "00112233445566778899aabbccddeeff",
},
"Raw",
"Hex",
"GOST R 34.12 (Kuznyechik, 2015)",
@ -52,9 +55,9 @@ TestRegister.addTests([
"E-SC",
"CBC",
"CP",
"PKCS5"
]
}
"PKCS5",
],
},
],
},
{
@ -65,8 +68,8 @@ TestRegister.addTests([
{
op: "GOST Decrypt",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "0011223344556677" },
{ option: "Hex", string: "00112233" },
{ option: "Hex", string: "0011223344556677" },
"Hex",
"Raw",
"GOST 28147 (Magma, 1989)",
@ -74,9 +77,9 @@ TestRegister.addTests([
"E-SC",
"OFB",
"CP",
"ZERO"
]
}
"ZERO",
],
},
],
},
{
@ -87,8 +90,11 @@ TestRegister.addTests([
{
op: "GOST Decrypt",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
{ option: "Hex", string: "00112233" },
{
option: "Hex",
string: "00112233445566778899aabbccddeeff",
},
"Hex",
"Raw",
"GOST R 34.12 (Kuznyechik, 2015)",
@ -96,9 +102,9 @@ TestRegister.addTests([
"E-TEST",
"CBC",
"CP",
"PKCS5"
]
}
"PKCS5",
],
},
],
},
{
@ -109,16 +115,16 @@ TestRegister.addTests([
{
op: "GOST Sign",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "0011223344556677" },
{ option: "Hex", string: "00112233" },
{ option: "Hex", string: "0011223344556677" },
"Raw",
"Hex",
"GOST 28147 (Magma, 1989)",
"64",
"E-C",
48
]
}
48,
],
},
],
},
{
@ -129,35 +135,39 @@ TestRegister.addTests([
{
op: "GOST Verify",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
{ "option": "Hex", "string": "42b77fb3d6f6bf04" },
{ option: "Hex", string: "00112233" },
{
option: "Hex",
string: "00112233445566778899aabbccddeeff",
},
{ option: "Hex", string: "42b77fb3d6f6bf04" },
"Raw",
"GOST R 34.12 (Kuznyechik, 2015)",
"128",
"E-TEST"
]
}
"E-TEST",
],
},
],
},
{
name: "GOST Key Wrap",
input: "Hello, World!123",
expectedOutput: "0bb706e92487fceef97589911faeb28200000000000000000000000000000000\r\n6b7bfd16",
expectedOutput:
"0bb706e92487fceef97589911faeb28200000000000000000000000000000000\r\n6b7bfd16",
recipeConfig: [
{
op: "GOST Key Wrap",
args: [
{ "option": "Hex", "string": "00112233" },
{ "option": "Hex", "string": "0011223344556677" },
{ option: "Hex", string: "00112233" },
{ option: "Hex", string: "0011223344556677" },
"Raw",
"Hex",
"GOST R 34.12 (Kuznyechik, 2015)",
"64",
"E-TEST",
"CP"
]
}
"CP",
],
},
],
},
{
@ -168,16 +178,16 @@ TestRegister.addTests([
{
op: "GOST Key Unwrap",
args: [
{ "option": "Hex", "string": "" },
{ "option": "Latin1", "string": "00112233" },
{ option: "Hex", string: "" },
{ option: "Latin1", string: "00112233" },
"Hex",
"Raw",
"GOST 28147 (Magma, 1989)",
"64",
"E-Z",
"CP"
]
}
"CP",
],
},
],
},
]);

View file

@ -67,10 +67,10 @@ CRC-32: d87f7e0c
`,
recipeConfig: [
{
"op": "Generate all hashes",
"args": ["All", true]
}
]
op: "Generate all hashes",
args: ["All", true],
},
],
},
{
name: "Hashes with length 32",
@ -86,10 +86,10 @@ NT Hash: 0CB6948805F797BF2A82807973B89537
`,
recipeConfig: [
{
"op": "Generate all hashes",
"args": ["128", true]
}
]
op: "Generate all hashes",
args: ["128", true],
},
],
},
{
name: "Hashes without names",
@ -107,9 +107,9 @@ ee67303696d205ddd2b2363e8e01b4b7199a80957d94d7678eaad3fc834c5a27
`,
recipeConfig: [
{
"op": "Generate all hashes",
"args": ["256", false]
}
]
}
op: "Generate all hashes",
args: ["256", false],
},
],
},
]);

View file

@ -14,20 +14,21 @@ TestRegister.addTests([
expectedOutput: "00010111",
recipeConfig: [
{
"op": "Generate De Bruijn Sequence",
"args": [2, 3]
}
]
op: "Generate De Bruijn Sequence",
args: [2, 3],
},
],
},
{
name: "Generate De Bruijn Sequence: Long Sequence",
input: "",
expectedOutput: "0000010000200003000110001200013000210002200023000310003200033001010010200103001110011200113001210012200123001310013200133002010020200203002110021200213002210022200223002310023200233003010030200303003110031200313003210032200323003310033200333010110101201013010210102201023010310103201033011020110301111011120111301121011220112301131011320113301202012030121101212012130122101222012230123101232012330130201303013110131201313013210132201323013310133201333020210202202023020310203202033021030211102112021130212102122021230213102132021330220302211022120221302221022220222302231022320223302303023110231202313023210232202323023310233202333030310303203033031110311203113031210312203123031310313203133032110321203213032210322203223032310323203233033110331203313033210332203323033310333203333111112111131112211123111321113311212112131122211223112321123311312113131132211323113321133312122121231213212133122131222212223122321223312313123221232312332123331313213133132221322313232132331332213323133321333322222322233223232233323233233333",
expectedOutput:
"0000010000200003000110001200013000210002200023000310003200033001010010200103001110011200113001210012200123001310013200133002010020200203002110021200213002210022200223002310023200233003010030200303003110031200313003210032200323003310033200333010110101201013010210102201023010310103201033011020110301111011120111301121011220112301131011320113301202012030121101212012130122101222012230123101232012330130201303013110131201313013210132201323013310133201333020210202202023020310203202033021030211102112021130212102122021230213102132021330220302211022120221302221022220222302231022320223302303023110231202313023210232202323023310233202333030310303203033031110311203113031210312203123031310313203133032110321203213032210322203223032310323203233033110331203313033210332203323033310333203333111112111131112211123111321113311212112131122211223112321123311312113131132211323113321133312122121231213212133122131222212223122321223312313123221232312332123331313213133132221322313232132331332213323133321333322222322233223232233323233233333",
recipeConfig: [
{
"op": "Generate De Bruijn Sequence",
"args": [4, 5]
}
]
}
op: "Generate De Bruijn Sequence",
args: [4, 5],
},
],
},
]);

View file

@ -11,13 +11,14 @@ TestRegister.addTests([
{
name: "All casings of test",
input: "test",
expectedOutput: "test\nTest\ntEst\nTEst\nteSt\nTeSt\ntESt\nTESt\ntesT\nTesT\ntEsT\nTEsT\nteST\nTeST\ntEST\nTEST",
expectedOutput:
"test\nTest\ntEst\nTEst\nteSt\nTeSt\ntESt\nTESt\ntesT\nTesT\ntEsT\nTEsT\nteST\nTeST\ntEST\nTEST",
recipeConfig: [
{
"op": "Get All Casings",
"args": []
}
]
op: "Get All Casings",
args: [],
},
],
},
{
name: "All casings of t",
@ -25,10 +26,10 @@ TestRegister.addTests([
expectedOutput: "t\nT",
recipeConfig: [
{
"op": "Get All Casings",
"args": []
}
]
op: "Get All Casings",
args: [],
},
],
},
{
name: "All casings of null",
@ -36,9 +37,9 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Get All Casings",
"args": []
}
]
}
op: "Get All Casings",
args: [],
},
],
},
]);

View file

@ -17,13 +17,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Gunzip",
args: []
}
]
args: [],
},
],
},
{
name: "Gunzip: No comment, no checksum and filename",
@ -32,13 +32,13 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Gunzip",
args: []
}
]
args: [],
},
],
},
{
name: "Gunzip: Has a comment, no checksum and has a filename",
@ -47,12 +47,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Gunzip",
args: []
}
]
}
args: [],
},
],
},
]);

View file

@ -13,77 +13,81 @@ TestRegister.addTests([
{
name: "Gzip: No comment, no checksum and no filename",
input: "The quick brown fox jumped over the slow dog",
expectedOutput: "0dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
expectedOutput:
"0dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
recipeConfig: [
{
op: "Gzip",
args: ["Dynamic Huffman Coding", "", "", false]
args: ["Dynamic Huffman Coding", "", "", false],
},
{
op: "Drop bytes",
args: [0, 10, false]
args: [0, 10, false],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
{
name: "Gzip: No comment, no checksum and has a filename",
input: "The quick brown fox jumped over the slow dog",
expectedOutput: "636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
expectedOutput:
"636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
recipeConfig: [
{
op: "Gzip",
args: ["Dynamic Huffman Coding", "comment", "", false]
args: ["Dynamic Huffman Coding", "comment", "", false],
},
{
op: "Drop bytes",
args: [0, 10, false]
args: [0, 10, false],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
{
name: "Gzip: Has a comment, no checksum and no filename",
input: "The quick brown fox jumped over the slow dog",
expectedOutput: "636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
expectedOutput:
"636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
recipeConfig: [
{
op: "Gzip",
args: ["Dynamic Huffman Coding", "", "comment", false]
args: ["Dynamic Huffman Coding", "", "comment", false],
},
{
op: "Drop bytes",
args: [0, 10, false]
args: [0, 10, false],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
{
name: "Gzip: Has a comment, no checksum and has a filename",
input: "The quick brown fox jumped over the slow dog",
expectedOutput: "66696c656e616d6500636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
expectedOutput:
"66696c656e616d6500636f6d6d656e74000dc9dd0180200804e0556ea8262848fb3dc588c6a7e76faa8aeedb726036c68d951f76bf9a0af8aae1f97d9c0c084b02509cbf8c2c000000",
recipeConfig: [
{
op: "Gzip",
args: ["Dynamic Huffman Coding", "filename", "comment", false]
args: ["Dynamic Huffman Coding", "filename", "comment", false],
},
{
op: "Drop bytes",
args: [0, 10, false]
args: [0, 10, false],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
]);

View file

@ -14,9 +14,9 @@ TestRegister.addTests([
expectedOutput: "21b457a327ce7a2d4fce5ef2c42400bd",
recipeConfig: [
{
"op": "HASSH Client Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "HASSH Client Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
{
@ -25,9 +25,9 @@ TestRegister.addTests([
expectedOutput: "f430cd6761697a6a658ee1d45ed22e49",
recipeConfig: [
{
"op": "HASSH Server Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "HASSH Server Fingerprint",
args: ["Hex", "Hash digest"],
},
],
}
},
]);

View file

@ -7,172 +7,210 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
"name": "HKDF: RFC5869 Test Case 1",
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"expectedOutput": "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 1",
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
expectedOutput:
"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c"},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA256", "with salt", 42,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "000102030405060708090a0b0c" },
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
"SHA256",
"with salt",
42,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 2",
"input": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"expectedOutput": "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 2",
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
expectedOutput:
"b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"},
{"option": "Hex", "string": "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"},
"SHA256", "with salt", 82,
op: "Derive HKDF key",
args: [
{
option: "Hex",
string: "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
},
{
option: "Hex",
string: "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
},
"SHA256",
"with salt",
82,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 3",
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"expectedOutput": "8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 3",
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
expectedOutput:
"8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
"SHA256", "with salt", 42,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "" },
{ option: "Hex", string: "" },
"SHA256",
"with salt",
42,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 4",
"input": "0b0b0b0b0b0b0b0b0b0b0b",
"expectedOutput": "085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 4",
input: "0b0b0b0b0b0b0b0b0b0b0b",
expectedOutput:
"085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c"},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA1", "with salt", 42,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "000102030405060708090a0b0c" },
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
"SHA1",
"with salt",
42,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 5",
"input": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"expectedOutput": "0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 5",
input: "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
expectedOutput:
"0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf"},
{"option": "Hex", "string": "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"},
"SHA1", "with salt", 82,
op: "Derive HKDF key",
args: [
{
option: "Hex",
string: "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
},
{
option: "Hex",
string: "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
},
"SHA1",
"with salt",
82,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 6",
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"expectedOutput": "0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 6",
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
expectedOutput:
"0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
"SHA1", "with salt", 42,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "" },
{ option: "Hex", string: "" },
"SHA1",
"with salt",
42,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 7",
"input": "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
"expectedOutput": "2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 7",
input: "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
expectedOutput:
"2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": ""},
"SHA1", "no salt", 42,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "" },
{ option: "Hex", string: "" },
"SHA1",
"no salt",
42,
],
},
],
},
{
"name": "HKDF: RFC5869 Test Case 1 with skip extract",
"input": "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5",
"expectedOutput": "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
"recipeConfig": [
name: "HKDF: RFC5869 Test Case 1 with skip extract",
input: "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5",
expectedOutput:
"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": ""},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA256", "skip", 42,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "" },
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
"SHA256",
"skip",
42,
],
},
],
},
{
"name": "HKDF: too large L",
"input": "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
"expectedOutput": "L too large (maximum length for SHA256 is 8160)",
"recipeConfig": [
name: "HKDF: too large L",
input: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
expectedOutput: "L too large (maximum length for SHA256 is 8160)",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"],
op: "From Hex",
args: ["None"],
},
{
"op": "Derive HKDF key",
"args": [
{"option": "Hex", "string": "000102030405060708090a0b0c"},
{"option": "Hex", "string": "f0f1f2f3f4f5f6f7f8f9"},
"SHA256", "with salt", 8161,
op: "Derive HKDF key",
args: [
{ option: "Hex", string: "000102030405060708090a0b0c" },
{ option: "Hex", string: "f0f1f2f3f4f5f6f7f8f9" },
"SHA256",
"with salt",
8161,
],
},
],

File diff suppressed because it is too large Load diff

View file

@ -14,9 +14,9 @@ TestRegister.addTests([
expectedOutput: "5902542.836307819",
recipeConfig: [
{
"op": "Haversine distance",
"args": []
}
op: "Haversine distance",
args: [],
},
],
},
{
@ -25,9 +25,9 @@ TestRegister.addTests([
expectedOutput: "0",
recipeConfig: [
{
"op": "Haversine distance",
"args": []
}
op: "Haversine distance",
args: [],
},
],
}
},
]);

View file

@ -7,13 +7,10 @@ TestRegister.addTests([
expectedOutput: "6162657279737477797468",
recipeConfig: [
{
"op": "To Hex",
"args": [
"None",
0
]
op: "To Hex",
args: ["None", 0],
},
]
],
},
{
name: "ASCII to Hex with colon deliminator ",
@ -21,41 +18,34 @@ TestRegister.addTests([
expectedOutput: "61:62:65:72:79:73:74:77:79:74:68",
recipeConfig: [
{
"op": "To Hex",
"args": [
"Colon",
0
]
}
]
op: "To Hex",
args: ["Colon", 0],
},
],
},
{
name: "ASCII to 0x Hex with comma",
input: "aberystwyth",
expectedOutput: "0x61,0x62,0x65,0x72,0x79,0x73,0x74,0x77,0x79,0x74,0x68",
expectedOutput:
"0x61,0x62,0x65,0x72,0x79,0x73,0x74,0x77,0x79,0x74,0x68",
recipeConfig: [
{
"op": "To Hex",
"args": [
"0x with comma",
0
]
}
]
op: "To Hex",
args: ["0x with comma", 0],
},
],
},
{
name: "ASCII to 0x Hex with comma and line breaks",
input: "aberystwyth",
expectedOutput: "0x61,0x62,0x65,0x72,\n0x79,0x73,0x74,0x77,\n0x79,0x74,0x68",
expectedOutput:
"0x61,0x62,0x65,0x72,\n0x79,0x73,0x74,0x77,\n0x79,0x74,0x68",
recipeConfig: [
{
"op": "To Hex",
"args": [
"0x with comma",
4
]
}
]
op: "To Hex",
args: ["0x with comma", 4],
},
],
},
{
name: "Hex stream to UTF-8",
@ -63,13 +53,10 @@ TestRegister.addTests([
expectedOutput: "救救孩子",
recipeConfig: [
{
"op": "From Hex",
"args": [
"Auto"
]
}
]
op: "From Hex",
args: ["Auto"],
},
],
},
{
name: "Multiline 0x hex to ASCII",
@ -83,15 +70,14 @@ TestRegister.addTests([
0x75,0x70,0x20,0x6d,0x79,0x20,0x6d,0x69,0x6e,0x64,0x20,0x77,0x68,0x69,0x63,\
0x68,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x66,0x69,0x67,0x73,0x20,0x49,\
0x20,0x77,0x6f,0x75,0x6c,0x64,0x20,0x63,0x68,0x6f,0x6f,0x73,0x65,0x2e",
expectedOutput: "I saw myself sitting in the crotch of the this fig tree, starving to death, just because I couldn't make up my mind which of the figs I would choose.",
expectedOutput:
"I saw myself sitting in the crotch of the this fig tree, starving to death, just because I couldn't make up my mind which of the figs I would choose.",
recipeConfig: [
{
"op": "From Hex",
"args": [
"Auto"
]
}
]
op: "From Hex",
args: ["Auto"],
},
],
},
{
name: "0x with Comma to Ascii",
@ -99,12 +85,9 @@ TestRegister.addTests([
expectedOutput: "test string",
recipeConfig: [
{
"op": "From Hex",
"args": [
"0x with comma"
]
}
]
op: "From Hex",
args: ["0x with comma"],
},
],
},
]);

View file

@ -35,12 +35,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hexdump",
args: [16, false, false]
args: [16, false, false],
},
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -50,12 +50,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hexdump",
args: [16, false, false]
args: [16, false, false],
},
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -65,12 +65,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hexdump",
args: [16, false, false]
args: [16, false, false],
},
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -80,12 +80,12 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hexdump",
args: [16, false, false]
args: [16, false, false],
},
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -96,8 +96,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hexdump",
args: [16, false, false]
}
args: [16, false, false],
},
],
},
{
@ -122,8 +122,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "To Hexdump",
args: [16, false, false]
}
args: [16, false, false],
},
],
},
{
@ -148,8 +148,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -175,8 +175,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -201,8 +201,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -227,8 +227,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
{
@ -254,8 +254,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hexdump",
args: []
}
args: [],
},
],
},
]);

View file

@ -9,41 +9,44 @@
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
import { GIF_ANIMATED_HEX, PNG_HEX, JPG_B64, EXIF_JPG_HEX, NO_EXIF_JPG_HEX } from "../../samples/Images.mjs";
import {
GIF_ANIMATED_HEX,
PNG_HEX,
JPG_B64,
EXIF_JPG_HEX,
NO_EXIF_JPG_HEX,
} from "../../samples/Images.mjs";
TestRegister.addTests([
{
name: "Render Image: nothing",
input: "",
expectedOutput: "",
recipeConfig: [
{ op: "Render Image", args: ["Raw"] }
]
recipeConfig: [{ op: "Render Image", args: ["Raw"] }],
},
{
name: "Render Image: raw gif",
input: GIF_ANIMATED_HEX,
expectedOutput: "<img src='data:image/gif;base64,R0lGODlhDwAPALMLAEJCQv/nAP/vAP/OAAAAAP+1AP+cAP//lP//EP//xv//7////wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFMgALACwAAAAADwAPAAAEWnBJCWqdeFWVzhkXBnAIEgTCYAAT0J3oma7UERCEgOIp65o4GU9VOZgESFRyUCjGYjoUs3J86nRTwEBAkHkJRM22q+QOQJQzFxcMp8/wgrsFKNgLK1aGYtFPIgAh+QQFCgALACwDAAkACQABAAAEBTBIMWUEACH5BAUKAAsALAQACgAHAAEAAAQFMKw5QwQAIfkEBQoACwAsBAAEAAcAAQAABAVQBClDBAAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwDAAQACAACAAAECZCssJYMUtQbAQAh+QQFGQALACwDAAQACQACAAAECTAIQmSgEotJIgAh+QQFCgALACwEAAQACAACAAAECXAFseoksmIRAQAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwEAAMABwADAAAECpCQRSW9VIgrQgQAIfkEBRkACwAsAwADAAgAAgAABAmQrLCWFJLaGQEAIfkEBRkACwAsAwADAAkAAgAABArwBEJEmCQIqnEEACH5BAUZAAsALAUAAwAHAAMAAAQKMIRFxaCYEoJ3BAAh+QQFHgALACwEAAQACAACAAAECZAssZYUMtQbAQAh+QQFCgALACwEAAoABwABAAAEBZCsOUkEACH5BAUKAAsALAMACQAJAAEAAAQFkKxJF4kAOw=='>",
expectedOutput:
"<img src='data:image/gif;base64,R0lGODlhDwAPALMLAEJCQv/nAP/vAP/OAAAAAP+1AP+cAP//lP//EP//xv//7////wAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFMgALACwAAAAADwAPAAAEWnBJCWqdeFWVzhkXBnAIEgTCYAAT0J3oma7UERCEgOIp65o4GU9VOZgESFRyUCjGYjoUs3J86nRTwEBAkHkJRM22q+QOQJQzFxcMp8/wgrsFKNgLK1aGYtFPIgAh+QQFCgALACwDAAkACQABAAAEBTBIMWUEACH5BAUKAAsALAQACgAHAAEAAAQFMKw5QwQAIfkEBQoACwAsBAAEAAcAAQAABAVQBClDBAAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwDAAQACAACAAAECZCssJYMUtQbAQAh+QQFGQALACwDAAQACQACAAAECTAIQmSgEotJIgAh+QQFCgALACwEAAQACAACAAAECXAFseoksmIRAQAh+QQFCgALACwDAAQACQACAAAECjAQIoKYV1xZSQQAIfkEBQoACwAsAwAEAAkAAgAABAkwCEkpIUFeEQEAIfkEBTIACwAsBAAEAAcAAQAABAWQkEVlBAAh+QQFGQALACwEAAMABwADAAAECpCQRSW9VIgrQgQAIfkEBRkACwAsAwADAAgAAgAABAmQrLCWFJLaGQEAIfkEBRkACwAsAwADAAkAAgAABArwBEJEmCQIqnEEACH5BAUZAAsALAUAAwAHAAMAAAQKMIRFxaCYEoJ3BAAh+QQFHgALACwEAAQACAACAAAECZAssZYUMtQbAQAh+QQFCgALACwEAAoABwABAAAEBZCsOUkEACH5BAUKAAsALAMACQAJAAEAAAQFkKxJF4kAOw=='>",
recipeConfig: [
{ op: "From Hex", args: ["Space"] },
{ op: "Render Image", args: ["Raw"] }
]
{ op: "Render Image", args: ["Raw"] },
],
},
{
name: "Render Image: hex png",
input: PNG_HEX,
expectedOutput: "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAFGElEQVRYw8VXXWwUVRT+7szszKzb3bbglqXbzbbQbYDQYJBGbWlTRUq1KtCmVYmECsHQKjE8mJrwYoIPpmIQEw2aaLA2PDRhATVpCxiLcYPBP0RQbIEVulNatt3SYX9mf2auD7QVlt3uLq3xPE3mnnvPd8/5zs8luD9hOzs7l1sslvJQKMR6PJ4fWlpafgWgAWAA0MnvlELSNEimDt65c6dpx44dB3JychplWUYgEGAAUFmWvxofHz9nNpvrwuHw72vXrt0KQJ0tAOJ0Oh8pKSlpFQRhmaZpAQB6o9FYBgATExPaJAAAAKWUEkKIqqq3Kisr7R0dHY+Lojhvw4YNnyXzyEwAiMvlai0sLNxHCNElUogHcKcoijIoCIIVADwez9aNGzd+nkiPS2bd6XSustvtSY2nElEUbVOO0bTkdGCS3d7hcLQwDKPDLCUcDt/YvHnz0WTeTgaAEQRheUoCEZKSxIIgLDh+/PhvPT09exOBSBYCSilV5iqLRFG0q6r62OSF1XQ8oAUCgVNpnE3TDIMUCoV+TJQJyQCgu7v7w2g0OjSjdUppOhxYt27d8tra2l2JACcFsHv37uEzZ848qyhK/2xIKAhCXmdn5wvJ6gAz0+bGxsZf1qxZU6FpWjRTw6FQyE0pVSmlmqZpkUzTcFrcbreSbqynRFXVYFVV1cMDAwP1kiS9Ul9ffzCZLof/QDRNUyilyqZNm75MpcvgfxZmrlItrkCl3Y7TCUHI5XJ9YzQan4pfGBoawvDwcCICngIQnSsAuuLiYgfLsvcs8DyPnJycRBxYDIBNxwszAli2wCC+uHrJq+y1n4sIc3e09PMKaLbeSCVJopIk3bUWi8Uc1dXVT/b19XXPppYz7euXHHji0ZXbBV53z7ai6q24FuW1n/r7GafTCVVV46tkNBqNlvb29v51XyR8adVCq9nAvTxw+QpijDD9X1ZULFxVD8ODdgBAbm4uyp4uQzg3/O/AyLLgef57n8/nq6mpKWYTxS9VCErMhkoCcBOyjIKKLTDoBby+Zw+sS1dA9akoWxjGoNtNqMGA/cb9sDXYUMVVoXSkFIQQuFyucpPJdEKn05U2NDQ0d3V1fZG2B1oqbEXWbOGDaSWGhd5kRlnZavRf+ANF+fkIyTKCExPE7/djm20bBoODWCQsgtlshiiKvlgs5uZ5fgUhhHAcl5eRB5bmGXaxDJkf/397UxO2NzVB1TQEJtNvdHQU5cZylGeVA6HpBjTm9XrbrFbrsUAg8OmhQ4fez4QDjI4jK1O0WIjcbexjY2OJ0pDJyspaPQmmoqampigTAFTTMJKixSJyu+RRWZYRPxYoirLIZDK9AQAcxy21WCyvZRIC6vVHPn6A168nBAnZyzIMDGYzHKWlYCwWJBgNSSQSOSvL8ttGo/E5SZL2ZcSBt3ovn3jnGUdrXhb/LgDTHa6FJMsw6PVgOQ7nLl4kPX19NBaLwWAwqHV1dSzLsgQAotHot0eOHDkM4PD9VEL65tcDnzQ9ZDlWNF9fy/H6/QCyGYaBRa/HjUuXEBobgzoyQm02G83Pz4fNZmOnpmSe5wclSXpvrt6G5MLJk88XFxbu5XU6650Lf16/rl32epm4YWTo5s2brc3NzcfSeuWmo/RRR8d5TdMOLlm8+JbA84Ucy+YCwKjfT8eDQTJp2BMMBvedPn16S1tb29m0W3fGAwTD8N91dS2zFxSs+Nvny77i9fr9fv/59vb2s1evXo1ket4/oXgLrXNMZZcAAAAASUVORK5CYII='>",
recipeConfig: [
{ op: "Render Image", args: ["Hex"] }
]
expectedOutput:
"<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAFGElEQVRYw8VXXWwUVRT+7szszKzb3bbglqXbzbbQbYDQYJBGbWlTRUq1KtCmVYmECsHQKjE8mJrwYoIPpmIQEw2aaLA2PDRhATVpCxiLcYPBP0RQbIEVulNatt3SYX9mf2auD7QVlt3uLq3xPE3mnnvPd8/5zs8luD9hOzs7l1sslvJQKMR6PJ4fWlpafgWgAWAA0MnvlELSNEimDt65c6dpx44dB3JychplWUYgEGAAUFmWvxofHz9nNpvrwuHw72vXrt0KQJ0tAOJ0Oh8pKSlpFQRhmaZpAQB6o9FYBgATExPaJAAAAKWUEkKIqqq3Kisr7R0dHY+Lojhvw4YNnyXzyEwAiMvlai0sLNxHCNElUogHcKcoijIoCIIVADwez9aNGzd+nkiPS2bd6XSustvtSY2nElEUbVOO0bTkdGCS3d7hcLQwDKPDLCUcDt/YvHnz0WTeTgaAEQRheUoCEZKSxIIgLDh+/PhvPT09exOBSBYCSilV5iqLRFG0q6r62OSF1XQ8oAUCgVNpnE3TDIMUCoV+TJQJyQCgu7v7w2g0OjSjdUppOhxYt27d8tra2l2JACcFsHv37uEzZ848qyhK/2xIKAhCXmdn5wvJ6gAz0+bGxsZf1qxZU6FpWjRTw6FQyE0pVSmlmqZpkUzTcFrcbreSbqynRFXVYFVV1cMDAwP1kiS9Ul9ffzCZLof/QDRNUyilyqZNm75MpcvgfxZmrlItrkCl3Y7TCUHI5XJ9YzQan4pfGBoawvDwcCICngIQnSsAuuLiYgfLsvcs8DyPnJycRBxYDIBNxwszAli2wCC+uHrJq+y1n4sIc3e09PMKaLbeSCVJopIk3bUWi8Uc1dXVT/b19XXPppYz7euXHHji0ZXbBV53z7ai6q24FuW1n/r7GafTCVVV46tkNBqNlvb29v51XyR8adVCq9nAvTxw+QpijDD9X1ZULFxVD8ODdgBAbm4uyp4uQzg3/O/AyLLgef57n8/nq6mpKWYTxS9VCErMhkoCcBOyjIKKLTDoBby+Zw+sS1dA9akoWxjGoNtNqMGA/cb9sDXYUMVVoXSkFIQQuFyucpPJdEKn05U2NDQ0d3V1fZG2B1oqbEXWbOGDaSWGhd5kRlnZavRf+ANF+fkIyTKCExPE7/djm20bBoODWCQsgtlshiiKvlgs5uZ5fgUhhHAcl5eRB5bmGXaxDJkf/397UxO2NzVB1TQEJtNvdHQU5cZylGeVA6HpBjTm9XrbrFbrsUAg8OmhQ4fez4QDjI4jK1O0WIjcbexjY2OJ0pDJyspaPQmmoqampigTAFTTMJKixSJyu+RRWZYRPxYoirLIZDK9AQAcxy21WCyvZRIC6vVHPn6A168nBAnZyzIMDGYzHKWlYCwWJBgNSSQSOSvL8ttGo/E5SZL2ZcSBt3ovn3jnGUdrXhb/LgDTHa6FJMsw6PVgOQ7nLl4kPX19NBaLwWAwqHV1dSzLsgQAotHot0eOHDkM4PD9VEL65tcDnzQ9ZDlWNF9fy/H6/QCyGYaBRa/HjUuXEBobgzoyQm02G83Pz4fNZmOnpmSe5wclSXpvrt6G5MLJk88XFxbu5XU6650Lf16/rl32epm4YWTo5s2brc3NzcfSeuWmo/RRR8d5TdMOLlm8+JbA84Ucy+YCwKjfT8eDQTJp2BMMBvedPn16S1tb29m0W3fGAwTD8N91dS2zFxSs+Nvny77i9fr9fv/59vb2s1evXo1ket4/oXgLrXNMZZcAAAAASUVORK5CYII='>",
recipeConfig: [{ op: "Render Image", args: ["Hex"] }],
},
{
name: "Render Image: base64 jpg",
input: JPG_B64,
expectedOutput: "<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQVFBQUFBQUFP/AABEIACAAIAMBEQACEQEDEQH/xAAbAAACAQUAAAAAAAAAAAAAAAAGBwkAAQIDCP/EAC4QAAIBAwIFAQcFAQAAAAAAAAECAwQFEQYSAAcIITFxIjJBQlJhwQkUFSORE//EABwBAAEFAQEBAAAAAAAAAAAAAAYAAgQFBwgDAf/EADARAAECBAQEBAYDAQAAAAAAAAECEQMEBSEABhIxQVFhoRMicZEUMnKBwdEVUrFC/9oADAMBAAIRAxEAPwCTPU+qDZ3jo6REnuUy71WQ4SJPG98d8Z7ADuT6EgSrlc/jiJaWAVHUHAPypG2pTXZ7AC6i4BDEi3kZETAMWKWQOW5PIfk8PYYDqif9y264XKrrZD5AnaGMeiIQMeuT9+M0jTJjHVOzK4iuiihP2SggN9Wo8ycESEaA0CGlI9AT7qfsw6YqmnFMwe33GropB4BnaaM+qOSP8wfvw6BM+CrVJTC4avqUtP3SsqDemk8iMJadYaPDSoegB90sfd/TBjpjU5u7yUdWiQ3GJd5EZ9iVPG9M98Z7EHuCR5yCdJolc/kSZaZATHSHt8qhtqS92exBukkAkggkdnpES4EWEXQbX3B5H8Hj7jEX/Vf1Xc3eTHUPqakm1HHTaZuGysskcNrp3V6YFoiju6FiyMhBAb5g3beBxT02VpmY/iJxST4mtSVeYuyCUp9BpD8nKuL4kzMSZp5hwQfKACLc7nv2bA5yz/UZ1fe9W2qyXOwUurDcqlKSCOywtR1gduynEkjRP385MQUZJOBwPZgyZLS8pEnJeaMMIDnXdLDqkBQ6WUSbAYnSFYiLiphRIYU9rWPe3cYy5m/qPatseqbrZLVp2k0q9tqWpJ0vkbVlWXXs3sxSLHH38ENKGGCDgjhZfyZLx5WHOTE0YgWHGiyWO11Ak9bJI2wp+sRERFQocPS1r3PYt3OC3pD6sObHO/n3Z6c32kk0xakasu8clrjT+pmWJY43UBgzFye5IxGx77cG6q0tTsufDTUMHxPESlPm4KISt+mk++nESUiTFQ8SEW06STbiLjv2fD16oemzTvO6WosGpoqilnt9VJNb7nQsq1FOshDEKWBBVht3KQQdo8FQRhs1WqpkrME1Dl2YqJ0lylSVEqSeFwDuNi4uHwZiVlqvIwlxN2FxuCLH/MKrp46NNBcnNe19xpbpcNRaqtka7P5IIgpI5lYCWONQM7gJE3kkZWRRghuPLMmdatXpFEGIhMOCs/8ALnUUnYknhYt1BNmxHkaXLSMXxASVDnwxr6jOjHQnN3Xdtu1XdblpzUt4YwN/GxrKlX/yiLGSRCp27URUMmQuTGpyzLl2Wc7VWhyS5eGhMSDDv5nGnUWYF7uS+lifmOwOPk9S5aejeIVFKjy44anS50zac5HVEVj00tVV1Nyqopbhcq5w086xkkA7QFVVBfCgfMckk54fArdTztX5SFMABIUCEpcBKQQpR4lyE7k8hbEn4SWpEjFWjdtzxOw7nHXWt9DQ6qRJ4isNwhG1JG911+lvwfhk8bpnLJ0LM0IRYJCJhAYE7Ef1VxZ9jdr2L4B6XVFSBKFXQe3UYTuqeVUFynhe8Wab93TKyQV9M0kM8KtjcI6iIh1DbVyFYZ2jPgcczR6RXqEtUGLLrAO/l1oLbHZSD0e4fg+DFM3LzI1IWPdj+8W0vyop7dUyy2izVD1s6CKW4VcktRUSICSqvUTMzlQSSFLYGTgcKBSa9XFJgwZdZHDyaEDrslAPc9cJU1Ly3mWse7n94cWiNCxaWR6iVlmuEq7WdfdRfpX8n44HHS+TMmw8swjGjELmFhiRskf1TxZ9zZ7WDYD6pVVT5CE2QO55nH//2Q=='>",
recipeConfig: [
{ op: "Render Image", args: ["Base64"] }
]
expectedOutput:
"<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQVFBQUFBQUFP/AABEIACAAIAMBEQACEQEDEQH/xAAbAAACAQUAAAAAAAAAAAAAAAAGBwkAAQIDCP/EAC4QAAIBAwIFAQcFAQAAAAAAAAECAwQFEQYSAAcIITFxIjJBQlJhwQkUFSORE//EABwBAAEFAQEBAAAAAAAAAAAAAAYAAgQFBwgDAf/EADARAAECBAQEBAYDAQAAAAAAAAECEQMEBSEABhIxQVFhoRMicZEUMnKBwdEVUrFC/9oADAMBAAIRAxEAPwCTPU+qDZ3jo6REnuUy71WQ4SJPG98d8Z7ADuT6EgSrlc/jiJaWAVHUHAPypG2pTXZ7AC6i4BDEi3kZETAMWKWQOW5PIfk8PYYDqif9y264XKrrZD5AnaGMeiIQMeuT9+M0jTJjHVOzK4iuiihP2SggN9Wo8ycESEaA0CGlI9AT7qfsw6YqmnFMwe33GropB4BnaaM+qOSP8wfvw6BM+CrVJTC4avqUtP3SsqDemk8iMJadYaPDSoegB90sfd/TBjpjU5u7yUdWiQ3GJd5EZ9iVPG9M98Z7EHuCR5yCdJolc/kSZaZATHSHt8qhtqS92exBukkAkggkdnpES4EWEXQbX3B5H8Hj7jEX/Vf1Xc3eTHUPqakm1HHTaZuGysskcNrp3V6YFoiju6FiyMhBAb5g3beBxT02VpmY/iJxST4mtSVeYuyCUp9BpD8nKuL4kzMSZp5hwQfKACLc7nv2bA5yz/UZ1fe9W2qyXOwUurDcqlKSCOywtR1gduynEkjRP385MQUZJOBwPZgyZLS8pEnJeaMMIDnXdLDqkBQ6WUSbAYnSFYiLiphRIYU9rWPe3cYy5m/qPatseqbrZLVp2k0q9tqWpJ0vkbVlWXXs3sxSLHH38ENKGGCDgjhZfyZLx5WHOTE0YgWHGiyWO11Ak9bJI2wp+sRERFQocPS1r3PYt3OC3pD6sObHO/n3Z6c32kk0xakasu8clrjT+pmWJY43UBgzFye5IxGx77cG6q0tTsufDTUMHxPESlPm4KISt+mk++nESUiTFQ8SEW06STbiLjv2fD16oemzTvO6WosGpoqilnt9VJNb7nQsq1FOshDEKWBBVht3KQQdo8FQRhs1WqpkrME1Dl2YqJ0lylSVEqSeFwDuNi4uHwZiVlqvIwlxN2FxuCLH/MKrp46NNBcnNe19xpbpcNRaqtka7P5IIgpI5lYCWONQM7gJE3kkZWRRghuPLMmdatXpFEGIhMOCs/8ALnUUnYknhYt1BNmxHkaXLSMXxASVDnwxr6jOjHQnN3Xdtu1XdblpzUt4YwN/GxrKlX/yiLGSRCp27URUMmQuTGpyzLl2Wc7VWhyS5eGhMSDDv5nGnUWYF7uS+lifmOwOPk9S5aejeIVFKjy44anS50zac5HVEVj00tVV1Nyqopbhcq5w086xkkA7QFVVBfCgfMckk54fArdTztX5SFMABIUCEpcBKQQpR4lyE7k8hbEn4SWpEjFWjdtzxOw7nHXWt9DQ6qRJ4isNwhG1JG911+lvwfhk8bpnLJ0LM0IRYJCJhAYE7Ef1VxZ9jdr2L4B6XVFSBKFXQe3UYTuqeVUFynhe8Wab93TKyQV9M0kM8KtjcI6iIh1DbVyFYZ2jPgcczR6RXqEtUGLLrAO/l1oLbHZSD0e4fg+DFM3LzI1IWPdj+8W0vyop7dUyy2izVD1s6CKW4VcktRUSICSqvUTMzlQSSFLYGTgcKBSa9XFJgwZdZHDyaEDrslAPc9cJU1Ly3mWse7n94cWiNCxaWR6iVlmuEq7WdfdRfpX8n44HHS+TMmw8swjGjELmFhiRskf1TxZ9zZ7WDYD6pVVT5CE2QO55nH//2Q=='>",
recipeConfig: [{ op: "Render Image", args: ["Base64"] }],
},
{
name: "Extract EXIF: nothing",
@ -59,7 +62,8 @@ TestRegister.addTests([
{
name: "Extract EXIF: hello world text (error)",
input: "hello world",
expectedOutput: "Could not extract EXIF data from image: Error: Invalid JPEG section offset",
expectedOutput:
"Could not extract EXIF data from image: Error: Invalid JPEG section offset",
recipeConfig: [
{
op: "Extract EXIF",
@ -105,7 +109,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Extract EXIF",
@ -120,7 +124,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Extract EXIF",
@ -131,7 +135,8 @@ TestRegister.addTests([
{
name: "Remove EXIF: hello world text (error)",
input: "hello world",
expectedOutput: "Could not remove EXIF data from image: Given data is not jpeg.",
expectedOutput:
"Could not remove EXIF data from image: Given data is not jpeg.",
recipeConfig: [
{
op: "Remove EXIF",
@ -146,7 +151,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Remove EXIF",
@ -165,7 +170,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Remove EXIF",
@ -180,74 +185,78 @@ TestRegister.addTests([
{
name: "Extract RGBA",
input: "424d460400000000000036040000280000000400000004000000010008000000000010000000120b0000120b0000000100000001000000c8000000cf000000d7000000df000000e7000000ef000000f7000000ff000083000000ac000000d5000000ff000000000083000000ac000000d5000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f070d05030b01090c040e060008020a",
expectedOutput: "0 200 0 0 0 131 0 215 0 0 0 213 131 0 0 0 231 0 213 0 0 0 247 0 0 223 0 0 0 255 0 207 0 0 0 172 255 0 0 0 255 0 172 0 0 0 239 0",
expectedOutput:
"0 200 0 0 0 131 0 215 0 0 0 213 131 0 0 0 231 0 213 0 0 0 247 0 0 223 0 0 0 255 0 207 0 0 0 172 255 0 0 0 255 0 172 0 0 0 239 0",
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Extract RGBA",
args: [" ", false]
}
]
args: [" ", false],
},
],
},
{
name: "Extract LSB",
input: PNG_HEX,
expectedOutput: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000208000000000000000000008000000000000000000000000248000000200240000000208908000000200240000000200821000000200240000000061249000000240000000000209b69000001a49b00000000a204a1200001a49b00000009800414000001a49b0000000035db6c00000094924000000086dffc20000df6dec8000001e10014a0000df6dec800002564924b00000df6dec80000009a6db20000007edb4124804177fffba0002fffff69249044e0924bc4002fffff6924905fb2db6d04002fffff692490416d2490040001bfffcc92030dbffffdc00037fffffdb6d302c6db6d700037fffffdb6d327eb6db6148037fffffdb6d30db4000014800dffffeb6d9aefffffff640",
expectedOutput:
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000208000000000000000000008000000000000000000000000248000000200240000000208908000000200240000000200821000000200240000000061249000000240000000000209b69000001a49b00000000a204a1200001a49b00000009800414000001a49b0000000035db6c00000094924000000086dffc20000df6dec8000001e10014a0000df6dec800002564924b00000df6dec80000009a6db20000007edb4124804177fffba0002fffff69249044e0924bc4002fffff6924905fb2db6d04002fffff692490416d2490040001bfffcc92030dbffffdc00037fffffdb6d302c6db6d700037fffffdb6d327eb6db6148037fffffdb6d30db4000014800dffffeb6d9aefffffff640",
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Extract LSB",
args: ["B", "G", "A", "", "Column", 2]
args: ["B", "G", "A", "", "Column", 2],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
{
name: "View Bit Plane",
input: PNG_HEX,
expectedOutput: "89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af400000140494441547801c5c1416ea3400000c1ee11ffff726fe6808410186ce26c95fde0432a154f0cdea4b2aa505151519954ee1a5c50995454aea8ac54ae2c5ca8982a3ea132551c199c507942e58ec1898adf50f1cae084ca15952b2a152a47067f40a5e2c8e00f54a81c199ca8b85271a542a5e2c8e005159527542ace0c5ea8a8f844c54ae5ccc217555c197c41c55d83ff6cf0052a772ddca052b1a752b1a772d7c2432a4f2c3c50f1d4c20b2a1593ca918a4965afe2cac29b2a562a93ca56c55d0b2754b62a269555c554b15251a9b8637040e5884ac54a654ba5a2624be5cce040c5918a55c55ec5a4a232a9549c197c48655239523155bc3278a862af624be5ccc2072aaea854a8549c5978834a85ca5ec5918a57ec076f50a958a9546ca94c1557ec071754a68a2d958a270637544c2a2abf69e1a68a95ca54b152a978d73f2e08bd57b6f839a00000000049454e44ae426082",
expectedOutput:
"89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af400000140494441547801c5c1416ea3400000c1ee11ffff726fe6808410186ce26c95fde0432a154f0cdea4b2aa505151519954ee1a5c50995454aea8ac54ae2c5ca8982a3ea132551c199c507942e58ec1898adf50f1cae084ca15952b2a152a47067f40a5e2c8e00f54a81c199ca8b85271a542a5e2c8e005159527542ace0c5ea8a8f844c54ae5ccc217555c197c41c55d83ff6cf0052a772ddca052b1a752b1a772d7c2432a4f2c3c50f1d4c20b2a1593ca918a4965afe2cac29b2a562a93ca56c55d0b2754b62a269555c554b15251a9b8637040e5884ac54a654ba5a2624be5cce040c5918a55c55ec5a4a232a9549c197c48655239523155bc3278a862af624be5ccc2072aaea854a8549c5978834a85ca5ec5918a57ec076f50a958a9546ca94c1557ec071754a68a2d958a270637544c2a2abf69e1a68a95ca54b152a978d73f2e08bd57b6f839a00000000049454e44ae426082",
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "View Bit Plane",
args: ["Green", 3]
args: ["Green", 3],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
{
name: "Randomize Colour Palette",
"input": PNG_HEX,
expectedOutput: "89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af4000004f3494441547801c5c10b50cf0700c0f16fbfff8f0ae5f157ed9f1e446358ab28b3913f29b3f89f65deab9859c624cafbf557b6eb3662799c8a285c541479ed3c125d2d2cba52e45d4da8bc66b99d1ebbff6ddd75ddeff7efef75fb7c8c5cb5b10dbc869ccbd1ac4f0c67dfc55cba1f9ec32dd303bc0e854aadd1f20ace5f29e1c9346b4c3982aada03b3285b540f4b099f664ca5720321a34c582466b2f38f3e1842a1526bb4e811efe64a56403a465dc270a998cb517b47e62f7842870b6aaabc5b519627a253784e606a8e25470fbbe358a0c2fd692f9c9668b8bda084e77d5f2247448f790f42a9b9da915d415a6020508a3e49e207e8ec7961cb9594545657e5e26e0fdaf9df5014998a141119f16eae24b4db84f7d775bc8e3e3e9e24f12fabaccf282210292232ce6a5e12dab58e37656be7cf8893916498d72345404681d7365ae217b18b969495261019998f8569145204e47c3e99b7a58f8f278fa76e478a808c522f23de165b3b7f3aee9c8e14011956e9b6841c29419f5d8bfd6889ad9d3fc1c9c654be08428a808cfc9a0c02e7d711973a823751569ac0c79dd72347408fb9ee3d102f4c616d9c82579596dd8df1b5c58caf2d26625d2fe488b420b16c129e3d7825534ccbb01a3881f0803354adba49c5853ce488bc037ba66b48c93586e20298885e02ff338177c0a1ed600c256200973699b0f130cd9dafcd20c87a3bcd9d29d90b1462081103c4d444d1bee2139aab9b7c87ec50479adbd47f13a0c610227a94af8a6565ce118ce72dc1618d3b4ded6f678465840dd905bd519f3e455305e67eb4f1db8ed94fdeb444448f0dbb94740bcec029db9fa636fc99cbf176a708b9e44198af3573469b323cb992469694b031bd133b2a955cb2a8461f0119a3b6f810fcac81619ea1c42cbf43a3711393d8727b1ee37ad6a263b1388cc8a872264cc8a7d1c97116d407ede1ab9c44ac3de610e5f32372142ab5468b84d091d984d79a90147e8dfb8322e8bcf71cdf370ce07ae6158606ee479c164c8794ddf88f76664c5d3d96579ee171db85d9917524b996102e2e65d882753c4c28e690714f9e3ffa1b2902122a0e6571a3c8864657b304ee2e4d6579e1038e0879cc0c716765c67ec2ee1d63cbaa9154db0760ffcc8e0fd7f643d3ba9c31ce69fc3c68124507bae060eb8379dc45e4884850aa4730ca2e97e68a572ca178055c7ff411cb56c4002bf86ef6717c53f94f3c3a4ff72590d6fa09ef134ae0a983ec1efc2b720424fc55b8107dbea8fe81134ecee8687c4d68ae62de45bc636ad099782b126b8f39c81190b0f292127d5295cb98f2b415aa2a055dcb2fb035b081a686f48ee5f4d37ee80c9d91498855007204240cc9ea89efeabec871ec5443c381b1980c9a4f456d1233a38d68ce667c2ee7c2927019e1ce8bb84ce48848f832d10bb1f50dd6540d03d268d4677d39ed1d52514407d3b6d8830327dc49b0984574507b3a3b0573fb5806f762afa37379790e7783ab0849ee0f66fd91a350a9355a24d4bb754239ca02df597598d52dc5c2bb339503cde95213cff3a089240d7f48fd522f9c943eec1db088e53b0412631ea193dec188e4b3a7d9d6eb535a62e4aa8d6da005bfe4d9125de082dbcd6f69ca6ecc66c2166ca329eb198ee4bf5780a5ba3b861030c05cd732eea4acc3c42106671f0d52ac6738727064325b8ff5c752dd1d4329546a8d1603bc2c51f2bbf3356eae2c64b379374c964561b5f53c36d65e14fd3683c7f7179232d686bdf9777915ff00ec08ae8ecb66a3370000000049454e44ae426082",
input: PNG_HEX,
expectedOutput:
"89504e470d0a1a0a0000000d4948445200000020000000200806000000737a7af4000004f3494441547801c5c10b50cf0700c0f16fbfff8f0ae5f157ed9f1e446358ab28b3913f29b3f89f65deab9859c624cafbf557b6eb3662799c8a285c541479ed3c125d2d2cba52e45d4da8bc66b99d1ebbff6ddd75ddeff7efef75fb7c8c5cb5b10dbc869ccbd1ac4f0c67dfc55cba1f9ec32dd303bc0e854aadd1f20ace5f29e1c9346b4c3982aada03b3285b540f4b099f664ca5720321a34c582466b2f38f3e1842a1526bb4e811efe64a56403a465dc270a998cb517b47e62f7842870b6aaabc5b519627a253784e606a8e25470fbbe358a0c2fd692f9c9668b8bda084e77d5f2247448f790f42a9b9da915d415a6020508a3e49e207e8ec7961cb9594545657e5e26e0fdaf9df5014998a141119f16eae24b4db84f7d775bc8e3e3e9e24f12fabaccf282210292232ce6a5e12dab58e37656be7cf8893916498d72345404681d7365ae217b18b969495261019998f8569145204e47c3e99b7a58f8f278fa76e478a808c522f23de165b3b7f3aee9c8e14011956e9b6841c29419f5d8bfd6889ad9d3fc1c9c654be08428a808cfc9a0c02e7d711973a823751569ac0c79dd72347408fb9ee3d102f4c616d9c82579596dd8df1b5c58caf2d26625d2fe488b420b16c129e3d7825534ccbb01a3881f0803354adba49c5853ce488bc037ba66b48c93586e20298885e02ff338177c0a1ed600c256200973699b0f130cd9dafcd20c87a3bcd9d29d90b1462081103c4d444d1bee2139aab9b7c87ec50479adbd47f13a0c610227a94af8a6565ce118ce72dc1618d3b4ded6f678465840dd905bd519f3e455305e67eb4f1db8ed94fdeb444448f0dbb94740bcec029db9fa636fc99cbf176a708b9e44198af3573469b323cb992469694b031bd133b2a955cb2a8461f0119a3b6f810fcac81619ea1c42cbf43a3711393d8727b1ee37ad6a263b1388cc8a872264cc8a7d1c97116d407ede1ab9c44ac3de610e5f32372142ab5468b84d091d984d79a90147e8dfb8322e8bcf71cdf370ce07ae6158606ee479c164c8794ddf88f76664c5d3d96579ee171db85d9917524b996102e2e65d882753c4c28e690714f9e3ffa1b2902122a0e6571a3c8864657b304ee2e4d6579e1038e0879cc0c716765c67ec2ee1d63cbaa9154db0760ffcc8e0fd7f643d3ba9c31ce69fc3c68124507bae060eb8379dc45e4884850aa4730ca2e97e68a572ca178055c7ff411cb56c4002bf86ef6717c53f94f3c3a4ff72590d6fa09ef134ae0a983ec1efc2b720424fc55b8107dbea8fe81134ecee8687c4d68ae62de45bc636ad099782b126b8f39c81190b0f292127d5295cb98f2b415aa2a055dcb2fb035b081a686f48ee5f4d37ee80c9d91498855007204240cc9ea89efeabec871ec5443c381b1980c9a4f456d1233a38d68ce667c2ee7c2927019e1ce8bb84ce48848f832d10bb1f50dd6540d03d268d4677d39ed1d52514407d3b6d8830327dc49b0984574507b3a3b0573fb5806f762afa37379790e7783ab0849ee0f66fd91a350a9355a24d4bb754239ca02df597598d52dc5c2bb339503cde95213cff3a089240d7f48fd522f9c943eec1db088e53b0412631ea193dec188e4b3a7d9d6eb535a62e4aa8d6da005bfe4d9125de082dbcd6f69ca6ecc66c2166ca329eb198ee4bf5780a5ba3b861030c05cd732eea4acc3c42106671f0d52ac6738727064325b8ff5c752dd1d4329546a8d1603bc2c51f2bbf3356eae2c64b379374c964561b5f53c36d65e14fd3683c7f7179232d686bdf9777915ff00ec08ae8ecb66a3370000000049454e44ae426082",
recipeConfig: [
{
op: "From Hex",
args: ["None"]
args: ["None"],
},
{
op: "Randomize Colour Palette",
args: ["myseed"]
args: ["myseed"],
},
{
op: "To Hex",
args: ["None"]
}
]
args: ["None"],
},
],
},
/* { This operation only works in a browser
name: "Optical Character Recognition",

View file

@ -11,11 +11,12 @@ TestRegister.addTests([
{
name: "Index of Coincidence",
input: "Hello world, this is a test to determine the correct IC value.",
expectedMatch: /^Index of Coincidence: 0\.07142857142857142\nNormalized: 1\.857142857142857/,
expectedMatch:
/^Index of Coincidence: 0\.07142857142857142\nNormalized: 1\.857142857142857/,
recipeConfig: [
{
"op": "Index of Coincidence",
"args": []
op: "Index of Coincidence",
args: [],
},
],
},

View file

@ -14,9 +14,9 @@ TestRegister.addTests([
expectedOutput: "503053a0c5b2bd9b9334bf7f3d3b8852",
recipeConfig: [
{
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3 Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
{
@ -25,9 +25,9 @@ TestRegister.addTests([
expectedOutput: "a314eb64cee6cb832aaaa372c8295bab",
recipeConfig: [
{
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3 Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
{
@ -36,9 +36,9 @@ TestRegister.addTests([
expectedOutput: "c1a36e1a870786cc75edddc0009eaf3a",
recipeConfig: [
{
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3 Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
{
@ -47,9 +47,9 @@ TestRegister.addTests([
expectedOutput: "4826a90ec2daf4f7b4b64cc1c8bd343b",
recipeConfig: [
{
"op": "JA3 Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3 Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
]);

View file

@ -14,9 +14,9 @@ TestRegister.addTests([
expectedOutput: "bed95e1b525d2f41db3a6d68fac5b566",
recipeConfig: [
{
"op": "JA3S Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3S Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
{
@ -25,9 +25,9 @@ TestRegister.addTests([
expectedOutput: "130fac2dc19b142500acb0abc63b6379",
recipeConfig: [
{
"op": "JA3S Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3S Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
{
@ -36,9 +36,9 @@ TestRegister.addTests([
expectedOutput: "ccc514751b175866924439bdbb5bba34",
recipeConfig: [
{
"op": "JA3S Fingerprint",
"args": ["Hex", "Hash digest"]
}
op: "JA3S Fingerprint",
args: ["Hex", "Hash digest"],
},
],
},
// This Server Hello was based on draft 18 of the TLS1.3 spec which does not include a Session ID field, leading it to fail.

View file

@ -33,8 +33,8 @@ TestRegister.addTests([
},
{
name: "JSON Beautify: space, string",
input: "\"string\"",
expectedOutput: "\"string\"",
input: '"string"',
expectedOutput: '"string"',
recipeConfig: [
{
op: "JSON Beautify",
@ -42,8 +42,8 @@ TestRegister.addTests([
},
{
op: "HTML To Text",
args: []
}
args: [],
},
],
},
{
@ -92,8 +92,8 @@ TestRegister.addTests([
},
{
name: "JSON Beautify: space, object",
input: "{\"second\":2,\"first\":3}",
expectedOutput: "{\n \"second\": 2,\n \"first\": 3\n}",
input: '{"second":2,"first":3}',
expectedOutput: '{\n "second": 2,\n "first": 3\n}',
recipeConfig: [
{
op: "JSON Beautify",
@ -101,14 +101,15 @@ TestRegister.addTests([
},
{
op: "HTML To Text",
args: []
}
args: [],
},
],
},
{
name: "JSON Beautify: tab, nested",
input: "[2,{\"second\":2,\"first\":3,\"beginning\":{\"j\":\"3\",\"i\":[2,3,false]}},1,2,3]",
expectedOutput: "[\n\t2,\n\t{\n\t\t\"second\": 2,\n\t\t\"first\": 3,\n\t\t\"beginning\": {\n\t\t\t\"j\": \"3\",\n\t\t\t\"i\": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]",
input: '[2,{"second":2,"first":3,"beginning":{"j":"3","i":[2,3,false]}},1,2,3]',
expectedOutput:
'[\n\t2,\n\t{\n\t\t"second": 2,\n\t\t"first": 3,\n\t\t"beginning": {\n\t\t\t"j": "3",\n\t\t\t"i": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]',
recipeConfig: [
{
op: "JSON Beautify",
@ -116,14 +117,15 @@ TestRegister.addTests([
},
{
op: "HTML To Text",
args: []
}
args: [],
},
],
},
{
name: "JSON Beautify: tab, nested, sorted",
input: "[2,{\"second\":2,\"first\":3,\"beginning\":{\"j\":\"3\",\"i\":[2,3,false]}},1,2,3]",
expectedOutput: "[\n\t2,\n\t{\n\t\t\"beginning\": {\n\t\t\t\"i\": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t],\n\t\t\t\"j\": \"3\"\n\t\t},\n\t\t\"first\": 3,\n\t\t\"second\": 2\n\t},\n\t1,\n\t2,\n\t3\n]",
input: '[2,{"second":2,"first":3,"beginning":{"j":"3","i":[2,3,false]}},1,2,3]',
expectedOutput:
'[\n\t2,\n\t{\n\t\t"beginning": {\n\t\t\t"i": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t],\n\t\t\t"j": "3"\n\t\t},\n\t\t"first": 3,\n\t\t"second": 2\n\t},\n\t1,\n\t2,\n\t3\n]',
recipeConfig: [
{
op: "JSON Beautify",
@ -131,8 +133,8 @@ TestRegister.addTests([
},
{
op: "HTML To Text",
args: []
}
args: [],
},
],
},
]);

View file

@ -44,8 +44,8 @@ TestRegister.addTests([
},
{
name: "JSON Minify: string",
input: "\"string\"",
expectedOutput: "\"string\"",
input: '"string"',
expectedOutput: '"string"',
recipeConfig: [
{
op: "JSON Minify",
@ -88,8 +88,8 @@ TestRegister.addTests([
},
{
name: "JSON Minify: object",
input: "{\n \"second\": 2,\n \"first\": 3\n}",
expectedOutput: "{\"second\":2,\"first\":3}",
input: '{\n "second": 2,\n "first": 3\n}',
expectedOutput: '{"second":2,"first":3}',
recipeConfig: [
{
op: "JSON Minify",
@ -99,8 +99,9 @@ TestRegister.addTests([
},
{
name: "JSON Minify: tab, nested",
input: "[\n\t2,\n\t{\n\t\t\"second\": 2,\n\t\t\"first\": 3,\n\t\t\"beginning\": {\n\t\t\t\"j\": \"3\",\n\t\t\t\"i\": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]",
expectedOutput: "[2,{\"second\":2,\"first\":3,\"beginning\":{\"j\":\"3\",\"i\":[2,3,false]}},1,2,3]",
input: '[\n\t2,\n\t{\n\t\t"second": 2,\n\t\t"first": 3,\n\t\t"beginning": {\n\t\t\t"j": "3",\n\t\t\t"i": [\n\t\t\t\t2,\n\t\t\t\t3,\n\t\t\t\tfalse\n\t\t\t]\n\t\t}\n\t},\n\t1,\n\t2,\n\t3\n]',
expectedOutput:
'[2,{"second":2,"first":3,"beginning":{"j":"3","i":[2,3,false]}},1,2,3]',
recipeConfig: [
{
op: "JSON Minify",

View file

@ -15,67 +15,70 @@ const EXPECTED_CSV_EMPTY = "\r\n\r\n";
TestRegister.addTests([
{
name: "JSON to CSV: strings as values",
input: JSON.stringify({a: "1", b: "2", c: "3"}),
input: JSON.stringify({ a: "1", b: "2", c: "3" }),
expectedOutput: EXPECTED_CSV_SINGLE,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: numbers as values",
input: JSON.stringify({a: 1, b: 2, c: 3}),
input: JSON.stringify({ a: 1, b: 2, c: 3 }),
expectedOutput: EXPECTED_CSV_SINGLE,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: numbers and strings as values",
input: JSON.stringify({a: 1, b: "2", c: 3}),
input: JSON.stringify({ a: 1, b: "2", c: 3 }),
expectedOutput: EXPECTED_CSV_SINGLE,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: boolean and null as values",
input: JSON.stringify({a: false, b: null, c: 3}),
input: JSON.stringify({ a: false, b: null, c: 3 }),
expectedOutput: "a,b,c\r\nfalse,null,3\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: JSON as an array",
input: JSON.stringify([{a: 1, b: "2", c: 3}]),
input: JSON.stringify([{ a: 1, b: "2", c: 3 }]),
expectedOutput: EXPECTED_CSV_SINGLE,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: multiple JSON values in an array",
input: JSON.stringify([{a: 1, b: "2", c: 3}, {a: 1, b: "2", c: 3}]),
input: JSON.stringify([
{ a: 1, b: "2", c: 3 },
{ a: 1, b: "2", c: 3 },
]),
expectedOutput: EXPECTED_CSV_MULTIPLE,
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
@ -86,7 +89,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
@ -97,74 +100,74 @@ TestRegister.addTests([
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: nested JSON",
input: JSON.stringify({a: 1, b: {c: 2, d: 3}}),
input: JSON.stringify({ a: 1, b: { c: 2, d: 3 } }),
expectedOutput: "a,b.c,b.d\r\n1,2,3\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: nested array",
input: JSON.stringify({a: 1, b: [2, 3]}),
input: JSON.stringify({ a: 1, b: [2, 3] }),
expectedOutput: "a,b.0,b.1\r\n1,2,3\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: nested JSON, nested array",
input: JSON.stringify({a: 1, b: {c: [2, 3], d: 4}}),
input: JSON.stringify({ a: 1, b: { c: [2, 3], d: 4 } }),
expectedOutput: "a,b.c.0,b.c.1,b.d\r\n1,2,3,4\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: nested array, nested JSON",
input: JSON.stringify({a: 1, b: [{c: 3, d: 4}]}),
input: JSON.stringify({ a: 1, b: [{ c: 3, d: 4 }] }),
expectedOutput: "a,b.0.c,b.0.d\r\n1,3,4\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: nested array, nested array",
input: JSON.stringify({a: 1, b: [[2, 3]]}),
input: JSON.stringify({ a: 1, b: [[2, 3]] }),
expectedOutput: "a,b.0.0,b.0.1\r\n1,2,3\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
},
{
name: "JSON to CSV: nested JSON, nested JSON",
input: JSON.stringify({a: 1, b: { c: { d: 2, e: 3}}}),
input: JSON.stringify({ a: 1, b: { c: { d: 2, e: 3 } } }),
expectedOutput: "a,b.c.d,b.c.e\r\n1,2,3\r\n",
recipeConfig: [
{
op: "JSON to CSV",
args: [",", "\\r\\n"]
args: [",", "\\r\\n"],
},
],
}
},
]);

View file

@ -8,11 +8,15 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
const outputObject = JSON.stringify({
String: "SomeString",
Number: 42,
iat: 1
}, null, 4);
const outputObject = JSON.stringify(
{
String: "SomeString",
Number: 42,
iat: 1,
},
null,
4,
);
TestRegister.addTests([
{
@ -23,7 +27,7 @@ TestRegister.addTests([
{
op: "JWT Decode",
args: [],
}
},
],
},
{
@ -34,7 +38,7 @@ TestRegister.addTests([
{
op: "JWT Decode",
args: [],
}
},
],
},
{
@ -45,7 +49,7 @@ TestRegister.addTests([
{
op: "JWT Decode",
args: [],
}
},
],
}
},
]);

View file

@ -8,11 +8,15 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
const inputObject = JSON.stringify({
String: "SomeString",
Number: 42,
iat: 1
}, null, 4);
const inputObject = JSON.stringify(
{
String: "SomeString",
Number: 42,
iat: 1,
},
null,
4,
);
const hsKey = "secret_cat";
const rsKey = `-----BEGIN RSA PRIVATE KEY-----
@ -40,34 +44,37 @@ TestRegister.addTests([
{
name: "JWT Sign: HS256",
input: inputObject,
expectedOutput: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
expectedOutput:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk",
recipeConfig: [
{
op: "JWT Sign",
args: [hsKey, "HS256"],
}
},
],
},
{
name: "JWT Sign: HS384",
input: inputObject,
expectedOutput: "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ._bPK-Y3mIACConbJqkGFMQ_L3vbxgKXy9gSxtL9hA5XTganozTSXxD0vX0N1yT5s",
expectedOutput:
"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ._bPK-Y3mIACConbJqkGFMQ_L3vbxgKXy9gSxtL9hA5XTganozTSXxD0vX0N1yT5s",
recipeConfig: [
{
op: "JWT Sign",
args: [hsKey, "HS384"],
}
},
],
},
{
name: "JWT Sign: HS512",
input: inputObject,
expectedOutput: "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.vZIJU4XYMFt3FLE1V_RZOxEetmV4RvxtPZQGzJthK_d47pjwlEb6pQE23YxHFmOj8H5RLEdqqLPw4jNsOyHRzA",
expectedOutput:
"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.vZIJU4XYMFt3FLE1V_RZOxEetmV4RvxtPZQGzJthK_d47pjwlEb6pQE23YxHFmOj8H5RLEdqqLPw4jNsOyHRzA",
recipeConfig: [
{
op: "JWT Sign",
args: [hsKey, "HS512"],
}
},
],
},
{
@ -81,8 +88,8 @@ TestRegister.addTests([
},
{
op: "JWT Decode",
args: []
}
args: [],
},
],
},
{
@ -96,8 +103,8 @@ TestRegister.addTests([
},
{
op: "JWT Decode",
args: []
}
args: [],
},
],
},
{
@ -111,8 +118,8 @@ TestRegister.addTests([
},
{
op: "JWT Decode",
args: []
}
args: [],
},
],
},
{
@ -126,8 +133,8 @@ TestRegister.addTests([
},
{
op: "JWT Decode",
args: []
}
args: [],
},
],
},
{
@ -141,8 +148,8 @@ TestRegister.addTests([
},
{
op: "JWT Decode",
args: []
}
args: [],
},
],
},
{
@ -156,8 +163,8 @@ TestRegister.addTests([
},
{
op: "JWT Decode",
args: []
}
args: [],
},
],
}
},
]);

View file

@ -8,11 +8,15 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
const outputObject = JSON.stringify({
String: "SomeString",
Number: 42,
iat: 1
}, null, 4);
const outputObject = JSON.stringify(
{
String: "SomeString",
Number: 42,
iat: 1,
},
null,
4,
);
const hsKey = "secret_cat";
/* Retaining private key as a comment
@ -59,7 +63,7 @@ TestRegister.addTests([
{
op: "JWT Verify",
args: [hsKey],
}
},
],
},
{
@ -70,7 +74,7 @@ TestRegister.addTests([
{
op: "JWT Verify",
args: [rsPub],
}
},
],
},
{
@ -81,7 +85,7 @@ TestRegister.addTests([
{
op: "JWT Verify",
args: [esPub],
}
},
],
}
},
]);

View file

@ -11,12 +11,8 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Jump: Empty Label",
input: [
"should be changed",
].join("\n"),
expectedOutput: [
"c2hvdWxkIGJlIGNoYW5nZWQ=",
].join("\n"),
input: ["should be changed"].join("\n"),
expectedOutput: ["c2hvdWxkIGJlIGNoYW5nZWQ="].join("\n"),
recipeConfig: [
{
op: "Jump",
@ -30,12 +26,8 @@ TestRegister.addTests([
},
{
name: "Jump: skips 1",
input: [
"shouldnt be changed",
].join("\n"),
expectedOutput: [
"shouldnt be changed",
].join("\n"),
input: ["shouldnt be changed"].join("\n"),
expectedOutput: ["shouldnt be changed"].join("\n"),
recipeConfig: [
{
op: "Jump",
@ -47,8 +39,8 @@ TestRegister.addTests([
},
{
op: "Label",
args: ["skipReplace"]
args: ["skipReplace"],
},
],
}
},
]);

View file

@ -41,5 +41,5 @@ TestRegister.addTests([
args: ["Helloworld", 0, "test"],
},
],
}
},
]);

View file

@ -15,8 +15,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "LZNT1 Decompress",
args: []
}
args: [],
},
],
}
},
]);

View file

@ -14,9 +14,9 @@ TestRegister.addTests([
expectedOutput: "BYUwNmD2AEDukCcwBMg=",
recipeConfig: [
{
"op": "LZString Compress",
"args": ["Base64"]
}
op: "LZString Compress",
args: ["Base64"],
},
],
},
{
@ -25,9 +25,9 @@ TestRegister.addTests([
expectedOutput: "hello world",
recipeConfig: [
{
"op": "LZString Decompress",
"args": ["Base64"]
}
op: "LZString Decompress",
args: ["Base64"],
},
],
}
},
]);

View file

@ -7,158 +7,136 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
"name": "Levenshtein Distance: Wikipedia example 1",
"input": "kitten\nsitting",
"expectedOutput": "3",
"recipeConfig": [
name: "Levenshtein Distance: Wikipedia example 1",
input: "kitten\nsitting",
expectedOutput: "3",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
op: "Levenshtein Distance",
args: ["\\n", 1, 1, 1],
},
],
},
{
"name": "Levenshtein Distance: Wikipedia example 2",
"input": "saturday\nsunday",
"expectedOutput": "3",
"recipeConfig": [
name: "Levenshtein Distance: Wikipedia example 2",
input: "saturday\nsunday",
expectedOutput: "3",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
op: "Levenshtein Distance",
args: ["\\n", 1, 1, 1],
},
],
},
{
"name": "Levenshtein Distance: Wikipedia example 1 with substitution cost 2",
"input": "kitten\nsitting",
"expectedOutput": "5",
"recipeConfig": [
name: "Levenshtein Distance: Wikipedia example 1 with substitution cost 2",
input: "kitten\nsitting",
expectedOutput: "5",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 2,
],
op: "Levenshtein Distance",
args: ["\\n", 1, 1, 2],
},
],
},
{
"name": "Levenshtein Distance: varied costs 1",
"input": "kitten\nsitting",
"expectedOutput": "230",
"recipeConfig": [
name: "Levenshtein Distance: varied costs 1",
input: "kitten\nsitting",
expectedOutput: "230",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 10, 100, 1000,
],
op: "Levenshtein Distance",
args: ["\\n", 10, 100, 1000],
},
],
},
{
"name": "Levenshtein Distance: varied costs 2",
"input": "kitten\nsitting",
"expectedOutput": "1020",
"recipeConfig": [
name: "Levenshtein Distance: varied costs 2",
input: "kitten\nsitting",
expectedOutput: "1020",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1000, 100, 10,
],
op: "Levenshtein Distance",
args: ["\\n", 1000, 100, 10],
},
],
},
{
"name": "Levenshtein Distance: another delimiter",
"input": "kitten sitting",
"expectedOutput": "3",
"recipeConfig": [
name: "Levenshtein Distance: another delimiter",
input: "kitten sitting",
expectedOutput: "3",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
" ", 1, 1, 1,
],
op: "Levenshtein Distance",
args: [" ", 1, 1, 1],
},
],
},
{
"name": "Levenshtein Distance: too few samples",
"input": "kitten",
"expectedOutput": "Incorrect number of samples. Check your input and/or delimiter.",
"recipeConfig": [
name: "Levenshtein Distance: too few samples",
input: "kitten",
expectedOutput:
"Incorrect number of samples. Check your input and/or delimiter.",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
op: "Levenshtein Distance",
args: ["\\n", 1, 1, 1],
},
],
},
{
"name": "Levenshtein Distance: too many samples",
"input": "kitten\nsitting\nkitchen",
"expectedOutput": "Incorrect number of samples. Check your input and/or delimiter.",
"recipeConfig": [
name: "Levenshtein Distance: too many samples",
input: "kitten\nsitting\nkitchen",
expectedOutput:
"Incorrect number of samples. Check your input and/or delimiter.",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, 1,
],
op: "Levenshtein Distance",
args: ["\\n", 1, 1, 1],
},
],
},
{
"name": "Levenshtein Distance: negative insertion cost",
"input": "kitten\nsitting",
"expectedOutput": "Negative costs are not allowed.",
"recipeConfig": [
name: "Levenshtein Distance: negative insertion cost",
input: "kitten\nsitting",
expectedOutput: "Negative costs are not allowed.",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", -1, 1, 1,
],
op: "Levenshtein Distance",
args: ["\\n", -1, 1, 1],
},
],
},
{
"name": "Levenshtein Distance: negative deletion cost",
"input": "kitten\nsitting",
"expectedOutput": "Negative costs are not allowed.",
"recipeConfig": [
name: "Levenshtein Distance: negative deletion cost",
input: "kitten\nsitting",
expectedOutput: "Negative costs are not allowed.",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, -1, 1,
],
op: "Levenshtein Distance",
args: ["\\n", 1, -1, 1],
},
],
},
{
"name": "Levenshtein Distance: negative substitution cost",
"input": "kitten\nsitting",
"expectedOutput": "Negative costs are not allowed.",
"recipeConfig": [
name: "Levenshtein Distance: negative substitution cost",
input: "kitten\nsitting",
expectedOutput: "Negative costs are not allowed.",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 1, 1, -1,
],
op: "Levenshtein Distance",
args: ["\\n", 1, 1, -1],
},
],
},
{
"name": "Levenshtein Distance: cost zero",
"input": "kitten\nsitting",
"expectedOutput": "0",
"recipeConfig": [
name: "Levenshtein Distance: cost zero",
input: "kitten\nsitting",
expectedOutput: "0",
recipeConfig: [
{
"op": "Levenshtein Distance",
"args": [
"\\n", 0, 0, 0,
],
op: "Levenshtein Distance",
args: ["\\n", 0, 0, 0],
},
],
},

File diff suppressed because one or more lines are too long

View file

@ -11,33 +11,36 @@ TestRegister.addTests([
{
name: "Luhn Checksum on standard data",
input: "35641709012469",
expectedOutput: "Checksum: 7\nCheckdigit: 0\nLuhn Validated String: 356417090124690",
expectedOutput:
"Checksum: 7\nCheckdigit: 0\nLuhn Validated String: 356417090124690",
recipeConfig: [
{
op: "Luhn Checksum",
args: []
args: [],
},
],
},
{
name: "Luhn Checksum on standard data 2",
input: "896101950123440000",
expectedOutput: "Checksum: 5\nCheckdigit: 1\nLuhn Validated String: 8961019501234400001",
expectedOutput:
"Checksum: 5\nCheckdigit: 1\nLuhn Validated String: 8961019501234400001",
recipeConfig: [
{
op: "Luhn Checksum",
args: []
args: [],
},
],
},
{
name: "Luhn Checksum on standard data 3",
input: "35726908971331",
expectedOutput: "Checksum: 6\nCheckdigit: 7\nLuhn Validated String: 357269089713317",
expectedOutput:
"Checksum: 6\nCheckdigit: 7\nLuhn Validated String: 357269089713317",
recipeConfig: [
{
op: "Luhn Checksum",
args: []
args: [],
},
],
},
@ -48,7 +51,7 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Luhn Checksum",
args: []
args: [],
},
],
},
@ -59,8 +62,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Luhn Checksum",
args: []
args: [],
},
],
}
},
]);

View file

@ -11,11 +11,12 @@ TestRegister.addTests([
{
name: "Microsoft Script Decoder",
input: "#@~^RQAAAA==-mD~sX|:/TP{~J:+dYbxL~@!F@*@!+@*@!&@*eEI@#@&@#@&\x7fjm.raY 214Wv:zms/obI0xEAAA==^#~@",
expectedOutput: "var my_msg = \"Testing <1><2><3>!\";\r\n\r\nWScript.Echo(my_msg);",
expectedOutput:
'var my_msg = "Testing <1><2><3>!";\r\n\r\nWScript.Echo(my_msg);',
recipeConfig: [
{
"op": "Microsoft Script Decoder",
"args": []
op: "Microsoft Script Decoder",
args: [],
},
],
},

View file

@ -13,12 +13,13 @@ TestRegister.addTests([
{
name: "Magic: nothing",
input: "",
expectedOutput: "Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
expectedOutput:
"Nothing of interest could be detected about the input data.\nHave you tried modifying the operation arguments?",
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
@ -28,8 +29,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
@ -39,8 +40,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
@ -50,8 +51,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [1, true, false]
}
args: [1, true, false],
},
],
},
{
@ -61,41 +62,44 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [1, false, true]
}
args: [1, false, true],
},
],
},
{
name: "Magic Chain: Base64",
input: "WkVkV2VtUkRRbnBrU0Vwd1ltMWpQUT09",
expectedMatch: /From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)/,
expectedMatch:
/From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Base64\('A-Za-z0-9\+\/=',true,false\)/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
name: "Magic Chain: Hex -> Hexdump -> Base64",
input: "MDAwMDAwMDAgIDM3IDM0IDIwIDM2IDM1IDIwIDM3IDMzIDIwIDM3IDM0IDIwIDMyIDMwIDIwIDM3ICB8NzQgNjUgNzMgNzQgMjAgN3wKMDAwMDAwMTAgIDMzIDIwIDM3IDM0IDIwIDM3IDMyIDIwIDM2IDM5IDIwIDM2IDY1IDIwIDM2IDM3ICB8MyA3NCA3MiA2OSA2ZSA2N3w=",
expectedMatch: /From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Hexdump\(\)\nFrom_Hex\('Space'\)/,
expectedMatch:
/From_Base64\('A-Za-z0-9\+\/=',true,false\)\nFrom_Hexdump\(\)\nFrom_Hex\('Space'\)/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
name: "Magic Chain: Charcode -> Octal -> Base32",
input: "GY3SANRUEA2DAIBWGYQDMNJAGQYCANRXEA3DGIBUGAQDMNZAGY2CANBQEA3DEIBWGAQDIMBAGY3SANRTEA2DAIBWG4QDMNBAGQYCANRXEA3DEIBUGAQDMNRAG4YSANBQEA3DMIBRGQ2SANBQEA3DMIBWG4======",
expectedMatch: /From_Base32\('A-Z2-7=',false\)\nFrom_Octal\('Space'\)\nFrom_Hex\('Space'\)/,
expectedMatch:
/From_Base32\('A-Z2-7=',false\)\nFrom_Octal\('Space'\)\nFrom_Hex\('Space'\)/,
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
@ -105,8 +109,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
@ -116,20 +120,21 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [3, false, false]
}
args: [3, false, false],
},
],
},
{
name: "Magic: Raw Inflate",
input: "\x4d\x52\xb1\x6e\xdc\x30\x0c\xdd\xf3\x15\x44\x80\x6e\xae\x91\x02\x4d\x80\x8e\x4d\x9a\x21\x53\x8b\xa6\x43\x56\x5a\xe2\x9d\x84\x93\x25\x43\x94\xed\xf8\xef\xf3\xe8\x6b\x0e\xb7\x1c\xce\xd4\x7b\x8f\x8f\x7c\x7c\xda\x06\xa9\x4f\x41\x0e\x14\x95\x98\x34\x8e\x53\x92\x8e\x62\x6e\x73\x6c\x71\x11\x5a\x65\x20\x9e\x26\x3a\x94\x4a\x8e\x6b\xdd\x62\x3e\x52\x99\x1b\x71\x4a\x34\x72\xce\x52\xa9\x1c\xe8\xd6\x99\xd0\x2d\x95\x49\x2a\xb7\x58\xb2\xd2\x1a\x5b\x88\x19\xa2\x26\x31\xd4\xb2\xaa\xd4\x9e\xfe\x05\x51\xb9\x86\xc5\xec\xd2\xec\xe5\x7f\x6b\x92\xec\x8a\xb7\x1e\x29\x9e\x84\xde\x7e\xff\x25\x34\x7e\x64\x95\x87\xef\x1d\x8d\xa5\x0a\xb9\x62\xc0\x77\x43\xd6\x6d\x32\x91\x33\xf6\xe7\xf3\x6b\x47\xbf\x9e\x5f\x89\xb3\xa7\xc7\x54\xd6\x43\xd4\xd0\x91\xab\x82\x4e\x10\x1c\x62\xe6\xba\xed\xaf\x41\xde\xfd\x3c\x4e\x8a\x57\x88\x55\x51\x35\x15\x7b\xf1\x72\x5d\xc1\x60\x9e\x1b\x03\xc6\xc9\xcd\xe9\xac\x13\x58\x31\xc3\x8e\x76\x41\xdc\x49\xe7\x11\x42\x2f\x7f\x96\x87\xbd\xf6\xd6\xdf\xdf\xfd\xa0\x89\xab\x02\x0c\x66\xe0\x7c\x34\x1a\xfe\x54\x76\x0d\xeb\xfa\x1c\x11\x2c\x23\x8c\xb3\x0b\xfb\x64\xfd\xcd\x0d\xb6\x43\xad\x94\x64\x69\x78\xd1\x78\xcc\xe2\x51\x00\x85\x07\x2c\x67\x28\x2d\x50\x13\x17\x72\x84\xa3\x9d\x9d\x4b\xfe\x7a\x5d\xe1\xb4\x69\x53\xe3\x20\x9c\x38\x99\x69\xd9\x87\xc0\xa2\x2f\xab\x5b\x79\x3b\xe7\x63\x41\x06\x5e\xcc\x1f\x18\x5e\x20\x61\xe5\x0b\xd0\xbc\xa8\x25\xc0\xe9\x58\x2a\x5e\x46\xed\xe9\xa5\x41\x40\x81\xc9\x4e\x70\x22\xbe\xbb\x58\xed\x68\x98\x63\xc2\x6d\xc0\x18\x72\xad\x32\x4a\x6e\x38\x94\x8d\x10\x6e\x2d\xc0\xd2\x60\x09\x7c\xfa\x34\x4f\x2d\x48\xac\xf4\xed\xee\x0b\x3e\x72\x59\xf6\xab\xa0\x16\x47\x1c\xc9\x82\x65\xa9\xe0\x17\xb6\x36\xc1\x46\xfb\x0f",
expectedMatch: /#recipe=Raw_Inflate(.|\n)+CyberChef is a simple, intuitive web app for carrying out all manner of /,
expectedMatch:
/#recipe=Raw_Inflate(.|\n)+CyberChef is a simple, intuitive web app for carrying out all manner of /,
recipeConfig: [
{
op: "Magic",
args: [1, false, false]
}
]
args: [1, false, false],
},
],
},
{
name: "Magic: Defang IP Address, valid",
@ -138,9 +143,9 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [1, false, false]
}
]
args: [1, false, false],
},
],
},
{
name: "Magic: Defang IP Address, invalid",
@ -149,8 +154,8 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Magic",
args: [1, false, false]
}
]
}
args: [1, false, false],
},
],
},
]);

File diff suppressed because one or more lines are too long

View file

@ -10,20 +10,23 @@ TestRegister.addTests([
{
name: "Multi-Bombe: 3 rotor",
input: "BBYFLTHHYIJQAYBBYS",
expectedMatch: /<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
expectedMatch:
/<td>LGA<\/td> {2}<td>SS<\/td> {2}<td>VFISUSGTKSTMPSUNAK<\/td>/,
recipeConfig: [
{
"op": "Multiple Bombe",
"args": [
op: "Multiple Bombe",
args: [
// I, II and III
"User defined",
"EKMFLGDQVZNTOWYHXUSPAIBRCJ<R\nAJDKSIRUXBLHWTMCQGZNPYFVOE<F\nBDFHJLCPRTXVZNYEIWGAKMUSQO<W",
"",
"AY BR CU DH EQ FS GL IP JX KN MO TZ VW", // B
"THISISATESTMESSAGE", 0, false
]
}
]
"THISISATESTMESSAGE",
0,
false,
],
},
],
},
/*
* This is too slow to run regularly

View file

@ -73,5 +73,5 @@ TestRegister.addTests([
args: [0, true],
},
],
}
},
]);

View file

@ -30,5 +30,4 @@ TestRegister.addTests([
},
],
},
]);

View file

@ -19,7 +19,8 @@ TestRegister.addTests([
args: ["NFD"],
},
],
}, {
},
{
name: "Normalise Unicode - NFC",
input: "\u00c7\u0043\u0327\u2160",
expectedMatch: /\u00C7\u00C7\u2160/,
@ -29,7 +30,8 @@ TestRegister.addTests([
args: ["NFC"],
},
],
}, {
},
{
name: "Normalise Unicode - NFKD",
input: "\u00c7\u0043\u0327\u2160",
expectedMatch: /C\u0327C\u0327I/,
@ -39,7 +41,8 @@ TestRegister.addTests([
args: ["NFKD"],
},
],
}, {
},
{
name: "Normalise Unicode - NFKC",
input: "\u00c7\u0043\u0327\u2160",
expectedMatch: /\u00C7\u00C7I/,
@ -51,4 +54,3 @@ TestRegister.addTests([
],
},
]);

View file

@ -12,7 +12,8 @@ TestRegister.addTests([
{
name: "Generate HOTP",
input: "12345678901234567890",
expectedOutput: "URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224",
expectedOutput:
"URI: otpauth://hotp/OTPAuthentication?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ\n\nPassword: 755224",
recipeConfig: [
{
op: "Generate HOTP",

View file

@ -137,10 +137,10 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
}
]
op: "PEM to Hex",
args: [],
},
],
},
{
name: "PEMtoHex: No footer",
@ -148,10 +148,10 @@ TestRegister.addTests([
expectedOutput: "PEM footer '-----END RSA PRIVATE KEY-----' not found",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
}
]
op: "PEM to Hex",
args: [],
},
],
},
{
name: "PEMtoHex: Multiple PEMs",
@ -159,14 +159,14 @@ TestRegister.addTests([
expectedOutput: "FOOBAR",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "From Hex",
"args": ["Auto"]
}
]
op: "From Hex",
args: ["Auto"],
},
],
},
{
name: "PEMtoHex: Single line PEM",
@ -174,47 +174,50 @@ TestRegister.addTests([
expectedOutput: "FOO",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "From Hex",
"args": ["None"]
}
]
op: "From Hex",
args: ["None"],
},
],
},
{
name: "PEMtoHex: EC P-256 Private Key",
input: PEMS_EC_P256_PRIVATE_KEY,
expectedOutput: "30770201010420885d43140870c9c21c3dd7e16a8dbfe560c9c5a6168119a5197d5f4f9d4fdb87a00a06082a8648ce3d030107a1440342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7",
expectedOutput:
"30770201010420885d43140870c9c21c3dd7e16a8dbfe560c9c5a6168119a5197d5f4f9d4fdb87a00a06082a8648ce3d030107a1440342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
}
]
op: "PEM to Hex",
args: [],
},
],
},
{
name: "PEMtoHex: EC P-256 Private Key PKCS8",
input: PEMS_EC_P256_PRIVATE_KEY_PKCS8,
expectedOutput: "308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b0201010420885d43140870c9c21c3dd7e16a8dbfe560c9c5a6168119a5197d5f4f9d4fdb87a1440342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7",
expectedOutput:
"308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b0201010420885d43140870c9c21c3dd7e16a8dbfe560c9c5a6168119a5197d5f4f9d4fdb87a1440342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
}
]
op: "PEM to Hex",
args: [],
},
],
},
{
name: "PEMtoHex: EC P-256 Public Key",
input: PEMS_EC_P256_PUBLIC_KEY,
expectedOutput: "3059301306072a8648ce3d020106082a8648ce3d0301070342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7",
expectedOutput:
"3059301306072a8648ce3d020106082a8648ce3d0301070342000414b41c05bcc3c1ea3a69fe24de4d2029630d58e6559fcfbd847dabbf80ca29867b135cfae0b06d3e707580ccfef870cac92af6a330f7ff8e9d21b40c5d464aa7",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
}
]
op: "PEM to Hex",
args: [],
},
],
},
{
name: "PEMtoHex: RSA Private Key PKCS1",
@ -222,14 +225,14 @@ TestRegister.addTests([
expectedOutput: "fb49bd96ffc5d1351a35d773921fac03",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "MD5",
"args": []
}
]
op: "MD5",
args: [],
},
],
},
{
name: "PEMtoHex: RSA Private Key PKCS8",
@ -237,14 +240,14 @@ TestRegister.addTests([
expectedOutput: "23086d03633689fee64680c3c24409eb",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "MD5",
"args": []
}
]
op: "MD5",
args: [],
},
],
},
{
name: "PEMtoHex: RSA Public Key PKCS1",
@ -252,14 +255,14 @@ TestRegister.addTests([
expectedOutput: "5fc3f1f6c5d5806760b12eaad0c0292c",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "MD5",
"args": []
}
]
op: "MD5",
args: [],
},
],
},
{
name: "PEMtoHex: RSA Public Key PKCS8",
@ -267,14 +270,14 @@ TestRegister.addTests([
expectedOutput: "30fbe8e9495d591232affebdd6206ea6",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "MD5",
"args": []
}
]
op: "MD5",
args: [],
},
],
},
{
name: "PEMtoHex: Certificate",
@ -282,13 +285,13 @@ TestRegister.addTests([
expectedOutput: "6694d8ca4a0ceb84c3951d25dc05ec6e",
recipeConfig: [
{
"op": "PEM to Hex",
"args": []
op: "PEM to Hex",
args: [],
},
{
"op": "MD5",
"args": []
}
]
}
op: "MD5",
args: [],
},
],
},
]);

View file

@ -6,7 +6,7 @@
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
import {ASCII_TEXT, UTF8_TEXT, ALL_BYTES} from "../../samples/Ciphers.mjs";
import { ASCII_TEXT, UTF8_TEXT, ALL_BYTES } from "../../samples/Ciphers.mjs";
// RSA-1024
const ALICE_PRIVATE = `-----BEGIN PGP PRIVATE KEY BLOCK-----
@ -151,14 +151,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "PGP Encrypt",
"args": [ALICE_PUBLIC]
op: "PGP Encrypt",
args: [ALICE_PUBLIC],
},
{
"op": "PGP Decrypt",
"args": [ALICE_PRIVATE, ""]
}
]
op: "PGP Decrypt",
args: [ALICE_PRIVATE, ""],
},
],
},
{
name: "PGP Encrypt/Decrypt: RSA, All bytes",
@ -166,14 +166,14 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES,
recipeConfig: [
{
"op": "PGP Encrypt",
"args": [ALICE_PUBLIC]
op: "PGP Encrypt",
args: [ALICE_PUBLIC],
},
{
"op": "PGP Decrypt",
"args": [ALICE_PRIVATE, ""]
}
]
op: "PGP Decrypt",
args: [ALICE_PRIVATE, ""],
},
],
},
{
name: "PGP Encrypt/Decrypt: ECC, nothing",
@ -181,14 +181,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "PGP Encrypt",
"args": [BOB_PUBLIC]
op: "PGP Encrypt",
args: [BOB_PUBLIC],
},
{
"op": "PGP Decrypt",
"args": [BOB_PRIVATE, ""]
}
]
op: "PGP Decrypt",
args: [BOB_PRIVATE, ""],
},
],
},
{
name: "PGP Encrypt/Decrypt: ECC, All bytes",
@ -196,14 +196,14 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES,
recipeConfig: [
{
"op": "PGP Encrypt",
"args": [BOB_PUBLIC]
op: "PGP Encrypt",
args: [BOB_PUBLIC],
},
{
"op": "PGP Decrypt",
"args": [BOB_PRIVATE, ""]
}
]
op: "PGP Decrypt",
args: [BOB_PRIVATE, ""],
},
],
},
{
name: "PGP Decrypt and Verify: UTF8, Alice -> Bob",
@ -232,10 +232,10 @@ Signed on Tue, 29 May 2018 15:44:52 GMT
${UTF8_TEXT}`,
recipeConfig: [
{
"op": "PGP Decrypt and Verify",
"args": [ALICE_PUBLIC, BOB_PRIVATE, ""]
}
]
op: "PGP Decrypt and Verify",
args: [ALICE_PUBLIC, BOB_PRIVATE, ""],
},
],
},
{
name: "PGP Decrypt: ASCII, Alice -> Bob",
@ -255,10 +255,10 @@ H2qMY1O7hezH3fp+EZzCAccJMtK7VPk13WAgMRH22HirG4aK1i75IVOtjBgObzDh
expectedOutput: ASCII_TEXT,
recipeConfig: [
{
"op": "PGP Decrypt",
"args": [ALICE_PRIVATE, ""]
}
]
op: "PGP Decrypt",
args: [ALICE_PRIVATE, ""],
},
],
},
{
name: "PGP Verify: ASCII, Alice",
@ -281,9 +281,9 @@ Signed on Thu, 27 Jun 2019 16:20:15 GMT
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.`,
recipeConfig: [
{
"op": "PGP Verify",
"args": [ALICE_PUBLIC]
}
]
}
op: "PGP Verify",
args: [ALICE_PUBLIC],
},
],
},
]);

View file

@ -34,8 +34,8 @@ TestRegister.addTests([
},
{
name: "PHP Deserialize string",
input: "s:17:\"PHP Serialization\";",
expectedOutput: "\"PHP Serialization\"",
input: 's:17:"PHP Serialization";',
expectedOutput: '"PHP Serialization"',
recipeConfig: [
{
op: "PHP Deserialize",
@ -45,8 +45,8 @@ TestRegister.addTests([
},
{
name: "PHP Deserialize array (JSON)",
input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}",
expectedOutput: "{\"a\": 10,\"0\": {\"ab\": true}}",
input: 'a:2:{s:1:"a";i:10;i:0;a:1:{s:2:"ab";b:1;}}',
expectedOutput: '{"a": 10,"0": {"ab": true}}',
recipeConfig: [
{
op: "PHP Deserialize",
@ -56,8 +56,8 @@ TestRegister.addTests([
},
{
name: "PHP Deserialize array (non-JSON)",
input: "a:2:{s:1:\"a\";i:10;i:0;a:1:{s:2:\"ab\";b:1;}}",
expectedOutput: "{\"a\": 10,0: {\"ab\": true}}",
input: 'a:2:{s:1:"a";i:10;i:0;a:1:{s:2:"ab";b:1;}}',
expectedOutput: '{"a": 10,0: {"ab": true}}',
recipeConfig: [
{
op: "PHP Deserialize",

View file

@ -11,77 +11,84 @@ TestRegister.addTests([
{
name: "Parse IPv4 CIDR",
input: "10.0.0.0/30",
expectedOutput: "Network: 10.0.0.0\nCIDR: 30\nMask: 255.255.255.252\nRange: 10.0.0.0 - 10.0.0.3\nTotal addresses in range: 4\n\n10.0.0.0\n10.0.0.1\n10.0.0.2\n10.0.0.3",
expectedOutput:
"Network: 10.0.0.0\nCIDR: 30\nMask: 255.255.255.252\nRange: 10.0.0.0 - 10.0.0.3\nTotal addresses in range: 4\n\n10.0.0.0\n10.0.0.1\n10.0.0.2\n10.0.0.3",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "Parse IPv4 hyphenated",
input: "10.0.0.0 - 10.0.0.3",
expectedOutput: "Minimum subnet required to hold this range:\n\tNetwork: 10.0.0.0\n\tCIDR: 30\n\tMask: 255.255.255.252\n\tSubnet range: 10.0.0.0 - 10.0.0.3\n\tTotal addresses in subnet: 4\n\nRange: 10.0.0.0 - 10.0.0.3\nTotal addresses in range: 4\n\n10.0.0.0\n10.0.0.1\n10.0.0.2\n10.0.0.3",
expectedOutput:
"Minimum subnet required to hold this range:\n\tNetwork: 10.0.0.0\n\tCIDR: 30\n\tMask: 255.255.255.252\n\tSubnet range: 10.0.0.0 - 10.0.0.3\n\tTotal addresses in subnet: 4\n\nRange: 10.0.0.0 - 10.0.0.3\nTotal addresses in range: 4\n\n10.0.0.0\n10.0.0.1\n10.0.0.2\n10.0.0.3",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "Parse IPv4 list",
input: "10.0.0.8\n10.0.0.5/30\n10.0.0.1\n10.0.0.3",
expectedOutput: "Minimum subnet required to hold this range:\n\tNetwork: 10.0.0.0\n\tCIDR: 28\n\tMask: 255.255.255.240\n\tSubnet range: 10.0.0.0 - 10.0.0.15\n\tTotal addresses in subnet: 16\n\nRange: 10.0.0.1 - 10.0.0.8\nTotal addresses in range: 8\n\n10.0.0.1\n10.0.0.2\n10.0.0.3\n10.0.0.4\n10.0.0.5\n10.0.0.6\n10.0.0.7\n10.0.0.8",
expectedOutput:
"Minimum subnet required to hold this range:\n\tNetwork: 10.0.0.0\n\tCIDR: 28\n\tMask: 255.255.255.240\n\tSubnet range: 10.0.0.0 - 10.0.0.15\n\tTotal addresses in subnet: 16\n\nRange: 10.0.0.1 - 10.0.0.8\nTotal addresses in range: 8\n\n10.0.0.1\n10.0.0.2\n10.0.0.3\n10.0.0.4\n10.0.0.5\n10.0.0.6\n10.0.0.7\n10.0.0.8",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "Parse IPv6 CIDR - full",
input: "2404:6800:4001:0000:0000:0000:0000:0000/48",
expectedOutput: "Network: 2404:6800:4001:0000:0000:0000:0000:0000\nShorthand: 2404:6800:4001::\nCIDR: 48\nMask: ffff:ffff:ffff:0000:0000:0000:0000:0000\nRange: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
expectedOutput:
"Network: 2404:6800:4001:0000:0000:0000:0000:0000\nShorthand: 2404:6800:4001::\nCIDR: 48\nMask: ffff:ffff:ffff:0000:0000:0000:0000:0000\nRange: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "Parse IPv6 CIDR - collapsed",
input: "2404:6800:4001::/48",
expectedOutput: "Network: 2404:6800:4001:0000:0000:0000:0000:0000\nShorthand: 2404:6800:4001::\nCIDR: 48\nMask: ffff:ffff:ffff:0000:0000:0000:0000:0000\nRange: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
expectedOutput:
"Network: 2404:6800:4001:0000:0000:0000:0000:0000\nShorthand: 2404:6800:4001::\nCIDR: 48\nMask: ffff:ffff:ffff:0000:0000:0000:0000:0000\nRange: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "Parse IPv6 hyphenated",
input: "2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff",
expectedOutput: "Range: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nShorthand range: 2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
expectedOutput:
"Range: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nShorthand range: 2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "Parse IPv6 list",
input: "2404:6800:4001:ffff:ffff:ffff:ffff:ffff\n2404:6800:4001::ffff\n2404:6800:4001:ffff:ffff::1111\n2404:6800:4001::/64",
expectedOutput: "Range: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nShorthand range: 2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
expectedOutput:
"Range: 2404:6800:4001:0000:0000:0000:0000:0000 - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nShorthand range: 2404:6800:4001:: - 2404:6800:4001:ffff:ffff:ffff:ffff:ffff\nTotal addresses in range: 1.2089258196146292e+24\n\n",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
@ -91,8 +98,8 @@ TestRegister.addTests([
expectedOutput: "IPv4 CIDR must be less than 32",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
@ -102,8 +109,8 @@ TestRegister.addTests([
expectedOutput: "Block out of range.",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
@ -113,19 +120,20 @@ TestRegister.addTests([
expectedOutput: "IPv6 CIDR must be less than 128",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},
{
name: "invalid IPv6 address error",
input: "2404:6800:4001:/12",
expectedOutput: "Invalid input.\n\nEnter either a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0). IPv6 also supported.",
expectedOutput:
"Invalid input.\n\nEnter either a CIDR range (e.g. 10.0.0.0/24) or a hyphenated range (e.g. 10.0.0.0 - 10.0.1.0). IPv6 also supported.",
recipeConfig: [
{
"op": "Parse IP range",
"args": [true, true, false]
op: "Parse IP range",
args: [true, true, false],
},
],
},

View file

@ -8,7 +8,6 @@
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Parse ISO timestamp from ObjectId",
@ -18,7 +17,7 @@ TestRegister.addTests([
{
op: "Parse ObjectID timestamp",
args: [],
}
},
],
}
},
]);

View file

@ -14,14 +14,14 @@ TestRegister.addTests([
expectedOutput: "http://en.m.wikipedia.org",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "Parse QR Code",
"args": [false]
}
]
op: "Parse QR Code",
args: [false],
},
],
},
{
name: "Parse QR Code : PNG",
@ -29,12 +29,12 @@ TestRegister.addTests([
expectedOutput: "Hello world!",
recipeConfig: [
{
"op": "From Hex",
"args": ["Space"]
op: "From Hex",
args: ["Space"],
},
{
"op": "Parse QR Code",
"args": [false]
op: "Parse QR Code",
args: [false],
},
],
},
@ -44,12 +44,12 @@ TestRegister.addTests([
expectedOutput: "http://en.m.wikipedia.org",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "Parse QR Code",
"args": [true]
op: "Parse QR Code",
args: [true],
},
],
},
@ -59,13 +59,13 @@ TestRegister.addTests([
expectedOutput: "https://globeon.mobi/jyri",
recipeConfig: [
{
"op": "From Hex",
"args": ["None"]
op: "From Hex",
args: ["None"],
},
{
"op": "Parse QR Code",
"args": [true]
}
]
}
op: "Parse QR Code",
args: [true],
},
],
},
]);

View file

@ -17,9 +17,9 @@ Modulus: 0x00e2259ffd5bd231fc393d6fe2b813e4460ae83502d9065da27dbcd218d181c51cba5
recipeConfig: [
{
op: "Parse SSH Host Key",
args: ["Base64"]
}
]
args: ["Base64"],
},
],
},
{
name: "SSH Host Key: DSA",
@ -32,9 +32,9 @@ y: 0x3772df58441ea2502bce0f8e6c64cd42f684c2db84ed99aa2ed067295b1de1d3f899f266e29
recipeConfig: [
{
op: "Parse SSH Host Key",
args: ["Base64"]
}
]
args: ["Base64"],
},
],
},
{
name: "SSH Host Key: ECDSA",
@ -45,9 +45,9 @@ Point: 0x046c59592006272250a15070142a6be36d1e45464313f930d985a6e6f0eba3cd39d0367
recipeConfig: [
{
op: "Parse SSH Host Key",
args: ["Base64"]
}
]
args: ["Base64"],
},
],
},
{
name: "SSH Host Key: Ed25519",
@ -57,9 +57,9 @@ x: 0x1385eabf7d224bea1aed64c19ac71c8aa3a53079c3bf5ba6febb07f030dfe589`,
recipeConfig: [
{
op: "Parse SSH Host Key",
args: ["Base64"]
}
]
args: ["Base64"],
},
],
},
{
name: "SSH Host Key: Extract key",
@ -70,8 +70,8 @@ Modulus: 0x00e2259ffd5bd231fc393d6fe2b813e4460ae83502d9065da27dbcd218d181c51cba5
recipeConfig: [
{
op: "Parse SSH Host Key",
args: ["Base64"]
}
]
}
args: ["Base64"],
},
],
},
]);

View file

@ -16,7 +16,7 @@ TestRegister.addTests([
{
op: "Parse TCP",
args: ["Hex"],
}
},
],
},
{
@ -27,7 +27,7 @@ TestRegister.addTests([
{
op: "Parse TCP",
args: ["Hex"],
}
},
],
},
{
@ -38,7 +38,7 @@ TestRegister.addTests([
{
op: "Parse TCP",
args: ["Hex"],
}
},
],
}
},
]);

View file

@ -12,45 +12,77 @@ TestRegister.addTests([
{
name: "Parse TLV: LengthValue",
input: "\x05\x48\x6f\x75\x73\x65\x04\x72\x6f\x6f\x6d\x04\x64\x6f\x6f\x72",
expectedOutput: JSON.stringify([{"length": 5, "value": [72, 111, 117, 115, 101]}, {"length": 4, "value": [114, 111, 111, 109]}, {"length": 4, "value": [100, 111, 111, 114]}], null, 4),
expectedOutput: JSON.stringify(
[
{ length: 5, value: [72, 111, 117, 115, 101] },
{ length: 4, value: [114, 111, 111, 109] },
{ length: 4, value: [100, 111, 111, 114] },
],
null,
4,
),
recipeConfig: [
{
"op": "Parse TLV",
"args": [0, 1, false]
}
]
op: "Parse TLV",
args: [0, 1, false],
},
],
},
{
name: "Parse TLV: LengthValue with BER",
input: "\x05\x48\x6f\x75\x73\x65\x04\x72\x6f\x6f\x6d\x04\x64\x6f\x6f\x72",
expectedOutput: JSON.stringify([{"length": 5, "value": [72, 111, 117, 115, 101]}, {"length": 4, "value": [114, 111, 111, 109]}, {"length": 4, "value": [100, 111, 111, 114]}], null, 4),
expectedOutput: JSON.stringify(
[
{ length: 5, value: [72, 111, 117, 115, 101] },
{ length: 4, value: [114, 111, 111, 109] },
{ length: 4, value: [100, 111, 111, 114] },
],
null,
4,
),
recipeConfig: [
{
"op": "Parse TLV",
"args": [0, 4, true] // length value is patently wrong, should be ignored by BER.
}
]
op: "Parse TLV",
args: [0, 4, true], // length value is patently wrong, should be ignored by BER.
},
],
},
{
name: "Parse TLV: KeyLengthValue",
input: "\x04\x05\x48\x6f\x75\x73\x65\x05\x04\x72\x6f\x6f\x6d\x42\x04\x64\x6f\x6f\x72",
expectedOutput: JSON.stringify([{"key": [4], "length": 5, "value": [72, 111, 117, 115, 101]}, {"key": [5], "length": 4, "value": [114, 111, 111, 109]}, {"key": [66], "length": 4, "value": [100, 111, 111, 114]}], null, 4),
expectedOutput: JSON.stringify(
[
{ key: [4], length: 5, value: [72, 111, 117, 115, 101] },
{ key: [5], length: 4, value: [114, 111, 111, 109] },
{ key: [66], length: 4, value: [100, 111, 111, 114] },
],
null,
4,
),
recipeConfig: [
{
"op": "Parse TLV",
"args": [1, 1, false]
}
]
op: "Parse TLV",
args: [1, 1, false],
},
],
},
{
name: "Parse TLV: KeyLengthValue with BER",
input: "\x04\x05\x48\x6f\x75\x73\x65\x05\x04\x72\x6f\x6f\x6d\x42\x04\x64\x6f\x6f\x72",
expectedOutput: JSON.stringify([{"key": [4], "length": 5, "value": [72, 111, 117, 115, 101]}, {"key": [5], "length": 4, "value": [114, 111, 111, 109]}, {"key": [66], "length": 4, "value": [100, 111, 111, 114]}], null, 4),
expectedOutput: JSON.stringify(
[
{ key: [4], length: 5, value: [72, 111, 117, 115, 101] },
{ key: [5], length: 4, value: [114, 111, 111, 109] },
{ key: [66], length: 4, value: [100, 111, 111, 114] },
],
null,
4,
),
recipeConfig: [
{
"op": "Parse TLV",
"args": [1, 4, true] // length value is patently wrong, should be ignored by BER.
}
]
}
op: "Parse TLV",
args: [1, 4, true], // length value is patently wrong, should be ignored by BER.
},
],
},
]);

View file

@ -11,7 +11,8 @@ TestRegister.addTests([
{
name: "Parse UDP: No Data - JSON",
input: "04 89 00 35 00 2c 01 01",
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0x0101\"}",
expectedOutput:
'{"Source port":1161,"Destination port":53,"Length":44,"Checksum":"0x0101"}',
recipeConfig: [
{
op: "Parse UDP",
@ -22,10 +23,12 @@ TestRegister.addTests([
args: [],
},
],
}, {
},
{
name: "Parse UDP: With Data - JSON",
input: "04 89 00 35 00 2c 01 01 02 02",
expectedOutput: "{\"Source port\":1161,\"Destination port\":53,\"Length\":44,\"Checksum\":\"0x0101\",\"Data\":\"0x0202\"}",
expectedOutput:
'{"Source port":1161,"Destination port":53,"Length":44,"Checksum":"0x0101","Data":"0x0202"}',
recipeConfig: [
{
op: "Parse UDP",
@ -51,5 +54,5 @@ TestRegister.addTests([
args: [],
},
],
}
},
]);

View file

@ -12,124 +12,128 @@ TestRegister.addTests([
{
name: "Protobuf Decode: no schema",
input: "0d1c0000001203596f751a024d65202b2a0a0a066162633132331200",
expectedOutput: JSON.stringify({
"1": 28,
"2": "You",
"3": "Me",
"4": 43,
"5": {
"1": "abc123",
"2": {}
}
}, null, 4),
expectedOutput: JSON.stringify(
{
1: 28,
2: "You",
3: "Me",
4: 43,
5: {
1: "abc123",
2: {},
},
},
null,
4,
),
recipeConfig: [
{
"op": "From Hex",
"args": ["Auto"]
op: "From Hex",
args: ["Auto"],
},
{
"op": "Protobuf Decode",
"args": ["", false, false]
}
]
op: "Protobuf Decode",
args: ["", false, false],
},
],
},
{
name: "Protobuf Decode: partial schema, no unknown fields",
input: "0d1c0000001203596f751a024d65202b2a0a0a066162633132331200",
expectedOutput: JSON.stringify({
"Apple": [
28
],
"Carrot": [
"Me"
],
"Banana": "You"
}, null, 4),
expectedOutput: JSON.stringify(
{
Apple: [28],
Carrot: ["Me"],
Banana: "You",
},
null,
4,
),
recipeConfig: [
{
"op": "From Hex",
"args": ["Auto"]
op: "From Hex",
args: ["Auto"],
},
{
"op": "Protobuf Decode",
"args": [
op: "Protobuf Decode",
args: [
`message Test {
repeated fixed32 Apple = 1;
optional string Banana = 2;
repeated string Carrot = 3;
}`,
false,
false
]
}
]
false,
],
},
],
},
{
name: "Protobuf Decode: partial schema, show unknown fields",
input: "0d1c0000001203596f751a024d65202b2a0a0a066162633132331200",
expectedOutput: JSON.stringify({
"Test": {
"Apple": [
28
],
"Carrot": [
"Me"
],
"Banana": "You"
expectedOutput: JSON.stringify(
{
Test: {
Apple: [28],
Carrot: ["Me"],
Banana: "You",
},
"Unknown Fields": {
4: 43,
5: {
1: "abc123",
2: {},
},
},
},
"Unknown Fields": {
"4": 43,
"5": {
"1": "abc123",
"2": {}
}
}
}, null, 4),
null,
4,
),
recipeConfig: [
{
"op": "From Hex",
"args": ["Auto"]
op: "From Hex",
args: ["Auto"],
},
{
"op": "Protobuf Decode",
"args": [
op: "Protobuf Decode",
args: [
`message Test {
repeated fixed32 Apple = 1;
optional string Banana = 2;
repeated string Carrot = 3;
}`,
true,
false
]
}
]
false,
],
},
],
},
{
name: "Protobuf Decode: full schema, no unknown fields",
input: "0d1c0000001203596f751a024d65202b2a0a0a06616263313233120031ff00000000000000",
expectedOutput: JSON.stringify({
"Apple": [
28
],
"Carrot": [
"Me"
],
"Banana": "You",
"Date": 43,
"Elderberry": {
"Fig": "abc123",
"Grape": {}
expectedOutput: JSON.stringify(
{
Apple: [28],
Carrot: ["Me"],
Banana: "You",
Date: 43,
Elderberry: {
Fig: "abc123",
Grape: {},
},
Huckleberry: 255,
},
"Huckleberry": 255
}, null, 4),
null,
4,
),
recipeConfig: [
{
"op": "From Hex",
"args": ["Auto"]
op: "From Hex",
args: ["Auto"],
},
{
"op": "Protobuf Decode",
"args": [
op: "Protobuf Decode",
args: [
`message Test {
repeated fixed32 Apple = 1;
optional string Banana = 2;
@ -144,40 +148,42 @@ TestRegister.addTests([
}
message subSubTest {}`,
false,
false
]
}
]
false,
],
},
],
},
{
name: "Protobuf Decode: partial schema, show unknown fields, show types",
input: "0d1c0000001203596f751a024d65202b2a0a0a06616263313233120031ba32a96cc10200003801",
expectedOutput: JSON.stringify({
"Test": {
"Carrot (string)": [
"Me"
],
"Banana (string)": "You",
"Date (int32)": 43,
"Imbe (Options)": "Option1"
},
"Unknown Fields": {
"field #1: 32-Bit (e.g. fixed32, float)": 28,
"field #5: L-delim (e.g. string, message)": {
"field #1: L-delim (e.g. string, message)": "abc123",
"field #2: L-delim (e.g. string, message)": {}
expectedOutput: JSON.stringify(
{
Test: {
"Carrot (string)": ["Me"],
"Banana (string)": "You",
"Date (int32)": 43,
"Imbe (Options)": "Option1",
},
"field #6: 64-Bit (e.g. fixed64, double)": 3029774971578
}
}, null, 4),
"Unknown Fields": {
"field #1: 32-Bit (e.g. fixed32, float)": 28,
"field #5: L-delim (e.g. string, message)": {
"field #1: L-delim (e.g. string, message)": "abc123",
"field #2: L-delim (e.g. string, message)": {},
},
"field #6: 64-Bit (e.g. fixed64, double)": 3029774971578,
},
},
null,
4,
),
recipeConfig: [
{
"op": "From Hex",
"args": ["Auto"]
op: "From Hex",
args: ["Auto"],
},
{
"op": "Protobuf Decode",
"args": [
op: "Protobuf Decode",
args: [
`message Test {
optional string Banana = 2;
repeated string Carrot = 3;
@ -195,34 +201,35 @@ TestRegister.addTests([
Option2 = 2;
}`,
true,
true
]
}
]
true,
],
},
],
},
{
name: "Protobuf Encode",
input: JSON.stringify({
"Apple": [
28
],
"Banana": "You",
"Carrot": [
"Me"
],
"Date": 43,
"Elderberry": {
"Fig": "abc123",
"Grape": {}
input: JSON.stringify(
{
Apple: [28],
Banana: "You",
Carrot: ["Me"],
Date: 43,
Elderberry: {
Fig: "abc123",
Grape: {},
},
Huckleberry: [3029774971578],
Imbe: 1,
},
"Huckleberry": [3029774971578],
"Imbe": 1
}, null, 4),
expectedOutput: "0d1c0000001203596f751a024d65202b2a0a0a06616263313233120031ba32a96cc10200003801",
null,
4,
),
expectedOutput:
"0d1c0000001203596f751a024d65202b2a0a0a06616263313233120031ba32a96cc10200003801",
recipeConfig: [
{
"op": "Protobuf Encode",
"args": [
op: "Protobuf Encode",
args: [
`message Test {
repeated fixed32 Apple = 1;
optional string Banana = 2;
@ -241,41 +248,39 @@ TestRegister.addTests([
Option0 = 0;
Option1 = 1;
Option2 = 2;
}`
]
}`,
],
},
{
"op": "To Hex",
"args": [
"None",
0
]
}
]
op: "To Hex",
args: ["None", 0],
},
],
},
{
name: "Protobuf Encode: incomplete schema",
input: JSON.stringify({
"Apple": [
28
],
"Banana": "You",
"Carrot": [
"Me"
],
"Date": 43,
"Elderberry": {
"Fig": "abc123",
"Grape": {}
input: JSON.stringify(
{
Apple: [28],
Banana: "You",
Carrot: ["Me"],
Date: 43,
Elderberry: {
Fig: "abc123",
Grape: {},
},
Huckleberry: [3029774971578],
Imbe: 1,
},
"Huckleberry": [3029774971578],
"Imbe": 1
}, null, 4),
expectedOutput: "1203596f75202b2a0a0a06616263313233120031ba32a96cc1020000",
null,
4,
),
expectedOutput:
"1203596f75202b2a0a0a06616263313233120031ba32a96cc1020000",
recipeConfig: [
{
"op": "Protobuf Encode",
"args": [
op: "Protobuf Encode",
args: [
`message Test {
optional string Banana = 2;
optional int32 Date = 4;
@ -291,16 +296,13 @@ TestRegister.addTests([
Option0 = 0;
Option1 = 1;
Option2 = 2;
}`
]
}`,
],
},
{
"op": "To Hex",
"args": [
"None",
0
]
}
]
op: "To Hex",
args: ["None", 0],
},
],
},
]);

View file

@ -1,6 +1,6 @@
/**
* RAKE, Rapid Automatic Keyword Extraction tests.
*
*
* @author sw5678
* @copyright Crown Copyright 2024
* @license Apache-2.0
@ -9,14 +9,14 @@ import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
"name": "RAKE: Basic Example",
"input": "test1 test2. test2",
"expectedOutput": "Scores: , Keywords: \n3.5, test1 test2\n1.5, test2",
"recipeConfig": [
name: "RAKE: Basic Example",
input: "test1 test2. test2",
expectedOutput: "Scores: , Keywords: \n3.5, test1 test2\n1.5, test2",
recipeConfig: [
{
"op": "RAKE",
"args": ["\\s", "\\.\\s|\\n", "i,me,my,myself,we,our"]
op: "RAKE",
args: ["\\s", "\\.\\s|\\n", "i,me,my,myself,we,our"],
},
],
}
},
]);

View file

@ -6,7 +6,7 @@
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
import {ASCII_TEXT, UTF8_TEXT, ALL_BYTES} from "../../samples/Ciphers.mjs";
import { ASCII_TEXT, UTF8_TEXT, ALL_BYTES } from "../../samples/Ciphers.mjs";
const PEM_PRIV_2048 = `-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAwfaUOpUEutKyU3wkCv6kYunz4MqxzSuTSckRz1IxwZtwIiqq
@ -53,14 +53,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-1"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-1"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-1, ASCII",
@ -68,14 +68,14 @@ TestRegister.addTests([
expectedOutput: ASCII_TEXT,
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-1"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-1"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-1, UTF-8",
@ -83,14 +83,14 @@ TestRegister.addTests([
expectedOutput: UTF8_TEXT.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-1"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-1"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-1, All bytes",
@ -98,14 +98,14 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-1"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-1"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-1"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/MD5, nothing",
@ -113,14 +113,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "MD5"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "MD5"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/MD5, ASCII",
@ -128,14 +128,14 @@ TestRegister.addTests([
expectedOutput: ASCII_TEXT,
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "MD5"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "MD5"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/MD5, UTF-8",
@ -143,14 +143,14 @@ TestRegister.addTests([
expectedOutput: UTF8_TEXT.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "MD5"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "MD5"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/MD5, All bytes",
@ -158,14 +158,14 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "MD5"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "MD5"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "MD5"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-256, nothing",
@ -173,14 +173,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-256"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-256"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-256, ASCII",
@ -188,14 +188,14 @@ TestRegister.addTests([
expectedOutput: ASCII_TEXT,
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-256"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-256"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-256, UTF-8",
@ -203,14 +203,14 @@ TestRegister.addTests([
expectedOutput: UTF8_TEXT.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-256"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-256"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-256, All bytes",
@ -218,14 +218,14 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-256"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-256"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-256"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-384, nothing",
@ -233,14 +233,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-384"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-384"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-384, ASCII",
@ -248,14 +248,14 @@ TestRegister.addTests([
expectedOutput: ASCII_TEXT,
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-384"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-384"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-384, UTF-8",
@ -263,14 +263,14 @@ TestRegister.addTests([
expectedOutput: UTF8_TEXT.substr(0, 80),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-384"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-384"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-384, All bytes",
@ -278,14 +278,14 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-384"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-384"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-384"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-512, nothing",
@ -293,14 +293,14 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-512"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-512"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-512, ASCII",
@ -308,14 +308,14 @@ TestRegister.addTests([
expectedOutput: ASCII_TEXT.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-512"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-512"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-512, UTF-8",
@ -323,14 +323,14 @@ TestRegister.addTests([
expectedOutput: UTF8_TEXT.substr(0, 60),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-512"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-512"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"],
},
],
},
{
name: "RSA Encrypt/Decrypt: RSA-OAEP/SHA-512, All bytes",
@ -338,13 +338,13 @@ TestRegister.addTests([
expectedOutput: ALL_BYTES.substr(0, 100),
recipeConfig: [
{
"op": "RSA Encrypt",
"args": [PEM_PUB_2048, "RSA-OAEP", "SHA-512"]
op: "RSA Encrypt",
args: [PEM_PUB_2048, "RSA-OAEP", "SHA-512"],
},
{
"op": "RSA Decrypt",
"args": [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"]
}
]
op: "RSA Decrypt",
args: [PEM_PRIV_2048, "", "RSA-OAEP", "SHA-512"],
},
],
},
]);

View file

@ -10,107 +10,149 @@ TestRegister.addTests([
{
name: "Rabbit: RFC Test vector, without IV 1",
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
expectedOutput: "b15754f036a5d6ecf56b45261c4af70288e8d815c59c0c397b696c4789c68aa7f416a1c3700cd451da68d1881673d696",
expectedOutput:
"b15754f036a5d6ecf56b45261c4af70288e8d815c59c0c397b696c4789c68aa7f416a1c3700cd451da68d1881673d696",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": ""},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: RFC Test vector, without IV 2",
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
expectedOutput: "3d2df3c83ef627a1e97fc38487e2519cf576cd61f4405b8896bf53aa8554fc19e5547473fbdb43508ae53b20204d4c5e",
expectedOutput:
"3d2df3c83ef627a1e97fc38487e2519cf576cd61f4405b8896bf53aa8554fc19e5547473fbdb43508ae53b20204d4c5e",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "912813292e3d36fe3bfc62f1dc51c3ac"},
{"option": "Hex", "string": ""},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "912813292e3d36fe3bfc62f1dc51c3ac",
},
{ option: "Hex", string: "" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: RFC Test vector, without IV 3",
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
expectedOutput: "0cb10dcda041cdac32eb5cfd02d0609b95fc9fca0f17015a7b7092114cff3ead9649e5de8bfc7f3f924147ad3a947428",
expectedOutput:
"0cb10dcda041cdac32eb5cfd02d0609b95fc9fca0f17015a7b7092114cff3ead9649e5de8bfc7f3f924147ad3a947428",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "8395741587e0c733e9e9ab01c09b0043"},
{"option": "Hex", "string": ""},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "8395741587e0c733e9e9ab01c09b0043",
},
{ option: "Hex", string: "" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: RFC Test vector, with IV 1",
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
expectedOutput: "c6a7275ef85495d87ccd5d376705b7ed5f29a6ac04f5efd47b8f293270dc4a8d2ade822b29de6c1ee52bdb8a47bf8f66",
expectedOutput:
"c6a7275ef85495d87ccd5d376705b7ed5f29a6ac04f5efd47b8f293270dc4a8d2ade822b29de6c1ee52bdb8a47bf8f66",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": "0000000000000000"},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "0000000000000000" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: RFC Test vector, with IV 2",
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
expectedOutput: "1fcd4eb9580012e2e0dccc9222017d6da75f4e10d12125017b2499ffed936f2eebc112c393e738392356bdd012029ba7",
expectedOutput:
"1fcd4eb9580012e2e0dccc9222017d6da75f4e10d12125017b2499ffed936f2eebc112c393e738392356bdd012029ba7",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": "c373f575c1267e59"},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "c373f575c1267e59" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: RFC Test vector, with IV 3",
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
expectedOutput: "445ad8c805858dbf70b6af23a151104d96c8f27947f42c5baeae67c6acc35b039fcbfc895fa71c17313df034f01551cb",
expectedOutput:
"445ad8c805858dbf70b6af23a151104d96c8f27947f42c5baeae67c6acc35b039fcbfc895fa71c17313df034f01551cb",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": "a6eb561ad2f41727"},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "a6eb561ad2f41727" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: generated stream should be XORed with the input",
input: "cedda96c054e3ddd93da7ed05e2a4b7bdb0c00fe214f03502e2708b2c2bfc77aa2311b0b9af8aa78d119f92b26db0a6b",
expectedOutput: "7f8afd9c33ebeb3166b13bf64260bc7953e4d8ebe4d30f69554e64f54b794ddd5627bac8eaf47e290b7128a330a8dcfd",
expectedOutput:
"7f8afd9c33ebeb3166b13bf64260bc7953e4d8ebe4d30f69554e64f54b794ddd5627bac8eaf47e290b7128a330a8dcfd",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": ""},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: least significant bits should be used for the last block",
@ -118,14 +160,19 @@ TestRegister.addTests([
expectedOutput: "f56b45261c4af702",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": ""},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: invalid key length",
@ -133,14 +180,16 @@ TestRegister.addTests([
expectedOutput: "Invalid key length: 8 bytes (expected: 16)",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "0000000000000000"},
{"option": "Hex", "string": ""},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{ option: "Hex", string: "0000000000000000" },
{ option: "Hex", string: "" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
name: "Rabbit: invalid IV length",
@ -148,30 +197,40 @@ TestRegister.addTests([
expectedOutput: "Invalid IV length: 4 bytes (expected: 0 or 8)",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "00000000000000000000000000000000"},
{"option": "Hex", "string": "00000000"},
"Big", "Hex", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "00000000000000000000000000000000",
},
{ option: "Hex", string: "00000000" },
"Big",
"Hex",
"Hex",
],
},
],
},
{
// this testcase is taken from the first example on Crypto++ Wiki
// https://www.cryptopp.com/wiki/Rabbit
// this testcase is taken from the first example on Crypto++ Wiki
// https://www.cryptopp.com/wiki/Rabbit
name: "Rabbit: little-endian mode (Crypto++ compatible)",
input: "Rabbit stream cipher test",
expectedOutput: "1ae2d4edcf9b6063b00fd6fda0b223aded157e77031cf0440b",
recipeConfig: [
{
"op": "Rabbit",
"args": [
{"option": "Hex", "string": "23c2731e8b5469fd8dabb5bc592a0f3a"},
{"option": "Hex", "string": "712906405ef03201"},
"Little", "Raw", "Hex"
]
}
]
op: "Rabbit",
args: [
{
option: "Hex",
string: "23c2731e8b5469fd8dabb5bc592a0f3a",
},
{ option: "Hex", string: "712906405ef03201" },
"Little",
"Raw",
"Hex",
],
},
],
},
]);

View file

@ -14,13 +14,23 @@ TestRegister.addTests([
expectedOutput: "/<>",
recipeConfig: [
{
"op": "Regular expression",
"args": ["User defined", "", true, true, false, false, false, false, "Highlight matches"]
op: "Regular expression",
args: [
"User defined",
"",
true,
true,
false,
false,
false,
false,
"Highlight matches",
],
},
{
"op": "Remove whitespace",
"args": [true, true, true, true, true, false]
}
op: "Remove whitespace",
args: [true, true, true, true, true, false],
},
],
},
{
@ -29,9 +39,19 @@ TestRegister.addTests([
expectedOutput: "Hello\nWorld",
recipeConfig: [
{
"op": "Regular expression",
"args": ["User defined", ".+", true, true, true, false, false, false, "List matches"]
}
op: "Regular expression",
args: [
"User defined",
".+",
true,
true,
true,
false,
false,
false,
"List matches",
],
},
],
},
{
@ -40,9 +60,19 @@ TestRegister.addTests([
expectedOutput: "",
recipeConfig: [
{
"op": "Regular expression",
"args": ["User defined", "\\pS", true, true, false, false, false, false, "List matches"]
}
op: "Regular expression",
args: [
"User defined",
"\\pS",
true,
true,
false,
false,
false,
false,
"List matches",
],
},
],
},
{
@ -51,9 +81,19 @@ TestRegister.addTests([
expectedOutput: "𝌆\n😆",
recipeConfig: [
{
"op": "Regular expression",
"args": ["User defined", "\\pS", true, true, false, false, true, false, "List matches"]
}
op: "Regular expression",
args: [
"User defined",
"\\pS",
true,
true,
false,
false,
true,
false,
"List matches",
],
},
],
}
},
]);

View file

@ -12,26 +12,29 @@ TestRegister.addTests([
{
name: "Register: RC4 key",
input: "http://malwarez.biz/beacon.php?key=0e932a5c&data=8db7d5ebe38663a54ecbb334e3db11",
expectedOutput: "zNu5y53uBoU2rm7qhq9ijjnVHSlJ9PJ/zpp+xL/to8qIBzkDwKzUNQ==",
expectedOutput:
"zNu5y53uBoU2rm7qhq9ijjnVHSlJ9PJ/zpp+xL/to8qIBzkDwKzUNQ==",
recipeConfig: [
{
op: "Register",
args: ["key=([\\da-f]*)", true, false]
args: ["key=([\\da-f]*)", true, false],
},
{
op: "RC4",
args: [
{
"option": "Hex",
"string": "$R0"
}, "Hex", "Latin1"
]
option: "Hex",
string: "$R0",
},
"Hex",
"Latin1",
],
},
{
op: "To Base64",
args: ["A-Za-z0-9+/="]
}
]
args: ["A-Za-z0-9+/="],
},
],
},
{
name: "Register: AES key",
@ -42,34 +45,36 @@ TestRegister.addTests([
recipeConfig: [
{
op: "Register",
args: ["(.{32})", true, false]
args: ["(.{32})", true, false],
},
{
op: "Drop bytes",
args: [0, 32, false]
args: [0, 32, false],
},
{
op: "AES Decrypt",
args: [
{
"option": "Hex",
"string": "1748e7179bd56570d51fa4ba287cc3e5"
option: "Hex",
string: "1748e7179bd56570d51fa4ba287cc3e5",
},
{
"option": "Hex",
"string": "$R0"
option: "Hex",
string: "$R0",
},
"CTR", "Hex", "Raw",
"CTR",
"Hex",
"Raw",
{
"option": "Hex",
"string": ""
option: "Hex",
string: "",
},
{
"option": "Hex",
"string": ""
}
]
}
]
}
option: "Hex",
string: "",
},
],
},
],
},
]);

Some files were not shown because too many files have changed in this diff Show more