We watched an AI crack the Enigma code in just over 10 minutes

Anyone who paid attention in history class (or has seen The Imitation Game) will know that Alan Turing was responsible for shortening the Second World War by at least two years, saving countless lives on both sides. 

He (along with a brilliant team of codebreakers and cryptologists) did this by cracking the German encryption system known as the Enigma code.  

Along with the cracking of Enigma, Turing is credited as being the father of contemporary computing so it was with some excitement that we headed to London's Imperial War Museum to see how quickly a contemporary computer could solve the problem that Turing and his team grappled with during the war.

Before we talk about the AI, let's just focus on what the problem was that it had to solve. The Enigma machine was a German piece of engineering that encrypted messages using a complex set of rules that allowed you to scramble a message in a quasi-random manner that meant the only way to decrypt it would be to have the exact settings of the machine used to write the code.

3114 251521 18514 208919?

You program your machine with the same settings, type in the encrypted message, and the original message pops out. It’s like the codes you’d make in your bedroom where ‘T’ means ‘B’ and so on, only instead of ‘T’ always meaning ‘B’, ‘T’ is a different letter every single time you press it. 

This is achieved through an incredibly complicated method that includes a plug board that does the direct ‘letter for letter’ transfer, then a number of different rotors that change that letter into another letter, and then an input that changes the frequency with which those rotors shift. 

A genuine three-rotor Enigma machine

A genuine three-rotor Enigma machine

All of those different elements combined mean that you quickly get millions, and then hundreds of millions of different possible outcomes. 

The army and Luftwaffe used a three-rotor Enigma, the navy used a four-rotor Enigma, and it was the navy codes that played a pivotal part in preparing for D-day, so the simulation we saw was modelled on a four-rotor system. 

The code was generated from the sentence “German is a beautiful language”, and ended up with over 53 billion different combinations of letters that needed decrypting. The AI did it in 12 minutes 50 seconds. While it worked, we were treated to a lesson on the Enigma machine by best-selling author Simon Singh (pictured).

A Grimm future for AI?

Unlike the traditional method of cracking the code, the AI was trained to look for German language, and then work out the statistical probability of the sentence decrypted being the accurate original based on how ‘German’ it was, using 2,000 cloud servers to do the calculations. 

The AI was trained in what German looks like using Grimm’s Fairy tales. While a pretty cool bit of trivia, we thought it was interesting that a book full of cautionary tales was used as the training tool for an AI when barely a month goes by without dire warnings about the dangers of AI.

The event was admittedly a marketing stunt for the creators of the AI, Enigma Pattern, and the cloud server unit used, DigitalOcean, but it does have some real world applications. 

Lukasz Kuncewicz, Head Data Scientist at Enigma Pattern spoke about how the same probability analysis AI can be used to detect cancer, decide if someone should get a loan, or if you wanted it to, could crack passwords.

Bletchley Park, where Turing and his team cracked the Enigma code

Bletchley Park, where Turing and his team cracked the Enigma code

What's really interesting is that the AI is able to not only complete tasks given to it, but also independently decide on its own parameters to search for valuable information. Our concern was that if an AI was deciding what was important, how do you stop it from deciding that something unimportant is important and wasting its time?

The first stage is in getting an AI that can give feedback on what it's doing. Not all AIs are capable of this at the moment, but it's getting more common. And then there is a required human element where a person checks the AI's working to make sure it isn’t doing something stupid. 

Another concern is that if the AI can be used to crack passwords, then what's to stop someone buying the AI, getting access to servers and breaking people's passwords? In the words of Lukasz:

"Nothing. It's like a knife. It can save lives or it can take lives."

We wonder what Turing would have made of that.

Andrew London

Andrew London is a writer at Velocity Partners. Prior to Velocity Partners, he was a staff writer at Future plc.