Didier Stevens

Thursday 28 December 2006

Brute Forcing Enigma

Filed under: My Software — Didier Stevens @ 12:32

A colleague of mine is getting married and her friends gave her a bunch of puzzles to solve. One puzzle is about the Enigma cipher machine, that’s why she asked me for help.

She has to go to this page (a flash simulation of the Enigma cipher machine) and solve this puzzle: If ANSWER is YRKRHL, then insert ENIGMA into enigma to find the answer…

It was immediately clear to me that we were dealing with a KPA: find the key (Enigma cipher machine configuration) that encrypts ANSWER into YRKRHL, and then we’ll be able to find the encrypt ENIGMA.

I quickly wrote a C# program to brute force all the starting positions (AAA – ZZZ), based on this article. At first my program didn’t find a solution, so I added brute forcing of the rotors and steckers configuration. By then my colleague had received a hint from her friends, which allowed us to set the correct configuration of the rotors, starting positions and steckers.

The funny thing is that my program found several other solutions:

Solution: rotor 243 key JRP steckers ACLX cleartext ANSWER ciphertext YRKRHL
cleartext2 ENIGMA ciphertext2 JRHSCB
Solution: rotor 513 key TJB steckers ADNT cleartext ANSWER ciphertext YRKRHL
cleartext2 ENIGMA ciphertext2 IRLHUN
Solution: rotor 234 key UHH steckers AGJS cleartext ANSWER ciphertext YRKRHL
cleartext2 ENIGMA ciphertext2 XRNBIK
Solution: rotor 234 key UHH steckers AGKU cleartext ANSWER ciphertext YRKRHL
cleartext2 ENIGMA ciphertext2 XRNBIU
Solution: rotor 321 key ESM steckers AHFY cleartext ANSWER ciphertext YRKRHL
cleartext2 ENIGMA ciphertext2 BRDHAQ
Solution: rotor 125 key HMH steckers AHRU cleartext ANSWER ciphertext YRKRHL
cleartext2 ENIGMA ciphertext2 QRYFNZ

Download:

BruteForceEnigma.zip (https)

MD5: A9FEBBABA207E7C3790D075FD3A3D22B

7 Comments »

  1. I’m the writer of that article. I’m glad my work was of use to you.

    P.S.
    The Reich would not have any chance in out times :))

    Comment by Adi Clepcea — Thursday 28 December 2006 @ 13:24

  2. I have been interested in how the Enigma code was broken for some time and your program looks good. Presumably you need to run it from the command line? I will give it a try and see how I get on.

    Comment by Anonymous — Wednesday 24 August 2011 @ 8:12

  3. Didier

    I’m very interested in this piece of software. My only question is, how do you use it?

    Thanks.

    Comment by Chris Miles — Friday 26 August 2011 @ 6:35

  4. @Chris Did you try to run it?

    Comment by Didier Stevens — Friday 26 August 2011 @ 17:44

  5. Yes, I’m trying to run it using the command line interface in XP. It keeps throwing up an error that the cleartext and ciphertext command line arguments are missing. Presumably when typing “bruteforceenigma” to start the program, somehow I need to follow it with the cleartext and ciphertext that I wish the program to find the enigma machine settings for? If you could provide me with a step by step guide on how the program works that would be great. Thanks for your help and for the program itself.

    Chris

    Comment by Chris Miles — Tuesday 30 August 2011 @ 6:50

  6. @Chris Here’s an example: BruteForceEnigma.exe /clearText:ENIGMA /cipherText:YRKRHL

    Comment by Didier Stevens — Tuesday 30 August 2011 @ 17:31

  7. Thanks I am now able to run it successfully.

    Chris

    Comment by Chris Miles — Friday 2 September 2011 @ 7:04


RSS feed for comments on this post. TrackBack URI

Leave a Reply (comments are moderated)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 230 other followers

%d bloggers like this: