There was a time when you could just go out and buy an Enigma machine. In the early nineteen-twenties, any organization with a need to keep its communications secret could order a few of those brand-new devices from Germany and rest assured that any messages encoded using them would be safe from prying eyes. It didn’t take long for the military to catch on to the Enigma’s usefulness. Just a few years after the machine came on the market, it had been adopted by the German Navy, Army, and Air Force, and made possible the rapid, secret coordination central to the technique we now call blitzkrieg. When World War II began, Axis forces were confident, as anyone in possession of an unbreakable code might well be.As history played out, of course, that code turned out to be breakable. That this came as a surprise to the Nazis makes sense if you watch the new video above from Veritasium, which opens up an actual Enigma machine and explains its inner workings. Each letter typed into its keyboard passes through a series of interchangeable rotors wired together, then comes back through in the opposite direction, resulting in a particular substitute letter.Each character entered advances at least one of the rotors, each of which turns at a different speed, meaning that the already complex substitution cipher constantly changes. To make it even trickier, the Nazis made modifications to their Enigma machines, including a telephone-operator-style plugboard that expanded the possible encryption keys to 7 x 1018: an infinite-seeming number that fairly cried out for the mathematical services of Alan Turing.Already famous for having come up with the “Turing machine,” which could theoretically manipulate strings of symbols in what we’d now call an algorithmic fashion, he was recruited by Britain’s wartime codebreaking headquarters at Bletchley Park, where experts were already hard at work reverse-engineering the Enigma machine. There he considered flaws in the design of the device, such as its inability to encrypt any given letter as itself, and the ways in which its human operators used it, such as making predictable weather reports. Exploiting these weaknesses required building a non-theoretical computation engine, the Bombe, to grind through all possibilities at what would then have seemed an unfathomable speed. The intelligence the Bombe produced contributed to the success of the surprise D‑Day invasion and may have taken years off the potential ravages of World War II. It wouldn’t have happened without Turing’s formidable intelligence — or his understanding that you need a machine to outsmart a machine.Related Content:The Enigma Machine: How Alan Turing Helped Break the Unbreakable Nazi CodeHow British Codebreakers Built the First Electronic ComputerThe LEGO Turing Machine Gives a Quick Primer on How Your Computer WorksA Turing Machine Handmade Out of WoodCan You Crack the Uncrackable Code in Kryptos, the CIA’s Work of Public Art?The Story of Elizebeth Friedman, the Pioneering Cryptologist Who Thwarted the Nazis & Got Burned by J. Edgar HooverBased in Seoul, Colin Marshall writes and broadcasts on cities, language, and culture. He’s the author of the newsletter Books on Cities as well as the books 한국 요약 금지 (No Summarizing Korea) and Korean Newtro. Follow him on the social network formerly known as Twitter at @colinmarshall.