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:

PropertyWhat it RepresentsWhen It Changes
Rotor IDWiring + notch positionsChosen from inventory
RingstellungAlphabet ring offsetSet once per day
PositionCurrent rotationChanges 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:

  1. Encryption = decryption
  2. No self-encryption
  3. Correct stepping
  4. 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.

Β© 2026 Emil Irgi. All Rights Reserved. Template by Takuya Matsuyama.