How long would it take an average computer to figure out the WWII Enigma machine - Page 1
Forum section: electronics / general

author: Beamin
author_rank: Super Contributor
timestamp: January 01, 2021, 10:19:35 pm
content: Say we recreated the "bomb" (I think it was called the bomb; the thing in blechly park with all the tubes in it that they would feed intercepted codes) in software and fed it some 3 or 4 rotor and plug board enigma codes how hard would it be to figure out the message? Using the same cryptography the British used no special modern day NSA code cracking.Could you do it on an arduino? Would it take minutes, seconds, milliseconds? How many lines of code would it take in C or python?

author: tpowell1830
author_rank: Frequent Contributor
timestamp: January 01, 2021, 10:33:46 pm
content: Hi BeaminJudging from your past posts, my guess is that you know the answer to this, however, without knowing the key codes, this could not be done (until you have the algorithm).But, further, if all is known and the c code is in place, my guess is that on an arduino, this would take milliseconds.Your turn...

author: CJay
author_rank: Super Contributor
timestamp: January 02, 2021, 12:00:37 am
content: Quote from: tpowell1830 on January 01, 2021, 10:33:46 pmNope, there were examples written a few years ago for (I think a Pentium 3) PC and it only just beat the Bombe, I suspect an Arduino would take considerably longer.https://www.zdnet.com/article/uk-code-breakers-release-enigma-war-machine-simulator/

author: ledtester
author_rank: Super Contributor
timestamp: January 02, 2021, 12:20:38 am
content: This talk is excellent presentation on how to use modern cryptoanalysis techniques on Enigma. Includes a live demo of cracking a message.https://youtu.be/gNXzMDulp7MUnfortunately their site enigmacrack.com and source code don't seem to online anymore.

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: January 02, 2021, 01:19:56 am
content: It would be interesting to compare how long it takes with and without the essential knowledge Turin et al had regarding weaknesses in Enigma (i.e., that a given letter never gets encrypted to itself and messages (nearly) always ended with Heil Hitler).

author: themadhippy
author_rank: Super Contributor
timestamp: January 02, 2021, 01:40:22 am
content: cyberchef seems to get the job done rather quickly,description of how to use it and links to exampleshttps://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex

author: ledtester
author_rank: Super Contributor
timestamp: January 02, 2021, 01:55:19 am
content: Quote from: themadhippy on January 02, 2021, 01:40:22 amFrom that page at the bottom:Quote

author: CJay
author_rank: Super Contributor
timestamp: January 02, 2021, 09:35:23 am
content: Quote from: themadhippy on January 02, 2021, 01:40:22 amIt does,*much* faster than the original Bombe simulator I saw, would be interesting to see if it could be implemented on something embedded.

author: Beamin
author_rank: Super Contributor
timestamp: January 02, 2021, 04:15:47 pm
content: Quote from: ledtester on January 02, 2021, 12:20:38 amSo how do they know they are actually breaking the code? Does the computer/gpu try a combination see what comes out, then does a second step where it checks if the text is jibberish?Not sure how they did it but I would do a hybrid brute force like this:1. Start with a combination rotor setting 1,2,3: Code word: QWER ASDF2. Get a result: ZXCV BNMK3. Take that result compare to an english dictionary and see if ZXCV is a real word. IF NOT then go back to 1 but with rotor setting 1.2.44. Get Result BLUE DOGS5. Compare to dictionary: Yes those are real words stop program, or if more jibberish goto 1,2,5 try again.I dont see how they were error checking, and 20 min on a 2012 GPU would take an arduino a VERY long time, correct me if im wrong.As an aside: How can a GPU take 18 in the video but a tube based navy bomb take 20 min according to the posters in this thread? Thats like the DSKY running an iphone app.

author: CJay
author_rank: Super Contributor
timestamp: January 02, 2021, 05:16:21 pm
content: Quote from: Beamin on January 02, 2021, 04:15:47 pmAnd you'd fail mightily with that sort of brute force attack, it could take an incredibly long time.The Bombe didn't decrypt messages, it determined rotor settings AFAIR, it also relied on 'preprocessing' based on a *lot* of knowledge of how Enigma worked and how it was used plus the rigid message format used for things like weather reports, general messages ending with Heil Hitler etc.All those factors combined to greatly reduce the work the Bombes had to do.I suggest watching one of the demos on youtube (if you choose the right/wrong one you might even catch a glimpse of me)

author: jmelson
author_rank: Super Contributor
timestamp: January 02, 2021, 07:22:40 pm
content: Quote from: Beamin on January 01, 2021, 10:19:35 pmthat's the "bombe", name apprently from the Poles who first started working on cracking Enigma.QuoteThat was Colossus,m and was used to crack the Lorenz SZ42, the first serious cypher machines. Cracking that made the Enigma look like aceral box decoder ring toy.QuoteA PDP-8 from the 1960's could crack Enigma codes in minutes. Actually, there were two Enigmas, the army Enigma ha 3 rotors, the navy version had 4. The US built several hundred bombes for the cracking effort. Every day at midnight, the Germans changed the order and selection of rotors, and then they were not changed for the rest of the day. The NCR-built bombes were set up with all possible rotor combinations (that took something like 26 machines) and would try to crack the correct rotor combination. That took several MINUTES on an all electromechanical bombe (for army Enigma) and about 20 minutes for navy. Once they knew the rotor combination to use, all machines were set up with those rotors and they ran all the machines in parallel to crack all the messages. This was done in a huge barn-like building in downtown Washington, DC.As for the SZ42, code-named "tunny" by the British, they had several electromechanical machines before building Colossus, which was part electromechanical with a lot of electronics. It read the SZ42 cyphertext from punched paper tape at several thousand characters per second, allowing the character stream to slip one character per full pass against the crib tape. Maintaining the alignment of the two tapes was a problem, so they eventually stores the crib electronically, so there was only one tape to deal with. (The "crib" is snippets of expected cleartext such as "heil Hitler" or"commander" etc.)There is a LOT of info on these systems available online, for your reading pleasure. There are sample Enigma cyphertexts and decoding programs for one to try out.Jon

author: Beamin
author_rank: Super Contributor
timestamp: January 02, 2021, 08:18:53 pm
content: Quote from: CJay on January 02, 2021, 05:16:21 pmDo you have a link to the video you are in?

author: floobydust
author_rank: Super Contributor
timestamp: January 02, 2021, 08:43:28 pm
content: https://www.youtube.com/watch?v=ZY1Y5xyKcBw&feature=youtu.beHow Enigma's key compares to a serial-killers, I'm not sure.The recentcracking of the Zodiac Killer messages,long considered a Holy Grail in cryptography for decades, is an excellent lesson and the last two videos 4, 5 are great.https://www.eevblog.com/forum/security/nerds-solve-50-years-old-zodiac-killers-cipher/It shows he made PC softwareCipher Explorerthat takes the ciphertext and applies multiple key patterns. But you must have a human to interpret the results, not sure how automated it could be unless you know words in the plain text.

author: jmelson
author_rank: Super Contributor
timestamp: January 03, 2021, 01:43:58 am
content: Quote from: floobydust on January 02, 2021, 08:43:28 pmYes, the Germans made the Enigma cracking easy, every message signed off with "heil Hitler". All you needed was to run the last ten characters of ciphertext against all steps of the decode permutation rotors, and it would give you the ending position of the rotors. The Bletchley Park crew had tables so you could back up the rotors by the length of the message and then decode the full text. Since there were seven rotors and you could pick any 3 (army) or 4 (navy) that added some more permutations that you needed to run.Jon

author: Cyberdragon
author_rank: Super Contributor
timestamp: January 03, 2021, 06:34:13 am
content: Quote from: CJay on January 02, 2021, 09:35:23 amWould that have been this one?https://www.101computing.net/turing-welchman-bombe-simulator/

author: CJay
author_rank: Super Contributor
timestamp: January 03, 2021, 09:26:35 am
content: Quote from: Beamin on January 02, 2021, 08:18:53 pmProbably not, it's just a video from someone else who was at Bletchley on the day I was there a few years ago and I slip into shot a couple of times.

author: CJay
author_rank: Super Contributor
timestamp: January 03, 2021, 09:35:22 am
content: Quote from: Cyberdragon on January 03, 2021, 06:34:13 amNo idea, that one may be based on their code but this is on the GCHQ Github:https://github.com/gchq/CyberChef/wiki/Enigma,-the-Bombe,-and-Typex

author: Kjelt
author_rank: Super Contributor
timestamp: January 03, 2021, 09:46:02 am
content: Quote from: Beamin on January 02, 2021, 04:15:47 pmThat is presuming the cleartext message is in english.A different language, one extra permutation or the use of numbers in the start of the message and you will never find an answer.

author: Kleinstein
author_rank: Super Contributor
timestamp: January 03, 2021, 11:54:16 am
content: The simulation of teh Enigma is rather fast. The tricky part in breaking such a code it to decide if the decifert text is valid or not. This part depends very much on what you know about the text - like knowing he likely end. Imagine someone writing text with so many errors that it is bareley readbl a kompder wyll haf a hrt tme tu chech.

author: CJay
author_rank: Super Contributor
timestamp: January 03, 2021, 12:47:46 pm
content: Quote from: Kleinstein on January 03, 2021, 11:54:16 amThat's the difficulty, to automatically check the validity of a solution you have to have some idea of the possible message content.I could make an assumption based on your forum profile that a ciphertext from you is likely plaintext in German or English but I have no idea if you speak other languages too so my 'dictionary' may have just expanded immensely.Similarly I don't know if you've used a translation application to a language you don't speak, if you've abbreviated, used txtspk, made typos, used a code or are just enciphering a message from somebody else who speaks a completely different set of languages.There are so many possibly permutations that it becomes nigh impossible without a 'crib' and even after all that, if you somehow miraculously manage to get a machine to 'recognise' valid plaintext, it's possible there could be multiple 'hits' which will need to be checked and analysed.It's not a trivial problem even if the keyspace is small enough to make a brute force decryption possible.

author: Kjelt
author_rank: Super Contributor
timestamp: January 03, 2021, 04:41:58 pm
content: Quote from: CJay on January 03, 2021, 12:47:46 pmThat is true however it will become easier is you have a more other ciphertexts that were encrypted with the same cypher.In the above Zodiac case there are only three or four samples with different ciphers and the maniac also made some encoding errors which contribute significantly to the difficulty of breaking it.In the enigma case the same cipher was used by all "senders" during the entire day, so the samplesize would be quite large, so enough ciphertexts to double check all your found possible correct solutions.If the germans would have started and ended with a random alphanumerical sequence, I doubt the code would have been broken, at least not until they also recovered the coding book (which is an example of a one time pad which is still the only perfect encryption scheme).

author: jmelson
author_rank: Super Contributor
timestamp: January 03, 2021, 05:10:07 pm
content: Quote from: Beamin on January 02, 2021, 04:15:47 pmThere was NEVER a "tube based" bombe. Colossus was used only to crack "tunny" or Lorenz SZ42 ciphers, electromechanical bombes were used for Enigma, which was a vastly simpler code.OK, there are several issues with Enigma. **IF** you know the wiring of the rotors that interchange the letters, it is not a very robust code. If you **DO NOT** know the wiring, it is a VERY difficult code to crack. As I understand it, Enigma was NEVER cracked without capture of a set of rotors.The Germans changed out the set of rotors sometime in the middle of the war, and it took six months to capture a set of rotors, meanwhile all efforts at breaking the new rotor wiring with code-cracking methods were fruitless.Since there were only seven rotors to choose from, the combinatorics limited the search space of the number of possible setups of the machines. That only had to be done once per day. Then, you only had to find the starting position of the rotors for each message. The Bletchley Park bombes could test about 26 positions a second. When they matched an adjustable number of characters of the crib, they stopped and the position was noted. The NCR bombes tested something like 780 positions per second, and when a match was detected had to slow down and back up so that the position and number of matched characters could be printed on an adding machine tape. then, the machine resumed the search automatically.I'm kind of guessing that the GPU program is either starting out not knowing the order of rotors, or maybe without even knowing the rotor wiring, although I think that search space is so huge you would not be able to find the correct hits among all the random ones that looked probable.But, if the crib was the entire cleartext, then it could be done. I don't know how long that would take.Jon

author: jmelson
author_rank: Super Contributor
timestamp: January 03, 2021, 05:21:38 pm
content: Quote from: Kjelt on January 03, 2021, 04:41:58 pmIf you have the code books, then you know the start position of the rotors for every message. Then, the messages can be decoded with an Enigma machine, with no effort to break the system. The codebooks only covered a relatively short time period, so quickly became outdated. As I understand it, for each day, they had a page of 3 digit numbers with a rotor starting position for each. So, number 123 would have you set the rotors to S Z K V, for a navy machine. The operator would send 123 in cleartext before transmitting the ciphertext, so the receiving operator could set his machine to the same starting position.As long as you had SOME known "crib" text anywhere in the message, you could still decode it, but a bombe would not have worked, as it only compared 10 characters of the ciphertext against the full key to see if it matched the crib. Yes, just another shortcoming of how the Germans used the Enigma.One other shortoming of Enigma is that no letter could ever be represented by itself. This was the result of using a reflector disc at one end of the rotor stack to send the signal back through the rotors again. Somebody once sent a message of all "L" characters, the Bletechley Park guys immediately spotted that, and it became basically a readout of part of the rotor wiring.Jon

author: CJay
author_rank: Super Contributor
timestamp: January 03, 2021, 09:22:20 pm
content: Rotor wiring is laborious to work out but there were occasions where it was reverse engineered without having access to the physical hardware.Rejwski did it, Knox did it and I'm sure others too.

