Purple was the name used by the US military to identify the most secure diplomatic cryptographic system used by the Japanese Foreign Office during, and just before, World War II. It was not a code, but an electromechanical cypher. The color name referred to binders used by US cryptanalyists for material in this cypher; there had been a Red 'code' (also a cypher) used by the Japanese Foreign Office and purple was the next available color. The Japanese also used the Coral and Jade stepping switch cyphers; it's not clear whether whoever named them kept to the binder color system. The Purple machine was a successor to, and improvement on, both the Red machine and what the Americans called the M machine (used in some embassies and consulates by attaches). All were designed by a Japanese Navy captain. The information gained from decryptions was eventually code-named Magic within the US government.

In operation, the encrypting machine accepted typewritten input (in Latin letters) and produced cyphertext output. The result was a potentially excellent crypto system. In fact, operational errors, chiefly in choosing keys, made the system much less secure than it could have been. The Japanese believed it to be effectively unbreakable throughout the War. It was broken by a team from the US Army Signals Intelligence Service, then directed by William Friedman. The team was led by Frank Rowlett.

The Purple machine itself was first used by Japan in 1939, but US and British cryptographers had broken some of its messages well before the attack on Pearl Harbor. US cryptographers decrypted and translated the 14-part Japanese diplomatic message declaring war against the States before the Japanese Embassy in Washington could. The US never found any hint of the attack on Pearl Harbor in the Purple traffic at the time, nor could they have as the Japanese were very careful to not discuss the planned attack in Foreign Office communications. In fact, no detailed information about the planned attack was even available to the Japanese Foreign Office; it was regarded by the military, particularly the more nationalistic military, as insufficiently 'reliable'. US access to private Japanese diplomatic communications (even the most secret ones) was less useful than it might otherwise have been because policy in Japan in the pre-War period was controlled largely by military groups (eg, in China and Manchuria), not by the Foreign Office. And, the Foreign Office itself deliberately kept from its embassies and consulates much of the information it did have, so the ability to read Purple transmissions was less than definitive regarding Japanese tactical or strategic military intentions.

Even so, the diplomatic information discovered was of even more limited value to the US because of its lack of dissemination within the US Government. Magic traffic was distributed in such a way that many policy makers who should have access to it to do their jobs knew nothing of it, and those to whom it actually was distributed (at least before Pearl Harbor) saw each message (only briefly, as the courier stood by to take it back) in isolation from all others (no copies or notes were permitted). Before Pearl Harbor, in any case, they saw only those decrypts thought 'important enough' by the distributing Army or Navy officers. Nonetheless, being able to read Purple messages gave the Allies a great advantage in the war; for instance, the Japanese ambassador to Germany produced long reports for Tokyo which were encrypted with the Purple machine. They included reports on discussions with Hitler, a report on a tour of the invasion defenses in Northern France, ....

The break into the Purple traffic, and into Japanese messages generally, was the subject of acrimonious hearings in Congress after WWII in connection with an attempt to decide who, if anyone, had allowed the disaster at Pearl Harbor to happen and who therefore should be blamed. During those hearings the Japanese learned, for the first time, that the Purple cypher machine had been broken. They had been continuing to use it, even after the War, with the encouragement of the American Occupation. Much confusion over who in Washington or Hawaii knew what and when, especially as 'we were decrypting their messages' has led some to conclude that 'someone in Washington' knew about the Pearl Harbor attack before it happened.

In fact, Purple was an enticing, but quite tactically limited, window into Japanese planning and policy because of the peculiar nature of Japanese policy making prior to the War (see above). A better tactical window was the Japanese Fleet Code (an encoded cypher actually), called JN-25 by US Navy cryptographers. Breaking into the version in use in the months after December 7 provided enough information to lead to U.S naval victories in the battles of the Coral Sea and Midway, crushing the main air offensive power of the Japanese fleet at the latter and stopping the Japanese advance south in the former. Later, broken JN-25 traffic also provided the schedule and routing of the plane Admiral Yamamoto Isoroku would be flying in during an inspection tour in the SW Pacific, giving the US Navy the chance to assassinate the tactician who had devised Pearl Harbour.

Public notice had actually been served that Japanese cryptography was inadequate by the Chicago Tribune, which published a series of stories just after Midway in 1942 directly claiming -- correctly, of course -- that the victory was due in large part to US breaks into Japanese crypto systems (in this case, the JN-25 cypher, though which system(s) had been broken was not mentioned). Fortunately, neither the Japanese nor anyone who might have told them, seem to have noticed either the Tribune or stories based on the Tribune account published in other US papers. Nor did they notice announcements made on the floor of the US Congress to the same effect. There were no changes in Japanese cryptography which can, then or now, be connected with those newspaper accounts or Congressional disclosures.

An excellent (and somewhat brief) account of the WWII crypto struggle is Battle of Wits, by S. Budiansky. Combined Fleet Decoded by J. Prados has, in somewhat scattered form, a complementary and fuller account of Japanese cryptography, mostly from the Japanese side. Both are recent enough to reflect much of the release of information that had been kept secret since the War.

The United States obtained portions of a Purple machine from the Japanese Embassy in Germany following Germany's defeat in 1945 and discovered that the Japanese had used the exact same stepping switch in its construction as Leo Rosen of SIS had chosen when building a 'duplicate' in Washington in 1939/1940.

In the book Sword and Shield, by C. Andrew, based on the Mitrokhin archive smuggled out of Russia in the early '90s by a KGB archivist, the claim is made that the Soviets independently broke into Japanese Purple traffic (as well as the Red predecessor machine) and that decrypted Purple messages contributed to the decision by Stalin to move troops from Far Eastern Asia to the area around Moscow for the counterattack in Dec of '41. Those messages are said to have been credible enough to convince the Soviets there would not be a Japanese attack on them.

The German Enigma machine and Purple

The German Enigma was unrelated to the Purple machine, though there have been published claims that Purple was 'merely' an Enigma copy of some sort. In fact, the Purple machine was a Japanese development, the last of a series designed by a Japanese Navy captain, though there seems to have been some assistance by at least one Polish officer prior to the 1930s.