Photo via Tim Gage/Flickr (CC BY-SA 2.0)

The WWII Enigma machine is getting a 21st century update

One programmer created a way to send and receive cryptic messages through code.

Mar 1, 2020, 5:37 am*



Selena Larson

It’s one of the most famous cryptographic devices in history, and took genius computer scientists and mathematicians to crack its code for the Allies during World War II. The Enigma machine has become something of a legend in cryptography and code-breaking—it’s uncrackable code helped the German military smuggle messages before and during the war.

The Enigma is useless now. Since the code was broken, it’s impossible to use it to send encrypted messages. But the allure of one of the earliest technical cyphers remains intact, and recently underwent something of a renaissance after the technology was depicted in the 2014 film The Imitation Game chronicling Alan Turing’s Nazi code-breaking legacy for MI6 with the bombe machine.

Brazilian computer scientist Bruno Lucattelli was inspired by Turing’s work on the Enigma machine. After watching the movie and conducting research on machine learning and artificial intelligence, he decided to recreate the technology as software so people learning programming and cryptography would be able to use a computer program to send encrypted messages in a similar fashion as was done during World War II.

The Enigma looks a bit like a high tech typewriter. In the simplest terms, the device contains electrical circuits that close when you press a key. When someone strikes a key on the Enigma, the corresponding letter lights up. But between the light panel and the keyboard are a series of mechanical devices that change the wiring of the circuits, so when a letter is pressed, a different letter is illuminated. In order to know which light corresponded to the correct letter during World War II to decipher the codes, a key was stored in a codebook, and each date had a different configuration assigned to it.

To turn the cryptographic hardware into a software program, Lucattelli assigned each object in the Enigma machine to a piece of code called a “class” through object-oriented programming.

“The software I built has a keyboard class, light panel class, a rotor, a reflector, and a clipboard,” Lucattelli explained. “So those three last devices I listed were equipment responsible for changing the letters and building the Enigma cypher.”

The goal of his Enigma project is to act as an educational resource, and by providing a physical object that corresponds with the codebase, it becomes easier to understand object-oriented programing concepts.

Lucattelli wrote the program in ABAP, an enterprise software language created by SAP that has its roots in COBOL, one of the first high-level programming languages. It’s not a general purpose language like Ruby or Python that most people are somewhat familiar with—Lucattelli wanted to take on a project that was outside the range of traditional ABAP uses and apply it to programs it wasn’t designed for.

He open-sourced the project on GitHub, so anyone with an understanding of basic programming concepts can set up a configuration to send and receive encoded messages. Of course they will only be understood so long as the people you’re communicating with have a codebook that contains the decryption keys.

Lucattelli knows this project is useless for actually encrypting messages, but he hopes the project inspires students and people who are trying to better understand programming concepts.

“Enigma was a simple machine, and it’s a challenge for someone who’s just starting out how to translate the physical meaning into actual working software,” he said. “So when you see this example, what I believe will happen is that [students] do start to make this analogy between software and hardware, but they’ll start to associate the piece of software with the actual requirements that Enigma fulfill in order to work.”

Photo via Tim Gage/Flickr (CC BY SA 2.0)

Share this article
*First Published: Apr 17, 2015, 4:33 pm