The Enigma machines were a series of electromechanical rotor ciphers based on a German engineer, Arthur Scherbius's invention . Enigma machines were widely used by Nazi Germany during the World War 2. British scientist Alan Turing, leveraging on earlier breakthrough by three Polish military intelligence cryptanalysts Marian Rejewski, Jerzy Różycki and Henryk Zygalski, led the effort to break the cipher. Poor configuration and usage of the machine also facilitated the cryptanalysis. Breaking Enigma was a very important breakthrough that supported the Allied forces' war efforts, without which the outcome of the war and the world we live in today might have been quite different.
This enigma emulator has been developed by Leelar Thaophialuang as part of a set of demonstrators of basic cryptography techniques created in the School of Computer Science and Engineering at NTU Singapore under Anwitaman Datta's initiative, and captures the functionality and complexity of the Enigma machine. The emulator only simulates the three rotor Enigma M3 (Army; Navy). Reference materials for further reading can be found in the acknowledgement section. The last tab provides the actual emulator (works on Firefox & Opera).
1. This emulator was designed and implemented by Leelar Thaophialuang as part of his final year project in the School of Computer Science and Engineering at NTU Singapore.
 By Bob Lord - German Enigma Machine, uploaded in english wikipedia on 16. Feb. 2005 by en:User:Matt Crypto, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=258976
 B.Lucattelli.(2006). Writing the Enigma Machine in ABAP: An Educational Project[online]. Available at: http://lucattelli.com/talks/enig-en/
 By Punishar - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=48423083
 Crypto Museum.(2009). Enigma Cipher Machine[online]. Available at: http://www.cryptomuseum.com/crypto/enigma/img/exploded.gif
 By en:User:Wapcaplet - uploaded in english wikipedia on 30. Jul. 2004 by author, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=258985
 T.Long.(2009). Enigma Simulator by Terry Long[online]. Available at: http://www.terrylong.org/images/screenshots/2.png(URL)
 T.Sale. Technical Specification of the Enigma[online]. Available at: http://www.codesandciphers.org.uk/enigma/rotorspec.htm(URL)
