This is a Javascript implementation of the British Rotor Cipher Machine - Typex.
TypeX.init() accepts 4 arguments:
- Which rotors to use.
- The orientation of the rotors. 1 = reversed.
- The indicator key (the starting position for each rotor)
- Text to encipher / decipher
Unfortunately the actual rotor wirings of the Typex have never been disclosed or recovered. So the wirings used in this example are that of the Enigma.
Either run from the command line with Node, or there is an example interface in example/index.html. Just open this file in your browser.
TypeX.init('01234', '00100', 'AOAKN', 'This is the string to be encoded');
// Output: KLHESNYNIMQAZHIZROBHDZHKWRQFFRTY
TypeX.init('01234', '00100', 'AOAKN', 'KLHESNYNIMQAZHIZROBHDZHKWRQFFRTY');
// Output: THISXISXTHEXSTRINGXTOXBEXENCODED