Type B Cipher Machine
Purple was the name used by the US military to identify the most secure diplomatic cryptographic system used by the Japanese government during, and just before, World War II. The color name referred to binders used by US cryptanalyists for material in this cypher; there had been a Red code used by the Japanese Foreign Office. The information gained from decryptions was called Magic. In operation, the encrypting machine (only one of those designed by a Japanese Navy Captain) 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 was first used by Japan in 1939, but US and British cryptographers had broken it well before Pearl Harbor. US cryptographers decrypted and translated the 14-part Japanese diplomatic message to be delivered in Washington just before the attack on Pearl Harbor was scheduled to happen before the Japanese Embassy in Washington. But, because policy in Japan in the pre-War period was controlled largely by military groups (eg, in China and Manchuria) and not by the official Foreign Office, and because the Foreign Office deliberately kept from its embassies and consulates much of the information it did have, the ability to read Purple transmissions was less than defintive regarding Japanese intentions. 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. The German encoding machine, Enigma, was unrelated to the Purple machine, though there have been published claims that Purple was 'merely' an Enigma copy of some sort. Many of the German Enigma variants were also broken before (by the Poles) and during the War (by the British at Bletchley Park). The mathematician and computer pioneer Alan Turing worked on German Naval Enigma at Bletchley Park.
The break into Purple traffic 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. During those hearings the Japanese learned for the first time that the Purple machine had been broken. They had been continuing to use it after the War. Much confusion over who knew what and when, especially when 'we were decrypting their messages' has led some to conclude that 'someone in Washington' knew about the 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 current Japanese Fleet Code (an encoded cypher actually), called JN-25 by US Navy cryptographers. Breaking into it in the months after December 7, 1941, provided enough information to win the Battle of Midway. Purple provided no contribution to that cryptographic 'triumph'. 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 which directly claimed -- 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). Fortunately, the Japanese seem not to have noticed either the Tribune or stories based on the Tribune account published in other US papers. There were no changes in Japanese cryptography which can be connected with those newspaper accounts.
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 account of Japanese cryptography mostly from the Japanese side. Both are recent enough to reflect release of information that had been kept from the public since the War.