In the history of cryptography, 97-shiki ōbun injiki (九七式欧文印字機, "System 97 Typewriter for European Characters") or Angōki B-gata (暗号機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 using a 6 X 25 substitution table.
The codename "Purple" referred to binders used by US cryptanalysts for material produced by various systems; it replaced the Red machine used by the Japanese Foreign Office. The Japanese also used Coral and JADE stepping-switch systems. American forces referred to information gained from decryptions as Magic.
The 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 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.