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 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 CS00270with high-precision measurement resolution of0.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.shbased 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:
- Acquire Hardware: Obtain a standard, unmodified WaveShare RP2040-Tiny microcontroller board.
- Flash Firmware: Connect the board via USB and drag-and-drop the pre-compiled
.uf2firmware image directly onto the drive to initialize the bare-metal emulator. - Execute Verification: Run the
verify_p1030700.shscript 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 (
.txtfiles) and interactive terminal recordings (.castfiles) 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.shasciinema 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.txtrec_p1030700.castNote: The Video Demonstrations have been recorded using asciinema to faithfully capture standard output directly from the hardware execution. You can seamlessly replay any
.castfile linked above by runningasciinema play <file.cast>in your terminal (e.g.,asciinema play recs/rec_p1030700.cast). - The raw standard output logs (
-
Exhibit D: Board Firmware & Enigma Library Source Code
- Board Firmware:
enigma-core_firmware_v1.0.2_RPI_PICO.uf2(SHA256:5300f6c246d1e9febcd12cd02e0c8d13d8b40f31dd67fdb2e9dca1c4b9b98d0d) - Enigma Library Source Code: enigma-python v3.1.2
- Board Firmware: