Enigma Simulator & Breaker
Encrypt and decrypt with a simulated Enigma M3, or recover an unknown key from ciphertext alone. Everything runs in your browser.
Machine
Left
Middle
Right
Message
- Letters
- 0
- Rotor windows
- —
Enigma is reciprocal: keying the ciphertext with the same settings decrypts it.
Ciphertext
- Letters
- 0
Load an example
The third example uses ten plug pairs, which the quick search cannot touch, so it loads the crib attack in Advanced mode instead.
What you already know
Anything you can tell the search narrows what it has to rank. Ring settings are worth far more than the rotor order. Leave a box unchecked to search for it.
Left
Middle
Right
Known-plaintext attack (crib)
A crib is a word or phrase you expect the plaintext to contain, such as a routine phrase an operator kept sending. It is the one attack that still works against a full ten-pair plugboard, because it deduces the key from the crib instead of scoring how the decryption reads. If you know where it starts, say so; it is far quicker.
Thorough search
This climbs a plugboard for every rotor setting instead of a shortlist, which is where the estimate above comes from. The tab has to stay open and the machine awake until it finishes, and closing the tab or reloading the page loses the work. On a short message it may still come back with nothing.
The search covers the standard M3: rotors I–V in any order, either reflector, any ring setting and start position. The plugboard is the hard part, and more ciphertext always helps.
Result
Run a break and the recovered key and plaintext appear here.
- Rotors
- —
- Reflector
- —
- Ring settings
- —
- Start positions
- —
- Plugboard
- —
- Index of coincidence
- —
The left ring cannot be recovered from ciphertext alone, because any ring setting paired with the matching start position gives the same text. The key shown is an equivalent one.
How the search works
What the quick search manages, by plug pairs
A letter only survives a plugboard-blind decryption if the plugboard misses it going in and coming out, so with k pairs steckered only ((26−2k)/26)² of the message arrives intact: 100% at no pairs, 59% at three, 38% at five, 5% at ten. The index of coincidence the quick search ranks on is a pairs statistic, so its signal falls with roughly the square of that. At ten pairs there is nothing left to rank.
| Plug pairs | Messages recovered | Typical time |
|---|---|---|
| 0 | 92% | ~5s |
| 3 | 89% | ~5s |
| 5 | 61% | ~6s |
| 8 | 3% | ~6s |
| 10 | 0% | — |
How much telling it what you know helps
Ring settings are worth far more than the rotor order, because they cut the search enough that the ranking is no longer noise. If you know everything but the plugboard there is no search left to do, and the tool just climbs the plugs.
| You know | 8 pairs | 10 pairs | Time |
|---|---|---|---|
| Nothing | 3% | 0% | ~6s |
| Rotor order | 42% | 0% | ~3s |
| Rotor order + ring settings | 96% | 58% | ~1s |
| Everything but the plugboard | always | always | instant |
The crib attack
The crib attack deduces the key instead of guessing at it. Assume one letter's plug, follow the consequences round the loops the crib makes, and see whether they contradict themselves. A wrong rotor setting contradicts every assumption at once, which is why the plugboard costs the deduction nothing: with ten plug pairs and nothing else known, a 180-letter message comes out whole from a 25-letter crib.
Longer cribs are better, because a longer menu closes more loops, and loops are what let the deduction rule settings out. A known position is much faster than searching every place the crib could sit. If the tool says the crib cannot sit anywhere, the guess is wrong, so try another.
Thorough mode
Climbs a plugboard for every rotor setting instead of a shortlist, because at eight or ten pairs the quick ranking is noise and there is nothing to be clever with. It costs roughly 0.2 ms per setting, and a completely unconstrained search is around 55 million settings, so hours. Constraints cut that down fast, though it can still fail to find the key on a short message. It also runs the quick search alongside and keeps whichever result reads better, so asking for more work never gives you a worse answer.