World War II wasn’t just fought with tanks on the plains of Europe or carriers in the Pacific. It was fought in silent, smoke-filled rooms by mathematicians, linguists, crossword enthusiasts, and engineers. It was the “wizard’s war”, a desperate race to hide one’s own secrets while laying bare the enemy’s.

I’ve always had a fascination with cryptography and its role in the second world war, mainly because it represents such a massive turning point for technology. For me, the appeal isn’t just the “spy craft”, but the machines themselves. This era was the literal birthplace of modern computing; we moved from rotors and gears to the first electronic digital processors in just a few short years.

Seeing how these early attempts to scramble and unscramble data paved the way for the computers we use every day is what makes this history so interesting to me. In this article, I want summarise the subjects that defined this era – starting with the Polish mathematicians who first proved that the “unbreakable” Enigma could be defeated by logic.

Breaking Enigma before the war began

If you ask most people who broke the German Enigma machine, they will almost universally give you one name: Alan Turing. They aren’t entirely wrong, but they are missing the crucial first chapter of the story.

Without the brilliance of three Polish mathematicians in the 1930s, Alan Turing and Bletchley Park might never have gotten off the starting line.

The looming shadow

In the years leading up to WWII, Poland found itself in a terrifying geographical position, squeezed between a rearming Nazi Germany and the Soviet Union. Desperate for intelligence, the Polish Cipher Bureau took a gamble. Instead of hiring traditional linguists to break codes, they hired mathematicians.

Enter Marian Rejewski, Jerzy Różycki, and Henryk Zygalski.

They were tasked with breaking the new German military cipher machine: Enigma. It looked like an oversized typewriter, but beneath the keyboard lay a series of rotating wheels (rotors) and a plugboard that scrambled messages into billions of possible combinations.

The leap of logic

The Germans were so confident in Enigma that they made mistakes. In the early days, to ensure a message was received correctly, operators would type the crucial three-letter message key twice (e.g., QWEQWE).

Marian Rejewski used the pure patterns derived from this repetition to use group theory – a high-level branch of mathematics – to deduce the internal wiring of the Enigma rotors without ever having seen them. It was a staggering feat of analytical deduction.

The Poles didn’t just use pencil and paper; they mechanised the process. They built “cyclometers” to catalogue rotor positions and eventually created the Bomba, an electromechanical device designed to rapidly test potential settings. It was the direct ancestor to the machines Turing would later build in England.

The handover

By 1939, the drums of war were beating. Germany increased the complexity of Enigma, adding more rotors. The Polish resources were exhausted; they could no longer keep up with the necessary calculations.

Just five weeks before Germany invaded Poland, Polish intelligence officials met with their British and French counterparts in the Kabaty Woods near Warsaw. In a dramatic reveal, they presented shocked British agents with two fully reconstructed Enigma replicas and all their mathematical research.

The British had been completely blocked on Enigma. The Polish contribution was the skeleton key they needed. As we will see in the next post, Bletchley Park took this Polish spark and fanned it into an industrial fire.

How Bletchley Park saved the Atlantic

Once the war began, the scale of the cryptographic challenge changed overnight. The Germans were no longer just sending diplomatic cables; they were coordinating U-boat “wolf packs” in the Atlantic, sinking the supply ships Britain needed to survive.

Breaking Enigma changed from an intellectual puzzle to a daily life-or-death struggle. The centre of this struggle was a Victorian estate northwest of London: Bletchley Park.

The eclectic army

Bletchley Park was unique. It wasn’t filled with typical soldiers. The government recruited anyone with a knack for puzzle-solving: chess champions, Egyptologists, mathematicians, and even winners of newspaper crossword competitions.

But the star of the show was undoubtedly Alan Turing. Turing realised that the Polish methods, while brilliant, relied on a German procedural error that could be fixed at any moment (and eventually was). Turing needed a method that broke the machine itself, not just the operator’s habits.

The fatal flaw and the “crib”

Turing exploited a brilliant design flaw in the Enigma machine: a letter could never be encrypted as itself. If you typed ‘A’, the result could be anything except ‘A’.

Turing realised that if you could guess a piece of the plain text message – say, a standard weather report header like “WETTERVORHERSAGE” – you could align it with the gibberish ciphertext. Wherever a letter in the guess matched a letter in the cipher, you knew that alignment was impossible.

