mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Typex: add simple tests
This commit is contained in:
parent
1f9fd92b01
commit
765aded208
2 changed files with 106 additions and 0 deletions
|
@ -86,6 +86,7 @@ import "./tests/ConvertCoordinateFormat";
|
||||||
import "./tests/Enigma";
|
import "./tests/Enigma";
|
||||||
import "./tests/Bombe";
|
import "./tests/Bombe";
|
||||||
import "./tests/MultipleBombe";
|
import "./tests/MultipleBombe";
|
||||||
|
import "./tests/Typex";
|
||||||
|
|
||||||
// Cannot test operations that use the File type yet
|
// Cannot test operations that use the File type yet
|
||||||
//import "./tests/SplitColourChannels";
|
//import "./tests/SplitColourChannels";
|
||||||
|
|
105
tests/operations/tests/Typex.mjs
Normal file
105
tests/operations/tests/Typex.mjs
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/**
|
||||||
|
* Typex machine tests.
|
||||||
|
* @author s2224834
|
||||||
|
* @copyright Crown Copyright 2019
|
||||||
|
* @license Apache-2.0
|
||||||
|
*/
|
||||||
|
import TestRegister from "../TestRegister";
|
||||||
|
|
||||||
|
TestRegister.addTests([
|
||||||
|
{
|
||||||
|
// Unlike Enigma we're not verifying against a real machine here, so this is just a test
|
||||||
|
// to catch inadvertent breakage.
|
||||||
|
name: "Typex: basic",
|
||||||
|
input: "hello world, this is a test message.",
|
||||||
|
expectedOutput: "VIXQQ VHLPN UCVLA QDZNZ EAYAT HWC",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Typex",
|
||||||
|
"args": [
|
||||||
|
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||||
|
false, "B", "C",
|
||||||
|
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||||
|
false, "D", "E",
|
||||||
|
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||||
|
false, "F", "G",
|
||||||
|
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||||
|
true, "H", "I",
|
||||||
|
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||||
|
true, "J", "K",
|
||||||
|
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||||
|
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||||
|
"None", true
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Typex: keyboard",
|
||||||
|
input: "hello world, this is a test message.",
|
||||||
|
expectedOutput: "VIXQQ FDJXT WKLDQ DFQOD CNCSK NULBG JKQDD MVGQ",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Typex",
|
||||||
|
"args": [
|
||||||
|
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||||
|
false, "B", "C",
|
||||||
|
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||||
|
false, "D", "E",
|
||||||
|
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||||
|
false, "F", "G",
|
||||||
|
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||||
|
true, "H", "I",
|
||||||
|
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||||
|
true, "J", "K",
|
||||||
|
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||||
|
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||||
|
"Encrypt", true
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Typex: self-decrypt",
|
||||||
|
input: "hello world, this is a test message.",
|
||||||
|
expectedOutput: "HELLO WORLD, THIS IS A TEST MESSAGE.",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
"op": "Typex",
|
||||||
|
"args": [
|
||||||
|
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||||
|
false, "B", "C",
|
||||||
|
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||||
|
false, "D", "E",
|
||||||
|
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||||
|
false, "F", "G",
|
||||||
|
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||||
|
true, "H", "I",
|
||||||
|
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||||
|
true, "J", "K",
|
||||||
|
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||||
|
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||||
|
"Encrypt", true
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "Typex",
|
||||||
|
"args": [
|
||||||
|
"MCYLPQUVRXGSAOWNBJEZDTFKHI<BFHNQUW",
|
||||||
|
false, "B", "C",
|
||||||
|
"KHWENRCBISXJQGOFMAPVYZDLTU<BFHNQUW",
|
||||||
|
false, "D", "E",
|
||||||
|
"BYPDZMGIKQCUSATREHOJNLFWXV<BFHNQUW",
|
||||||
|
false, "F", "G",
|
||||||
|
"ZANJCGDLVHIXOBRPMSWQUKFYET<BFHNQUW",
|
||||||
|
true, "H", "I",
|
||||||
|
"QXBGUTOVFCZPJIHSWERYNDAMLK<BFHNQUW",
|
||||||
|
true, "J", "K",
|
||||||
|
"AN BC FG IE KD LU MH OR TS VZ WQ XJ YP",
|
||||||
|
"EHZTLCVKFRPQSYANBUIWOJXGMD",
|
||||||
|
"Decrypt", true
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]);
|
Loading…
Add table
Add a link
Reference in a new issue