User:RashBold/Sandbox/PURPLE

In the history of cryptography, 97-shiki oobun Inji-ki (九七式欧文印字機) ("System 97 Printing Machine for European Characters") or Angooki Taipu-B (暗号機 タイプB) ("Type B Cipher Machine"), codenamed PURPLE by the United States, was a diplomatic cryptographic machine used by the Japanese Foreign Office just before and during World War II. The machine was an electromechanical stepping-switch device.

The information gained from decryptions was eventually code-named Magic within the US government.

The codename "PURPLE" referred to binders used by US cryptanalysts for material produced by various systems; there had been a RED machine used by the Japanese Foreign Office, and purple was the next available color. The Japanese also used CORAL and JADE stepping-switch systems. PURPLE was a successor to, and improvement on, both the RED machine and what the Americans called the "M machine" (used in some embassies and consulates by attachés). PURPLE and RED were designed by Japanese Navy Captain Risaburo Ito. The chief designer of PURPLE was Kazuo Tanabe.

History
Interest in breaking Japanese codes can be traced as far back as 1921, when codebreaking pioneer Herbert Yardley of the Cipher Bureau was able to break Japanese diplomatic codes which were sent by commercial cable lines and used by the Japanese negotiators during the Washington Naval Conference It was the knowledge gleaned from Yardley's codebreaking methods that enabled American negotiators to obtain favorable terms in the Washington Naval Treaty of 1922.

Overview
The Japanese Navy did not cooperate with the Army in cipher machine development, continuing to the war. 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 didn't know cryptanalysis. The Ministry of Foreign Affairs was supplied RED and PURPLE by the Navy. No one noticed 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 did its PURPLE design, so they 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, Genitiro Kakimoto (柿本権一郎) developed a prototype of RED, O-bun taipuraita-siki ango-ki (欧文タイプライタ暗号機) ("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 91-shiki injiki(九一式印字機) ("Type 91 print machine") in 1931. The year 1931 was year 2591 in the Japanese Imperial calendar. Thus it was pre-fixed "91-shiki" from the year it was developed.

