Deterministic Enigma Simulator
2025-12-15
When people think about the Enigma machine, itβs often described as mysterious or inscrutable β press a key, a lamp lights up, and something unknowable happens inside.
In reality, Enigma was neither random nor mysterious.
It was a fully deterministic electromechanical machine, governed entirely by mechanical state and fixed wiring. If you understand those rules, Enigma becomes predictable, testable, and β ultimately β breakable.
This project is a transparent Enigma simulator built to make that determinism visible.
π§ Enigma Was Deterministic, Not Random
Enigma never generated randomness on its own.
Given:
- the same hardware
- the same configuration
- the same starting positions
- the same sequence of keypresses
it will always produce the same output.
This simulator enforces that property strictly. There is:
- no RNG
- no entropy
- no time-based mutation
- no hidden state
If two runs differ, itβs because the configuration differed.
π’ Letters vs Numbers (How Enigma Actually Thinks)
Inside the Enigma machine, letters do not exist.
Internally, the machine operates on:
- 26 numbered electrical contacts (0β25)
Letters exist only:
- on the keyboard
- on the lampboard
- on the alphabet rings for the operator
This simulator uses letters only as a human-facing representation. All internal transformations are numeric and fully inspectable.
βοΈ Rotors: Three Independent Settings
Each rotor has three independent properties:
| Property | What it Represents | When It Changes |
|---|---|---|
| Rotor ID | Wiring + notch positions | Chosen from inventory |
| Ringstellung | Alphabet ring offset | Set once per day |
| Position | Current rotation | Changes every keypress |
Ringstellung is numeric because it represents a mechanical offset, not a visible state.
π Rotor Stepping and Double-Stepping
Rotor movement is mechanical, not logical.
This simulator implements:
- right rotor stepping on every keypress
- middle rotor stepping at its notch
- correct double-stepping behavior
- left rotor stepping only during double-step
π The Plugboard (Steckerbrett)
The plugboard swaps letters before and after the rotor stack.
Rules enforced:
- pairwise swaps only
- no self-mapping
- no duplicates
The plugboard does not weaken or fix the reflector flaw.
π The Reflector (The Core Flaw)
The reflector ensures:
No letter can ever encrypt to itself.
This invariant enables crib-based attacks and made the Bombe possible.
ποΈ Machines Modeled
Enigma I / M3
- Rotors: IβV
- Reflectors: B, C
- Rotor count: 3
Kriegsmarine M4
- Rotors: IβVIII
- Thin rotor: Beta or Gamma
- Reflectors: B-thin or C-thin
- Rotor count: 4 (one static)
Thin components are hardware-coupled and enforced by the simulator.
π Signal Path
Keyboard β Plugboard β Rotors β (Thin Rotor) β Reflector β (Thin Rotor) β Rotors β Plugboard β Lampboard
π¦ Exported Configuration
Exported configurations are equivalent to WWII key sheets, encoded as JSON.
π§ͺ Testing the Simulator
A correct model must satisfy:
- Encryption = decryption
- No self-encryption
- Correct stepping
- Legal hardware only
π¬ Why Build This?
For the same reason as the Provably Fair Dice Roller:
Trust is strongest when it is unnecessary.
Enigma was broken by understanding β not guessing.
Check this project here.
Built with Next.js and deliberate transparency.