Skip to content

bmoneill/enigma

Repository files navigation

enigma

An Enigma machine simulator and toolset for cryptanalysis

Linux CI status macOS CI status Windows CI status Doxygen status clang-format status Demo status Coverage

Table of Contents

Overview

This is a full-featured C99 library and toolset (with WebAssembly support) for simulating and cracking the Enigma.

The library and toolset currently supports simulating all common 4-rotor military Enigma configurations used in World War II. It also supports cracking ciphertext utilizing Index of Coincidence and n-gram analysis.

An online demo is available.

About the Enigma

The Enigma was a cipher device used by the Germans during World War II to encrypt military communication. It uses a very complex wiring system to scramble the input.

When a key is pressed, the signal first passes through the plugboard, which swaps the letter with another according to its configuration. It then travels through three rotors, each further scrambling the signal. Next, the signal reaches the reflector, which further scrambles the signal. Then, the signal passes through the rotors again in reverse. Finally, the signal passes through the plugboard again, and the resulting encoded letter lights up on the lampboard. The Enigma's encryption was symmetric — ciphertext is decrypted using the same key as was used to create it.

Building

Prerequisites

  • A C99 compiler
  • CMake 3.31.6 or later
  • WSL or MinGW (Windows only)

Building and Installing

# build library and tools
cmake -S . -B build
cmake --build build

# install library and tools
cmake --install build

Building the Web Demo

This only works on Linux and macOS.

# build the library first!
./build_webdemo.sh

Testing

git submodule update
cmake -S . -B build -DTEST=ON
cmake --build build
cd build
ctest --verbose

Tool Documentation

Further Reading

License

Copyright (c) 2025-2026 Ben O'Neill ben@oneill.sh. This work is released under the terms of the MIT License. See LICENSE for the license terms.

About

An Enigma machine simulator and toolset for cryptanalysis

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors