In February 1939, Japan introduced the Alphabetical Typewriter '97 to replace the previous machine-made cipher that they had been using for encrypting the communications of their diplomats. The Alphabetical Typewriter '97 or 97-shiki oo-bun inji-ki was numbered 97 for the year in which it was created 1937, which using the Japanese calender was 97th year of the 25th century. As was usual at the time governments were continually trying to crack the encrypted messages of other governments, and hence the US government made an attempt to crack it. The US had an advantage in the form of William Friedman and the Signal Intelligence Service who dubbed this new encryption system as Purple.
Similarly to Enigma the Purple cipher was a complex polyalphabetic machine capable of enciphering English letters with hundreds of thousands of different substitutions dependant upon the settings of the machine. But it differed from Enigma in the way that the substitution letters were generated. Where Enigma used rotors Purple used a battery of six-level telephone stepping switches that switched every time a letter was typed. The switching was in order to create an ever-changing stream of substitutions.
Thus a daunting task faced William Friedman and his group of cryptanalysts at the Signal Intelligence Service. The Japanese believed that Alphabetical Typewriter '97 was impossible to crack and unfortunately this was part of the problem. Fortunately for the Americans the Japanese used specific formal openings and closings to their messages. Additionally due to Purple being a new encryption system many mistakes were made and so more messages had to be sent in order to rectify the mistakes of the first messages.
Cryptanalysis is based upon depth and cribs, and the Japanese had unwittingly given the Americans all they needed to crack Purple. The task of cracking Purple was given to a group led by Frank Rowlett dubbed 'Purple Section'. Interestingly they did not have a sample machine to work on and so had to determine through analysis of encrypted texts what the machine was like. On 20th September 1940 whilst analysing some messages Genevieve Grotjan a key member of 'Purple Section' had a eureka moment. Her breakthrough enabled the team of cryptanalysts to understand the relationships between sequences of plaintext and enciphered text. This allowed a wiring diagram to be created that enabled technician Leo Rosen to build the first Purple Analog. The extent of their success in this task was realised towards the end of the war. When comparing a real Purple machine to the version that Rosen had built, it was discovered that they only differed slightly in wiring and that actually the American machine was less likely to garble messages.