Tonight on Nova, as soldiers fought on World War II's battlefields, other heroes were hidden away, toiling over secret enemy codes. Some of their work is still kept top secret. The work we were about to do was top secret. So if you talk about what goes on here, you will be shot. These men and women were the real secret weapons. Codebreakers. Funding for Nova's 20th anniversary season is made possible by Johnson & Johnson, the signature recognized around the world for commitment to quality health care products for the entire family. And, Lockheed, America's aerospace company, supporting math, science, and engineering education for national technology leadership. Major funding for Nova is provided by the Corporation for Public Broadcasting and by annual financial support from viewers like you. We're at a secret location somewhere in Maryland, inside a guarded warehouse. What dark secrets do these numbered crates hold? Why, when Nova asked to film here, did national security officials provide this footage, rather than reveal the location or the contents of this warehouse? The answer is inside this crate. It's being opened at our request for the first time since the end of World War II. It contains a machine known as the Purple Analog. This remarkable piece of equipment helped win the war. It enabled American codebreakers to read top secret Japanese messages from months before Pearl Harbor to the end of the war. To understand just how remarkable an achievement this machine was, we have to go back 40 years and halfway across the world to Edwardian London. This is the Admiralty, headquarters of the British Navy. It's looked much the same for 200 years, until a subtle change at the turn of the century, when a web of antennae was installed on the roof. Radio had just been invented. Orders could now be issued directly to warships in distant corners of the world. But the use of radio brought a new threat. Radio, or wireless telegraphy, when it came into being at the turn of the century, turned out to be a great boon for navies. It enabled operational headquarters to control ships far away at sea. But radio had an enormous disadvantage in comparison to this advantage. Namely, it turned over every message that it sent to the enemy. How were they to eliminate this leakage of information? They began to use codes and ciphers to protect them. But on the other side, the enemy, to gain access to this information, developed codebreaking. And it became, in World War I, for the first time, an important instrument of war. As the British High Command eavesdropped on the flood of German Navy signals, it began to lay the foundations for a new intelligence-gathering arm. Room 40 at the Admiralty became the birthplace of modern codebreaking. In Room 40, a group of aspiring codebreakers recruited from Oxford and Cambridge universities began to master their new trade. Almost immediately, they had a lucky break. In August 1914, the German cruiser Magdeburg was boarded by the Russians in the Baltic. They captured the German Navy's current codebook and sent it to their British allies. The codebook contained 34,000 words and phrases used to issue orders to German warships and the three-letter or five-digit code groups that represented them. With this document, the codebreakers in Room 40 could now understand the structure of German Navy codes. For the remainder of the war, they were able to read coded German orders and warn the British Navy whenever the enemy fleet put to sea. It was codebreaking's first great victory. But not all of Germany's coded messages went by radio. Some were sent by transatlantic cables that still ran through London. British intelligence routinely tapped these cables and all coded messages were sent to Room 40. In January 1917, a long telegram was sent from Berlin to Washington on an American-owned cable. Room 40 found that it was encrypted in a German diplomatic code and addressed to the German ambassador in Washington from the German foreign minister, Arthur Zimmerman. British codebreakers attacked the telegram and soon had a partial text. The words leapt from the page. Unrestricted submarine warfare. Alliance with Mexico. War with the USA. The head of Room 40, Admiral Blinker Hall, realized that the telegram might bring America into the war, but how to let the Americans see the message without revealing that Room 40 had been tapping American cables. Then the German ambassador in Washington sent a copy of the cable to the German embassy in Mexico City. British intelligence picked that signal up and to shield its codebreaking activities, London invented a story about capturing the telegraph in a Mexico City break-in and revealed the full text to the USA. The Zimmerman telegram was dynamite. Mexico was to declare a war on the USA and receive financial support to recover lost territories in Texas, New Mexico, and Arizona. The Zimmerman telegram was the most important single code solution in history. It demonstrated an absolutely brilliant use of intelligence by Admiral Hall. Its importance, of course, was that it precipitated America into the great war on the side of the Allies, and for the first time intelligence had had a significant effect on the course of world events. President Wilson, who had said he was too proud to go to war, now had no alternative. The U.S. immediately declared war on Germany. The fresh young troops from America tipped the balance in favor of the Allies. In 1918, with Germany beaten, the war to end all wars came to an end. But it wasn't long before new conflicts emerged. The first sparks flew at the 1921 conference in Washington. Japan, then one of the Allies, demanded a navy just as large as that of Britain and the U.S. The United States opposed Japan, and it had a powerful secret agent on its side. He was Major Herbert Yardley, head of the secret Black Chamber, the codebreaking unit of the Army and State Department. Although Yardley could not speak Japanese, he promised he would break the Japanese codes. He tackled them like a giant crossword puzzle, and with a combination of laborious trial and error and some inspired guesses, he succeeded. He decoded cables in which Tokyo revealed it would back down from its demands if pressed. Armed with this secret information, the U.S. forced Japan to accept a battleship fleet little more than half that of either the U.S. or Britain. The U.S. and British delegates were delighted, but the Japanese bitterly resented it, and the seeds of future conflict had been sown. U.S. Secretary of State Charles Evans Hughes must have known of Yardley's codebreaking exploits. He certainly exploited the results. But when his successor, Henry Stimson, took office, he was appalled. As soon as he discovered the State Department was secretly funding the Black Chamber, he closed it down with the famous line, Gentlemen do not read each other's mail. Yardley was fired and left without a job or pension at the height of the Depression. Desperate, he published a series of Saturday Evening Post articles and a book, The American Black Chamber, revealing how he broke the Japanese codes. The book became a bestseller in America and in Japan, where it fueled the growing anti-U.S. feeling. Herbert Yardley was one of the most remarkable characters in the history of cryptology. He was a womanizer, he was a poker player, and he was a drinker. But he was also an extraordinarily excellent codebreaker. And even though toward the middle of his life he wrote this book, The American Black Chamber, which revealed too many American codebreaking secrets, nevertheless his activity in breaking the Japanese naval code and diplomatic code at the time of the Washington Disarmament Conference proved an enormous boon to the United States. It enabled us to gain naval superiority over Japan, substantial naval superiority, which proved of great value during World War II. Meanwhile, the U.S. Army continued codebreaking and hired the brilliant young William Freedman. With his wife Elizabeth, also a talented codebreaker, he held codebreaking parties. Progressive dinners. They'd have progressive dinners in which codes were an essential part. And couples would come and they'd be split up, husband from wife, and sort of moved around to kind of equalize the teams. And they'd be given a sheet. And on the sheet were a succession of codes. And I imagine that they got more difficult as they went along, but you'd have to solve the first message to find out the restaurant to go to for the first course and so on through the meal. And then the first couple back to the house would win some kind of a small prize or something like that. And people really enjoyed those parties and came to them with relish. Unlike Yardley, who was a loner, Freedman set out to build up a team of codebreakers and quickly hired his first three trainees. Frank Rowlett, a young math teacher from Virginia, aced the civil service exam and was offered a job as a cryptanalyst. The salary offered with this position was $2,000 a year, which was more than both my wife and I were making as school teachers. And we decided that it was worth trying. Also, it had the opportunity of giving each of us a chance to go to Washington, where we never visited. So he reported to Freedman at his office in the old munitions building. It was during this first exchange with Freedman when he got through inquiring if I had a place to live. And had I been to Washington before and just sort of simple conversation, that I found an opportunity to ask him what a cryptanalyst was supposed to do. And he said, you mean you don't know what a cryptanalyst is? And I said, I never heard the word before. Then he looked out the window and he said, well, that's not strange. He says, I just invented it. It was 1930 and the U.S. Army was secretly listening to the growing volume of foreign military radio traffic. The tensions that would explode into World War II were already becoming clear to Freedman's team as early as 1931, as they listened in to Japan's ruthless invasion of Manchuria. But the American people were in no mood for foreign adventure. Policemen and cadets did the parading. While in Europe, it was German stormtroopers who marched into Austria. The Italians invaded Abyssinia. And Hitler seized part of Czechoslovakia with no one daring to oppose him. As Western Europe caved in to Hitler's threats, alarm bells rang in Poland. The Poles feared they were next on Hitler's list of conquests and intensified their efforts to decode the German military signals. Surrounded by enemies for centuries, Poland had developed an excellent code-breaking unit skilled at reading the messages of the German army. But in 1928, the codes became unreadable. The Poles suspected the Germans were now using a machine cipher instead of a code. So what's the difference between a code and a cipher? Codes are letters or numbers that substitute for whole words or phrases. And code books are like telephone directories with thousands of words and phrases listed alongside letter groups that represent them. The weakness of codes is that they can't be used for very long. The more messages the enemy code-breakers read, the more code groups they can break. So every few months, new code books have to be created and distributed to every military unit in the field. Ciphers are infinitely harder to crack because they replace every individual letter of every word. Ciphers have been used for centuries. This one, for example, was invented by the ancient Greek writer Polybius. Each letter is represented by two numbers. A is 11, B is 12, and so on. The Roman emperor Julius Caesar used a cipher in which the letters were transposed three places. So A becomes D, B becomes E. Some ciphers are built around a key word to make them easier to remember so that spies don't have to carry written keys with them. Here the word gothic is written down, followed by the remaining letters of the alphabet. This vital key word would be changed frequently. But these simple ciphers where one letter is always replaced by one other letter would be solved in a few minutes by any cryptanalyst using the characteristic features of any language that are the code-breakers' principal weapon. Take a page from any modern English text and count the different letters, and you get this standard pattern. In English, the most commonly used letters are E, T, A, O, N, and I. The least used are J, K, X, Q, Z. A letter frequency count is where all code-breakers begin, whatever the language. Another basic weapon is contact analysis because certain letters frequently appear together. In English, T, H is the commonest pairing of consonants. So if the code-breaker can find a T, he can also locate an H. E, A is the most frequent vowel grouping. S tends to appear with consonants. R usually appears with vowels. Complex ciphers try to conceal these tell-tale frequencies in letter contacts. The ultimate goal is to have each letter of each word of a message from a different cipher. In other words, A might be represented by B the first time it appears, but by C the second time, and D the third, and so on. This is what cipher machines can do, exploiting the millions of possible combinations of letters and numbers. In the 1920s, the Germans began to use the most powerful cipher machine so far invented. It was known as Enigma, an unsolvable puzzle. This was the machine the Polish code-breakers were up against. They struggled to solve certain Enigma ciphers by trial and error, but the method was hopelessly slow. Then they had a stroke of luck. Captain Gustav Bertrand of the French Secret Service reported a young man working at the German Ministry of Defense had offered to sell secrets. They gave him the code name Ash. French agents met Ash in a dozen European cities to buy classified documents. They included the operating manual for the German Army's version of the Enigma machine. The French shared the manual with the Poles, who now knew exactly how the Enigma machine worked. Later the Poles passed all their information on to British intelligence. This is an actual German Enigma cipher machine. The keyboard, which was used to put in the letters, and an illuminable panel here, which the output letters would show up on as you enciphered the message. And, of course, I must make clear that if I'm putting a message into code using an Enigma machine, the person who's receiving this message must have an identical Enigma machine identically set up to take the message out of code. To put a message into Enigma cipher, the Enigma operator first had to choose three code wheels from the seven that were available, or the eight later on that were available, put these wheels on their shaft in a particular order, then put the wheels into the machine, add these so-called plugs to a particular position, also pre-arranged, close the cover, and then begin, sometimes after some additional complications, begin enciphering by pressing letters of the message on the keyboard. So how did Enigma work? The heart of the machine was the maze of wiring inside the rotors. Each one was made of a thick disk of insulating material. Around the edges were rings of metal contacts for each of the 26 letters of the alphabet. Each contact was wired through to a different letter on the other side of the disk. The three rotors were each wired differently, and they were geared so that when the first rotor had moved through 26 positions, the next rotor was nudged forward one notch. These three rotors produced over 17,000 different cipher combinations before the machine repeated itself. To complicate matters, there was also a fourth disk which was used to direct the signal back through the other rotors. And then on the front of the machine, near the keyboard, there was a plug board capable of scrambling letters in a way that added several million possible cipher combinations. So when the cipher clerk pressed A on the keyboard, an electrical current flowed through the maze of wiring connecting rotors and plug board, and the letter representing A would appear on the panel. In the field, the operators removed the rotors and shuffled them three times a day. Initially the rotors were selected from a basket of five. Later on in the war, there would be no less than eight rotors to choose from. Even if a machine were captured by an enemy, they couldn't use it to decipher messages unless they also had the precise settings of the rotors and the plug board. So great was the final total of possible ciphers. The first six letters were the key or the indicator telling the recipient how to set up his enigma machine to decipher the message. By September 1939, thousands of enigmas and the German army awaited Hitler's order to conquer Europe. Poland was the first target, but the German blitzkrieg or lightning war was soon sweeping across Europe. The blitzkrieg depended on enigma. Radio messages coded and decoded by enigma gave the thousands of daily commands necessary to keep the armies on the move. These screaming Stuka dive bombers could be called to attack targets only yards away from the advancing German troops. Battlefields on which tens of thousands had died to gain a few yards in World War I were crossed in the morning. The French army, the largest in Europe, just fell apart. And Paris was occupied in 34 days. The ceasefire was signed by Hitler at Compiègne in the very railway carriage in which the Germans had surrendered in 1918. Now it was the French who were totally humiliated, while the Germans exalted. Meanwhile in Washington, still officially neutral, isolation was giving way to fear of war. Government buildings were now guarded night and day. And the terrible news from Europe was matched by events in the Pacific, where Japan was openly threatening U.S. interests. In 1938, the secret recording machines began to intercept a new Japanese cipher that the Washington codebreakers could not crack. They called it Purple. Of course, we were collaborating with the Navy at that time, and both of us were very anxious to get right onto this new machine, this thing that we early on named Purple. And we had some success with it in the first weeks, but not enough to allow us a full solution of it. Friedman's small team was ordered to drop everything and concentrate on breaking the Purple cipher. Frank Rowlett, a key team member, recalls just how difficult the assignment was. All we had was pen and paper and a calculator. One of these desk type things with nine rows of keys, ten columns wide or something like that. But those primitive methods would have taken decades. So the team modified three punch card tabulators to perform like computers. They had them running 24 hours a day, trying out possible solutions to the Japanese Purple messages they had intercepted. Their aim was to find out enough about the Japanese ciphers to build a replica of the Japanese machine, a seemingly impossible task made all the more difficult by the complexities of the Japanese language itself, a language that few Americans could then speak. Well, the language is so foreign if you forgive the expression to non-orientals. It's a completely different concept of pictographs, basically pictures representing words and ideas. And it's difficult. In order to read a Japanese paper, for example, one needs, one should know at least 2,000 and preferably 3,000 characters. Once the concept is achieved, then there's the business, the mechanical memorization of these characters. They can be everything from a simple one-stroke character, the word one is just one stroke, up to characters that have as many as 30 strokes within one character. Very complex. And in trying to translate these messages, there was the problem of the frequent Japanese use of homonyms, words which sound the same but have totally different meanings. A good example is the word that is now a name of a popular watch, a Japanese-made watch, Seiko, S-E-I-K-O. It's made up of two characters, and offhand I can think of four or five different meanings, totally different meanings. In addition to the watch name, there is a word Seiko, which means success, there is a word starlight, a steel manufacturer, a sexual intercourse, one meaning of Seiko, a perfume as another one, and a resort to a dictionary would yield another 10 or 12 more, totally different characters. Friedman's small team toiled on through 1939 and into 1940 in room 3416 of the munitions building on Constitution Avenue. They knew the Japanese had German Enigma machines, but that wasn't the answer. William Friedman drove himself relentlessly trying to find out how the Japanese machine worked. Time and time again he came to a dead end. After 18 months of unrelenting pressure, his health was broken, but by then he and his team had cracked the mystery. The answer has never been revealed before. The secret to Purple was not mechanical rotors like Enigma, but electrical relays of the sort available in any telephone exchange. Relays translated the movements of the telephone dial into electrical pulses and could make and break electric contact with great speed. Armed with this information, they built this machine to break Japanese purple ciphers. It remains, 50 years later, under guard in a secret government warehouse in Maryland. It consists basically of two electric typewriters. Into one was typed the Japanese enciphered message. The electrical impulses then passed through a 26-position plug board, which had to be reset every day, and through an electrical maze created by the rapid movements of the stepping relays. The Japanese plain text ready for translation appeared on the second typewriter. Amazingly, Friedman's team recreated this machine simply by analyzing the intercepted messages. In August 1940, Rowlett and the engineer Leo Rosen had the machine ready. I was working with Rosen. This was about 6.30 or 7 o'clock at night, because we wanted to finish this thing. We'd waited so long for it. We just couldn't wait any longer. And so I got a message, and we set up the machine to the indicator, and I started typing. And the first few groups, the first three or four that I typed in the machine came out beautifully on the other end. The Japanese plain text that we knew, because we'd solved the message by hand earlier, had to come out. And then all of a sudden, the machine stopped operating. And after a little puzzle about it, Rosen concluded that we had failed to put in a relay that was needed, a condenser over the relay points that was needed for the master relay. And so we got hold of one of those, and he installed it. And lo and behold, it worked just like a charm from then on. So we were ready to demonstrate it to the chief signal officer next morning, and also to Friedman and General Aiken and the others who were in the chain of command that were interested in what we were doing. And what was their reaction? Amazement and great pleasure. William Friedman's achievement has been shrouded in secrecy. Only now is his full contribution being recognized. He was probably the most brilliant cryptanalyst we've ever seen. He engendered theoretical ideas which took cryptography out of its kind of primitive land into the new world of statistical analysis in a very sophisticated way. He led and organized and directed and inspired the team that, using some of his techniques, cracked the Japanese purple cipher machine, which was quite possibly the greatest feat of cryptanalysis the world had ever seen. The breaking of purple allowed American intelligence to read all top-grade Japanese government traffic, including messages between Tokyo and Japanese embassies around the world. The Japanese ambassador in Berlin, Baron Oshima, was a close friend of Hitler, and he became an unwitting spy at Hitler's dinner table when all of his reports to Tokyo in the purple cipher were also read in Washington and passed on to London. As 1941 came to a close, top U.S. officials had a constant flow of secret information. But though they gained much vital intelligence, the codebreakers still had not penetrated another vital Japanese code called JN-25. Washington could follow Japanese preparations for war, but did not know that the Japanese fleet had already put to sea. The White House learned the Japanese embassy was burning documents. On the night of December 6, 1941, intercept stations picked up heavy Japanese radio traffic from Tokyo to their embassy in Washington. The machines clattered with the intercepted purple code groups. The tapes were rushed to the codebreakers on Constitution Avenue where the ciphers were decrypted. The text was then teletyped to the State Department. It ordered the Japanese ambassador to break off diplomatic relations at precisely 1 p.m. Washington time when the sun was just rising over the Hawaiian islands. Hickam Field, Pearl Harbor. Boeing B-17 fortresses are lined up wingtip to wingtip. On Battleship Row are seven battleships. The first bomb exploded at 7.55 a.m. with the battleships as the principal targets. In two hours, it was all over. 3,500 lay dead or wounded, and seven battleships were reported lost. Could the attack have been anticipated? Should President Roosevelt have known about it in advance? When I'm asked the question about Roosevelt's having advanced information, I ask where could it have come from? And the offer is made that it came from the British, that the British were breaking the Japanese codes and had the information, gave it to Churchill, and Churchill gave it to Roosevelt. We go back to the first stage of that premise, and that is that Japan was sending out messages that indicated they were going to attack Pearl Harbor. And my question is, to whom would they be sending such messages? There was no one on God's green earth they should be sending such messages. Now, we have, since the war, gone back and reviewed the messages, the Japanese JN-25 series messages that were intercepted prior to Pearl Harbor. And there are some 10,000 of those messages that were intercepted between 1 September and 7 December 1941. They were reviewed after the war, and some 1,200 or 1,300 of the messages were thought important enough to translate. And they were translated by my colleagues who were waiting to accumulate enough retirement points to get out of the Navy and get back to what they wanted to do in the first place. And so they were set to work doing these 1,200 messages. They're all down in the archives. And if you go through those messages knowing about the attack on Pearl Harbor, you can see things that suggest there was going to be an attack. And if you know, as we now know, that the target was Pearl Harbor, you can easily read into those messages that it was exclusively Pearl Harbor. Reading the Japanese diplomatic traffic made it clear to U.S. intelligence that Japan was preparing for war, and U.S. forces were on the alert throughout the Pacific. But no one ever imagined that the entire Japanese battle fleet could sail halfway across the Pacific to attack Hawaii without being seen. Most senior U.S. officials believed that the Philippines were the most likely target, but they were wrong. Since the unprovoked and dastardly attack by Japan on Sunday, December 7, 1941, a state of war has existed between the United States and the Japanese Empire. After Pearl Harbor, America was at war, and arms production became the top priority. Though the attack had crippled the Pacific fleet, the aircraft carriers Enterprise and Lexington were safely at sea when the Japanese attacked. At Pearl, work began immediately to raise and repair the damaged battleships. And away from the dockyards in underground bunkers, Commander Joe Rochefort and his small team of codebreakers were ordered to attack the vital Japanese fleet code JN-25 to learn where the next blow would come. JN-25 was the Japanese Navy's main operational code, whereas the Purple machine was a diplomatic cipher used by the Foreign Office and the diplomats. Purple was difficult to solve, but once solved was easier to go along with. On the other hand, JN-25 was a more difficult code to solve, not because of anything inherent in it, but because we had fewer intercepts, therefore less to work on. JN-25 was a tough code system with over 45,000 groups. The words of the messages were first transposed into five-figure groups. Then, from another codebook, random numbers were added to produce the groups that were actually sent. The sender also included a key to enable the receiver to remove the random numbers and get back to the original code. Tommy Dyer, one of Rochefort's key aides, was so short-staffed, he was assigned the bandsman from the battleship California, which had been sunk at Pearl, to operate the unit's IBM machines. Everyone worked around the clock to break JN-25. By April 1942, they began to decode almost complete messages, like this one detailing the destroyer escorts for Japanese carriers, and they learned of a major new attack. The Japanese sent the carriers Zuikaku and Shokaku to attack Port Moresby in New Guinea. After Rochefort showed him the messages, Admiral Chester Nimitz sent the Yorktown and Lexington to intercept the Japanese in the Coral Sea, but they failed to make contact. However, on May the 7th, Navy planes searching for the Japanese carriers spotted another force escorting enemy troop ships towards New Guinea. They attacked it and sank the carrier, the Shoho, in just ten minutes. The American codebreakers had helped to score a major victory. It was the first Japanese carrier sunk in the Pacific War, and the troop ships turned back. The next day, both the main carrier forces launched airstrikes. The Japanese carriers escaped with little damage, but the USS Lexington was hit and eventually had to be abandoned. For Nimitz, it was a grievous loss of both men and a major ship, but for the Japanese Navy, the Coral Sea was a disaster. Admiral Yamamoto now knew his only chance of winning the war was to lure the remainder of the U.S. fleet into battle and annihilate it. He prepared the largest Japanese battle fleet ever assembled. Admiral Nimitz was now faced with impossible odds. He had just three active carriers to cover the vast spaces of the Pacific. If he positioned his ships in the wrong place, it would leave Hawaii or the West Coast undefended and might well cost America the war. Long-range reconnaissance aircraft scanned the seas around Hawaii, but Nimitz had to depend on the skill of Rochefort and his codebreaking team at Pearl. In May, the team decoded a message that identified the next Japanese target as AF, but where was AF? In Washington, many believed that the target was the Aleutians, but the naval chief of staff thought the target was Pearl Harbor. Rochefort's team believed it was Midway and suggested a way to confirm their hunch. Midway Island had no independent water source, and they were dependent entirely on a desalinization plant, and he suggested that if a message could be sent from Midway saying that they're short on water, send a tanker full of fresh water, that that might cinch it as to the identification of Midway. So they got Admiral Nimitz's approval for it, called the commanding officer at Midway, told him to send a message in a low-level code that said they needed fresh water, and within two days the Japanese had said, AF has a problem, they're short on water, and that was the proof they needed. Midway was put on the alert, but many of the Washington naval staff still believed Nimitz was falling into a Japanese trap. The Japanese plan was typically complex. The Aleutians would be attacked as a diversion to draw Nimitz north. 24 hours later, the bulk of the Japanese force would wipe out the U.S. fleet, allowing invasion troops to occupy Midway. Nimitz made a desperate gamble. Acting solely on the intelligence from his codebreakers, he committed his entire carrier fleet to head off the attack on Midway. They took up a position northeast of Midway and sent search planes to locate the Japanese fleet some 200 miles to the west. Aboard the U.S. carriers, few of the pilots had combat experience. The U.S. Wildcat fighters were outclassed by the Japanese zeros. The American Devastator torpedo bombers were obsolete, and their torpedoes were outdated. Some pilots called themselves the Coffin Squadron. At 7 a.m., the U.S. carriers launched their attack aircraft. To defeat them, the agile zeros rose like flies from the decks of the four Japanese carriers. As the U.S. dive bombers flew towards their targets at 20,000 feet, down below, at sea level, the zeros wiped out all but four of the Devastators, which had failed to secure a single hit. But the Japanese, distracted by the sea level attack and lacking radar, did not sight the American dive bombers until too late. The first armor-piercing bomb struck at 10.26 a.m., the last at 10.30 a.m. Those four minutes were the turning point of the entire war in the Pacific. All four Japanese carriers were destroyed. It was June 4, 1942. As the American pilots returned to the carriers, they did not know they had won one of America's greatest naval victories. The Japanese had lost 2,500 men, 234 aircraft, and four carriers. They would never recover from this loss. The American losses were 307 men and one carrier, but the U.S. flags still flew over Midway. Admiral Nimitz said that the Battle of Midway could not have been won without the codebreakers. The U.S. Chief of Staff wrote, if it hadn't been for the cryptanalysts, we would almost certainly have been 3,000 miles out of place. After Midway, the Japanese were always fighting a defensive war. Meanwhile, 1942 was also a critical year in the Atlantic, and there codebreakers also played a vital role. Prime Minister Winston Churchill believed the German U-boats were the greatest threat faced by Britain. If the stream of supplies flowing from America to Britain in thousands of convoys had been broken, then Britain could not have continued to hold off Hitler. The greatest threat to the convoys lay in what was called the 1,000-mile Black Gap, an area in mid-Atlantic where there was no air cover possible from west or east. The U-boats could close in on the convoys under cover of darkness and deliver their attacks. In 1942, the U-boats were gaining the upper hand. They had sunk several million tons of Allied shipping, and the eastern seaboard of North America had become a killing ground. Admiral Carl Dernitz, the commander of the U-boat fleet, used his submarines in groups called Wolfpacks. This strategy depended on Enigma messages. On the wall of his command bunker, Dernitz had a huge checkered map of the North Atlantic. Day and night, signals enciphered on Enigma machines flashed to and from the U-boats as the Admiral placed his submarines like chess pieces precisely across the tracks of the Allied convoys. They sent hundreds of ships and their vital cargoes to the bottom. Naval officers in London worked around the clock trying to steer the convoys around the Wolfpacks, but there was very little intelligence. The codebreakers had to break the German Navy Enigma. At a country house near London called Bletchley Park, British and U.S. codebreakers toiled in a group of huts to decipher the orders of the German high command. Their daily task was to solve the six-letter key or indicator that showed the German rotor settings for that day. One of them was Arthur Levinson of New York. By concentrating on one key and seeing the traffic from that operator day after day, you got to know some of his likes and dislikes, particularly in the selection of indicators, which was left to the individual, and certain individuals tended in certain directions. Some engaged in obscenities, which were helpful. Some were fans of American movie stars, and in one case the outside indicator was Tom, and we thought maybe the inside Tom-Tom, but it turned out it was Tom Mix, who fortunately had a six-letter name. Two Cambridge mathematicians, the eccentric genius Alan Turing, often regarded as the father of the modern computer, and Gordon Welshman had devised a machine to test the possible settings of the rotors. The machine was essentially a stack of 12 three-rotor Enigma wheels, which tested possible combinations. Eventually, the British had 60 of these machines running 24 hours a day. Without them, the breaking of Enigma would have been impossible. There were thousands of intercepts a day. They already had great success with the Luftwaffe and Army codes, in part because the German operators selected their own keys. But in the German Navy, the keys were rigidly laid down on a monthly sheet. The U-boats continued to devastate the convoys. Then a young Bletchley codebreaker, Harry Hensley, suggested a plan. A naval task force from the base at Scapa Flow in Scotland would race north to ambush a German weather ship in hope of capturing the monthly key sheet. It worked. Another break came when a U-boat was depth-charged to the surface, and a raiding party led by 20-year-old David Baum got on board. The 12-volt secondary lighting was on. The main lights, of course, have all been broken by all the depth-charging, but there was a dim light. You could see enough. And it was very quiet. No generators running, like you have in a ship all the time. A hum. No hum. Deathly silence. Just the hissing, a nasty hissing noise coming out of the batteries, presumably. Gas escaping. And then the rolling to and fro to Atlantic Swell, a plop, of the sea. By far, of course, the most important thing was the Enigma machine. And there it was, screwed to the cable alongside the wireless set. And, of course, we didn't know what it was. We knew it had something to do with decoding, because it was a typewriter. It looked like a typewriter. And my telegraphist, who always carried a telegraphist in an onboarding party, he had a screwdriver. He unscrewed it, and we passed it up. Of course, the miracle was it wasn't dropped overboard. Bletchley Park could now read the U-boat signals, and the vital shipping saved during this period kept Britain fighting. Then in February 1943, Dernitz introduced a new four-rotor Enigma to be used only by the U-boats. Once again, Allied codebreakers were blacked out, and the U-boats again wrought havoc among the ships. In Britain, the decoding machines could not be built fast enough. But in America, more than 200 of them were constructed. They were operated 24 hours a day by special teams of waves at Naval headquarters on Nebraska Avenue in Washington. One wave was teenager Ronnie Hulick. I joined a small contingent of waves that was sent to Dayton, Ohio, to the National Cash Register Company. In Dayton, we were assigned to a building and sort of a laboratory, and we sat at a table with these small wheels. We were given a soldering iron and many little wires of different colors and a graph to follow. And we soldered the little yellow wire here, the little green wire over here. And this went on for an eight-hour shift. When we left the building, another shift came in and proceeded to wire the rotor wheels. One day we came on duty and were told that we were going back to Washington, D.C. And when we returned to Washington, we were assigned to barracks near the Naval Communications Annex. It was on Nebraska and Massachusetts Avenue in Washington. The first day on duty, we were ushered into the chapel. And a Naval officer got up in the pulpit. And I remember thinking, isn't this lovely? They're welcoming us here with a prayer, a little benediction. And this big fellow proceeded to tell us that the work we were about to do was top secret. And he said, we must never talk about what goes on at this base. He leaned over the pulpit and he said, and don't think because you are women you will receive any special consideration. He said, if you talk about what goes on here, you will be shot. As far as is known, none were. The 200 testing machines clattered on day and night for the remainder of the war. Once the United States came into the naval war, cooperation became extremely close between the British codebreakers at Bletchley Park and the American naval codebreakers at Nebraska Avenue in Washington. They were not actually hardwired together in that the machines, the bombs, the key finding aids were actually linked together. But the cooperation was extremely intimate in that when one found a key or a possible key, it was immediately reported to the other side of the Atlantic, so both could recover the messages based on this key. From mid-1943, with the information supplied by the codebreakers, the tide began to turn in the Atlantic. Convoys still lost ships, but the introduction of new weapons, more long-range air cover, radar, and small escort carriers helped to destroy the menace of the U-boats. It is now more than 45 years since the U-boats surfaced for the last time to surrender. Just how big a role did the codebreakers play in winning the war? Much of their work is still secret, but it is clear that the codebreakers stopped the Battle of the Atlantic from being lost until the improved weapons arrived to make sure that it could be won. What about the wider assessment? If the codebreakers hadn't broken the Japanese Purple or JN-25 codes and the German Enigma machine, the war could well have dragged on into 1947 or beyond. The flow of intelligence was the best-kept secret of the war. With the information available from codebreaking, the Allies were able to divert their convoys around the wolf packs. They were able to win battles on land. In the Pacific, the Americans were able to defeat the Japanese at the Battle of the Midway, turning the tide of the war in the Pacific. And the war was considerably shortened by these activities thereby saving lives and preventing many women and children from becoming widows and orphans. And in the end, codebreaking became the preeminent source of intelligence, and it remains so today. In 1945, as Allied troops entered Berlin, they found the city in ruins. The Reichstag was a burned-out shell. American search teams were very interested in the unobtrusive building that housed the Japanese consulate. The house and grounds were gone over with a fine-tooth comb, and in a bunker they found a strange piece of equipment that they couldn't identify. It was sent to Washington and ended up on Frank Rowlett's desk. He immediately recognized it as the heart of a Japanese Purple machine. To this day, it remains the only part of a Japanese Purple machine ever recovered. Thank you. A production of WGBH Boston. Funding for NOVA is provided by Lockheed, America's aerospace company, supporting math, science, and engineering education for national technology leadership. And Johnson & Johnson, the signature recognized around the world for commitment to quality health care products for the entire family. Major funding for NOVA is provided by the Corporation for Public Broadcasting and by annual financial support from viewers like you. This is PBS. Next time on NOVA, what is lurking in the Gobi Desert? Is it Velociraptor, the villain of Jurassic Park? Mark, Mike here. Yeah. I found a monster. The hunt is on for dinosaurs of the Gobi. That's next time on NOVA. For a transcript of the NOVA program you've just seen, send $5 to this address or call 1303-831-9000.