How did the United States break the Japanese secret code in World War II?

By the mid-1930s the U.S. Navy had begun to solve some Japanese diplomatic messages with relative ease. But just as the Navy succeeded in breaking what the United States called the Red code, Japan’s Foreign Office installed new, more sophisticated coding machines in its major embassies, and the ensuing transmissions had the Navy baffled.

The new Japanese system, called Purple by the Americans, was reserved for top-secret diplomatic communications, and it was one of the most complicated devised before the age of computers. In order to break it, American officials initiated the greatest effort to date in the field of cryptanalysis, the science of breaking codes without prior knowledge of the keys.

The responsibility for solving the Purple system was shared by the Navy’s OP-20-G, its radio intelligence section in Washington, D.C., and the Army’s Signal Intelligence Service, or SIS, also in Washington, an organization headed by the civilian cryptologist William F. Friedman. A Russian-born geneticist who had become interested in cryptology at a research laboratory in Geneva, Illinois, Friedman had come to be recognized as the premier code-breaker in the United States.

The Army began intercepting Purple messages in 1937, but it was not until February 1939, when Chief Signal Officer General Joseph 0. Maubourgne, Friedman’s boss, urged Friedman to drop all of his administrative obligations and devote his full attention to Purple, that a major attack was mounted. Friedman understood that his work, along with that of the team he directed, would be conducted under total secrecy; even his wife, Elizebeth, herself a cryptologist, would not know the nature of the project. As the painstaking task progressed, Friedman would find his personal involvement increasing to the point where his nights as well as his days were filled with thoughts of nothing but the Purple machine.

Friedman’s first step in solving was to collect messages sent on the same day, since presumably all of these messages would be controlled by the same keys. Next, his team looked for patterns, such as repeated letters or the absence of certain letters, in an attempt to determine the rules governing the system.

Knowledge obtained from breaking of the earlier, Red code enabled the team to identify paragraphs, which were usually numbered, and standard phrases such as “I have the honor to inform Your Excellency . . .” Newspaper dispatches often provided clues to the subject matter of messages, and sometimes translations of entire cryptograms were received when the Japanese embassy submitted their dispatches to the U.S. State Department. On rarer occasions, whenever a Japanese coding operator had made a mistake, the same message would be sent twice. The codebreakers would then have two nearly identical, or isomorphic, messages in front of them, and by locating the discrepancies they could zero in on the keys to the code.

Progress was sporadic. But gradually, with the help of mathematicians using group theory and congruences, Friedman’s team, assisted by the Navy, put together a sketch of the Purple system, a kind of cipher that could be illustrated by two alphabet tables, one 20 consonants wide by 20 deep, the other 6 vowels wide by 6 deep. (The Japanese transliterated their language into Roman letters for encrypting.) From their pencil-and-paper diagrams, the team began to build a model of the Purple machine.

Their inelegant contraption consisted of two typewriters connected by wires to a drawer-sized coding box between them. When a message was typed in plain language on one typewriter, it would automatically be sent through the box and emerge in coded form on the other typewriter.

The nerve center of the machine was four telephone selector switches within the box. These switches took the electrical impulse caused by a key’s being depressed on the input typewriter and shifted it to another letter on the output typewriter. They produced hundreds of thousands of combinations before arriving back at their starting positions. Any letter of the alphabet could be represented by a different letter each time it was enciphered. A, for example, could be represented by J the first time it appeared, T the second, and R the third, all within the same message.

What the American team had constructed was a replica of what the Japanese called their 97-shiki 0-bun In-ji-ki, or Alphabetical Typewriter ’97. The ’97 stood for the Japanese calendar year 2597, corresponding to 1937. The Japanese, in turn, had adapted their version from a German prototype called the Enigma machine. To encode a message, a Japanese operator would look up the key for the day in a thick Yu Go key book, plug in the 26 wires leading from each typewriter according to the key, and begin to send. If he so desired, the operator could superencipher an important communication by first encoding it in a code book and then enciphering the code text. The American model resembled its Japanese counterpart almost exactly, down to the loud humming noise it made and the showers of sparks it sometimes emitted as it ran.

Using their machine, Friedman’s team read the first complete Purple message in August 1940. Shortly after the initial breakthrough, Lieutenant Francis A. Raven, a member of the naval team of codebreakers, discovered the key to the keys. He found that the Japanese had divided each month into thirds and that the keys for the last nine days in each ten-day period were jugglings of the key for the first day. Solutions, then, were needed for only the 1st, 11th, and 21st days of the month. But although some master keys were identified in minutes, others required weeks or months to locate, and still others proved so elusive they were never recovered.

Following their success, the SIS built several copies of the Purple machine and distributed them to the Army, the Navy, and certain British codebreaking groups. The British, who had been stymied in their attempts to break Purple, partially returned the favor by passing along a little information about German codes and ciphers.

In October 1940, after 18 months of intensive work on the Purple project, Friedman was made an Army Reserve lieutenant colonel, but less than 2 months later he collapsed from nervous exhaustion and was taken to the psychiatric ward of Walter Reed Hospital. Soon after he left the hospital in March 1941, he was honorably discharged from the Army for medical reasons. He continued to work in the SIS, as a civilian, for the duration of the Second World War.

On December 7, 1941, at 5 A.M., the SIS broke the last section of a 14-part ultimatum sent from Tokyo to the Japanese embassy in Washington. This last part contained a veiled declaration of war, saying that Japan was breaking off relations with the United States, and that the entire 14-part message was to be delivered to U.S. Secretary of State Cordell Hull at 1 P.M. that afternoon. The men who intercepted the message correctly assumed that the time of delivery would correspond to a Japanese military attack on the Allied Forces somewhere in the Pacific. But where, exactly, would the attack occur?

One P.M. Eastern Standard Time corresponds to dawn in Hawaii, but Washington’s efforts to notify Pearl Harbor in the quickest possible manner were frustrated by a series of blunders. President Roosevelt thought it more likely that the Japanese would attack the British in Malaysia than the United States Pacific fleet.

Moreover, American military officials feared that a direct radiotelephone call to Hawaii could alert the Japanese, who would be listening in, to the fact that the Purple code had been broken. Therefore, the news of an impending attack was sent by telegraph. Army Chief of Staff General George C. Marshall and other officials believed it would go through military channels; however, due to a mistake by communication personnel, the message was passed on to San Francisco by commercial telegraph, relayed from there to Hawaii, and finally delivered by motorcycle messenger to an American commander hours after the Japanese strike force had arrived.

Even though the breaking of the Purple code failed to avert the Pearl Harbor disaster, later interceptions of Japanese messages aided the Allies enormously. They were invaluable, through the reading of messages of Japanese diplomats in Berlin, in revealing many of Hitler’s plans.

As General Marshall once wrote, “The conduct of General Eisenhower’s campaign and of all operations in the Pacific are closely related in conception and timing to the information we secretly obtain through these intercepted codes. They contribute greatly to the saving in American lives, both in the conduct of current operations and in looking towards the early termination of the war.”