Tea, milk, no
sugar. Thanks

Stuart Rutter, a developer at Square Enix in London. Enjoys cryptography, search algorithms, competitive coding, and start-up ventures.

Javascript
100%

PHP 5.x
100%

Objective-C (iOS)
100%

HTML5 & CSS3
100%

Node JS
90%

NRDBMS
90%

RDBMS
90%

Adobe CS
80%

Python
60%

Ruby
60%

Cryptography
50%

Chess
30%

Disclaimer: Howsoever expressed or interpereted, the opinions found herein do not represent those of my professional employer.

TypeX Emulator in Javascript

March 13th 2013

This is a Javascript implementation of the British Rotor Cipher Machine - Typex.

The code for this I have put on GitHub, usage is as follows.

Enciphering

var demo1 = TypeX.init('01234', '00100', 'AOAKN', 'This is the string to be encoded');
//demo1 == KLHESNYNIMQAZHIZROBHDZHKWRQFFRTY

Deciphering

var demo2 = TypeX.init('01234', '00100', 'AOAKN', 'KLHESNYNIMQAZHIZROBHDZHKWRQFFRTY');
//demo2 == THISXISXTHEXSTRINGXTOXBEXENCODED

TypeX.init() accepts the following parameters:

  1. Which rotors to use
  2. The orientation of the rotors. 1 = reversed
  3. The indicator key (the starting position for each rotor)
  4. Text to encipher / decipher

The majority of this code is based on that of the Enigma - their workings are very similar, with a few exceptions such as fixed position rotors (stators), and the rotors could be inserted in reverse.

Unfortunately the wirings of the Typex have never been disclosed or recovered. Unlike the Enigma the Typex had many more inserts which have mostly been destroyed, GCHQ have the only Typex insert collection that I know of from which the wirings could easily be recovered using a continuity tester. So, the wirings that I have used in this simulator are those of the Enigma as recovered by Rejewski.

comments powered by Disqus