mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-26 01:36:17 -04:00
Merge branch 'master' into CC-1523
This commit is contained in:
commit
6265f2c372
32 changed files with 1300 additions and 101 deletions
|
@ -62,6 +62,7 @@ import "./tests/JSONtoCSV.mjs";
|
|||
import "./tests/JWTDecode.mjs";
|
||||
import "./tests/JWTSign.mjs";
|
||||
import "./tests/JWTVerify.mjs";
|
||||
import "./tests/LZNT1Decompress.mjs";
|
||||
import "./tests/MS.mjs";
|
||||
import "./tests/Magic.mjs";
|
||||
import "./tests/MorseCode.mjs";
|
||||
|
@ -134,6 +135,7 @@ import "./tests/LevenshteinDistance.mjs";
|
|||
import "./tests/SwapCase.mjs";
|
||||
import "./tests/HKDF.mjs";
|
||||
import "./tests/GenerateDeBruijnSequence.mjs";
|
||||
import "./tests/GOST.mjs";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
// import "./tests/SplitColourChannels.mjs";
|
||||
|
|
183
tests/operations/tests/GOST.mjs
Normal file
183
tests/operations/tests/GOST.mjs
Normal file
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
* GOST tests.
|
||||
*
|
||||
* The GOST library already includes a range of tests for the correctness of
|
||||
* the algorithms. These tests are intended only to confirm that the library
|
||||
* has been correctly integrated into CyberChef.
|
||||
*
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
*
|
||||
* @copyright Crown Copyright 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "GOST Encrypt: Magma",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "f124ac5c0853870906dbaf9b56",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Encrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
"64",
|
||||
"E-SC",
|
||||
"OFB",
|
||||
"CP",
|
||||
"ZERO"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Encrypt: Kuznyechik",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "8673d490dfa4a66d5e3ff00ba316724f",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Encrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
"128",
|
||||
"E-SC",
|
||||
"CBC",
|
||||
"CP",
|
||||
"PKCS5"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Decrypt: Magma",
|
||||
input: "f124ac5c0853870906dbaf9b56",
|
||||
expectedOutput: "Hello, World!",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Decrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
"Hex",
|
||||
"Raw",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
"128",
|
||||
"E-SC",
|
||||
"OFB",
|
||||
"CP",
|
||||
"ZERO"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Decrypt: Kuznyechik",
|
||||
input: "8673d490dfa4a66d5e3ff00ba316724f",
|
||||
expectedOutput: "Hello, World!\0\0\0",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Decrypt",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
"Hex",
|
||||
"Raw",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
"128",
|
||||
"E-TEST",
|
||||
"CBC",
|
||||
"CP",
|
||||
"PKCS5"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Sign",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "810d0c40e965",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Sign",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
"64",
|
||||
"E-C",
|
||||
48
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Verify",
|
||||
input: "Hello, World!",
|
||||
expectedOutput: "The signature matches",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Verify",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "00112233445566778899aabbccddeeff" },
|
||||
{ "option": "Hex", "string": "42b77fb3d6f6bf04" },
|
||||
"Raw",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
"128",
|
||||
"E-TEST"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Key Wrap",
|
||||
input: "Hello, World!123",
|
||||
expectedOutput: "0bb706e92487fceef97589911faeb28200000000000000000000000000000000\r\n6b7bfd16",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Key Wrap",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "00112233" },
|
||||
{ "option": "Hex", "string": "0011223344556677" },
|
||||
"Raw",
|
||||
"Hex",
|
||||
"GOST R 34.12 (Kuznyechik, 2015)",
|
||||
"64",
|
||||
"E-TEST",
|
||||
"CP"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "GOST Key Unwrap",
|
||||
input: "c8e58458a42d21974d50103d59b469f2c8e58458a42d21974d50103d59b469f2\r\na32a1575",
|
||||
expectedOutput: "0123456789abcdef0123456789abcdef",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST Key Unwrap",
|
||||
args: [
|
||||
{ "option": "Hex", "string": "" },
|
||||
{ "option": "Latin1", "string": "00112233" },
|
||||
"Hex",
|
||||
"Raw",
|
||||
"GOST 28147 (Magma, 1989)",
|
||||
"64",
|
||||
"E-Z",
|
||||
"CP"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
]);
|
|
@ -1094,8 +1094,8 @@ TestRegister.addTests([
|
|||
expectedOutput: "981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST hash",
|
||||
args: ["D-A"]
|
||||
op: "GOST Hash",
|
||||
args: ["GOST 28147 (1994)", "256", "D-A"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1105,8 +1105,8 @@ TestRegister.addTests([
|
|||
expectedOutput: "2cefc2f7b7bdc514e18ea57fa74ff357e7fa17d652c75f69cb1be7893ede48eb",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "GOST hash",
|
||||
args: ["D-A"]
|
||||
op: "GOST Hash",
|
||||
args: ["GOST 28147 (1994)", "256", "D-A"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
22
tests/operations/tests/LZNT1Decompress.mjs
Normal file
22
tests/operations/tests/LZNT1Decompress.mjs
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* LZNT1 Decompress tests.
|
||||
*
|
||||
* @author 0xThiebaut [thiebaut.dev]
|
||||
* @copyright Crown Copyright 2023
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "LZNT1 Decompress",
|
||||
input: "\x1a\xb0\x00compress\x00edtestda\x04ta\x07\x88alot",
|
||||
expectedOutput: "compressedtestdatacompressedalot",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "LZNT1 Decompress",
|
||||
args: []
|
||||
}
|
||||
],
|
||||
}
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue