The Teenager Who Cracked the Code No One Else Could
How a 17-Year-Old Outsmarted Japan’s “Unbreakable” Cipher and Changed the Pacific War
The basement of Building One at Pearl Harbor was never meant to feel heroic.
It smelled of stale sweat, cheap cigarettes, and the quiet panic of men who knew they were losing. Rows of desks were packed so tightly that elbows brushed as exhausted naval analysts stared at endless columns of numbers. Five digits. Then another five. Then another. Thousands of them. Meaningless. Relentless. Mocking.
It was April 1942. Four months after Pearl Harbor, the Pacific War was going badly. Japanese forces were advancing with speed and confidence, striking where they pleased and vanishing before American commanders could react. Wake Island had fallen. Guam had fallen. The Philippines were on the brink. American submarines prowled empty seas, while Japanese carrier groups seemed to know exactly where to strike next.
The reason was simple and terrifying: Japan could see. America could not.
At the center of the darkness sat a code known as JN-25, the Imperial Japanese Navy’s main operational cipher. It was not just a code. It was a fortress.
And everyone in that basement believed it could not be broken.
The Code That Was Killing Sailors
JN-25 was elegant in its cruelty. Japanese messages were first converted into five-digit code groups using a massive codebook—tens of thousands of entries. “Carrier.” “Fuel.” “Attack.” “Tomorrow.” Each became a number.
But even that was not enough. Before transmission, Japanese operators added a second layer: random numerical additives taken from separate tables that changed frequently. The result was a code wrapped inside a cipher, then wrapped again. Even if you guessed the meaning of one group, the math buried it under shifting numerical noise.
America’s best minds had been attacking JN-25 for over a year. Ivy League mathematicians. Naval Academy graduates. Legendary cryptanalysts like Agnes Driscoll, already famous for breaking earlier Japanese systems. They worked sixteen-hour days, drowning in numbers, building charts and tables, searching for patterns that refused to appear.
By early 1942, the U.S. Navy could read perhaps five percent of current Japanese naval traffic—and most of that came too late to matter.
Admiral Chester Nimitz needed answers. Where would the Japanese strike next? Hawaii again? Alaska? Australia? Without that knowledge, every American move was a gamble, and every gamble cost lives.
Inside Building One, confidence was collapsing.
Then a teenager noticed something everyone else had ignored.
The Kid Who Wasn’t Supposed to Be There
Andrew Maté Gleason did not look like a savior of the Pacific Fleet.
He looked like a boy playing dress-up in a Navy uniform that didn’t quite fit.
Born in 1921, Gleason was just seventeen when Pearl Harbor was attacked. Too young to enlist legally, he forged his birth certificate and joined anyway. Not out of recklessness, but restlessness. He had always been wired differently—able to spot patterns where others saw chaos. Numbers didn’t confuse him. They spoke to him.
The Navy didn’t know what to do with a skinny kid who said he liked math and puzzles, so they assigned him to OP-20-G, naval cryptanalysis. Not as an analyst. Not as a codebreaker.
As a message sorter.
His job was simple: take intercepted Japanese messages and file them by date and origin. He was told—repeatedly—not to touch the real work.
So he watched. And listened. And quietly noticed things no one else had time to see.
Night after night, surrounded by stacks of messages everyone else dismissed as unreadable noise, Gleason’s mind kept circling one strange detail. The message headers—the unencrypted indicators—looked…uneven.
Traffic from Tokyo to Berlin used only certain letters. Berlin to Tokyo used different ones.
It was subtle. Easy to overlook. Easy to dismiss.
Unless you were seventeen and hadn’t been taught what was “impossible.”
A Crack in the Wall
One night, Gleason spread dozens of messages across an empty desk. If the indicators followed a predictable structure, and if their plain-text patterns were known, then subtracting them from the encrypted values might expose pieces of the additive tables.
It sounded too simple.
It worked.
With pencil and paper, Gleason began peeling back the numbers. His first tests weren’t perfect, but they weren’t random either. He refined the method. Tested again. Improved the accuracy. Seventy percent. Then eighty.
He had found a way inside JN-25’s second layer—the part everyone believed made the system unbreakable.
When he tried to tell his superiors, he was brushed aside. He was a kid. A file clerk. A nobody. Real cryptanalysts had been fighting this monster for years. What could a teenager possibly see that they hadn’t?
So Gleason kept working in secret.
The Moment Everything Changed
In May 1942, Japanese radio traffic spiked dramatically. Something big was coming. OP-20-G knew it—but could not read enough to act with confidence. Messages referenced a target called “AF.” No one knew what it was.
Admiral Nimitz arrived at Building One demanding answers.
And that’s when Gleason stood up.
Against every rule of military protocol, the lowest-ranked person in the room spoke. His voice cracked as he explained his idea. The split alphabets. The indicator subtraction. The notebook full of math he wasn’t supposed to have.
Silence followed.
Then the experts leaned in.
Agnes Driscoll checked the work. So did Marshall Hall Jr. One by one, they realized what they were seeing. The method wasn’t elegant. It wasn’t polished.
But it worked.
Nimitz gave them seventy-two hours.
Breaking the Unbreakable
For three days, no one slept.
The team applied Gleason’s method across thousands of messages. Additives fell away. Code groups began to speak. Locations emerged. Timelines sharpened.
AF was not Alaska. It was Midway.
Japan was planning a massive carrier strike—four fleet carriers, an invasion force, and a decisive trap designed to finish what Pearl Harbor had started.
Now America knew.
Nimitz positioned his carriers northeast of Midway. When Japanese planes struck the island on June 4, 1942, American dive bombers were already in the air. Minutes later, three Japanese carriers were burning. By sunset, four were lost.
The Battle of Midway changed the war.
And it happened because a teenager refused to accept that a problem was unsolvable.
The Aftermath No One Saw
Gleason’s method didn’t just win Midway. It transformed naval intelligence. Within months, OP-20-G was reading the majority of Japanese naval traffic. Submarines stopped hunting blind. Convoys were intercepted. Ambushes became routine.
Japanese officers wrote in their diaries that the Americans seemed to know their plans in advance.
They did.
After the war, Gleason followed Nimitz’s advice. He went to college. Then Harvard. He became one of the greatest mathematicians of the twentieth century, solving problems others believed impossible.
For decades, his wartime role remained classified.
When it was finally revealed, Gleason shrugged. He said he was young, lucky, and noticed something others were too busy to see.
But history tells a clearer story.
Sometimes, revolutions don’t come from authority or experience. Sometimes they come from fresh eyes, stubborn curiosity, and the courage to speak when no one is listening.
JN-25 was never truly unbreakable.
It just needed someone who didn’t know it was supposed to be.





