Simulating the Enigma Machine in Javascript