These guessed phrases were called “cribs.”

The Bombe – a mechanical Sherlock Holmes

To test these cribs against millions of rotor positions required speed. Turing, along with Gordon Welchman, designed the British “Bombe.”

These massive, loud, ticking electromechanical monoliths weren’t “computers” in the modern sense; they were process-of-elimination machines. A Bombe housed dozens of spinning Enigma drums mimicking the German machines. It would rapidly cycle through tens of thousands of possible settings, ruling out the impossible ones based on the “crib” and the “no letter can be itself” rule.

When the Bombe stopped, it meant: “Here is a possibility.”

By mid-war, Bletchley Park had become an intelligence factory. Wrens (Women’s Royal Naval Service) operated hundreds of Bombes around the clock in deafening conditions. The resulting intelligence, codenamed “Ultra”, allowed the Allies to re-route convoys away from U-boats, effectively winning the Battle of the Atlantic and ensuring D-Day could eventually happen.

How a fake water crisis won the Battle of Midway

While Bletchley Park was battling rotors and gears in Europe, the code war in the Pacific against Imperial Japan was a different beast altogether. It required mastering machines, but also a deep understanding of language and psychology.

The American effort to break Japanese codes was known as “Magic.”

Purple vs. JN-25

The Japanese used two primary systems that the US focused on:

  • Purple (The Diplomatic Code): This was a machine cipher, similar in concept to Enigma but using stepping switches instead of rotors. American genius William Friedman led the team that reverse-engineered the Purple machine before Pearl Harbor, allowing the US to read Japan’s diplomatic mail to its embassies.
  • JN-25 (The Naval Code): This was the big one for the actual fighting. It wasn’t a machine; it was a super-complex “book code” involving tens of thousands of five-digit numbers that had to be cross-referenced in codebooks and then further encrypted with an additive table.

Breaking JN-25 was brute-force agony, led by Commander Joe Rochefort at “Station Hypo” in a basement at Pearl Harbor.

The target “AF”

In the spring of 1942, the US Navy was reeling. They knew a massive Japanese offensive was coming, designed to wipe out the remaining American aircraft carriers.

Through partially broken JN-25 radio traffic, Rochefort’s team kept seeing references to a target location designated “AF.” The Japanese were gathering everything they had to attack “AF.” But where was it?

Some in Washington believed “AF” was the Aleutian Islands near Alaska. Rochefort was convinced it was the tiny, strategic atoll of Midway. The fate of the Pacific war hinged on who was right.

The ruse

Rochefort concocted a brilliant plan to prove his theory. He used a secure underwater cable to order the base commander at Midway to send out a plain-language, unencrypted radio message stating that the base’s fresh water distillation plant had broken down.

It was bait.

Two days later, Station Hypo intercepted a Japanese JN-25 message reporting to Tokyo that “AF is short on water.”

The trap sprung. The target was confirmed as Midway. Admiral Nimitz committed his precious carriers to ambush the Japanese fleet. The resulting Battle of Midway was the turning point of the Pacific War, a victory owed entirely to a cryptographic bluff.

The legacy of the Navajo code talkers

We have looked at incredible machines – Enigma, Purple, the Bombe – designed to scramble information using advanced mathematics.

But the single most secure, unbreakable code of World War II involved no machines at all. It relied on a human voice, speaking a language that the Axis powers couldn’t even begin to comprehend.

The need for speed

In the chaos of a beach landing in the Pacific, like Iwo Jima or Tarawa, minutes mattered. Standard encryption was too slow; encoding a message, transmitting it Morse code, and decoding it on the other end took precious time that front-line Marines didn’t have.

The US military needed a “Type 1” code – something that could be spoken instantly over a radio but remain unintelligible to the enemy listening in.

The idea came from Philip Johnston, a WWI veteran who had grown up on the Navajo reservation. He knew the Navajo language was notoriously complex. It is tonal, unwritten, and has syntax completely alien to European or Asian languages.

“Iron Fish” and “Hummingbirds”

The Marine Corps recruited young Navajo men and tasked them with creating a code based on their native tongue.

They developed a two-layer system. First, they created a phonetic alphabet using Navajo words (e.g., the letter ‘A’ was “Wol-la-chee”, the Navajo word for Ant).

