Enigma machine emulator

Personal
Cryptography
Python
Object-oriented Python 3 emulation of the Enigma M3 cipher machine, with rotors and reflectors as first-class classes.
Published

April 1, 2023

Personal project

Enigma M3 emulator screenshot

Idea

Reading about the Enigma cipher and Turing’s role in breaking it sent me down the rabbit hole of actually implementing the machine. The result is a faithful Python 3 emulation of the Enigma M3, modeled object-oriented with the machine and its components — rotors, reflectors, plugboard — as first-class classes.

Implementation

Each component is its own class with a clean substitution interface, so the machine itself is mostly orchestration over component composition. Settings are reproducible, which makes encrypt-then-decrypt round trips straightforward to verify.

Stack

Python 3, no external dependencies.

GitHub repository →