The work of the British codebreakers at Bletchley Park during World War II is now a famous tale of genius, perseverance and success that saved the lives of civilians and troops alike and supposedly shortened the war by as many as two years.

Using mathematical and deciphering skills as well as innovative computer technology, the supposedly unbreakable Enigma code was cracked, allowing British intelligence to discover where hostile U-boats, ships and troops were heading so that Allied troop and convoy vessels could alter their routes accordingly.

[Read more: Bletchley Park staff meet 78 years after war’s outbreak]

The Enigma machine was so complex that its most advanced incarnation could be configured 158,962,555,217,826,360,000 different ways but had one flaw which led to its downfall - no letter could be substituted for itself. 

Even with this knowledge it took years many brilliant men to women months to crack the code. Now almost 75 years on, artificial intelligence (AI) can unscramble an Enigma-encoded message in less than 15 minutes.

At the Imperial War Museum last week, two companies – DigitalOcean and Enigma Pattern – used the latest AI technology to decipher a German message in a live demonstration.

What is the Enigma Machine?

Enigma Machine

Author Simon Singh, who has written on code breaking, explained the context and the importance of the encrypting machine.

It was created before World War II but it did not have much use so the companies that created it went bust, explained Singh. It was the militarisation of Nazi Germany that really provided the environment for it to be useful.

Looking like a large typewriter, it is a machine that can provide millions of different ways of scrambling messages through using three to five rotors which substituted the original letters for alternatives.

So, when you press a letter a lamp will light up, but due to the rotors moving, it’s never a static swap - you could type the same letter repeatedly and get a different result each time. 

“Spaghetti wiring inside each of those rotors that changes one letter into a different letter,” Singh explained. “But what’s clever about the Enigma is that these keep moving.”

The results could be further complicated by changing the order of the rotors and tweaking the wiring according to daily pre-set daily keys which would be known by both the sender of the message and the recipient. All these variations made it extremely challenging for codebreakers who only had the encoded message in their possession.

Who were the codebreakers at Bletchley Park?

Alan Turing is the most famous of the group of codebreakers who worked at the top secret Milton Keynes site, but he had an expert team alonside him. 

Experienced cryptologists Dilly Knox and Nigel de Grey led the efforts at Bletchley Park alongside recent Cambridge and Oxford University graduates such as Gordon Welchman, Joan Clarke and Bill Tutte.

How was the code broken during World War II?

Mavis Batey

The work at Bletchley Park built on brilliant Polish codebreaking intelligence that was smuggled out of Poland, through France and on to London.

One key breakthrough occurred when codebreaker Mavis Batey received a message that did not contain a single 'w' among some 200 characters of apparent gibberish. Using the knowledge that each letter cannot be substituted as itself, she therefore was able to work out the coding.

“It’s a huge job, but it could be done,” said Singh, on this seemingly impossible deduction. Computers such as the Colossus computer and the Bombe mechanised the process. 

[Read more: Cracking the Enigma code was diversion for Alan Turing]

How was the code broken with artificial intelligence?

Using DigitalOcean’s cloud servers and artificial intelligence software from Enigma Pattern, a short German message was decoded at the Imperial War Museum.

The software had been trained to learn German through Grimm’s Fairy Tales, and was tested on an Enigma machine that had 15,354,393,600 password variants.

By using an array of servers, millions of different combinations could be tested simultaneously before the artificial intelligence could pinpoint those results it recognised as German.

Lukasz Kuncewicz, head data scientist at Enigma Pattern, explained how the same artificial intelligence software could also be used in healthcare, financial services or to crack passwords.

What was the impact of cracking the code?

Historians have estimated that the cracking of the Enigma machine shortened World War II by as much as two years.

However, for 30 years after the war the importance of the codebreakers remained a secret: it is believed that Enigma machines were still used to send diplomatic messages up until the 1970s - with the senders unaware that British intelligence could actually read these 'unbreakable' dispatches.

[Read more: Top 5 must-have smart home presents]