Second, and more importantly, they created a dictionary of unique terms for military hardware. There were no words in Navajo for “dive bomber” or “submarine.”

  • A submarine became besh-lo (“Iron Fish”).
  • A fighter plane became da-he-tih-hi (“Hummingbird”).
  • America became Ne-he-mah (“Our Mother”).

The only unbroken code

The Code Talkers were deployed to the hottest zones in the Pacific. In the first 48 hours of the Battle of Iwo Jima, six Navajo Code Talkers working around the clock transmitted over 800 messages without a single error.

Major Howard Connor, a signal officer at Iwo Jima, later stated, “Were it not for the Navajos, the Marines would never have taken Iwo Jima.”

Japanese intelligence was baffled. They captured Navajo soldiers at Bataan earlier in the war, but because those soldiers weren’t trained in the specific code terms, even they couldn’t understand the transmissions.

It remains the only spoken military code in modern history that was never broken by an enemy. The Code Talkers served with supreme distinction, using the language of a culture their own government had tried to suppress to help win the war.

The secret birth of the computer age

When we think of the start of the computer age, we usually think of the 1950s or 60s. But the digital revolution actually began in 1943, in absolute secrecy, driven by the need to crack the toughest cipher of the war.

We’ve talked about Enigma, but Enigma was used for tactical battlefield communications. For top-level strategic communication between Hitler and his High Command, the Germans used machines that made Enigma look like a child’s toy. The British called these Lorenz machines “Tunny.”

The ultimate challenge

The Lorenz machine was a beast. It used 12 wheels instead of Enigma’s 3 or 4, creating a level of complexity that was astronomically higher.

Breaking it required another feat of impossible genius. In 1941, a German operator made the mistake of sending a 4,000-character message twice using nearly the same settings. British mathematician Bill Tutte – a chemist by training – analysed these two messages for months.

In what is perhaps the greatest intellectual feat of the war, Tutte deduced the entire logical architecture of the Lorenz machine from sheer statistical analysis, without ever having seen the device.

Enter Tommy Flowers

Knowing how the machine worked was one thing; reading the traffic daily was another. The calculations required to break Lorenz messages were too vast even for the electromechanical Bombes used for Enigma. They were too slow.

The codebreakers needed speed. They needed electronics.

Tommy Flowers, a working-class engineer from the British Post Office who specialised in telephone exchanges, proposed a radical idea. He wanted to use thousands of vacuum tubes (valves) – which were notoriously unreliable – to create a fully electronic, programmable digital machine.

Many at Bletchley were sceptical. But Flowers, using his own money to buy parts at first, built “Colossus.”

The first computer

Colossus Mark I arrived at Bletchley Park in December 1943. It was a behemoth, using 1,600 glowing vacuum tubes. It read paper tape at a blistering 5,000 characters per second.

While the Enigma Bombes clicked and clacked mechanically, Colossus hummed. It was the world’s first programmable, electronic, digital computer.

Colossus machines were vital for cracking Lorenz traffic in the lead-up to D-Day, providing confirmation that Hitler was swallowing the Allies’ deception plans regarding the landing site.

The buried legacy

So why isn’t Tommy Flowers a household name like Alan Turing?

Secrecy. After the war, Winston Churchill ordered the Colossus machines dismantled and destroyed. The blueprints were burned. The very existence of these machines was classified top secret for decades. The intense Cold War had begun, and Britain didn’t want the Soviets to know their capabilities.

The people who built and operated the first real computers went back to their normal lives, forbidden to speak of what they had done. It wasn’t until the 1970s and 80s that the truth about Colossus began to emerge, finally giving these engineers their rightful place as the architects of the modern digital world.

References and further reading

If you only read a few books on this subject, make them these for WWII cryptologic history.

  • The Code Book by Simon Singh: The most accessible introduction to the history of secrecy. It covers Enigma and the Navajo Code Talkers in detail.
  • Alan Turing: The Enigma by Andrew Hodges: A deeply researched biography of Turing.
  • Battle of Wits by Stephen Budiansky: A fantastic all-in-one history that balances the European and Pacific theatres, showing how codebreaking influenced specific battles.
  • Between Silk and Cyanide by Leo Marks: A memoir by the head of ciphers for the SOE. It’s a good resource for “low-tech” agent ciphers.

For those who want to see the original documents and machines, these official institutions have digitised much of their collections.