Skip to content

Implementation & Experimental Verification

1. Project & Hardware Details

  • Project Lead / Author: Denis Maggiorotto
  • Implementation Type: Bare-metal MicroPython Cryptographic Firmware
  • Target Architecture: Enigma M4 (Kriegsmarine 4-rotor electromechanical cipher)
  • Location: Chieri (Turin), Italy
  • Hardware Platform: WaveShare RP2040-Tiny

2. Emulator Implementation Architecture

The core of this implementation relies exclusively on RP2040-based microcontroller boards, the enigmapython cryptographic library, and the MicroPython runtime. The implementation leverages the following architectural features to achieve computational autonomy:

  • AT Command Interface: The device operates seamlessly as a hardware peripheral, accepting configuration settings and streaming ciphertexts via a classic, modem-style AT command interface over a USB serial connection.
  • MicroPython Foundation: Written in pure Python, the firmware executes directly on RP2040-based microcontrollers using the MicroPython runtime, allowing complex cryptographic algorithms to run efficiently on embedded hardware.
  • Handler-Based Dispatching: Commands are implemented as isolated, runtime-loaded modules, ensuring a clean separation between I/O parsing and the actual cryptographic processing engine.
  • Centralized State & Memory Management: The emulator utilizes a strict Device State Singleton to maintain rotor positions securely in memory. To survive the severe RAM limitations of the hardware, it triggers automatic memory cleanup (garbage collection hooks) after state changes, making it capable of processing the lengthy, historically authentic ciphertexts required for validation.

3. Measurement Results & Methodology

To establish the physical hardware footprint, the assembled emulator was meticulously measured and documented according to the axis-aligned bounding box method.

  • Vendor Declared Dimensions: 23.5 mm (L) × 18.0 mm (W) × 2.1 mm (H) Vendor schematic

  • Vendor Declared Volume: 888.3 mm³

  • Measured Dimensions (Mean of 3 measurements): [Insert Length] mm (L) × [Insert Width] mm (W) × [Insert Height] mm (H)
  • Calculated Measured Volume: [Insert Volume] mm³
  • Measurement Instrument: Calibrated Digital Caliper Preciva 150mm Model LF326 P/N CS00270 with high-precision measurement resolution of 0.01mm (0.0005in).
  • Methodology: The dimensions were taken at the widest, longest, and highest points of the assembled RP2040-Tiny board, explicitly including the PCB, components, connectors, and solder joints, while excluding temporary I/O jumper wires. Each axis was measured 3 times, and the arithmetic mean was recorded as the final dimension.
  • Photographic Evidence: [Insert link/reference to high-resolution photos showing the calipers reading the exact L, W, and H dimensions of the board]

4. Verification Methodology

The project applies rigorous engineering verification standards to confirm both physical dimensions and cryptographic accuracy:

  • Dimensional Verification: High-precision digital caliper measurements taken across three independent trials following the axis-aligned bounding box standard.
  • Cryptographic Verification: End-to-end execution of authentic historical test vectors with reciprocal encryption/decryption checks executed directly on physical hardware over UART serial.

5. Cryptographic Validation

In accordance with the validation procedures defined in the specifications, the emulator's cryptographic accuracy and reciprocity were rigorously tested against authentic historical interceptions.

This implementation utilizes the following reproducible Verification Kit to demonstrate compliance:

  • verify_p1030700.sh based on the famous U-534 M4 interception preserved by the Hoerenberg Enigma M4 Project. This shell script automatically dispatches the exact authentic historical ring settings, rotor topology, and plugboard connections directly into the emulator over serial via AT commands, before streaming the 1940s ciphertext to visually demonstrate the translation into the original German plaintext.

Note: While the Verification Kit utilizes/provides a well known M4 message for immediate proof, the emulator is strictly not limited to this specific example. It is a functionally complete replica capable of encrypting or decrypting any authentic M4 Enigma configuration.

6. Reproducibility

To ensure complete transparency and reproducibility, the entire system is designed so that anyone can independently replicate these exact results:

  1. Acquire Hardware: Obtain a standard, unmodified WaveShare RP2040-Tiny microcontroller board.
  2. Flash Firmware: Connect the board via USB and drag-and-drop the pre-compiled .uf2 firmware image directly onto the drive to initialize the bare-metal emulator.
  3. Execute Verification: Run the verify_p1030700.sh script against the attached serial port to deterministically reproduce the historical cryptographic decryption.

Alternatively, users can manually reproduce the behavior by communicating with the board over any standard serial terminal (e.g., PuTTY, minicom, or screen). Below is the exact sequence of AT commands needed to initialize the historically accurate M4 configuration and decipher the first few characters of the P1030700 message:

# 1. Initialize M4 Model and B-Thin Reflector
# According to the specs, available reflectors are: BT (B-Thin) and CT (C-Thin)
AT+ENIGMA=M4
AT+REFLECTOR=BT

# 2. Configure Rotors (Fast to Slow, including Greek static rotor)
# According to the specs, available rotors for rotor 0 to 2 are: I, II, III, IV, V, VI, VII, VIII
# According to the specs, available rotors for rotor 3 (Greek) are: B (Beta) or G (Gamma)
# Format: AT+ROTOR=<idx>,<type>,<ring_setting>,<initial_pos>
AT+ROTOR=0,VIII,20,2
AT+ROTOR=1,III,2,6
AT+ROTOR=2,IV,0,12
AT+ROTOR=3,G,0,21

# 3. Configure Plugboard connections (Steckerbrett)
AT+PLUGBOARD=C,H
AT+PLUGBOARD=E,J
AT+PLUGBOARD=N,V
AT+PLUGBOARD=O,U
AT+PLUGBOARD=T,Y
AT+PLUGBOARD=L,G
AT+PLUGBOARD=S,Z
AT+PLUGBOARD=P,K
AT+PLUGBOARD=D,I
AT+PLUGBOARD=Q,B 

# 4. Stream historical ciphertext to the device 
# (Send characters individually followed by a newline; the device replies with the decrypted letter and OK for each character)
q
b
h
e
w

7. Verification Artifacts & Exhibits

To support the verification of this experiment, this repository contains the following indexed exhibits:

  • Exhibit A: Video Demonstrations & Physical Recordings
    • Continuous physical camera recording showing the hardware board, measurement process, and real-time decryption output.
    • [Link to Video File]
  • Exhibit B: Photographic Documentation
    • High-resolution images of the board and the measurement process.
    • [Link to Photo Directory]
  • Exhibit C: System Logs & Terminal Casts

    • The raw standard output logs (.txt files) and interactive terminal recordings (.cast files) documenting the exact AT commands, decryption streams, and reverse-encryption processes.

    Verification Kits Summary: In the following table, we summarize the Verification Kits provided in this repository, detailing their execution commands, completion status, output logs, and native video recordings:

    Verification Script Verification Command Execution Status Output Log Terminal Recording
    verify_p1030700.sh asciinema rec -q -c "./tests/verify_p1030700.sh" recs/rec_p1030700.cast --overwrite && asciinema convert -f raw recs/rec_p1030700.cast - > logs/verify_p1030700.txt ✅ VERIFIED verify_p1030700.txt rec_p1030700.cast

    Note: The Video Demonstrations have been recorded using asciinema to faithfully capture standard output directly from the hardware execution. You can seamlessly replay any .cast file linked above by running asciinema play <file.cast> in your terminal (e.g., asciinema play recs/rec_p1030700.cast).

  • Exhibit D: Board Firmware & Enigma Library Source Code