92 lines
7.3 KiB
JavaScript
92 lines
7.3 KiB
JavaScript
/**
|
|
* SIGABA machine tests
|
|
*
|
|
* @author hettysymes
|
|
* @copyright hettysymes 2020
|
|
* @license Apache-2.0
|
|
*/
|
|
import TestRegister from "../../lib/TestRegister.mjs";
|
|
|
|
TestRegister.addTests([
|
|
{
|
|
name: "SIGABA: encrypt test 1",
|
|
input: "HELLO WORLD TESTING THE SIGABA MACHINE",
|
|
expectedOutput: "ULBECJCZJBJFVUDWAVRGRBMPSQHOTTNVQEESKN",
|
|
recipeConfig: [
|
|
{
|
|
"op": "SIGABA",
|
|
"args": [
|
|
"BHKWECJDOVAYLFMITUGXRNSPZQ", true, "G",
|
|
"CDTAKGQOZXLVJYHSWMIBPRUNEF", false, "L",
|
|
"WAXHJZMBVDPOLTUYRCQFNSGKEI", false, "I",
|
|
"HUSCWIMJQXDALVGBFTOYZKRPNE", false, "T",
|
|
"RTLSMNKXFVWQUZGCHEJBYDAIPO", false, "B",
|
|
"GHAQBRJWDMNZTSKLOUXYPFIECV", false, "N",
|
|
"VFLGEMTCXZIQDYAKRPBONHWSUJ", true, "Q",
|
|
"ZQCAYHRJNXPFLKIOTBUSVWMGDE", false, "B",
|
|
"EZVSWPCTULGAOFDJNBIYMXKQHR", false, "J",
|
|
"ELKSGDXMVYJUZNCAROQBPWHITF", false, "R",
|
|
"3891625740", "3",
|
|
"6297135408", "1",
|
|
"2389715064", "8",
|
|
"9264351708", "6",
|
|
"9573086142", "6",
|
|
"Encrypt"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: "SIGABA: encrypt test 2",
|
|
input: "PCRPJZWSPNOHMWANBFBEIVZOXDQESPYDEFBNTHXLSICIRPKUATJVDUQFLZOKGHHHDUDIBRKUHVCGAGLBWVGFFXNDHKPFSPSCIIPCXUFRRHNYWIJFEJWQSGMSNJHWSLPKVXHUQUWIURHDIHIUTWGQFIYLTKEZAUESWYEKIWXUSSXWXBEHCXCUDQWKCISVPKXJVPOIJZ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DRVAQSNUWHMDJVDNNMPGOYRGQRSBGSPQKGCTFZQWSOXBWSQZDCRQJQAWZDPQEILGMMABIMCDPNSKAFCLPQGIRJCMGQREBEUHBYREXFABFMVZTZBDUMASVNUMHIYRSZLGNZFMVAIABLCUZLJLKKZPWEXDHYZFVSNRLCLNDRKLKSWRHQVQJRTHCNFZXDEXSLAXXOGMFVSGCJGAWOLGDMTLWSFNTCUVCCEACINRZAZZOGLEHHXLPHVKILBBJDPOOCILQKKGODSXOBDPZZDXHJLLBOBVFCHJVMUBUZZIKGCWGCYGXVEHHIJGPEQERWEZLILQNHPHALFKFMGADNELGBKILKIUETGDCBQUEOECWVFNOXTJKUYPWBNEKYSIKMVSAMBZGLIKDAOELRSTKFASEKABTUCPSFEGXXQGDFPSPVOLBHGLZSLLWCABSRKZDQQRKVCKXDGTIHPDNMPDZEXYFYKXZTPJPLYOFNLWAGKJEOHOYLMZELXIDWWNXPKEPUCKNNNHJLFYHPQNHMMCGMUPHSUSYYIVWTIMFKKKTFPGFTLTWWSQBRBMGBTZXPVULKNZIIKVTYLJFISGPTLZFTCLGNZOMVKZOIMUDGXRDDSVFRHRYWBEWHYLCUISYMRWAZZAQPJYXZQQKZLILOSHXUTQJFPTXQSREKSUDZTLGUDLUGOJMQHJRJHXCHQTKJULTWWQOXIRFRQEYBPJPEKXFIRMNATWNFBADOSIJVZYRYDBHDAEDJUVDHLDAU",
|
|
recipeConfig: [
|
|
{ "op": "SIGABA",
|
|
"args": [
|
|
"YCHLQSUGBDIXNZKERPVJTAWFOM", true, "A",
|
|
"INPXBWETGUYSAOCHVLDMQKZJFR", false, "B",
|
|
"WNDRIOZPTAXHFJYQBMSVEKUCGL", false, "C",
|
|
"TZGHOBKRVUXLQDMPNFWCJYEIAS", false, "D",
|
|
"YWTAHRQJVLCEXUNGBIPZMSDFOK", true, "E",
|
|
"QSLRBTEKOGAICFWYVMHJNXZUDP", false, "F",
|
|
"CHJDQIGNBSAKVTUOXFWLEPRMZY", false, "G",
|
|
"CDFAJXTIMNBEQHSUGRYLWZKVPO", true, "H",
|
|
"XHFESZDNRBCGKQIJLTVMUOYAPW", false, "I",
|
|
"EZJQXMOGYTCSFRIUPVNADLHWBK", false, "J",
|
|
"7591482630", "0",
|
|
"3810592764", "1",
|
|
"4086153297", "2",
|
|
"3980526174", "3",
|
|
"6497135280", "4",
|
|
"Encrypt"]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: "SIGABA: decrypt test",
|
|
input: "AKDHFWAYSLHJDKXEVMJJHGKFTQBZPJPJILOVHMBYOAGBZVLLTQUOIKXFPUFNILBDPCAELMAPSXTLMUEGSDTNUDWGZDADBFELWWHKVPRZNDATDPYEHIDMTGAGPDEZYXFSASVKSBMXVOJQXRMHDBWUNZDTIIIVKHJYPIEUHAJCNBXNLGVFADEWIKXDJZBUTGOQBCQZWYKRVEENWRWWRYDNOAPGMODTPTUJZCLUCRDILJABNTBTWUEIJSJRQBUVCOUJJDWFMNNUHXBDFYXLGUMXQEAWSVHBXQGEOOGPYRVOAJLAIYIOHHEXACDTAWWCBGQRNPERSIKHTXPXKBUNACZLFZTRBMBBDDGKNBIQMFHZROCZZBGNZSJKDRRWPEQHLCFADNPWPWSLPIFNKBWQPMARUERGWUUODXSCOJQECGHIZRFRNRSXWSFWKISHHTUFRVXLHCQWGBMRDHCYDSVNIDDRSTODCGJSSBLUYOBGEWFOVKOZBJTYCAKMZECUGLJGTSZJNBOLTMUZRRSIGGRQHLRPMGLINASSMZOBNACKUMSFNIZAUFCPFXXOOTJQWWLZOFLGZLHJCWZJCRJKVOUDLNMKQATGVTOFHACAEKFLRWRTTMVRXHYGOTYPNBMUSKDAKXFCICUOVSWXGPQOYUUWTWRPQMEQCSDJMMJKELIHGEDYKWOVHVPUAIBFGAODXODXVFIIZIGWRZSBTIGXVHFABMMOPGVMLGHQQXNOEJRDLOBGUOWSELBHERZFSBLUODMOGIBNVGVGQYDBTKLOPNKZZNGLTTGZYYXIBAHZJDCILZXKNSJDHXWT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UCBDXRJHGPKPYXHPPPNVSBBCDRLVVIYPKAKYIXTJVYDGVPHXULWMADBEICNIFKWUOOHEFNANDKOXMCVBVORLQYNXLULOEGVGWNKNMOHYVRSYSOVYGAKCGAWKGAIAQNQR",
|
|
recipeConfig: [
|
|
{ "op": "SIGABA",
|
|
"args": [
|
|
"YCHLQSUGBDIXNZKERPVJTAWFOM", true, "A",
|
|
"INPXBWETGUYSAOCHVLDMQKZJFR", false, "B",
|
|
"WNDRIOZPTAXHFJYQBMSVEKUCGL", false, "C",
|
|
"TZGHOBKRVUXLQDMPNFWCJYEIAS", false, "D",
|
|
"YWTAHRQJVLCEXUNGBIPZMSDFOK", true, "E",
|
|
"QSLRBTEKOGAICFWYVMHJNXZUDP", false, "F",
|
|
"CHJDQIGNBSAKVTUOXFWLEPRMZY", false, "G",
|
|
"CDFAJXTIMNBEQHSUGRYLWZKVPO", true, "H",
|
|
"XHFESZDNRBCGKQIJLTVMUOYAPW", false, "I",
|
|
"EZJQXMOGYTCSFRIUPVNADLHWBK", false, "J",
|
|
"7591482630", "0",
|
|
"3810592764", "1",
|
|
"4086153297", "2",
|
|
"3980526174", "3",
|
|
"6497135280", "4",
|
|
"Decrypt"]
|
|
}
|
|
]
|
|
}
|
|
]);
|