Type B Cipher Machine
In the history of cryptography, the "System 97 Typewriter for European Characters" (九七式欧文印字機) or "Type B Cipher Machine", codenamed Purple by the United States, was an encryption machine used by the Japanese Foreign Office from February 1939 to the end of World War II. The machine was an electromechanical device that used stepping-switches to encrypt the most sensitive diplomatic traffic. All messages were written in the 26-letter English alphabet, which was commonly used for telegraphy. Any Japanese text had to be transliterated or coded. The 26-letters were separated using a plug board into two groups, of six and twenty letters respectively. The letters in the sixes group were scrambled using a 6 X 25 substitution table, while letters in the twenties group were more thoroughly scrambled using three successive 20 X 25 substitution tables.[1]
The cipher codenamed "Purple" replaced the Type A Red machine previously used by the Japanese Foreign Office. The sixes and twenties division was familiar to U.S. Army Signals Intelligence Service (SIS) cryptographers from their work on the Type A cipher and it allowed them to make early progress on the sixes portion of messages. The twenties cipher proved much more difficult, but a breakthrough in September 1940 allowed the Army cryptographers to construct a machine that duplicated the behavior (was an analog) of the Japanese machines, even though no one in the U.S. had any description of one.[2]
The Japanese also used stepping-switches in systems, codenamed Coral and Jade, that did not divide their alphabets. American forces referred to information gained from decryptions as Magic.
Development of Japanese cipher machines
Overview
The Imperial Japanese Navy did not cooperate with the Army in pre-war cipher machine development, and that lack of cooperation continued into World War II. The Navy believed the Purple machine was sufficiently difficult to break that it did not attempt to revise it to improve security. This seems to have been on the advice of a mathematician, Teiji Takagi, who lacked a background in cryptanalysis. The Ministry of Foreign Affairs was supplied Red and Purple by the Navy. No one in Japanese authority noticed the weak points in both machines.
Just before the end of the war, the Army warned the Navy of a weak point of Purple, but the Navy failed to act on this advice.
The Army developed their own cipher machines on the same principle as Enigma -- 92-shiki injiki, 97-shiki injiki and 1-shiki 1-go injiki -- from 1932 to 1941. The Army judged that these machines had lower security than the Navy's Purple design, so the Army's two cipher machines were less used.
Prototype of Red
Japanese diplomatic communications at negotiations for the Washington Naval Treaty were broken by the American Black Chamber in 1922, and when this became publicly known, there was considerable pressure to improve their security. In any case, the Japanese Navy had planned to develop their first cipher machine for the following London Naval Treaty. Japanese Navy Captain Risaburo Ito, of Section 10 (cipher & code) of the Japanese Navy General Staff Office, supervised the work.
The development of the machine was the responsibility of the Japanese Navy Institute of Technology, Electric Research Department, Section 6. In 1928, the chief designer Kazuo Tanabe and Navy Commander Genichiro Kakimoto developed a prototype of Red, "Roman-typewriter cipher machine".
The prototype used the same principle as the Kryha cipher machine, having a plug-board, and was used by the Japanese Navy and Ministry of Foreign Affairs at negotiations for the London Naval Treaty in 1930.
Red
The prototype machine was finally completed as "Type 91 Typewriter" in 1931. The year 1931 was year 2591 in the Japanese Imperial calendar. Thus it was prefixed "91-shiki" from the year it was developed.
The 91-shiki injiki Roman-letter model was also used by the Ministry of Foreign Affairs as "Type A Cipher Machine", codenamed "Red" by United States cryptanalysts.
The Red machine was unreliable unless the contacts in its half-rotor switch were cleaned every day. It enciphered vowels (AEIOUY) and consonants separately, perhaps to reduce telegram costs,[3]:842–849 and this was a significant weak point. The Navy also used the 91-shiki injiki Kana-letter model at its bases and on its vessels.
Purple
In 1937, the Japanese completed the next generation "Type 97 Typewriter". The Ministry of Foreign Affairs machine was the "Type B Cipher Machine", codenamed Purple by United States cryptanalysts.
The chief designer of Purple was Kazuo Tanabe. His engineers were Masaji Yamamoto and Eikichi Suzuki. Eikichi Suzuki suggested the use of a stepping switch instead of the more troublesome half-rotor switch.
Clearly, the Purple machine was more secure than Red, but the Navy did not recognize that Red had already been broken. The Purple machine inherited a weakness from the Red machine that six letters of the alphabet were encrypted separately. It differed from Red in that the group of letters was changed and announced every nine days, whereas in Red they were permanently fixed as the Latin vowels 'a', 'e', 'i', 'o', 'u' and 'y'. Thus US Army SIS was able to break the cipher used for the six letters before it was able to break the one used for the 20 others.
Design of the Type B Cipher Machine
The Type B Cipher Machine consisted of several components. As reconstructed by the U.S Army,[4] there were electric typewriters at either end, similar to those used with the Type A Machine. The Type B was organized for encryption as follows:
- An input typewriter
- An input plugboard that permutes the letters from the typewriter keyboard and separates them into a group of six letters and a group of 20 letters
- A stepping switch with 6 layers wired to select one out of 25 permutations of the letters in the sixes group
- Three stages of stepping switches (I, II, and III), connected in series. Each stage is effectively a 20 layer switch with 25 outputs on each layer. Each stage selects one out of 25 permutations of the letters in the twenties group. The Japanese used three 7-layer stepping switches geared together to build each stage (see photos). The U.S. SIS used four 6-layer switches per stage in their first analog machine.
- An output plug board that reverses the input permutation and sends the letters to the output typewriter for printing
- The output typewriter
For decryption, the data flow is reversed. The keyboard on the second typewriter becomes the input and the twenties letters pass through the stepping switch stages in the opposite order.
Stepping switches
A stepping switch is a multi-layer mechanical device that was commonly used at the time in telephone switching systems. Each layer has a set of electrical connects, 25 in the Type B, arranged in a semicircular arc. These do not move and are called the stator. A wiper arm on a rotor at the focus of the semicircle connects with one stator contact at a time. The rotors on each layer are attached to a single shaft that advances from one stator contact to the next whenever an electromagnet connected to a ratchet is pulsed. There are actually two wiper arms on each level, connected together, so that when one wiper advance past the last contact in the semicircle, the other engages the first contact. This allows the rotor connections to keeps cycling through all 25 stator contacts as the electromagnet is pulsed.[1]
To encrypt the twenties letters, a 20-layer stepping switch was needed in each of the three stages. Both the Japanese version and the early American analog constructed each stage from several smaller stepping switches of the type used in telephone central offices. The American analog used four 6-level switches to create one 20-layer switch. The four switches in each stage were wired to step synchronously. The fragment of a Type 97 Japanese machine on display at the National Cryptologic Museum, the largest piece known in existence, has three 7-layer stepping switches (see photo). The U.S. Army developed an improved analog in 1944 that has all the layers needed for each stage on a single shaft. An additional layer was used in the improved analog to automatically set each switch bank to the initial position specified in the key.
However implemented, the 20-layer stepping switch in each stage had 20 rotor connections and 500 stator connections, one wiper and 25 stator contacts on each layer. Each stage must have exactly 20 connections on each end to connect with the adjacent stage or plugboard. On the rotor side, that is not a problem as there are 20 rotors. On the stator end of a stage, every column of stator contacts corresponding to the same rotor position on each of the 20 layers is connected to the 20 output wires (leads in the diagram) in a scrambled order, creating a permutation of the 20 inputs. This is done differently for each of the rotor positions. Thus each stator output wire has 25 connections, one from each rotor position, though from different levels. The connections needed to do this created a "rats nest" of wires in the early U.S. analog. The improved analog organized the wiring more neatly with three matrices of soldering terminals visible above each stepping switch in the photograph.
Stepping order
The stages were bi-directional. Signals went through each stage in one direction for encryption and in the other direction for decryption. Unlike the system in the German Enigma machine, the order of the stages was fixed and there was no reflector. However the stepping arrangement could be changed.
The sixes switches stepped one position for each character encrypted or decrypted. The motions of the switches in the twenties stages were more complex. The three stages were assigned to step fast, medium or slow. There were six possible ways to make this assignment and the choice was determined by a number included at the beginning of each message called the message indicator. The U.S. improved analog has a six-position switch for making this assignment, see photo. The message indicator also specified the initial positions of the twenties switches. The indicator was different for each message or part of a message, when multi-part messages were sent. The final part of the key, the alphabet plugboard arrangement, was changed daily.
The twenties switch stepping was controlled in part by the sixes switch. Exactly one of the three switches stepped for each character. The fast switch stepped for each character except when the sixes switch was in its 25th position. Then the medium switch stepped, unless it too was in its 25th position, in which case the slow switch stepped.
Weaknesses and cryptanalysis
The SIS learned in 1938 of the forthcoming introduction of a new diplomatic cipher from decoded messages. Type B messages began to appear in February 1939. The Type B had several weaknesses, some in its design, others in the way it was used. Frequency analysis could often make 6 of the 26 letters in the ciphertext alphabet letters stand out from the other 20 letters, which were more uniformly distributed. This suggested the Type B used a similar division of plaintext letters as used in the Type A. The weaker encryption used for the "sixes" was easier to analyze. The sixes cipher turned out to be polyalphabetic with 25 fixed permuted alphabets, each used in succession. The only difference between messages with different indicators was the starting position in the list of alphabets. The SIS team recovered the 25 permutations by 10 April 1939. The frequency analysis was complicated by the presence of romanized Japanese text and the introduction in early May of a Japanese version of the Phillips Code.[5]
Knowing the plaintext of 6 out of 26 letters scattered throughout the message sometimes enabled parts of the rest of the message to be guessed, especially when the writing was highly stylized. Some diplomatic messages included the text of letters from the U.S. government to the Japanese government. The English text of such messages could usually be obtained. Some diplomatic stations did not have the Type B, especially early in its introduction, and sometimes the same message was sent in Type B and in the Type A Red cipher, which the SIS had broken. All these provided cribs for attacking the twenties cipher.
William F. Friedman was assigned to lead the group of cryptographers attacking the B system in August 1939.[5]:10 Even with the cribs, progress was difficult. The permutations used in the twenties cipher were "brilliantly" chosen, according to Friedman, and it became clear that periodicities would be unlikely to be discovered by waiting for enough traffic encrypted on a single indicator, since the plugboard alphabets changed daily. The cryptographers developed a way to transform messages sent on a different days with the same indicator into homologous messages that would appear to have been sent on the same day. This provided enough traffic based on the identical settings (6 messages with indicator 59173) to have a chance of finding some periodicity that would reveal the inner workings of the twenties cipher.
On 20 September 1940 at about 2 pm Genevieve Grotjan, carrying a set of work sheets walked up to a group of men engrossed in conversation and politely attempted to get Frank Rowlett's attention. She had found evidence of cycles in the twenties cipher. Celebration ensued at this first break in the 20s cipher and it soon enabled a replica machine to be built.[6]:99 A pair of other messages using indicator 59173 were decrypted by 27 September, coincidentally the date that the Tripartite Agreement between Nazi Germany, Italy, and Japan was announced. There was still a lot of work to do to recover the meaning of the other 119 possible indicators. As of October 1940, one third of the indicator settings had been recovered.[5]:7 From time to time the Japanese instituted new operating procedures to strengthen the Type B system, but these were often described in messages to diplomatic outputs in the older system, giving the Americans warning.[1]:p. 29
Reconstruction of the Purple machine was based on ideas of Larry Clark. Advances into the understanding of Purple keying procedures were made by Lt Francis A. Raven, USN. After the initial break, Raven discovered that the Japanese had divided the month into three 10-days periods, and, within each period, they used the keys of the first day, with small, predictable changes.[7][2]
The Japanese believed Type B to be unbreakable throughout the war, and even for some time after the war, even though they had been informed otherwise by the Germans. In April 1941, Hans Thomsen, a diplomat at the German embassy in Washington, D.C., sent a message to Joachim von Ribbentrop, the German foreign minister, informing him that "an absolutely reliable source" had told Thomsen that the Americans had broken the Japanese diplomatic cipher (that is, Purple). That source apparently was Konstantin Umansky, the Soviet ambassador to the US, who had deduced the leak based upon communications from U.S. Undersecretary of State Sumner Welles. The message was duly forwarded to the Japanese; but use of the code continued.[8][3]
American analogs
The SIS built its first machine that could decrypt Purple messages in late 1940. A second Purple analog was built by the SIS for the US Navy. A third was sent to England in January 1941 on HMS King George V, which had brought Ambassador Halifax to the U.S. That Purple analog was accompanied by a team of four American cryptologists, two Army, two Navy, who received information on British successes against German ciphers in exchange. This machine was subsequently sent to Singapore, and after Japanese moves south though Malaya, on to India. A fourth Purple analog was sent to the Philippines and a fifth was kept by the SIS. A sixth, originally intended for Hawaii, was sent to England for use there.[3]:p.23 The Purple intercepts proved important in the European theater due to the detailed reports on German plans sent in that cipher by the Japanese ambassador in Berlin.
Fragmentary recovery of Japanese machines
The United States obtained portions of a Purple machine from the Japanese Embassy in Germany following Germany's defeat in 1945 (see image above) and discovered that the Japanese had used a stepping switch almost identical in its construction to the one Leo Rosen of SIS had chosen when building a duplicate (or Purple analog machine) in Washington in 1939 and 1940. The stepping switch was a uniselector; a standard component used in large quantities in automatic telephone exchanges in countries like America, Britain, Canada, Germany and Japan, with extensive dial-telephone systems. The U.S. used four 6-level switches in each stage of its Purple analogs,[5] the Japanese used three 7-level switches. Both represented the 20s cipher identically. Note however that these were not two-motion or Strowger switches as sometimes claimed: twenty-five Strolger-type (sic) stepper switches ...[9]
Apparently, all other Purple machines at Japanese embassies and consulates around the world (e.g. in Axis countries, Washington, London, Moscow, and in neutral countries) and in Japan itself, were destroyed and ground into small particles by the Japanese. American occupation troops in Japan in 1945−52 searched for any remaining units.[10] A complete Jade cipher machine, built on similar principles but without the sixes and twenties separation, was captured and is on display at NSA's National Cryptologic Museum.
Impact of Allied decryption
The Purple machine itself was first used by Japan in June 1938, but U.S. and British cryptanalysts had broken some of its messages well before the attack on Pearl Harbor. U.S. cryptanalysts decrypted and translated Japan's 14-part message to its Washington Embassy breaking off negotiations with the United States at 1 p.m. Washington time on 7 December 1941, before the Japanese Embassy in Washington had done so. Decryption and typing difficulties at the Embassy, coupled with ignorance of the importance of it being on time, were major reasons the "Nomura note" was delivered late.
During World War II, the Japanese ambassador to Nazi Germany, General Hiroshi Oshima was well-informed on German military affairs. His reports went to Tokyo in Purple-enciphered radio messages. Examples include a comment that Hitler told him on 3 June 1941 that in every probability war with Russia cannot be avoided. In July and August 1942 he toured the Russian front, and in 1944 the Atlantic Wall fortifications against invasion along the coasts of France and Belgium, and on 4 September that Hitler told him that Germany would strike in the West, probably in November.[11] Since these messages were being read by the Allies, this provided valuable intelligence about German military preparations against the forthcoming invasion of Western Europe. He was described by General George Marshall as "our main basis of information regarding Hitler's intentions in Europe".[12]
The decrypted Purple traffic, and Japanese messages generally, was the subject of acrimonious hearings in Congress post-World War II in connection with an attempt to decide who, if anyone, had allowed the attack at Pearl Harbor to happen and who therefore should be blamed. It was during those hearings that the Japanese learned, for the first time, that the Purple cipher machine had indeed been broken. See the Pearl Harbor advance-knowledge conspiracy theory article for additional detail on the controversy and the investigations.
The Russians also succeeded in breaking into the Purple system in late 1941, and together with reports from Richard Sorge, learned that Japan was not going to attack the Soviet Union. Instead, its targets were southward, toward Southeast Asia and US and UK interests there. This allowed Stalin to move considerable forces from the Far East to Moscow in time to help stop the German push to Moscow in December.[13]
References
- Wes Freeman; Geoff Sullivan; Frode Weierud (January 2003). "PURPLE Revealed: Simulation and Computer-aided Cryptanalysis of Angooki Taipu B" (PDF). CRYPTOLOGIA Vol. XXVII.
- Friedman, William F. (14 October 1940). "Preliminary Historical Report on the Solution of the "B" Machine" (PDF). Archived from the original (PDF) on 4 April 2013. Retrieved 16 February 2013.
- Kahn, David (1996). The Codebreakers: The Comprehensive History of Secret Communication from Ancient Times to the Internet. Scribner. Text from excerpt of first chapter on WNYC website Archived 25 January 2008 at the Wayback Machine
- The captured Jade cipher machine, which was part of the same cipher family, has only one typewriter and, instead, has a switch for encryption or decryption. The Japanese Type B machine may have been built similarly.
- Friedman, William F. (14 October 1940). "Preliminary Historical Report on the Solution of the Type "B" Machine" (PDF). Archived from the original (PDF) on 4 April 2013.
- Mundy, Liza (2017). Code Girls: The Untold Story of the American Women Code Breakers of World War II. New York, Boston: Hachette Books. ISBN 978-0-316-35253-6.
- Clark, R.W. (1977). The Man who broke Purple. London: Weidenfeld and Nicolson. pp. 103–112. ISBN 0-297-77279-1.
- Langer, Howard (1999). World War II: An Encyclopedia of Quotations. Greenwood Publishing Group. p. 198. ISBN 978-0-313-30018-9. Retrieved 11 February 2008.
- Costello, John (1994). Days of Infamy: MacArthur, Roosevelt, Churchill – the Shocking Truth Revealed. New York: Pocket Books. p. 55. ISBN 978-0-141-02926-9.
- 'Big Machines', pg. 182 says "few if any [PURPLE equipment and documents] were recovered even after VJ day"
- Budiansky 2000, pp. 196,268,326.
- "Marshall-Dewey Letters". Time Inc. 17 December 1945.
- Kelley, Stephen J. (2001). Big Machines. Aegean Park Press. p. 106. ISBN 0-894122-90-8.
Further reading
- Big Machines, by Stephen J. Kelley (Aegean Park Press, Walnut Creek, 2001, ISBN 0-89412-290-8) – Contains a lengthy, technically detailed description of the history of the creation of the PURPLE machine, along with its breaking by the US SIS, and an analysis of its cryptographic security and flaws
- Budiansky, Stephen (2000). Battle of Wits: The complete story of Codebreaking in World War II. New York: Free Press. pp. 351-353. ISBN 0-684-85932-7. - Appendix C: Cryptanalysis of the Purple Machine
- Clark, Ronald W. "The Man Who Broke Purple: the Life of Colonel William F. Friedman, Who Deciphered the Japanese Code in World War II", September 1977, Little Brown & Co, ISBN 0-316-14595-5.
- Freeman, Wes; Sullivan, Geoff; Weierud, Frode (2003). "Purple Revealed: Simulation and Computer-Aided Cryptanalysis of Angooki Taipu B". Cryptologia. 27 (1): 1–43. doi:10.1080/0161-110391891739. S2CID 12776919.
- Combined Fleet Decoded by J. Prados
- The Story of Magic: Memoirs of an American Cryptologic Pioneer, by Frank B. Rowlett (Aegean Park Press, Laguna Hills, 1998, ISBN 0-89412-273-8) – A first-hand memoir from a lead team member of the team which 'broke' both Red and Purple, it contains detailed descriptions of both 'breaks'
- Smith, Michael (2000). The Emperor's Codes: Bletchley Park and the breaking of Japan's secret ciphers. London: Bantam Press. ISBN 0593-046412.
- Smith, Michael (2000). The Emperor's Codes: the Breaking of Japan's Secret Ciphers. New York: Arcade Publishing. ISBN 9781559705684.
- Lee, Bruce. (1995). Marching Orders: the Untold Story of World War II. New York: Crown Publishers Inc. ISBN 9780517575765.
External links
Wikimedia Commons has media related to PURPLE cipher machine. |
- The Japanese Wikipedia article on the Type B machine has much technical information including the substitution tables, detailed stepping algorithm, punctuation codes and a sample decryption. It also has reactions from Japanese sources to the American decryption. Entering the website link https://ja.wikipedia.org/wiki/パープル暗号 into Google Translate and clicking "Translate this page" will provide a serviceable English translation.
- Red and Purple: A Story Retold NSA analysts' modern-day attempt to duplicate solving the Red and Purple ciphers. Cryptologic Quarterly Article (NSA), Fall/Winter 1984-1985 - Vol. 3, Nos. 3-4 (last accessed: 22 August 2016).
- A web-based Purple Simulator (last accessed: 10 February 2019)
- A Purple Machine simulator written in Python
- A GUI Purple Machine simulator written in Java
- Purple, Coral, and Jade
- The Purple Machine Information and a simulator (for very old Windows).