I want you to imagine, just for a second, trying
to build a perfectly functioning, incredibly
complex mechanical device. But, you know, here's
the catch. Right. There is always a catch. Exactly.
You have never actually seen a blueprint for
this machine. You have never seen a photograph
of it. You have never even held a single gear
or a switch or a wire that belongs to it. Wow.
OK. Yeah. The only thing you have, like your
absolute only clue to how this whole machine
operates, is the scrambled gibberish it spits
out. It is... It's basically the cryptographic
equivalent of trying to map out the entire floor
plan of a massive pitch black building while
you're standing blindfolded across the street,
you know, simply by listening to the sound of
someone else's footsteps echoing inside. That
is such a wild image, but it's true. You are
reverse engineering a ghost using nothing but
abstract logic. And that is the staggering historical
reality we are exploring today in this deep dive.
We are looking at one of the most consequential
intellectual triumphs of the 20th century, really.
The Japanese type B cipher machine. Famously
code named purple by the United States. Right,
the purple machine. The Japanese government,
I mean, they considered the purple cipher to
be absolute mathematical perfection. They deployed
it to protect their highest level diplomatic
communications in those tense years leading up
to and during. World War II. So they were putting
all their eggs in this one basket. Completely.
It represents this fascinating study of technological
hubris, honestly, because its creators were just
so convinced of its invulnerability that they
basically trusted it with the survival of their
entire empire. Which is heavy. So our mission
for you today is to unpack this machine from
the inside out. We are going to look at the mechanical
architecture of Purple. explore how American
code breakers managed to like blindly reconstruct
it from thin air and trace how the intelligence
they pulled from it completely altered the global
battlefield. It really changed everything. It
did. But, you know, before we get to the purple
machine itself, the sources show we actually
need to rewind a bit. We have to look at the
predecessor that basically set Gopal up for failure.
Yeah, you really cannot understand the fatal
flaws of purple without understanding the paranoia
that birthed it in the first place. We have to
go back to, um... the 1922 Washington Naval Treaty.
Right. The arms control conference after World
War One. Exactly. So during those negotiations,
the Japanese delegation was just completely stunned
to discover that the American Black Chamber,
which was the U .S. cryptography bureau at the
time, had been intercepting and reading their
secure diplomatic traffic. Just reading their
mail right in front of them essentially. Yeah.
And the Americans used that intercepted intelligence
to force Japan into a really unfavorable treaty
regarding the size of their naval fleet. Man,
that level of exposure on the global stage, it
must have created just massive institutional
panic in Tokyo. Oh, it was a profound humiliation
for the Japanese military establishment. I mean,
the pressure to completely overthrow their cryptographic
security was immense. So the Japanese Navy decided,
you know, they had to take the lead on this.
And by 1931, their engineers had developed a
new electromechanical cipher machine called the
Type 91. The United States would later code name
this early machine Red. OK, so I am looking at
the history of this Red machine. and I expected
it to be the impenetrable fortress they wanted,
but it actually had some really glaring operational
issues, right? Oh yeah, big time. Beyond just
being temperamental -like, apparently it required
constant cleaning to prevent electrical shorts.
The Japanese Navy eventually discovered a fundamental
mathematical vulnerability. They realized the
red cipher could... you know, theoretically be
broken by a dedicated adversary. And see, it
is worse than just a realized vulnerability.
This is where bureaucratic dysfunction basically
sabotages national security. How so? Well, the
Japanese Navy knows the Red Machine has a cryptographic
weakness. But instead of immediately pulling
it from service, they actively obscure the severity
of the flaw from the Japanese Ministry of Foreign
Affairs. Wait, the same Ministry of Foreign Affairs
that relies on this exact machine for all of
their international diplomatic correspondence?
That is the one. I am trying to wrap my head
around that decision. It is like a corporation's
IT department discovering that their company
-wide password manager has this huge back door
that hackers can exploit. Yeah. But instead of
shutting it down, they just... vaguely advised
the CEO to be careful while letting everyone
keep using it just to save face. Yes, that institutional
face -saving is the absolute core issue here.
The lack of internal cooperation between the
Japanese Army, the Navy, and the Foreign Office
created these massive silos of information. Furthermore,
the Navy placed just an unwarranted amount of
faith in their own internal talent. Right, because
they brought in their own guy. Exactly. They
relied heavily on mathematicians like Tej Takagi.
Now Takagi was undeniably a brilliant world -class
mathematician in the realm of number theory.
But... And there's always a but, he wasn't a
code breaker. Right, he lacked any practical
background in cryptanalysis. So he understood
the pure mathematics of encryption, but he had
no actual experience breaking codes. It's like
he knew how to build a really complex lock, but
he had never studied how a professional lock
picker actually goes about breaking one open.
That is a perfect way to put it. That offensive
mindset was completely missing. So when the Japanese
rolled out the next -generation machine for the
Ministry of Foreign Affairs in 1937, which was
the Type 97, or PURPLE, that interdepartmental
silence meant that PURPLE inadvertently inherited
this foundational DNA from the compromised RED
machine. They just copied the homework without
realizing the answers were wrong. Basically,
yeah. The engineers carried over core design
philosophies without realizing those philosophies
were inherently flawed from the start. Okay,
so... Because that flawed DNA was baked in, let's
look at the actual architecture of purple. Because
I originally assumed that, you know, since this
was a World War II electromechanical cipher,
they were using a system of spinning, wired rotors
to scramble letters. Like the famous German Enigma
machine. Exactly. But the sources show they went
in a completely different mechanical direction.
Yeah, they bypassed rotor technology entirely.
Instead of rotors, the Japanese engineers utilized
what are called stepping switches. Okay, stepping
switches. What are those exactly? To understand
these, you really have to look at the commercial
technology of the 1930s. These were the exact
same multi -layered mechanical switches utilized
in automatic telephoto exchanges of the era.
Oh, wow. So they essentially repurposed off -the
-shelf commercial telecommunications hardware
for a top secret military cipher. Pretty much.
It was a very clever application of existing
technology, to be fair. In the purple machine,
these stepping switches featured layers of electrical
contacts arranged in these semicircular banks.
OK, I'm picturing that. And a mechanical wiper
arm would sweep across these contacts, completing
different electrical circuits to scramble the
input. So an operator would type a plain letter
on an electric typewriter. The signal would travel
through a plug board, go into this chaotic maze
of stepping switches, and emerge as a totally
different enciphered letter on a second typewriter.
Right. And this brings us to the specific design
decision that completely compromised the entire
system. Because Roman letters were the international
standard for telegraph transmission at the time,
right? Yes, exactly. So the Japanese text was
first transliterated into the 26 -letter English
alphabet. But when feeding those 26 letters into
the stepping switches, the purple machine didn't
scramble the whole alphabet together in one massive
pool, did it? No, it didn't. It segregated them.
The machine physically divided the 26 letters
into two distinct groups. This is wild to me.
It is. There was a group of six letters, which
were typically vowels, and a group of 20 letters,
which were usually consonants. The famous 6s
and 20s. Right. And the 20 group was heavily
protected. When a letter from the 20s group was
typed, the electoral signal was routed through
three successive highly complex stages of stepping
switches. So lots of layers of scrambling for
those 20. Tons. Some of these switches stepped
rapidly with every keystroke, some stepped at
a medium pace, and some moved very slowly. It
created this wildly unpredictable rat's nest
of permutations. But, and here's the kicker,
the group of six letters was treated entirely
differently. Completely different. A letter in
the sixes group only passed through a single
stepping switch stage, and that switch just stepped
forward one predictable position for every character
type. Just one click at a time. I mean from a
security standpoint, if you split your alphabet
and treat a fraction of it with vastly weaker
encryption, aren't you basically handing the
enemy a massive foothold? Oh, you absolutely
are. You reduce the mathematical complexity of
the cipher exponentially. because the cryptanalysts
can isolate those six letters immediately. Like,
why on earth would they do that? It drastically
degrades the cryptographic integrity of the entire
system. And the reason they implemented this
split, it actually traces back to a holdover
from the Red Machine. The prevailing historical
consensus is that this architectural weakness
began as a simple, mundane cost saving measure.
Wait, I need to make sure I'm understanding this
correctly. They compromised the security of their
entire empire to save money. Believe it or not,
yes. In the 1920s and 30s, international telegraph
companies based their fees on the type of text
being transmitted. If a telegram consisted of
pronounceable syllables, it was often charged
at a lower rate than a telegram consisting of
just random, unpronounceable strings of consonants.
Oh, you have got to be kidding me. No, I'm serious.
By ensuring that vowels and consonants were encrypted
somewhat separately, the designers hoped the
resulting cipher text might occasionally group
into pronounceable blocks, which could potentially
qualify for lower transmission tariffs. That
is unbelievable. So because that cost saving
flow existed, the Americans had this tiny structural
crack to pry open. Exactly. And in 1939, the
United States Army Signal Intelligence Service,
the SIS, decided to exploit it. They noticed
this new, highly complex cipher system was replacing
the old red traffic. Right, they saw the shift
happening. And a legendary cryptologist named
William F. Friedman was tasked with assembling
a team to break it. And Friedman's team, I mean,
they faced a monumental challenge. They were
staring at reams of intercepted ciphertext with
absolutely no knowledge of the physical machine
that produced it. It's like a pile of gibberish.
Right. But because of that 6 and 20 split we
just talked about, statistical analysis quickly
revealed a glaring pattern. When they counted
the frequencies of the letters in the intercepted
messages, they noticed that six specific letters
behaved distinctly differently from the other
20. The weaker encryption on the sixes basically
betrayed their presence immediately. The SIS
realized those six letters were essentially operating
on a simple polyalphabetic cipher -like, just
running through 25 fixed alphabets in a continuous
loop. It was that simple. And by April 1939,
the Americans had completely mathematically cracked
the sixes. Which is a crucial first step, but
it only allowed them to read about 20 percent
of any given message, right? Exactly. The remaining
20 letters, the consonants, were just an absolute
brick wall. Those letters were being scrambled
through the three stages of telephone switches,
and the starting positions of those switches
changed based on a daily key and a unique message
indicator. So to penetrate that wall, the SIS
team had to rely on cribs. Yes, cribs are essential
here. For those who might not know, a crib is
a cryptanalyst's best friend. It is basically
a highly educated guess about the exact plain
text that corresponds to a specific piece of
scrambled ciphertext. And diplomatic communications
are notoriously vulnerable to cribs. Because
they're so formal. Precisely. The Japanese Foreign
Office used this highly stylized, rigidly formal
language. Messages would frequently begin with
exact, predictable phrases like, I have the honor
to inform your excellency. Ah, so if the Americans
could align that known plain text with the scrambled
ciphertext, they could start mapping the electrical
pathways inside the machine. Yes. Furthermore,
because Purple was deployed gradually, some of
the smaller Japanese consulates around the world
still only had the older Oh, meaning Tokyo would
sometimes transmit the exact same diplatic circular
twice. Yes, they did. Once in the new, supposedly
unbreakable purple cipher, and once in the compromised
red cipher that the Americans could already read
fluently. It was a massive mistake. Having the
translated red message sitting right next to
the encrypted purple message gave Friedman's
team the perfect Rosetta Stone. That's incredible.
Even with those cribs, mapping the internal wiring
of multiple cascading stepping switches without
ever actually looking at the physical hardware.
I mean, that sounds like an agonizing process.
Oh, it was grueling. The pivotal breakthrough
did not occur until September 1940, and it was
driven by a brilliant cryptanalyst named Genevieve
Gr - The sources really highlight Grachin's work
is the absolute turning point here. She was staring
at what the team called homologous messages.
Right, homologous messages. These were messages
that were sent on completely different days,
but because of laziness or just operational error
by the Japanese clerks, they utilized the exact
same starting settings for the machine. Which
is a huge security no -no. A massive one. Analyzing
homologous messages allows cryptanalysts to compare
the chaotic output of the 20s group across multiple
texts. was essentially performing statistical
gymnastics. She wasn't just looking at the letters
themselves. She was looking at the physical distances
between repeating cipher letters. So she's mapping
the gaps. Exactly. And she discovered that the
intervals between certain scrambled characters
were multiples of specific numbers. Oh, wow.
So by finding those repeating mathematical intervals,
she proved that the seemingly random gibberish
was actually generating a predictable loop. Yes.
She found the mechanical period of the machine.
That is amazing. She exposed the hidden mathematical
cycles just from staring at the letters. She
really did. Her discovery proved definitively
that the chaotic permutations were the result
of a specific number of switches moving at specific,
measurable speeds. And shortly after Gratian's
breakthrough, another team member, Navy Lieutenant
Francis Raven, discovered the underlying protocol
for the keys. He realized the Japanese were altering
the machine's starting positions on a rigid 10
-day cycle. with highly predictable minor daily
shifts within that block. So the math is finally
completely exposed, and with the mathematical
rhythm of the 20 group figured out, the team
realized the logic perfectly mirrored the operation
of commercial automatic telephone exchanges.
Which brings us to the hardware phase. Leo Rosen,
who was an electrical engineer on the SIS team,
quite literally went to a commercial telecommunications
catalog, ordered standard uniselector switches
like the exact kind used to route everyday phone
calls, and just started wiring them together
based on Grotchen's mathematical models. so audacious.
By late 1940, through grueling methodical deduction,
the SIS had constructed the Purple Analog. The
Purple Analog. Yeah, it was this massive whirring
assembly of commercial telephone parts just sitting
in a laboratory in Washington, D .C. They could
feed intercepted Japanese ciphertext into one
end of this machine, and plain, readable Japanese
would literally clatter out of the typewriter
on the other end. Building the purple analog
meant the United States could now read the minds
of the Japanese government in real time. And
this reality violently shifts our story out of
the quiet laboratories of the SIS and onto the
global battlefield. The shift is dramatic. The
intelligence gathered from Purple and other intercepted
Japanese communications was collectively codenamed
Magic by the Allies, right? Right. Magic. And
the geopolitical consequences of the magic intercepts
were staggering. The most immediate and honestly
tragic intersection of this intelligence with
world events occurred in December 1941. The attack
on Pearl Harbor. Yes. The Japanese government
transmitted a 14 -part message to their embassy
in Washington, officially terminating diplomatic
negotiations with the United States, which effectively
signaled war. And it was enciphered in purple.
But because the purple analog was fully operational,
U .S. cryptanalysts intercepted the transmission,
decoded the 20s and the 6s, translated the Japanese,
and had the finalized English text. in the hands
of the U .S. government by 1 .00 p .m. on December
7th. Which is incredible speed. They processed
the message faster than the Japanese embassy
scouts could even decrypt and type it up for
delivery themselves. It's true. The tragedy,
of course, is that while the cryptographic break
was flawless, the speed of bureaucratic communication
was not. By the time the final decrypted warning
was distributed, the attack on Pearl Harbor was
already underway. Just a heartbreaking delay.
However, as the war expanded, the Purple Machine
inadvertently transformed into one of the greatest
intelligence assets the Allies possessed in the
European theater. That is the big twist of this
story. Right. The Japanese built a machine to
protect their own secrets, and it ended up betraying
the deepest secrets of their closest ally. We
have to talk about General Hiroshi Oshima. Oh,
General Oshima. He was the Japanese ambassador
to Nazi Germany, and honestly, his role in the
war effort cannot be overstated. He was deeply
trusted by the Nazi high command. Which was rare,
right? Extremely rare. Adolf Hitler, who was
notoriously paranoid and rarely trusted anyone
outside his inner circle, viewed Oshima as this
ideological confidant. Hitler and his top generals
would have incredibly candid detailed conversations
with Oshima regarding German military strategy.
And Oshima would take meticulous notes during
these high level briefings, return to the Japanese
embassy in Berlin and transmit incredibly detailed
reports back to his superiors in Tokyo. All of
it encrypted in the purple cipher. He was completely
unaware that the Americans and the British were
intercepting the transmissions, running them
through the purple analog and reading every single
word. Everything. Everything. General George
Marshall, the US Army Chief of Staff, even stated
that Ambassador Ishimu was their primary source
of information regarding Hitler's strategic intentions.
The level of detail Oshima provided was astonishing.
I mean, he personally toured the Atlantic Wall,
the massive coastal fortifications the Germans
were constructing to repel an allied invasion
of France. He sent comprehensive descriptions
of Trump deployments, bunker locations and defensive
strategies back to Tokyo. And the allies simply
intercepted the transmissions and essentially
received the German blueprints straight from
the Japanese ambassador. Thanks for the tour.
Right. Exactly. But Oshima also transmitted Hitler's
confidential plans regarding the Soviet Union.
And this introduces a critical geopolitical pivot
point because the United States and Britain were
not the only nations reading purple. Oh, this
is fascinating. The Soviet Union broke it too.
Yes. Through their own cryptanalysis efforts,
the Soviets had also managed to break the purple
system by late 1941. So Joseph Stalin is reading
Oshima's mail as well. He is. And through these
decrypted purple messages, which were corroborated
by human intelligence from spies like Richard
Sorge, the Soviets confirmed a vital piece of
strategic information. Which was? Japan had definitively
decided to target Southeast Asia and would not
launch an attack against the Soviet Union's eastern
border. OK. The impact of that single piece piece
of intelligence on the Eastern Front is massive.
Because Stalin knew with absolute certainty that
his Eastern flank was secure from a Japanese
invasion, he'd initiated a massive troop transfer.
A huge gamble, but a calculated one. Right. He
pulled his elite winter trained Siberian divisions
away from the east and rushed them via the Trans
-Siberian railway to defend Moscow. And those
Siberian troops arrived just as the German panzer
divisions were pushing toward the Soviet capital
in December 1941. The reinforcements were decisive
in halting the German advance and saving Moscow.
It is entirely possible that the intelligence
extracted from the Purple Cipher prevented the
total collapse of the Soviet Union. That is just
mind -blowing. But given the sheer volume of
strategic leaks, it seems impossible that the
Axis powers wouldn't realize their communications
were compromised at some point. And this brings
us to the most infuriating moment of the story,
at least from the Japanese perspective, that
Germans actually figured out the code was broken.
They did. In April 1941, well before Pearl Harbor,
a German diplomat stationed in Washington named
Hans Thompson sent an urgent message to the German
foreign minister in Berlin. Thompson explicitly
warned that the Americans were actively reading
the Japanese diplomatic ciphers. Where did Thompson
even get that information? The leak was this
remarkable chain of diplomatic whispers. The
U .S. Undersecretary of State, Sumner Wells,
vaguely hinted at the intercepts during a conversation
with the Soviet ambassador to the U .S. The Soviet
ambassador deduced the reality of the situation
and subsequently leaked the information to the
Germans. The German government deemed the intelligence
reliable and immediately forwarded the stark
warning to Tokyo. I mean, if your closest military
ally urgently contacts you and explicitly states
that your secure communications network is compromised
and the enemy is reading your mail, the logical
response is to immediately shut the system down.
The logical response, yes. But the Japanese Foreign
Ministry conducted a brief internal investigation
and concluded that their cipher was perfectly
safe. They just ignored it. They flatly rejected
the German warning. They rationalized that the
leak must have come from like a human spy operating
within the embassy or that the Germans were simply
mistaken. They refused to believe that an adversary
could crack a machine as sophisticated as Purple
without physically stealing one. Their blind
faith in their own technological superiority
completely overrode the empirical warning from
their ally. Yeah, and because of that institutional
arrogance, the Americans continued to read their
highest level diplomatic secrets for the entirety
of the war. The Japanese military establishment
treated the technology as infallible. And there
is a profound lingering irony to the physical
legacy of this technology, too. In the final
days of the war, as the empire was collapsing,
Japanese embassy staff around the world were
ordered to frantically destroy their purple machines
to prevent them from falling into allied hands,
right? Right. total destruction. They smashed
them into unrecognizable pieces. The U .S. military
only ever recovered fragmented burned components
from the ruins of the embassy in Berlin. No fully
intact original purple machine was ever found.
The original machines were completely obliterated,
yet the American built replicas. Purple analogs
constructed out of standard telephone parts by
engineers who had never even seen the original
survived the war perfectly intact. It is a phenomenal
narrative of cause and effect. A machine born
out of inner service secrecy and paranoia between
the Japanese Navy and foreign affairs. It was
crippled from its inception by a budgetary decision
to save a few pennies on telegraph fees by treating
vowels differently. So preventable. And then
it was painstakingly reverse engineered by brilliant
crip analysts like Genevieve Grachin and William
F. Friedman, who pulled mathematical cycles out
of pure chaos. And ultimately, it served as the
greatest unwitting spy of the 20th century, broadcasting
the Axis powers deepest secrets right into the
hands of the allies. It truly is a master class
in the vulnerabilities of complex systems. But
if we pull back from the history of World War
II and look at our current technological landscape,
there is a distinctly unsettling parallel here.
How so? Today, our entire global infrastructure
banking, military communications, personal data,
it all relies on modern end -to -end encryption.
We utilize algorithms like RSA, which rely on
prime factorization. And much like the Japanese
engineers who built purple, our modern cryptographers
tell us that these mathematical fortresses are
effectively unbreakable by any classical computer.
Right. We've placed absolute trust in the math.
We have. But the specter on the horizon is quantum
computing. A fully functional quantum computer
running Shor's algorithm could theoretically
shatter our current encryption standards in moments,
rendering our supposedly unbreakable systems
entirely transparent. Just completely blow it
wide open. Exactly. So it forces us to ask a
very uncomfortable question. As we place our
blind faith in the infallibility of modern cryptographic
technology, are we simply setting ourselves up
to be the victims of the exact same huge that
doomed the purple machine.