Enigma Crib Analysis

The Enigma machine was used in World War II to encrypt secret messages.

The enigma machine was used in World War II to encrypt secret messages.

During World War II, Enigma machines were used by the Germans to encrypt and decrypt military radio communications. An Enigma machine consists of a complex sets of interconnected rotors used to performs substitution and transposition ciphers to encrypt data. The Germans would change the enigma settings every day making it extremely difficult for the allies to break the Enigma code.

In order to crack the Enigma code, the allies decided to set up a team of code breakers (cryptanalysts) at Bletchley Park, UK. Amongst these, Alan Turing and Dillwyn Knox rapidly identified that the best approach to crack the Enigma code was to find a method to identify the Engima settings used by the German on that day. This is due to the fact that the same settings can be used to both encrypt a plaintext to cypher text and to decrypt a cipher text back to its original plaintext. In other words the Enigma machine is used to implement a symmetric encryption: knowing the key (Enigma settings) enables you to both encrypt and decrypt messages.

The method they identified to work out the Enigma settings relied on the use of cribs. The term crib was used at Bletchley Park to denote any known plaintext or suspected plaintext at some point in an enciphered message. Effectively code breakers realised that the Germans were regularly sending Weather reports (in German Wetter Vorhersage) and could identify the ciphertext containing these words (based on the time of the day these reports were sent). Another message that Germans often used was the message “Nothing to report” (in German Keine besonderen Ereignisse) which was also used to identify useful cribs.

So let’s consider the following encrypted message:
enigma-crib-ciphertext

Now let’s assume that we know (or strongly suspect) that this message contains the expression “SECRET MESSAGE”, but we are not sure at which position in the text this might be.

It could be that the plain text message starts with “SECRETMESSAGE” in this case the crib would be:
enigma-crib-ciphertext-pos1

However it could be that the expression “SECRETMESSAGE” is within the ciphertext at a different position. (not necessary at the very start of the message). E.g. If it was at position 5 the crib would then be:
enigma-crib-ciphertext-pos5

So when an encrypted message was intercepted and the code breakers suspected it may contain a crib, one of their first task was to identify the possible starting position of the crib to get a full crib (plaintext with matching ciphertext). To do so cryptanalysts exploited the property of the Enigma machine which ensured that it never encoded a letter as itself. So any crib that contained at least one letter encoded as itself could be automatically discarded. This hugely reduced the number of potential cribs that could then be exploited to try to work out the Enigma settings.

Using our intial ciphertext, you can see how most crib positions can be discarded, resulting in only two possible cribs:
enigma-crib-analysis

Python Challenge


In this challenge we will write a computer program to help cryptanalyst identify potential cribs from a ciphertext. Our program will use to inputs: a plaintext crib (e.g. SECRETMESSAGE) and a full cypher text. The program will then work out and return all potential cribs by investigating all possible positions of the crib in the cipher text and discarding invalid cribs (cribs containing a letter that would be encoded as itself).

Online Crib Analysis


You can use our online Crib Analysis page to test/compare the output of your code against our online solution.

Find out more


Find out more about Enigma and the Turing-Welchman Bombe which was used to break the Enigma code:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4 / 5. Vote count: 12

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: ,