• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!



Page history last edited by Jason 15 years, 6 months ago
Table of contents

Enigma M4 Message Breaking Project

Project Summary Description: http://distributedcomputing.info/ap-crypto.html#m4

URL: http://www.bytereef.org/m4_project.html

Blog: http://www.bytereef.org/m4-project-blog.html

Mailing lists: http://www.bytereef.org/mailinglists.html

Original client

Statistics: http://www.bytereef.org/m4-project-stats.txt

Recent results: http://www.bytereef.org/m4-project-results.txt

New Client

Statistics: http://www.bytereef.org/new-server-stats.txt

Recent results: http://www.bytereef.org/new-server-results.txt

What's new?


July 8th: New XML-RPC clients released. Clients now come with an installer.

March 28th: a new client was released. The new client implements some improvements in the attack, and addresses client side logging so you can more easily see what your computers are doing.

A low volume announce list has been created mailto:m4-announce@bytereef.org

Please see the project blog for details.

What are the encrypted messages?

There is further information on the website, but to summarize, the three encrypted messages (http://members.fortunecity.com/jpeschel/erskin.htm) the project is currently trying to crack were WWII time messages presented in Cryptologia magazine in 1996 in an exchange between cryptographers Ralph Erskine and Jim Gillogly. The messages in a report dated 25th November 1942 were intercepted somewhere in North Atlantic during the ten month special intelligence blackout from February to December 1942. The blackout was a result of the German U-boats switching from Hydra (Doplhin) cipher-system (http://uboat.net/technical/enigma_ciphers.htm) to more complex Triton (Shark) cipher-system simultaneously with adopting the four-rotor version of Enigma into general use on first of February. This proved to be more than either US or British intelligence could handle, contributing to significant Allied losses. While the allied intelligence eventually caught up with the improved encryption, the messages in question are believed to not have been broken before.

Frode Weierud, a cryptologist interested in Enigma machines (http://www.cryptocellar.org/), reportedly had the following to say about the messages: "The message format is such that it is 100% sure that these three messages are Enigma or RHV (Reserve Hand Verfahren) which was the backup hand cipher used in case something happened to the Enigma machine itself or they had lost or had to destroy their Enigma keys for some reason or another. As RHV were rarely used I think we can assume with a very [high] probability that these are genuine Naval Enigma messages. As I don't know where they were intercepted it is impossible to make any guess about the key in use or if they are enciphered on a three rotor or a four rotor machine."

Mostly the project has a curiosity value, though there is a very small possibility that the remaining unencrypted message could provide additional historical information about the war. An overview of the events surrounding the Enigma cipher and its significance from American perspective can be found, among other places, at http://www.ibiblio.org/pha/ultra/navy-1.html which was used as reference for "Triton blackout" description.

Details on the first decrypted message

From Dan Girard's 6/18/2006 post to the m4-breakers list:

The purpose of the message was to inform B.d.U. (U-Boat Command) of the contents of a previous message which U-264 had sent at 13:02 on that day, bearing the time/date group 1132/19 and the serial number 229, and which B.d.U. was unable to read because it had been enciphered incorrectly:
1302           Funkspruch 1132/19/229: 
"Bei Angriff unter Wasser gedrückt.
Wabos. Letzter Gegnerstand 0830 Uhr
AJ 9863, 220 Grad, 8 sm. Stosse nach.
14 mb fällt. NNO 4, Sicht 10.

English translation:

1302           Radio signal    1132/19/229:
"Forced to submerge during attack.
Depth charges. Last enemy position 0830h
AJ 9863, [course] 220 degrees, [speed] 8 knots. [I am] following [the enemy].
[barometer] [10]14 mb [tendency] falling, [wind] nor-nor-east,
[force] 4, visibility 10 [nautical miles].

Four hours later, B.d.U. sent this message:

1701           Funkspruch 1630/19/244: 
"FT 1132/19 auf Anton nicht gelöst.
Leitnummer 229 erledigt."

Translation: "Radio message 1132/19 on [radio circuit] 'A' not solved. Serial number 229 cancelled."

This entry in the war diary is followed by Looks' explanatory comment:

Es handelt sich um meinen Funkspruch, der
wegen falscher Schlüsseleinstellung un-
klar ist.

Translation: "This refers to my radio message, which is unclear due to incorrect key-setting."

The first message might have been enciphered with the wrong day's key, since its time/date group is close to the time (1200) when the key would change; or perhaps, if the "Stichwort" procedure (used for altering the Enigma settings when a compromise of the Enigma keys was suspected) was in effect, the radio operator might have made a mistake in applying the procedure. In any case, U-264 had to send a new message telling B.d.U. what the contents of the first had been, referring to it by its date/time group, 1132/19, and this second message is the one that was intercepted by the HF/DF operator aboard HMS Hurricane, and solved more than 63 years later by the M4 Project:

1930           Funkspruch    1851/19/252:
"F T 1132/19 Inhalt:
Bei Angriff unter Wasser gedrückt.
Wabos. Letzter Gegnerstand 0830 Uhr
AJ 9863, 220 Grad, 8 sm. Stosse nach.
14 mb. fällt, NNO 4, Sicht 10.

English translation:

1930           Radio signal    1851/19/252:
"F T 1132/19 contents:
Forced to submerge during attack.
Depth charges. Last enemy position 0830h
AJ 9863, [course] 220 degrees, [speed] 8 knots. [I am] following [the enemy].
[barometer] [10]14 mb [tendency] falling, [wind] nor-nor-east,
[force] 4, visibility 10 [nautical miles].

The U264 was exceptional in that unlike most other U-boats it suffered no casualties onboard during the war, and for having been the first operational U-boat equipped with a "schnorchel" (snorkel), a device allowing it to take air from surface while submerged. On 19th February 1944 the U264 took part in a battle with Royal Navy 2nd Escort Group and all of its crew were captured. The U-boat sank in the North Atlantic, South-East of Cape Clear, presumably taking its Enigma and codebooks with it. Though the U-boats fate was not related to the decrypted message, participants may find it interesting.

Details on the second decrypted message

From Dan Girard:

On November 18th 1942, U-43 (Schwantke) torpedoed and fatally damaged the American motor tanker "Brilliant" which was sailing with the eastbound convoy SC 109. U-43 lost contact with the convoy on the 19th due to fog, and U-boat command (B.d.U.) sent a radio message ordering U-522 (Schneider), U-663 (Schmid), U-445 (Fenn) and U-623 (Schröder) to join the search. Here is that radio message as it appears in U-623's war diary, and my rough translation:
1648  AL 4427  Eingang_FT._1544/19/242:
1.) Schneider mit Höchstfahrt zum Geleitzug
Schwandtke stossen zum Fühlung halten.
2.) Schmid, Fenn, Schröder mit Höchstfahrt
auf Geleit Schwandtke operieren. Standort
1325 Marqu. AJ 9164, nordöstl. Kurs.