author: alank2
author_rank: Super Contributor
timestamp: January 04, 2021, 01:12:01 am
content: The bombe was not a put in the message and wait for the answer type of thing - there were hundreds of talented code breakers at Bletchley Park responsible for obtaining a daily key and the bombe was only a part of that process.I think someone tried a distributed computer attack in 2008 to break some of the remaining unencrypted German messages from WWII, but it did not do well at it.

author: CJay
author_rank: Super Contributor
timestamp: January 04, 2021, 07:37:49 am
content: Quote from: alank2 on January 04, 2021, 01:12:01 amhttps://www.cnet.com/news/distributed-computing-cracks-enigma-code/

author: Simon
author_rank: Unknown
timestamp: January 04, 2021, 08:54:44 am
content: The whole thing was relays at best and basically it was a guessing game. The codes were brute forced although this was after obtaining clues. For example there was a German station that every morning would transmit "nothing to report" once they guessed the message contents they could use it to try and find out the code. Some of the peculiarities of the coding system also gave away clues. I think the bombs were simply motor drive enigma replicas with multiple replicas in each bomb so that they could simultaneously run lots of possible options on the days code until one of them spat out an intelligible message (in German). So there were no actual code cracking machines, they were just a very large number of duplicates of one machine built into one machine and then they had several machines. The cracking was done by humans. It was not necessarily the breaking that was the problem but the speed required because every 24 hours the code was changed and different German forces used different codes so ideally on a good day by 1AM they had cracked it and knew the orders before those executing them did. on a bad day they did not crack the code until 23:00 so not much use as in 1 hour it would be changed and they would have to start again. So it was simply parallel execution of the same task on the same data until a result came out. Whittle it down with human calculation and intuition and then try out variants of the very good guesses.

author: Beamin
author_rank: Super Contributor
timestamp: January 05, 2021, 12:20:46 am
content: Quote from: CJay on January 04, 2021, 07:37:49 amQuoteQuick someone get the navy on the phone and tell them this!!!! I'm surprised they put such sensitive info on the internet.We still havent figured out if you could use an arduino to crack the code or how long it would take a PC, or how its done for that matter; that youtube video didnt explain how they did it.If I wasn't such a beginner it would be cool to build a arduno based enigma machine. I miss living in a house with a workshop/garage/tools. I would build it from an old type writter.

author: ledtester
author_rank: Super Contributor
timestamp: January 05, 2021, 01:29:02 am
content: I found this paper to be a good survey of the various techniques involved in a ciphertext-only attack on Enigma:https://cryptocellar.org/pubs/Enigma_ModernBreaking.pdfAlso check out the top-level of the website.This github repo looks promising with regard to the hill climbing algorithm:https://github.com/arvindpj007/Enigma-M4-CryptanalysisThere are a lot of references to a 1995 paper by James Gillogly which introduced the "Index of Coincidence" statistic. I was able to find a copy here:http://web.archive.org/web/20060720040135/http://members.fortunecity.com/jpeschel/gillog1.htm

author: cbutlera
author_rank: Regular Contributor
timestamp: January 06, 2021, 03:17:03 pm
content: Following a visit to Bletchley Park in March 2015, I wrote a simulator for the bombe and also for the (originally manual) process of extracting the remaining steckerboard configuration. The input data was a crib, the matching enciphered text and a bombe menu. The simulator worked through every permutation of and starting positions for the rotors until it identified a valid candidate. During this process, the bombe stops at multiple candidate positions, but most of these can be eliminated because a contradiction is reached while attempting to extract the remaining steckerboard configutation.All of the information that I used to write the simulation came from Gordon Welchman's book "The Hut Six Story". It was a command line, text only simulation, written in PowerBasic. It was not meant to be in any way fast, efficient or elegant, the only purpose of writing it was to cement my own understanding of the process. In particular, I tried to simulate the manner in which the bombe operated. The most processing intensive part was to simulate what the mechanical bombe did easily, which is electrical propagation from the initial active circuit throughout the entire bombe, which typically involves many hundreds of passages through the bombe drums.My simulator for a 12 Enigma-equivalent bombe (3 Rotor Enigma), running on a single thread of a 3.5GHz i5 ran at the equivalent of 27,000 RPM, compared to the 120 RPM of the later mechanical bombes.

author: ledtester
author_rank: Super Contributor
timestamp: June 12, 2021, 01:39:47 am
content: This video:Enigma Cryptanalysis Revisited – New State-of-the-Art Attacks on the Enigma Machine in CrypTool 2https://youtu.be/kptQbcTUVykcan give you a rough idea of the state of the art.The program "CrypTool 2" has several algorithms for decrypting Enigma, one known-plaintext attack (similar to the Bombe attack) and three ciphertext-only attacks:- Gillogly's attack- Lasry's hill-climbing attack- Lasry's simulated annealing attackAll of these have their own trade-offs.