All operations

Enigma machine

The German forces cipher machine, wired as it actually was.

What is loaded above

That is a real message, from the Enigma Instruction Manual of 1930, with the settings it was sent under. The output box holds the German plaintext, beginning FEINDLIQEINFANTERIEKOLONNEBEOBAQTETX: an enemy infantry column was observed.

Change any single setting and it collapses into nonsense. That fragility is the point of the machine, and it is also what made operator mistakes so valuable to the people trying to break it.

How it works

Each keypress sends current through the plugboard, three rotors, a reflector, back through the rotors and the plugboard again, and out to a lamp. A rotor turns before the current flows, so pressing the same key twice gives two different letters.

Ring settings rotate the wiring inside each rotor relative to its lettered rim. Positions are what the operator saw in the windows. The plugboard swaps pairs of letters before and after the rotor stack, and contributed most of the machine’s key space.

The flaw

The reflector guarantees no letter can ever encipher to itself. That single property, combined with predictable message openings, is what made the machine breakable. A guessed fragment could be slid along the ciphertext, and any position where a letter matched itself was eliminated instantly.

Encoding and decoding are therefore the same operation. Set the machine identically and run the ciphertext back through.

Verification

The rotor wirings, notches and reflectors here match the published tables, and the implementation was checked against the 1930 manual message, both parts of an Operation Barbarossa message from 1941, and the Scharnhorst message of 1943. The double-stepping behavior of the middle rotor, which is the detail most simulators get wrong, was verified against a documented keypress sequence and then differentially tested across three thousand random machine configurations against a second, independently written implementation.

Vigenere is the same idea of a shifting key, done with pencil and paper.