Encryption with the Enigma Machine

Germany used the Enigma encryption machine during the Second World War. The machine's alphabet consisted of lowercase letters, a dot, and whitespace, which is represented by the underscore "_". You can set rotors (permutations of the alphabet), reflectors (pairings within the alphabet), and rules (how rotors are rotated during encryption). Those were the fixed parts of the machine. Daily settings included the starting positions of the rotors. Further description is given as the Demonstration works. Choose one of the offered words and see the encryption proceed!


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


Each rotor has an ordered alphabet of length at the bottom and a permutation of the alphabet on top. On every rotor, for every letter X, there is a wire connecting X at the bottom to X at the top. Every letter at the top of the rotor is connected to the bottom letter just above it in the rotor or to the point just above it in the reflector, if the rotor is uppermost. In the reflector, there are wire connections between positions (i.e. positions in reflectors are matched in pairs).
When a letter is input to Enigma, the electricity goes through the wires described above (red line in animation). The coded letter is the letter where the electricity leaves the Enigma. After each coding, the rotors are rotated according to the rules. For every letter on each rotor there is a rule that gives the rotation after the coding if electricity goes through this letter. Every day the starting positions of the rotors were changed. You can set the starting position randomly by pushing the button.
When you let time go by slowly, you can see how the electricity passes through the Enigma machine during encryption and how the rotations happen. The last green letter of the picture is the letter that is currently encoding and the red word is the code up to that time. When electricity is in the rotor, the letter on this rotor is figured out on the side. This letter is important when the rotations take place.
Thanks to the reflector, if X is encrypted to Y (given a position of the rotors), Y is encrypted to X (with the same position of the rotors). This ensures that, with a given starting position of the rotors, encrypting some encrypted text will return the original text.
A detailed description of the Enigma machine is given by Graham Ellsbury [1].
[1] G. Ellsbury. "The Enigma Machine." (Jan 17, 2013) www.ellsbury.com/enigma2.htm.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+