Purple was a cipher used by Imperial Japan during WWII to encrypt diplomatic messages sent to embassies throughout the world. The Purple machine consisted of two electronic typewriters separated by a plugboard and a box containing the cryptographic elements in s series of relays within an intricate network of wiring.

After creating a “shadow Purple machine” in 1939, the U.S. Navy Interception Center was able to decode Purple messages well before the onset of the Pacific War. Although much important information regarding Japanese military plans plans and attack locations was obtained, no specific information about the attack on Pearl Harbor was recognized. After the U.S. entered the war,  decoding efforts were increased for all types of intercepted information to determine the position of the Japanese fleet and where it was headed.

In 1942, many purple messages forecast an attack at “AF.” U.S. cryptanalysts knew the meanings attached to a number of geographical designators, and presumed that “AF” stood for Midway. The definitive answer was obtained when Admiral Chester Nimitz ordered a message to be sent in a code that Japan had already broken: Midway is out of water. Hours later a PURPLE cipher reported  “AF is out of water.” Nimitz subsequently positioned his fleet at Midway and surprised the arriving Japanese fleet. The U.S. victory at the Battle of Midway in June 1942 was one of the most decisive battles of war, as Japan’s offensive power at sea was nearly destroyed.

Until 1943, when the Japanese stopped using Purple (a code they believed was indecipherable) , the United States made various surprise attacks on Japan due to the knowledge they had from Purple ciphers.