Jump to content

Type B Cipher Machine

From Wikipedia, the free encyclopedia
(Redirected from Purple code)

Analog of the Japanese Type B Cipher Machine (codenamed Purple) built by the U.S. Army Signal Intelligence Service
Purple analog in use

In the history of cryptography, the "System 97 Typewriter for European Characters" (九七式欧文印字機 kyūnana-shiki ōbun injiki) 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 × 25 substitution table, while letters in the twenties group were more thoroughly scrambled using three successive 20 × 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

[edit]

The Imperial Japanese Navy did not fully 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.[3] 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.

Prototype of Red

[edit]
Japanese Type A (RED) cipher machine

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

[edit]

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,[4]: 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

[edit]
Fragment of a Type 97 "Purple" cipher machine recovered from the Japanese embassy in Berlin at the end of World War II. Purple code was reverse engineered by the United States Army's Signal Intelligence Service in 1940.
Side view of recovered Type 97 fragment. The three stepping switches implemented one stage of the "twenties" cipher, with 25 permutations of 20 letters encoded by the mass of wires underneath.
Close up of fragment's stepping switches showing seven contact layers

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 AEIOUY. 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

[edit]
An equivalent analog to the Purple machine reconstructed by the US Signals Intelligence Service. A hand-operated Red analog is also visible
Six level telephone stepping switch similar to the type used by SIS to build its first Purple. analog. On display at The Telephone Museum.
Schematic diagram of SIS Purple analog machine
Front panel of the March 1944 improved U.S. Army PURPLE analog. The three rows of indicator lights show the position of the rotor in each stage. a removable plugboard in the center selects the alphabet. A six-position switch selects the stepping order and buttons on the box at top center are used to set the initial position of each rotor. Exhibit at the National Cryptologic Museum
Internal wiring of the improved U.S. Army PURPLE analog. All three stepping motor stages for the "twenties letters" are shown. The three large rectangular panels with many wires implement the substitution matrices for each stage. Each twenties stepping switch is located beneath its wiring panel. The stepping switches for the sixes letters are near the middle.
Close-up of the six-position switch that selects the stepping order in the improved U.S. analog

The Type B Cipher Machine consisted of several components. As reconstructed by the US Army,[5] 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 6 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

[edit]

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 advances past the last contact in the semicircle, the other engages the first contact. This allows the rotor connections to keep 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

[edit]

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

[edit]
PURPLE ciphertext of the first part of the 14-part message which was delivered by the Japanese to the U.S. Government on 7 December 1941. Note the hand-written calculations at the upper right which deduce the initial positions of the rotors and the stepping order from the message indicator.

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.[6]

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.[6]: 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 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.[7]: 99  A pair of other messages using indicator 59173 were decrypted by 27 September, coincidentally the date that the Tripartite Agreement between Nazi Germany, Fascist Italy, and Imperial 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.[6]: 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 Navy Lieutenant Francis Raven. After the initial break, Raven discovered that the Japanese had divided the month into three 10-day periods, and, within each period, they used the keys of the first day, with small, predictable changes.[8][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.[9][4]

American analogs

[edit]

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 through 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.[4]: 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

[edit]

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,[6] 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 ...".[10]

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.[11] 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

[edit]

The Purple machine itself was first used by Japan in June 1938, but American and British cryptanalysts had broken some of its messages well before the attack on Pearl Harbor. US cryptanalysts decrypted and translated Japan's 14-part message to its Washington embassy to break 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 for the "Nomura Note" to be 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. One had 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 Eastern Front, and in 1944, he toured the Atlantic Wall fortifications against invasion along the coasts of France and Belgium. On 4 September, Hitler told him that Germany would strike in the West, probably in November.[12]

Since those messages were being read by the Allies, they 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."[13]

The decrypted Purple traffic and Japanese messages generally were the subject of acrimonious hearings in Congress after World War II in connection with an attempt to decide who, if anyone, had allowed the attack at Pearl Harbor to happen and so should be blamed. It was during those hearings that the Japanese for the first time learned that the Purple cipher machine had indeed been broken.[citation needed] (See the Pearl Harbor advance-knowledge conspiracy theory article for additional detail on the controversy and the investigations.)

The Soviets also succeeded in breaking 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 American and British interests there. That allowed Stalin to move considerable forces from the Far East to Moscow in time to help stop the German push to Moscow in December.[14]

References

[edit]
  1. ^ a b c Wes Freeman; Geoff Sullivan; Frode Weierud (January 2003). "PURPLE Revealed: Simulation and Computer-aided Cryptanalysis of Angooki Taipu B" (PDF). CRYPTOLOGIA.
  2. ^ a b 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.
  3. ^ KOTANI, Ken. "Japanese Intelligence in WWII: Successes and Failures" (PDF). Japanese Intelligence in WWII.
  4. ^ a b c 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
  5. ^ 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.
  6. ^ a b c d 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.
  7. ^ 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.
  8. ^ Clark, R.W. (1977). The Man who broke Purple. London: Weidenfeld and Nicolson. pp. 103–112. ISBN 0-297-77279-1.
  9. ^ 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.
  10. ^ 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.
  11. ^ 'Big Machines', pg. 182 says "few if any [PURPLE equipment and documents] were recovered even after VJ day"
  12. ^ Budiansky 2000, pp. 196, 268, 326.
  13. ^ "Marshall-Dewey Letters". Time Inc. 17 December 1945.
  14. ^ Kelley, Stephen J. (2001). Big Machines. Aegean Park Press. p. 106. ISBN 0-894122-90-8.

Further reading

[edit]
[edit]