1648  AL 4427  Incoming Radio Signal 1544/19/242:
1.) Schneider proceed at top speed to convoy
"Schwandtke" in order to keep contact.
2.) Schmid, Fenn, Schröder operate at top speed
on convoy "Schwandtke". Position at 1325
hours naval square AJ 9164, northeasterly course.

[Note: When the Germans located an Allied convoy, they designated it in their radio messages by the surname of the U-boat commander who first reported it, i.e. "Geleitzug Schwandtke." I've seen the name "Schwantke" or "Schwandtke" spelled both ways in radio messages in several war diaries; but since I don't have a copy of U-43's, I don't know which way he himself spelled his name. I've seen the name more often spelled without the 'd' than with it, though.]

On the evening of November 20th, B.d.U. ordered U-663, U-623 and U-445 to search along three suspected courses SC 109 might have taken from its last reported position:

1838 AK 1993  Eingang FT. 1726/20/289: 
1.) Auf Kollisionspunkt für folgende Geleit-
kurse operieren: Schmid 45°, Schröder 55°,
Fenn 65°. Falls Geleit nicht angetroffen,
nicht nach NO zurücksuchen, sondern
Standort melden und nach Marqu. BC 24
weiter marschieren. Fahrt so einrichten,
daß Qu. am 23. 0800 h erreicht wird.
2.) Schwandtke, Schneider solange suchen, bis
Boote zu 1.) gemeldet haben, dann marsch
zum Ergänzen bzw. Rückmarsch.


1838  AK 1993  Incoming Radio Signal 1726/20/289: 
1.) Operate on collision point for the following
convoy courses: Schmid 45°, Schröder 55°,
Fenn 65°. If convoy not found, do not search
back to northeast; instead report position and
cruise further toward naval square BC 24. Arrange speed
so as to reach square at 0800 hours on the 23rd.
2.) Schwantke and Schneider continue search until
boats in [paragraph] 1 have reported, then either
head for refueling or return [to base].

Then, at 0425 on the 21st, U-623 sent this reply, which later turned out to be the second message broken by the M4 Project:

