The Enigma M4 simulator


Enigma Home Page

The Enigma M4

The Enigma M4 is an evolution of the classic model of the military Enigma (Enigma I / M3). Safety is enhanced by the addition of a fourth rotor. On the other hand, to be able to use the M3 and transform them into M4, the reflector of the M3 (UKW B) is replaced by two elements: a new reflector but thinner and a rotor but also thinner than the others and which therefore cannot put on the side of the new reflector.

To further increase security, this new couple (Thin-B reflector and fourth beta rotor) is duplicated (Thin-C reflector and gamma rotor). The two new rotors (beta and gamma) being interchangeable (Thin-B + beta, Thin-B + gamma, Thin-C + beta, Thin-C + gamma).

Compatibility with M3

It is possible to configure the M4 to emulate the M3.

  • Thin-B + beta (grund and ring to A/01) = UKW B
  • Thin-C + gamma (grund and ring to A/01) = UKW C

Example of using my simulator

1) Print the syntax

$ python3 M4.py
Syntax: M4.py UKW ROT4 LEFT MIDDLE RIGHT STECKS RING GRUND [Debug]
Rotors: I, II, ... VIII, Thin-B, Thin-C, beta, gamma
Example: M4.py Thin-B beta II I VII AB:CD:EF AAAA AAAA

2) Example of deciphering a message

The following message is genuine. It was issued by the U-262 submarine.

$ cat U-262.cry
NCZW VUSX PNYM INHZ XMQX SFWX WLKJ AHSH NMCO CCAK
UQPM KCSM HKSE INJU SBLK IOSX CKUB HMLL XCSJ USRR
DVKO HULX WCCB GVLI YXEO AHXR HKKF VDRE WEZL XOBA
FGYU JQUK GRTV UKAM EURB VEKS UHHV OYHA BCJW MAKL
FKLM YFVN RIZR VVRT KOFD ANJM OLBG FFLE OPRG TFLV
RHOW OPBE KVWM UQFM PWPA RMFH AGKX IIBG

$ python3 M4.py Thin-B beta II IV I   \
"AT:BL:DF:GJ:HM:NW:OP:QY:RZ:VX" AAAV VJNA < U-262.cry
VONVONJLOOKSJHFFTTTEINSEINSDREIZWOYYQNNSNEUNINHALT
XXBEIANGRIFFUNTERWASSERGEDRUECKTYWABOSXLETZTERGEGN
ERSTANDNULACHTDREINULUHRMARQUANTONJOTANEUNACHTSEYH
SDREIYZWOZWONULGRADYACHTSMYSTOSSENACHXEKNSVIERMBFA
ELLTYNNNNNNOOOVIERYSICHTEINSNULL

Download

Le simulateur M4 (TAR)