1
0
mirror of synced 2024-12-23 20:04:54 +01:00
CyberChef/tests/operations/tests/Colossus.mjs

93 lines
14 KiB
JavaScript
Raw Normal View History

2019-12-05 00:02:20 +01:00
/**
* Colossus tests.
* @author VirtualColossus [martin@virtualcolossus.co.uk]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Colossus Letter Count",
input: "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/N",
expectedMatch: /00 00 : a30/,
recipeConfig: [
{
"op": "Colossus",
"args": [
"",
"KH Pattern",
"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"
]
}
]
},
// Takes a while to run, so disabling for general purpose testing. Re-enable if modifying this operation.
// {
// name: "Colossus 1+2=.",
// input: "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/NNLH+WBFSBMJM-E3LMTPYJ.ZJDYI3TZZFVRP+REWQYOQMU3FNW.T4WB3IEPCJ-A3LWVRSZZECNGQVUFHO.R/3VZRF.Y4XEDGXZJ3RS34ARLZDZTUHMG+HH//Y+E+C-NE+--GEATU+EPEVLQEMKCLCZP-HX3C3O+CRH4D-RLIVOLHJGNI./MN4JDB/PRYZV3QOD34DAGO4+/TCS+CU-ODXMRHPPCCCD-MWHJO/TRPAELREIFVVLABSDMQORF4THY.UQTITEPYXAZ3DPNI/I+.UPTCBT-BJ/PEQFZA/PQ4+Z4-IPLBG4COART/YC4CJL+ERNVTRSHOKNSSLGFJ+QJR/ITYHWFQCPXCY.Z.X/VKTAR.LBXQK4JI/P+YDEM/LPBLK.CX/..QHBSOAO-FHJORYVBHQEYTF3/I-WZ4J.EYCYTEMG3DY3W/4VSE3/XAR3JEX4/3/LI4V/IAVLTODE-4HPLWUWMC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ROORLTU3LCNRFYYINEJW+TZBH/XSEX/QU++CJKUKJMV4ULC4JXQW+YE.Y-YDJHHF.ATHTN+/BZP-B/AZPFHSSWVNWI/LDUHVHUWU.KPAR-.A-TM3.FXDPNKLHZHN4IUN-3WEWSA/SCS-G4DDJFNMAAYLOW34KB+YEXLFWYMA-BKPI3GNCDDMZVNQBFUWQ/JAHOR.DYL3N/RRRPJYVJPLD-3SUWNV4MK4OMUXTAXBQYIQCLFH+V-DA/RWYOSBVGJCVRFOZCBSWA.XW-OLXJBNHTSPHSCYH+.4+RXBWCFVF3O.+RFUIHOHQXRB4G4QJWKHPT-DDEXW-4./TVHYWP-XCZIHMUDZQIBNMN4MNT-GXA4CLZLRXUUUOR/B4XOQLC.IZOM.PAUEXRJ.GRNBQGRZUQ.ISWES/YMK+AWCTQ4+-WKKA4HZ-/..XTPDBWOA3EQEDVPMN4BXHBGCGWBPOCHIYWE4NP3ILIQP.GCZA/FE
// expectedMatch: /31 05 : a3108/,
// recipeConfig: [
// {
// "op": "Colossus",
// "args": [
// "",
// "KH Pattern",
// "ΔZ", "ΔΧ", "",
// "None", "Select Program", "1+2=. (1+2 Break In, Find X1,X2)",
// "",
// "", "", "", "", "", false, "",
// "", "", "", "", "", false, "",
// "", "", "", "", "", false, "",
// false,
// "",
// false, false, false, false, false,
// "", false, false, "",
// "",
// 3100, "X1", "X2",
// "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"
// ]
// }
// ]
// },
// {
// name: "Colossus 4=5=/1=2",
// input: "CTBKJUVXHZ-H3L4QV+YEZUK+SXOZ/NNLH+WBFSBMJM-E3LMTPYJ.ZJDYI3TZZFVRP+REWQYOQMU3FNW.T4WB3IEPCJ-A3LWVRSZZECNGQVUFHO.R/3VZRF.Y4XEDGXZJ3RS34ARLZDZTUHMG+HH//Y+E+C-NE+--GEATU+EPEVLQEMKCLCZP-HX3C3O+CRH4D-RLIVOLHJGNI./MN4JDB/PRYZV3QOD34DAGO4+/TCS+CU-OD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/Z+3JKQ-FJUEAJSWRICIOE34HWDVBATM+4LPGHFPPQB3PR/Q4POSEO4N+FPALLZ-YF4FLWPMGXPIR+EQY+Q3PBVOZB.CDNDP3-.ZVPS4ITTUDUFSZD4-CO/EEIZFIE.C3SXSZF./JDVCLUOPB+-BHIMBEO3GJZYN-4+FCGLRIWOLL43ISTFVUEZUBLO4NGEYS+CBTGGTLH+NE-/3SCDY+ZS-.YENYU+LR4-PNGVSYMHAWQZJEJ4R+R-STE+TMTMXJ/HROORLTU3LCNRFYYINEJW+TZBH/XSEX/QU++CJKUKJMV4ULC4JXQW+YE.Y-YDJHHF.ATHTN+/BZP-B/AZPFHSSWVNWI/LDUHVHUWU.KPAR-.A-TM3.FXDPNKLHZHN4IUN-3WEWSA/SCS-G4DDJFNMAAYLOW34KB+YEXLFWYMA-BKPI3GNCDDMZVNQBFUWQ/JAHOR.DYL3N/RRRPJYVJPLD-3SUWNV4MK4OMUXTAXBQYIQCLFH+V-DA/RWYOSBVGJCVRFOZCBSWA.XW-OLXJBNHTSPHSCYH+.4+RXBWCFVF3O.+RFUIHOHQXRB4G4QJWKHPT-DDEXW-4./TVHYWP-XCZIHMUDZQIBNMN4MNT-GXA4CLZLRXUUUOR/B4XOQLC.IZOM.PAUEXRJ.GRNBQGRZUQ.ISWES/YMK+AWCTQ4+-WKKA4HZ-/..XTPDBWOA3EQEDVPMN4BXHBGCGWBPOCHIYWE4NP3ILIQP.GCZA/FE
// expectedMatch: /15 08 : a969/,
// recipeConfig: [
// {
// "op": "Colossus",
// "args": [
// "",
// "KH Pattern",
// "ΔZ", "ΔΧ", "",
// "None", "Select Program", "4=5=/1=2 (Given X1,X2 find X4,X5)",
// "",
// "", "", "", "", "", false, "",
// "", "", "", "", "", false, "",
// "", "", "", "", "", false, "",
// false,
// "",
// false, false, false, false, false,
// "", false, false, "",
// "",
// 960, "X4", "X5",
// "31", "5", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"
// ]
// }
// ]
// },
2019-12-05 00:02:20 +01:00
]);