0425           Ausgang FT. 0246/21/203: 
Auf Geleitkurs 55° nichts gefunden, marschie-
re befohlenes Qu. Standort Marqu. AJ 3995,
SO 4, See 3, 10/10 bedeckt, 28 mb steigend,
Nebel, Sicht 1 sm.


0425           Outgoing Radio Signal 0246/21/203: 
Found nothing on convoy's course 55°, [I am] moving
to the ordered [naval] square. Position naval square
AJ 3995. [wind] south-east [force] 4, sea [state] 3,
10/10 cloudy, [barometer] [10]28 mb [tendency] rising,
fog, visibility 1 nautical mile.
None of the U-boats was able to regain contact with SC 109. U-522 headed back to base; U-43 headed for a rendezvous with the "milch cow" U-tanker U-460; and U-445, U-663 and U-623 headed for naval square BC 24, the "befohlenes Quadrat" mentioned in the broken message.

Enigma M4 Client

Viewing local progress information

Updated Client

The UPDATED client (0.75) includes logging by default. Logging is recorded in logfile.txt within the project client directory. Log entries look like so ...

2006-03-30 07:01:22  enigma-client: trying to get workunit ...
2006-03-30 07:01:22 enigma-client: success: got workunit
2006-03-30 07:01:23 enigma: working on range ...
2006-03-30 09:03:02 enigma: finished range
2006-03-30 09:03:02 enigma-client: submitting results ...
2006-03-30 09:03:03 enigma-client: success: submitted results
2006-03-30 09:03:03 enigma-client: best result: M4=B:B253:YS:PSYY=AVELFJGUHPKOMWRZTY=1911139

The new client also uses a different server (TCP port) on the same host. The new client uses port 65521, while the old client uses port 65500.

As a result the instructions for using the client behind a firewall and some of the under-the-covers installation details have changed slighlty.

Please see the project blog for details.

Original Client

On both Windows and *nix machines you can use the above interactive running instructions to get some amount of feedback about the network connections of the client. This is good enough to see that it is working. The key-range currently under process can also be found out from 00hc.resume in the client directory; see separate section for interpetation of the file.

While I do not encourage modifying distributed computing software due to data integrity issues, people are likely to play around with this anyway, so here's how to obtain a real log file on *nix machines. Edit enigma-client.py in your client directory (f.e. pico ~/.enigma-client/enigma-client.py). Find the section near the end of the file reading:

""" main """
cmdseq = ('./enigma', '-R', '-o', '/dev/null', '00trigr.naval', '00bigr.naval', '00ciphertext')

This is the command line executed to run the actual decrypter task. Change the part reading '/dev/null' into 'logfile.txt' preserving the quote marks, making sure not to add extra newlines or other characters into undesirable places, and save the file. Now shutdown and restart your Enigma client, and you should have logfile.txt with progress reports in your client directory. This logfile may grow large over time, but you can delete it without affecting anything. There will be several entries for each chunk progressed, with each successively higher score of the chunk recorded.