The 91-shiki injiki Roman-letter model was also used Ministry of Foreign Affairs as Angooki Taipu-A (暗号機 タイプA) ("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, 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 next generation 97-shiki injiki(九七式印字機) ("Type 97 print machine") was completed. The Ministry of Foreign Affairs machine was the Angooki Taipu-B (暗号機 タイプB) ("Type B Cipher Machine"), codenamed PURPLE by United States cryptanalysts.

The chief designer of PURPLE was Kazuo Tanabe (田辺一雄). His engineers were Masaji Yamamoto (山本正治) and Eikiti Suzuki (鈴木恵吉). Eikiti Suzuki suggested use of 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 weak point from the RED machine, namely vowel-consonant separate encryption, which was called "sixes-twenties" by the US Army SIS.

Weaknesses
In operation, the enciphering machine accepted typewritten input (in Latin letters) and produced ciphertext output, and vice versa when deciphering messages. The result was a potentially excellent cryptosystem. In fact, operational errors, chiefly in key choice, made the system less secure than it could have been; in that way the PURPLE code shared the fate of the German Enigma machine. The Japanese believed it to be effectively unbreakable throughout, and somewhat after, 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 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 precisely the same "stepping switch" in its construction that 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 common type of unit used in high-tech telephone-company exchanges in countries like the United States, Canada, the UK, and Japan that had good dial-telephone systems in their large cities. These fast switches were at the heart of the systems.

Apparently, all of the 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 sand by Japanese. It is certain that the American occupation troops in Japan in 1945-52 searched for any remaining units.

The PURPLE machine itself was first used by Japan in June 1938, but US and British cryptologists had broken some of its messages well before the attack on Pearl Harbor. US cryptologists decrypted and translated the 14-part Japanese diplomatic message breaking off relations (ominously) with the United States at 1 p.m. Washington time on 7 December 1941 before the Japanese Embassy in Washington could do so. Difficulties at the Embassy were a major reason the diplomatic "note" was delivered late.

Other Factors
During WW-II, Hiroshi Ōshima, the Japanese ambassador in Berlin, avidly studied German military developments and deployments and reported on them at length back to Tokyo via PURPLE-enciphered messages sent via radio. A good example of this was that he reported on the emplacement of the Atlantic Wall fortifications that the German Wehrmacht was building along the coasts of France and Belgium. Thus, unaware to himself, he was reporting to the Allies all about German military preparations against the forthcoming D-Day invasion of Western Europe. All that time, the Americans and the British were reading every report that the Japanese ambassador was sending in PURPLE to Tokyo.

The decrypted PURPLE traffic, and Japanese messages generally, was the subject of acrimonious hearings in Congress post-WW-II in connection with an attempt to decide who, if anyone, had allowed the disaster 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 cypher machine had indeed been broken.

An example of a PURPLE message
At the right is an example of a PURPLE message. In raw form, it was the first part of the 14-part message that was received by the Japanese embassy in Washington, DC and sent to the US government on December 7, 1941. The message itself was intercepted by the US Navy intercept station at Bainbridge Island, Seattle, Washington at 1300 GMT on December 6. Some explanation is needed to understand the contents of the message, which is given below :
 * S352/6 1000S GR265
 * OBESE OVALS TIARA ..OME
 * 62527 ZTXOD NWKCC MAVNZ XYWEE TUQTC IMNVE UVIWB LUAXR RTLVA
 * RGNTP CNOIU PJLCI VRTPJ KAUHV MUDTH KTXYZ ELQTV WGBUH FAWSH
 * ULBFB HEXMY HFLOW D-KWH KKNXE BVPYH HGHEK XIOHQ HUHWI KYJYH
 * PPFEA LNNAK IBOOZ NFRLQ CFLJT TSSDD OIOCV T-ZCK QTSHX TIJCN
 * WXOKU FNQR- TAOIH WTATW VHOTG CGAKV ANKZA NMUIN


 * YOYJF SRDKK SEQBW KIOOR JAUWK XQGUW PDUDZ NDRMD HVHYP NIZXB
 * GICXR MAWMF TIUDB XIENL ONOQV QKYCO TVSHV NZZQP DLMXV NRUUN
 * QFTCD FECZD FGMXE HHWYO NHYNJ DOVJU NCSUV KKEIW OLKRB UUSOZ
 * UIGNI SMWUO SBOBL JXERZ JEQYQ MTFTX BJNCM JKVRK OTSOP BOYMK
 * IRETI NCPSQ JAWVH UFKRM AMXNZ UIFNO PUEMH GLOEJ HZOOK HHEED


 * NIHXF XFXGP DZBSK AZABY EKYEP NIYSH VKFRF PVCJT PTOYC NEIQB
 * FEXME RMIZL GDRXZ ORLZF SQYPZ FATZC HUGRN HWDDT AIHYO OCOOD
 * UZYIW JROOJ UMUIH RBEJF ONAXG NCKAO ARDIH CDZKI XPR-- DIMUW
 * OMHLT JSOUX PFKGE PWJOM TUVKM WRKTA CUPIG AFEDF VRKXF XLFGU
 * <span style="font-family:Courier,Courier New; font-size:x-small;">RDETJ IYOLK BHZKX OJDDO VRHMM UQBFO WRODM RMUWN AYKYP ISDLH


 * <span style="font-family:Courier,Courier New; font-size:x-small;">ECKIN LJORK WNWXA DAJOL ONOEV MUQDF IDSPE BBPWR OFBOP AZJEU
 * <span style="font-family:Courier,Courier New; font-size:x-small;">USBHG IORCS UUQKI IEHPC TJRWS OGLET ZLOUK KEOJO SMKJB WUCDD
 * <span style="font-family:Courier,Courier New; font-size:x-small;">CPYUU WCSSK WWVLI UPKYX GKQOK AZTEZ FHGVP JFEWE UBKLI ZLWKK
 * <span style="font-family:Courier,Courier New; font-size:x-small;">OBXLE PQPDA TWUSU UPKYR HNWDZ XXGTW DDNSH DCBCJ XAOOE EPUBP
 * <span style="font-family:Courier,Courier New; font-size:x-small;">WFRBQ SFXSE ZJJYA ANMG- WLYMG WAQDG IVNOH KOUTI XYFOK NGGBF


 * <span style="font-family:Courier,Courier New; font-size:x-small;">GANPW TUYLB EFFKU FLEXO IUUAN VMMJE QUSFH FDOHQ LAKWT BYYYL
 * <span style="font-family:Courier,Courier New; font-size:x-small;">NTLYT SXCGK CEEWQ RYAVG RKXIA NPXNO FVXGK JFAVK LTHOC XCIVK
 * <span style="font-family:Courier,Courier New; font-size:x-small;">OLXTJ TUNCL QCICR UIIWQ DDMOT PRVTJ KKSKF HXFKM DIKIZ WROGZ
 * <span style="font-family:Courier,Courier New; font-size:x-small;">JYMTM NOVMF J-OKT EIVMY ANOHN NYPDL EXCFR RNEBL MNYEB GNHCZ
 * <span style="font-family:Courier,Courier New; font-size:x-small;">ZCFNW GGRHR IUUTT ILKLO DUYZK QOZMM NHASX HLPVT NGHQD AJIUG


 * <span style="font-family:Courier,Courier New; font-size:x-small;">OOSZ. ....Z RTGWF BLKI. ..... ..YBD ABJ.. ...WY OEANV ...OM

The words :<span style="font-family:Courier,Courier New; font-size:x-small;">"OBESE OVALS" and :<span style="font-family:Courier,Courier New; font-size:x-small;">"TIARA [GN]OME" appear to designate Tokyo and Washington, DC respectively. The :<span style="font-family:Courier,Courier New; font-size:x-small;">"GR265" indicates that there are 265 sets of five characters in this part of the message, but there are only 262 groups in the archive copy. But as the copy shows that the teleprinter paper was torn at the last line, the last three groups may be on the following line.

On the archival copy itself, the notes in pencil need to be explained itself. The "6th" meant that this part of the message was received on December 6, and the "Army" notation meant that it was processed by the U.S. Army SIS, as it was an even-numbered day. "Pt.1" meant that it was the first part of a multi-part message. The number "15739" indicated to the operator where to set the switches before deciphering the message, and the numbers "9-1-24-6" represent the starting positions of the sixes switch and the twenties switches 1, 2 and 3 respectively, while the circled "4" designates the switch motion.