When a plaintext letter is pressed on the keyboard, the pressed key triggers an electric current which goes through the rotated components of the Enigma Machine. Once the current reaches the destination, a bulb that is coresponding to the ciphertext lights up. Encipherment with Enigma is special in that the same plaintext letter will not yield the same ciphertext letter next time (polyalphabetic substitution). This is due to the fact that every time a letter is typed, the right most rotor is rotated one step so that when the same letter is pressed again, it would not be enciphered as the same ciphertext letter. To add complexity to the enigma's encipherment, a plugboard was introduced to allow pairs of letters to be swapped before it actually goes through the movable elements of the Enigma. To make things even more complicated, different settings can be applied to every element of the Enigma machine so that different settings would uniquely generate different overall encryption.
The keyboard is used to type the text to be encrypted or decrypted. The keyboard accepts the entered letter and relays the letter to the plugboard. It consists of 26 alphabets and it is an old QWERT layout, as shown in following figure. When any key on the keyboard is entered, an electric signal representing the key is sent to the plugboard.
Plugboard (Steckerbrett in German) allows incoming signal or outgoing signal to be swapped first before it goes through the rotors or goes out to the Lampboard. Introduction of the plugboard to the Enigma machine made it more robust. Normally, plugboard setting is manually created by plugging two wires together, and the number of pairs are limited to 10 pairs only. The plugboard has an additional constraint that no single letter can be mapped to two different letters. Any letter that has no pair is implicitly mapped to itself.
Image source: 
A static rotor plays the role of a base reference. It has 26 letters with fixed positions. The static rotor seems to be doing nothing (in that it is static) but it has been chosen so that with every step of the right most rotor's rotation, the mapping of the letters between the right rotor and the stator varies significantly.
The rotors (alternatively wheels or drums, Walzen in German) are the main component of the Enigma machine. Every rotor has 26 contacts (letters) associated with 26 pins. The pins and contacts represent the 26 alphabets A-Z. A rotor individually can be seen to realize a monoalphabetic substitution cipher. For instance, in the Rotor 'I' (above Figure), the pin associated with the letter 'A' is wired to the letter 'E'. The complexity and security of the Enigma machine comes from the use of multiple rotors in a cascade, and their changing relative positions, which realize a polyalphabetic substitution. Each rotor has its own notch, used to indicate the step the rotor is in at a given time point.
Following table shows the internal-wiring/mapping of different rotors at default setting or when ring settings are set to zero.
Each rotor has one or two notches. Notch refers to the stepping mechanism. For single stepping, a rotor has only one notch and when the rotor has fully finished one round, it will trigger another rotor to move forward one step. This happens when a pal on the rotor meets the notch. For double stepping, rotor has two notches for triggering another rotor's step. It is not necessary that a rotor to fully finish one round for a next rotor to rotate, since, having two notches, the rotor can meet a notch earlier.
Note:Following table corresponds the Enigma machine M3 (Army; navy) only.
|Rotor VI,VII,VIII||Z and M|
Reflector (German: Umkehrwalze) is single-sided. The reflector takes the last input from the left rotor and performs a very simple substitution where its contacts are swapped in pairs. Two possible reflectors are available for the Enigma machine, each of them is wired up with different combination of wirings so that every single letter is reflected differently.
|Reflector Model||Pair of wirings|
|B||(BR) (CU) (DH) (EQ) (FS) (GL) (IP) (JX) (KN) (MO) (TZ) (VW)|
|C||(AF) (BV) (CP) (DJ) (EI) (GO) (HY) (KR) (LZ) (MX) (NW) (TQ) (SU)|
The lampboard follows the same layout as the keyboard. Each letter has its coresponding bulb, which lights up to represent the enciphered or deciphered letter obtained from the encryption and decryption respectively.
Enigma is a symmetric encryption system, so it is assumed that some secrets have already been agreed and exchanged a priori. These secrets are key, ring's order, ring setting, reflector setting, plugboard, and initial display windows.
Plugboard setting is indicated with a red rectangle in the figure below. To set the plugboard, first choose a pair of alphabets. Then click the first alphabet on the right side of the plugboard followed by clicking the second alphabet on the left side of the plugboard. When a character is clicked, the clicked pin will change its background to yellow signaling that the clicked pin is selected. This forms a pair of plugboard setting.
Following figure shows the above instructions. Since plugboard setting has a constraint that no single alphabet can be mapped to two different alphbets, in this example we are trying to swap 'K' with 'S'. We find that there are two wires, one is mapping the letter 'K' to the letter 'S' while another one is mapping the letter 'S' to 'K'. The number of pairs are limited to 10 pairs only.
The red rectangle shows the Walzenlage or Ring's order. There are three rotors from left to right: left rotor (outer), middle rotor, and right (inner) rotor. From left to right we can arrange the order of the rotor in any order by clicking the right-arrow button or left-arrow button. This emulator supports 8 differents rotors, namely 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', and 'VIII'. To set the ring's order, three rotors are chosen from these 8 rotors based on ones preference. Duplicating the rotor type is discouraged, example: "II II II", "II I II","II II I", and other duplicated orders.
Reflector Setting is highlighted by the red rectangle. In emulator implements two types of reflectors - reflector 'B' and reflector 'C'. To change the setting, click on the right-arrow button or left-arrow button. Different reflectors are wired differently.
The wiring of the Eintrittzwalze (ETW, entry wheel) between the Plugboard and the Rotors cannot be manipulated.
Ring Setting is the area of red rectangle. Changing the ring setting makes changes to the internal-wiring mapping. Each rotor has 26 possible ways of setting and setting ranges from 0-25. Changing the setting can be done by clicking left-arrow button or right-arrow button.
The display windows are shown in the red rectangle. Display windows are current positions of the three rotor which can be seen by the officer or user. Scrolling up and down the rotor will change the windows value (current positions). Display windows has to be firstly set before encryption/decryption. Display windows are secret from intruders and attackers. Every time a letter is typed, diplay winodow of the right most rotor is increased by one offset, followed by a conditional stepping if any of the midlle rotor or left most rotor meeting corresponding notches.
Inputs and Outputs is the area indicated with a red rectangle, located at the bottom of the Enigma emulator. This is an artefact of the emulator itself, where the input and corresponding output is printed to explicitly keep track of what has been typed as well as what has been the resulting enciphered text.
Reset Button is highlighted by the red rectangle. User can reset the enigma emulator to its default settings by clicking this button.