If you feel like an adventure (some assembly required!), on Windows you can extract the enigma-suite source distribution for Windows (http://www.bytereef.org/enigma-suite.html) and install Python for Windows (http://www.python.org/windows/). In enigma-suite-win-0.73.3\enigma-client\enigma-client.py find the equivalent section of:

""" main """
cmdline = 'enigma.exe -R 00trigr.naval 00bigr.naval 00ciphertext > NUL'


Now add -o logfile.txt near the beginnging and remove > NUL from the end, making the code read:

""" main """
cmdline = 'enigma.exe -R -o logfile.txt 00trigr.naval 00bigr.naval 00ciphertext'


You will also need to edit ecrun98.bat and ecrunXP.bat to refer to the directory you installed Python in. Now move all the files into same directory where enigma.exe is installed and run the correct batch-file from there. Make sure the logfile doesn't fill the hard-drive or bad things will happen.

David Gamey has suggested alternative way using Unicon.

This procedure was developed as there was no way to get the log data on Windows. However, Unicon runs on many platforms and the vast majority of programs run without source changes. For Windows:

  • Download and install the windows binary from http://unicon.sourceforge.net
  • From My Computer, Properties, Advanced, Environment Variables, select path in 'Systemvariables' and add ';C:\Unicon\bin' (or wherever you put it) at the end (without the ' )
  • Cut and paste the attached program into a Text Editor (direct copy paste did not work for me in the Unicon IDE)
  • Save the file named resume-logfile.icn in your \EnigmaClient directory
  • Open resume-logfile.icn in the Unicon IDE
  • Select Compile, Make Executable from the menu
  • Copy the resume-logfile.exe into each of your \EnigmaClient<n> directories
  • To start manually: Double click on each copy in each directory
  • Alternately, this can be run as a scheduled task in the same way as the enigma-client
procedure main(arglist)
repeat {
p := open(f := "00hc.resume","r") | stop("Unable to open " || f)
l := open(f := "00hc-resume-logfile.txt","a") | stop("Unable to open "|| f)
L0 := L1
L1 := []
while put(L1,read(p))
if L1[1] ~== (L0)[1] then {
write(l,&date||" "||&clock)
every write(l,!L0)
delay( 60 * 1000)
every write(!L1) 


It reads 00hc.resume file, writing a timestamp and the last version of the file to 00hc.resume-logfile.txt any time it changes (based on the first line). Delays a minute and repeats.

While the enigma client restarts automatically, this must be (re)started manually.

Interpretation of 00hc.resume

Typical contents of 00hc.resume returned to assignment server:


The currently processed range (and momentarily, best found key) are stored in 00hc.resume in the client execution directory. If you have a script or a tool which can update its view (or save into separate log if you're really that interested in what you've processed so far) every time that file changes like the Unicon script presented, you can follow its progress without changing the program. The format is explained in doc\enigma.txt of the distribution, but here's a brief recap. Fields in that file are separated by =, and the first field of each row indicates the Enigma machine version emulated, in this case M4. The second field is the starting key of the range you're working, third is ending key of the range. Fourth would be the current key, but since the file is only written when the process is interrupted, it's always same as first (or last) key of the range unless the process has been interrupted.

After the three keys the next field in this example is 0 and indicates we're only testing keys where the middle-rotor ring is in A position to reduce search-space. Field after that is 1 for a new workunit and 0 for done range and indicates number of passes to do over the key-range in this workunit. The field after that indicates whether we're on the first pass overall or not, as there is slightly different approach for the first pass, explained in doc\restarts.txt of the distribution. In this example we're no longed doing first pass. Final number is the "max score" at which the message is considered cracked - this is just sufficiently large number to not normally happen.

The second row indicates best key found in the range. In a new work-unit it's always same as the first key of the range, then follows a field indicating the stecker or plugboard settings that the score was obtained with, and finally the score itself. Unfortunately it's not possible to view these locally after the workunit has been returned and a new one received from the assignment server. You could go to the server log and look for it if you're fast enough :) The score itself is "bogus" in that as long as the key hasn't been cracked, its pretty much random number under about 3 million. For the one message cracked so far, the score jumped to over six million, so a succesful crak of the key should be easy to detect but until that happens there's no inherent "goodness" in slightly higher scores.

A quick guide to the key format is "reflector disc:rotor-wheel order from left to right:ring position on middle and right rotor-wheels:initial position of rotor-wheels:stecker/plugboard cable plug-pairs". In Enigma M4 project reflector and the leftmost so-called Greek wheel are usually combined into a single 26 position Beta-rotor. The other three rotors are selected from eight alternate unique rotors and the middle rotor ring-position is normally locked to A. A single work-unit of keyblock usually consists of all different initial positions of the four (or three) 26-position wheels for which the client will try to find optimal plugboard settings to break the code. The key will probably make little sense without understanding the Enigma rotor design (http://en.wikipedia.org/wiki/Enigma_rotor_details).

Okay, what's that score anyway?

It's a Sinkov statistic, also known as log-weight statistics. You can think of it as one of those Star Trek-science handwaving things, like Linux' Bogomips. Dr. Abraham Sinkov (http://en.wikipedia.org/wiki/Abraham_Sinkov) was one of the lead cryptographers involved in the wartime Enigma deciphering effort. He is also author of "Elementary Cryptanalysis: A Mathematical Approach" (http://www.cambridge.org/uk/catalogue/catalogue.asp?isbn=0883856220), a key text in cryptanalysis, where the log-weight statistics are mentioned on p77. However, a lot of information can be derived from the Enigma client source alone.

The score is driven by two key tables, 00bigr.naval and 00trigr.naval. These files contain bigraph (two letter groups) and trigraphs (three letter groups) and their respective frequencies in the subject text. The tables are generated with the aid of tools/mkdict.py, from which we learn the frequencies are derived by calculating number of occurences of each substring per sample text length - the probability of that substring as one would expect. The frequencies are then normalized by taking natural logarithm out of f / u * e, where u is lowest non-zero frequency and f is frequency of that substring in sample text and e is base of natural logarithm. Finally, the result is multiplied by 10000 so the algorithms can work on integers only.

The score of the least common substrings - usually occuring once in sample text - is now 10000, next 16931, third 20986 then 23863 and so forth. As you can see using the logarithm stems the growth of the score for higher frequencies so they aren't over-emphasized. Good Turing smoothing isn't used by the current application, but a treatise on it can be found at http://www.grsampson.net/RGoodTur.html and it basically means estimating the real-world frequencies from measured statistical sample that isn't likely to include all possibilities. Code is included in util/SGT.c module. Stefan Krah reported the unsmoothed probabilities performed 2% better in his tests and were hence adopted.

Computation of the actual scores is included in score.c, and involves summing up the previously calculated normalized scores for each bi- or tri-graph appearing in the decryption candidate. The hillclimb algorithm in hillclimb.c in turn uses these functions to try to determine whether its close to a break or not. Internally, the hillclimb algorithm uses both bigraph and trigraph scores as well as sum of both scores and Index of Coincidence, but only the trigraph scores is saved for outside use. The short story in laymans terms is the score of random text is about 10000 per letter, but can go up to about 15000 without being statistically significant. The one break so far had trigraph score of 26300 per letter.

Running the client behind a firewall

The new clients (0.76 or greater) now have the capability to connect to an XML-RPC server. The installer for the new clients tries to determine which version to use.

The default clients still use port 65521 and should be used whenever possible.

Running the Client as a Service on Windows XP

Only use these instructions if you know what you are doing.

The official install instructions are at:

http://www.bytereef.org (http://www.bytereef.org/)


  • Install Enigma
    1. Unzip enigma-suite-winXPexe-0.73.3.zip
    2. Change into the unzipped folder
    3. Run (double click) eclient-XP-Home-install.bat
  • Change password to a secure random password
    1. Goto Start -> Control Panel
    2. Click on "User Accounts"
    3. Click on "enigma-client"
    4. Click "Change the password"
    5. Enter a new secure random password
    6. Remember or write down the password
    7. Click "Change password"
  • Install the service
    1. Download and install the Windows 2003 Resource Kit from here (http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en)
    2. Copy the files instsrv.exe and srvany.exe from the Resource Kit install directory (the default directory is C:\Program Files\Windows Resource Kits\Tools\) to C:\EnigmaClient\
    3. Run "instsrv Enigma-Client C:\EnigmaClient\srvany.exe" (sans quotes) from the command line in C:\EnigmaClient
  • Configure the service
    1. Run REGEDIT, and find HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\EnigmaClient
    2. Right-click on EnigmaClient
    3. Select [new]->[key], name the new key Parameters
    4. Right-click Parameters
    5. Select [new]->[string value], and name the new value Application
    6. Right-click on Parameters
    7. Select [new]->[string value], and name the new value AppDirectory
    8. Double-click Application, and enter C:\EnigmaClient\ecrunXP.bat
    9. Double-click AppDirectory, and enter C:\EnigmaClient
    10. Close the Registry Editor
    11. Run services.msc
    12. Right-click EnigmaClient -> Properties
    13. Click the Log On tab
    14. Set the radio button to This Account and the username field to enigma-client
    15. Change the password to whatever you set it to earlier (you'll have to enter it twice) and click OK
    16. Reboot

Parts of this tutorial are taken from this document (http://miketechshow.com/files/create_your_own_service.pdf) from the Mike Tech Show (http://miketechshow.com)

Windows Client Annoyances

Clients version 0.76 or higher:

All of the annoyances below should be fixed.

Older clients:

The standard installation instruction establish the enigma-client as a scheduled task. The installation instructions address most if not all of these; however, if you've been running a while you may have missed them. Here's what's been discovered to date:

Localization of schtasks parameters required for installation script

In the install script the line schtasks /create ... onstart must be localized. In particular "onstart" must be localized.

Windows XP/Pro Account Passwords Expire

After running the enigma-client for a few weeks on Windows XP/Pro it silently fails to start because the password expires. In Windows XP/Pro the passwords expire by default after 42 days. This should not affect XP/Home users.

The Official MS/kb/FAQ on "Why do my accounts keep getting locked out?" can be found at http://www.microsoft.com/windowsxp/expertzone/newsgroupfaq.mspx#E5H

The project page on this issue can be found at: http://www.bytereef.org/howto/m4-project/change-passwd-expiry.html

To make a single user's password none expiring use the following:

1. Go to Start --> Run
2. Type: control userpasswords2
3. Select the Advanced tab in the User Accounts window
4. Press the Advanced button below the Advanced user management header
5. Select Users in the Local Users and Groups
6. In the right pane, right-click the user name for which you 
want to change the setting, and select Properties
7. On the General tab, check Password never expires
8. Click Apply and OK (all the way out) 

Then restart the scheduled task (from Start, Accessories, Scheduled Tasks).

Please ensure you have chosen a strong password, see Default password below.

Scheduled Tasks terminate after 72 hours

By default a scheduled task will terminate after 72 hours. Furthermore, there appears to be no means to set this from the commmand line.

The scheduler logs will show something like:

"ecrunXP.job" (ecrunXP.bat) 08/03/2006 6:47:57 PM ** WARNING ** The task was forced to close since its execution time exceeded the configured 


The manual solution involves the following:

Goto: start -> All Programs -> Accessories -> System Tools
Click on "Scheduled Tasks"
Right-click ecrunXP.bat
Click on "Properties"
Click the "Settings" tab
Deselect "Stop the task if ..."
Click "Apply"
Click "OK"

Default Password

Just in case you didn't see the reference in the project page, change the default password after installation. While not exactly an annoyance, this has been reported in the news and on several security sites as a security vulnerability. See how to change the default password for the Windows client (http://www.bytereef.org/howto/m4-project/changepasswd-bgtask.html) for more detail.

Verifying the first decryption

The first message decrypted proved to have been a U-boat communication from the North Atlantic encrypted with the 4-rotor Enigma, giving credence to the speculation about their encryption method. Evidence of the decryption can be obtained by the following commands:

On Windows, with enigma.exe in the current directory (C:\EnigmaClient):

C:\EnigmaClient>echo nczwvusxpnyminhzxmqxsfwxwlkjahshnmcoccakuqpmkcsmhkseinjusblkiosxckubhml lxcsjusrrdvkohulxwccbgvliyxeoahxrhkkfvdrewezlxobafgyujqukgrtvukameurbveksuhhvoyh abcjwmaklfklmyfvnrizrvvrtkofdanjmolbgffleoprgtflvrhowopbekvwmuqfmpwparmfhagkxiibg | "./enigma" -M M4 -u B -w B241 -r AAAV -s ATBLDFGJHMNWOPQYRZVX -m VJNA

On Unix:

perig:~/enigma-suite-0.73.1>echo "nczwvusxpnyminhzxmqxsfwxwlkjahshnmcoccakuqpmkcsmhkseinjusblkiosxckubhmllx csjusrrdvkohulxwccbgvliyxeoahxrhkkfvdrewezlxobafgyujqukgrtvukameurbveksuh hvoyhabcjwmaklfklmyfvnrizrvvrtkofdanjmolbgffleoprgtflvrhowopbekvwmuqfmpwp armfhagkxiibg" | ./enigma -M M4 -u B -w B241 -r AAAV -s ATBLDFGJHMNWOPQYRZVX -m VJNA

It is not possible to say for certain that all three messages are encrypted using same system. The message is signed by Kapitänleutnant Hartwig Looks, at the time commander of the German U264 submarine, dated and intercepted November 19th 1942. A matching entry was found in captain's log for the same day (see above).

Verifying the second decryption

The second message decrypted was also a U-boat communication from the North Atlantic encrypted with the 4 rotor Enigma. Evidence of the decryption can be obtained by the following commands:

On Windows, with enigma.exe in the current directory (C:\EnigmaClient):

C:\EnigmaClient>echo tmkfnwzxffiiyxutihwmdhxifzeqvkdvmqswbqndyozftiwmjhxhyrpaczugrremvpanwxgtkthn rlvhkzpgmnmvsecvckhoinplhhpvpxkmbhokccpdpevxvvhozzqbiyieouseznhjkwhydagtxdjd jkjpkcsdsuztqcxjdvlpamgqkkshphvksvpcbuwzfizpfuup | "./enigma" -M M4 -u B -w B241 -r AANV -s ATCLDHEPFGIOJNKQMURX -m MCSF

On Unix:

perig:~/enigma-suite-0.73.1>echo "tmkfnwzxffiiyxutihwmdhxifzeqvkdvmqswbqndyozftiwmjhxhyrpaczugrremvpanwxgtkthn rlvhkzpgmnmvsecvckhoinplhhpvpxkmbhokccpdpevxvvhozzqbiyieouseznhjkwhydagtxdjd jkjpkcsdsuztqcxjdvlpamgqkkshphvksvpcbuwzfizpfuup" | ./enigma -M M4 -u B -w B241 -r AANV -s ATCLDHEPFGIOJNKQMURX -m MCSF

Running the client interactively


Clients version 0.76 or greater:

Run the installer. Say no to the question of setting up a background task. Change into the newly created run directory. Run fgstart.bat.

Older clients:

The client installation instructions explain how to install the client as a service (which will allow it to run in the background whenever your system is running). Windows users who would like to run it interactively can do the following:

* extract the project archive file into a folder
* cd into the project folder, and into the "run" folder inside it
* run ecrunXP.bat to run the application
* press CTRL-C to exit the client

ecrunXP.bat does not display any output from the client by default. Edit ecrunXP.bat and remove "> NUL 2>&1" from the end of the command. Then when you run the client you will see status text like: enigma: working on range ...


Clients version 0.76 or greater:

Run the installer. The script fgstart is generated and placed into the run directory. Change into the run directory and run fgstart.

Older clients:

Linux users who would like to run the client interactively can do the following:

* make sure that no other client is running in the same directory
* cd ~/.enigma-client
* ./enigma-client.py keyserver.bytereef.org 65521
* stop with Ctrl-C

If you want to be able to follow the client progress, but don't want to take up a terminal (virtual as it MAY be) run the client with:

* screen ./enigma-client.py keyserver.bytereef.org 65521

Ctrl-A-D will detach that session, leaving it still running on the background. Run "screen -r" to redisplay the session.

Mac OS X

see Linux.


Ubuntu / Debian

To compile the client under Ubuntu 5.10 or Debian you have to add several packages if you don't already have them installed:

* sudo apt-get install gcc
* sudo apt-get install make
* sudo apt-get install libc6-dev

FreeBSD & OpenBSD

Mac OS X

Note: this worked for me under Mac OS X 10.4 (Tiger). It has also been tested on Panther and it should also work on earlier versions, but YMMV.

Note: You can follow the unix installation guides to the letter provided you have gcc etc. installed. For interactive use, just forget about the inittab and cron stuff. Also, pstree is not installed on default Mac OS X installation, but is available from f.e. DarwinPorts. It's not required for installation and anyway, you can also use Activity Monitor.

1. PREREQ: You should have the developer tools (i.e. gcc) installed before attempting a compile

2. Visit this page, and download the current/latest Unix source version from here:


3. gunzip and untar the source code in a subdirectory of your choice. (If you downloaded using Safari, this all might happen automatically if you have enabled opening of safe formats.)

4. Review the INSTALL document

5. You should review the following configuration files. I did NOT need to modify these files to get a good compile on my system.

6. Run the make command. My output looked like this:

% make

./compile enigma.c

./compile charmap.c

./compile cipher.c

./compile ciphertext.c

./compile date.c

./compile dict.c

./compile display.c

./compile error.c

./compile hillclimb.c

./compile ic.c

./compile input.c

./compile key.c

./compile result.c

./compile resume_in.c

./compile resume_out.c

./compile scan_int.c

./compile score.c

./compile stecker.c

./load enigma charmap.o cipher.o ciphertext.o date.o dict.o \ display.o error.o hillclimb.o ic.o input.o key.o result.o \ resume_in.o resume_out.o scan_int.o score.o stecker.o -lm

./compile tools/SGT.c -o tools/SGT.o

./load tools/SGT -lm


7. Follow the recommended installation from the INSTALL file. Also note that the following files are located in the tool subdirectory. You need administrator access (i.e. sudo-rights (recommended) or login as root (insecure)) to do the installation.



8. After your successful compile and installation, cd to the enigma-client subdirectory (~/.engima-client). From here, run the eclient-install.sh command.

9. complete

  • Note* If you see the message

head: `-1' option is obsolete; use `-n 1'

delete the directory, untar the file and run the following before running make:

perl -p -i -e 's/head -1/head -n 1/' Makefile


Successfully compiled the client code on Solaris Sparc using GNU make and GCC from http://www.sunfreeware.com/

No modifications to conf-cc or conf-ld were necessary

Install as root

Client code was also successfully compiled on Solaris 10(X86) using the Sun Studio 11 compiler. Modify conf-cc and conf-ld to contain just:


You can probably experiment more with the optimizer settings.

To run the eclient-install-sh, use bash:

/usr/bin/bash ./eclient-install.sh

Optimizing performance on GCC

NOTE: Do not run benchmarks in the distributed client installation directory, this will corrupt your 00hc.resume file!

Jeff Gilchrist has done some optimization experiments using a 3Ghz Pentium 4 Xeon processor on Fedora Core 3 and gcc 3.4. Best performance results were obtained using the following options defined in conf-cc

gcc -Wall -W -O3 -march=pentium4 -msse2

In general performance under other processors has increased by adding the -O3 option to gcc, but YMMV. If you wish to do your own optimzations, an ad-hoc benchmark can be done using the following options:

time ./enigma -c -f B:524:AZ:AAA -t B:524:AZ:ZZZ dict/00trigr.gen dict/00bigr.gen ct/orig1

Need for -msse2 switch seems specific to Pentium 4 (and prescott and nocona based on it, though for them -msse3 may be better). According to GCC man-page on x86_64 architechture (opteron) that also provides SSE2 its enabled by default. You can generally improve performance by using -march= flag specific to your architechture. To get the highest optimation for the program, ditch the provided buildscripts and do something like:

gcc -Wall -W -O3 -march=pentium4 -msse2 -s -o enigma *.c

This will do global optimizations instead of per module-file optimizations, and is really the way you want to go with something like the Enigma code.

With the notion of optimizing the compile, and the number of people running the client, I decided to let Acovea http://www.coyotegulch.com/products/acovea/index.html genetic algorithm compiler option search tool have a go at it. What I found out is that at least on my Fedora Core 4 x86_64 GCC 4.0 is badly broken, and most option combinations do not work. Perhaps for this reason the best compiler option for Opteron 64-bit processor family with GCC 4.0 turned out to have been -Os, optimize for size! The evolved options could not get near the presets. With that out of the way, I benchmarked the keyblock that yielded break of the first key over the second key with:

Linux me! 2.6.14-1.1637_FC4 #1 Wed Nov 9 19:01:56 EST 2005 x86_64 x86_64 x86_64 GNU/Linux AMD Athlon(tm) 64 Processor 3500+
time ./enigma -M M4 -c -f "B:B241:AV:AAAA" -t "B:B241:AV:ZZZZ" dict/00trigr.naval dict/00bigr.naval 00ciphertext

And clocked the following user-runtimes:

67m 40.310s : gcc -march=athlon64 -O3 -s -fprofile-use -o enigma *.c (Profile taken from run on different block)
64m 38.638s : gcc -march=athlon64 -O3 -s -o enigma *.c
63m 15.441s : gcc -march=athlon64 -Os -s -o enigma *.c

The conclusion on my system is -Os wins, evolved and profile driven optimizations lose, but the difference between -O3 and -Os is so small (about 2%) that trying to find best options is generally not worth it. Owners of newer Opterons that include the SSE3 instruction set may see a marginal improvement by compiling with "gcc -march=athlon64 -Os -msse3 -s -o enigma *.c".

On AthlonXP systems these settings seem to perform best:

gcc -Wall -W -O3 -march=athlon-xp -fomit-frame-pointer -mfpmath=sse -msse

although testing with GCC 4.0 on an AthlonXP, -Os appears to be faster.

Optimizing performance on Mac OS X

Change the conf-cc file depending on your processor. Run benchmarks to determine if it has an effect, as the compilers vary depending on your OS version and Developers Tools installed.

To determine the correct -mcpu option, run the "machine" command, and use the resulting number (minus "ppc"), resulting in (normally) the following:

G5: gcc -Wall -W -O3 -mcpu=970

G4: gcc -Wall -W -O3 -mcpu=7450


Outdated, use later versions!

A Visual Studio 2005 SSE2 optimized enigma build for Windows can be found at http://www.bfaber.com/dl/enigma-suite-winXPexe-0.73.3-SSE2.zip

Source code and Visual Studio project settings for this build can be found at http://www.bfaber.com/dl/enigma-src.zip

Mailing List

Instructions for subscribing to the mailing list: http://www.bytereef.org/mailinglists.html

Send a request to m4-breakers-index.1_263@bytereef.org to get the index of all the messages that have been posted to the mailing list. Replace 263 with the number of the most recent message posted to the list to get the most current index.

Send a request to m4-breakers-thread.263@bytereef.org to get the thread including that latest message. Replace 263 with the number of the message you want.

A request sent to m4-breakers-get.1_263@bytereef.org will return 100 messages (unless the defaults have been changed).

Details of how the mailing list works: http://www.ezmlm.org/ezman/ezman1.html#ss1.7

External links

M4 International Pages

M4 project live-cd [Outdated, upgrade to 0.76!]

Polls and Blogs

M4 project in the news

Museum links

Other related links

Comments (0)

You don't have permission to comment on this page.