Fact-checked by Grok 2 weeks ago

Type B Cipher Machine

The Type B Cipher Machine, codenamed by cryptanalysts, was an electromechanical encryption device developed by Japan's to secure high-level diplomatic communications during the late 1930s and . Introduced in June 1938 as a successor to the earlier Type A machine (codenamed Red), the Type B was installed in major overseas diplomatic posts starting in late 1938 and entered widespread operational use by February 1939, remaining in service until Japan's surrender in 1945. Officially designated the 97-shiki ōbun inji-ki (System 97 Printing Machine for Characters) or Angōki B-gata (Type B Cipher Machine) in , it processed messages in the Roman alphabet (A–Z), adapting them for Romanized text and other languages through polyalphabetic using 25-position stepping switches arranged in banks, rather than traditional rotors. The device featured a typewriter-like keyboard for input, indicator dials for setting daily keys, and a printing mechanism for output, with internal wiring that split the encipherment process into vowel and consonant groups to handle the nuances of Japanese phonetics within a Latin framework. Its deployment enabled the encryption of sensitive traffic to key embassies in , , and , but vulnerabilities in its switch-based stepping and key management allowed U.S. Army cryptanalysts, led by figures like William Friedman and Leo Rosen, to break the system by September 1940 using manual methods and later an electromechanical analog replicator. This breakthrough, codenamed "Magic," facilitated the interception and decryption of thousands of messages, including critical pre-war negotiations and wartime declarations, significantly influencing Allied intelligence efforts.

Historical Context and Development

Precursors: Prototype and Type A Red Machine

The development of diplomatic cipher machines began in 1927 under the cipher section of the Japanese Foreign Ministry, led by figures like Kakimoto Genichiro. Prototypes were completed by November 1929 for use at the London Naval Conference, featuring a single half-rotor design with 60 contacts to handle vowel and consonant separation in Romanized text. These early machines were tested but refined for security, with the system officially adopted in September 1932 as the 91-shiki Angooki Taipu A, known to U.S. cryptanalysts as the Type A machine. The Type A Red addressed manual codebook limitations by introducing machine encryption for high-level diplomatic communications, deployed across Japanese posts worldwide from approximately 1930. It used a single half-rotor with 60 contacts ( of 6 vowels and 20 consonants, excluding J for romanization), a plugboard for fixed s, and a break wheel for irregular stepping to combine and . Despite improvements, the Type A Red had vulnerabilities, including the "sixes and twenties" separation of vowels and consonants, which produced characteristic patterns. The irregular stepping, controlled by a 47-pin break wheel (with 4 to 11 pins removable for key variation), created exploitable cycles in known-plaintext attacks on diplomatic phrasing. Key variations included monthly or daily plugboard changes and initial settings, but the design's limited permutations allowed U.S. cryptanalysts to recover it manually by 1935 through systematic analysis. These weaknesses prompted development of a more secure successor.

Design and Introduction of Type B Purple Machine

The Type B Cipher Machine, officially the 97-shiki ōbun inji-ki (System 97 Printing Machine for European Characters) or Angōki B-gata, was developed by Foreign engineers from 1935 to 1938 as a successor to the Type A Red, codenamed by U.S. cryptanalysts. Prompted by the Red's , engineers including Eikichi incorporated telephone-type stepping switches to simulate Enigma-like rotor motion without physical rotors, enhancing security for Roman alphabet messages (A–Z, excluding J). Ordered into production in 1938, initial installations occurred in late 1938 at major diplomatic posts, entering widespread use by February 1939 for encrypting sensitive Foreign Office traffic. The machine featured a for input and mechanism for output, with six stepping switches (one for the 6 vowels, three for the 20 consonants) arranged to perform group substitutions and irregular stepping via control wheels. It included dual typewriters for efficient entry and printing in embassy environments. By mid-1940, approximately 10 units were deployed to key diplomatic missions, with additional production and distribution to other posts during . This design increased cryptographic depth for diplomatic dispatches in European languages and Romanized Japanese, prioritizing security and practicality over the Red's rotor-based system.

Technical Design and Operation

Core Components: Stepping Switches and Wiring

The Type B Cipher Machine, known to Allied cryptanalysts as the Purple machine, relied on electromechanical es as its primary hardware for performing substitutions, drawing from selector technology rather than rotors used in contemporary devices like the . These switches consisted of 13 motorized units in total, each featuring a single movable wiper and 25 fixed contacts arranged in banks to handle the Roman alphabet letters (A–Z), split via plugboard into groups of 6 and 20 for separate processing. One switch formed the "sixes" section with 6 levels and 25 positions per level, providing 150 contacts for fast-stepping substitutions, while the remaining 12 switches comprised three "twenties" sections, each built from four 6-level units wired to simulate 20 levels with 25 positions per level, yielding 500 contacts per twenties section and 1,500 overall. The four primary permutation switches—one sixes and three twenties—routed signals through fixed wiring paths for diffusion, with hierarchical stepping among the twenties sections determined by one of 6 possible monthly motion orders. This configuration allowed for complex permutations without rotating drums: the sixes switch provided 25 fixed 6-letter substitution tables via its wiring, and each twenties section supported a cycle length of 15,625 (25^3) based on its 20-position depth. The switches were interconnected internally with nearly 2,000 wires forming a dense "rat's nest" of cables, which defined the machine's substitution tables by linking input signals through multiple layers of permutation before output. External plugboards at the input and output ends provided additional flexibility, using patch cords or jumpers to connect the electric s to the switches and alter the overall wiring permutations; these boards typically featured positions, with daily changeable settings that complemented the monthly updates for motion orders and internal wirings. During setup, lamps illuminated to indicate switch positions, aiding operators in verifying alignments before . The machine drew power from standard AC sources to energize electromagnets for stepping and operations, housed in a compact wooden or metal casing without rotors, marking an evolution from the simpler switch-based Type A () machine. Each twenties section uses four 6-level switches wired to provide 20 independent levels (e.g., combining levels across switches for the additional beyond 18).

Encryption Process and Stepping Mechanism

The Type B Cipher Machine, also known as the Purple machine, enciphered by processing each letter through a series of electrical permutations facilitated by plugboards and stepping switches. To begin encryption, the operator entered the plaintext letter via an integrated electric keyboard, which sent an electrical signal corresponding to one of the Roman alphabet letters. This input first passed through an input plugboard, a wiring panel that could rearrange the letters in any of 26! possible permutations, effectively relabeling the alphabet and assigning letters to the internal 6 or 20 groups before further processing. The machine then routed the signal based on whether the letter belonged to the six-letter group or the twenty-letter group, as defined by the plugboard. For the six letters, the signal traveled through a single "sixes" , which permuted the output via fixed wiring connections across its 25 positions, providing one of 25 fixed (permutations of the 6 letters) depending on the switch's current position. For the twenty letters, the signal passed sequentially through three cascaded "twenties" —designated as fast, middle, and slow based on the monthly motion order—each with 25 positions and wiring that collectively yielded 25³ (15,625) permutations for the group. After permutation by the appropriate switches, the signal exited via an output plugboard, which applied a final rearrangement using the same settings as the input plugboard to produce the letter, printed on a second . This process repeated for each letter, with the machine advancing the switches after every input to generate a polyalphabetic . The stepping mechanism employed irregular advancement to disrupt predictable patterns and enhance , relying on electromechanical relays to rotate across numbered banks. The sixes switch advanced one position after every letter processed, cycling through its 25 positions before resetting. In contrast, the twenties switches operated in a hierarchical, conditional manner based on the sixes position: the fast switch advanced after every letter except when the sixes was at position 25 (where the middle advanced) or at position 24 and the middle was at 25 (where the slow advanced); the middle switch advanced when the sixes reached position 25; the slow switch advanced when the sixes was at position 24 and the middle was at 25. This created an irregular stepping sequence across the four active switches (one sixes and three twenties), with a total cycle length of 25⁴ (390,625) unique configurations before repetition, though key settings could alter motion orders for variability. Each step moved the switch exactly one position, avoiding multi-position jumps, but the conditional triggers ensured non-periodic behavior over short message lengths. Key management involved periodic reconfiguration to maintain cryptographic strength, with settings applied manually before each session. Monthly keys specified the plugboard wirings and one of six possible motion orders for the twenties switches to vary the stepping , while also defining rearrangements of the plugboards. Daily operations used a keylist to the initial positions of all four stepping switches (25 options each for sixes and twenties), ensuring between sender and receiver; operators cleared the machine's state with a lever at the start. These changes, distributed via secure channels, prevented long-term predictability, though the overall key space exceeded 10³² possibilities when combining plugboard permutations, switch wirings, and motion settings. mirrored the process in reverse, requiring identical key setups to recover the from inputs.

Cryptanalysis Efforts

Early Challenges and American Recovery Attempts

The Signal Intelligence Service (), led by William Friedman, first encountered the Type B Cipher Machine through intercepted Japanese diplomatic traffic beginning in 1939, as Japan transitioned from its predecessor system. The new cipher was codenamed by the , reflecting its status as a more advanced machine-based encryption for high-level communications. Initial American efforts faced significant obstacles, including the lack of any physical machines, as none were captured until after the war. Traffic volume was limited in the early stages, providing only sparse material for analysis, while variations in encryption depth settings hindered traditional techniques. The machine's switch-based design further complicated preliminary assumptions, as it deviated from rotor expectations derived from earlier systems. Recovery attempts began in 1940 with partial reconstruction of wiring diagrams, drawing on adaptations from the previously captured Red machine. SIS cryptanalysts, including Frank Rowlett, constructed rudimentary mockups using telephone stepping switches to simulate components. By mid-1940, the team had analyzed intercepted text, discerning the use of a 25-letter and confirming the cipher's reliance on electrical switches rather than rotors.

Breakthrough Methods and Analog Construction

The breakthrough in cryptanalyzing the Type B Cipher Machine, known as to U.S. , occurred in September 1940 when Genevieve Grotjan discovered repeating patterns in the ciphertexts, enabling the Signals Service () to achieve the first full decryption through a targeting repeated phrases common in diplomatic messages, such as formal salutations. This approach exploited predictable text elements to align with expected , revealing initial patterns in the machine's substitution mechanism. By September 1940, the had recovered the full wiring configuration, enabling more systematic attacks on subsequent traffic. Key methods included cycle-cutting, which capitalized on irregularities in the stepping switches' advancement to disrupt and analyze the machine's permutation cycles. Superimposed message analysis involved stacking multiple encryptions (depths) of similar messages to highlight alignments and reveal switch positions through emergent patterns. Additionally, mathematical modeling of the s allowed recovery of the active switch orders by identifying statistical correlations in letter distributions, bypassing the need for exhaustive trials. A specific weakness aiding these efforts was the stepping switches' tendency to produce detectable biases in letter frequencies, deviating from uniform randomness due to mechanical constraints. To facilitate automated decryption, the SIS constructed analogs of the Purple machine using modified telephone stepping switches and relay circuits, replicating the six-position substitution without rotors. The first working analog became operational in September 1940, incorporating electric typewriters for input and output, and connected via approximately 500 wires to mimic the scrambling process. This device, often called the "Purple analog," transformed manual recovery into a semi-automated procedure. The SIS team dedicated to Purple cryptanalysis expanded significantly to handle the growing volume of intercepts. By 1942, these advances enabled the recovery of a substantial portion of daily Purple traffic, providing consistent access to high-level Japanese diplomatic communications.

Intelligence Impact and Legacy

Decryption Achievements and Operational Use

The project, headquartered at in , represented the U.S. Army Signal Intelligence Service's dedicated effort to decrypt Japanese diplomatic communications enciphered on the Type B Cipher Machine (). Operational from late 1940, it enabled routine decryption of intercepted traffic, often within one day, prioritizing messages over other systems for timely translation and dissemination to top officials. By the , the setup had scaled through a that integrated intercept stations, analog reconstruction devices, and computational aids. Decryption achievements included revealing key aspects of Japanese negotiations, such as the prelude to the in 1940, where intercepts exposed Tokyo's diplomatic overtures to and for mutual defense, informing U.S. pre-war diplomacy on alignment risks. These decrypts supported broader diplomatic strategy by tracking Japan's foreign policy shifts and economic pressures. Specific operational uses encompassed to pinpoint embassy locations and activities, alongside correlation with sources like the JN-25 naval code for comprehensive threat assessment. Post-Pearl Harbor, efforts concentrated on endgame diplomacy, with 1945 decrypts exposing Japan's covert surrender overtures, including bids for Soviet mediation on peace terms despite the Potsdam Declaration's demands. The initial "fragmentary recovery" technique, which reconstructed partial messages from incomplete intercepts, advanced to full automated decryption via tabulators that sorted and matched ciphertexts efficiently. Reliance on analog machines for rapid key simulation further accelerated processing, turning raw intercepts into actionable intelligence.

Strategic Consequences for World War II

The decryption of the Type B Cipher Machine, known as to Allied cryptanalysts, provided the with critical insights into diplomatic intentions, enabling proactive responses in the lead-up to and during . In late 1941, intercepts—decrypts of PURPLE traffic—revealed Japan's deteriorating relations with the U.S. and its preparations to sever diplomatic ties, directly informing the drafting of Cordell Hull's 14-point note on November 26, 1941, which demanded Japanese withdrawal from and Indochina as a precondition for peace talks. These intercepts allowed American policymakers to anticipate Japanese escalation, shaping diplomatic maneuvers that pressured without immediate military confrontation. Overall, PURPLE decrypts influenced Allied strategy in the Pacific theater by exposing Japan's alignment with and its expansionist aims, facilitating coordinated responses such as resource embargoes and naval repositioning. Militarily, the intelligence from PURPLE played an indirect but supportive role in key Pacific operations by correlating diplomatic signals with operational data from other sources. For instance, during the Battle of Midway in June 1942, PURPLE-derived insights into Japanese embassy communications corroborated naval codebreaks (such as JN-25), confirming Tokyo's broader strategic objectives and aiding U.S. fleet deployments that led to the decisive Allied victory. Toward the war's end, MAGIC intercepts of PURPLE messages in July 1945 exposed Japanese peace feelers through Soviet channels, including cables between Ambassador Naotake Sato in Moscow and Foreign Minister Shigenori Togo, which revealed Tokyo's willingness to explore surrender terms but reluctance to accept unconditional capitulation without guarantees for Emperor Hirohito. This intelligence informed the Potsdam Declaration of July 26, 1945, which omitted explicit assurances on the emperor to test Japanese resolve, ultimately hastening surrender after the atomic bombings and Soviet entry into the war. The breaking of the Type B machine contributed significantly to the Allied triumph in the domain, providing a steady stream of high-level diplomatic revelations that complemented other efforts and shortened the Pacific conflict. Declassified in the 1970s through congressional reviews and Act releases, the MAGIC intercepts became starting around 1972, with fuller disclosures by 1978, allowing historians to assess their wartime value. Modern evaluations, however, note an overestimation of PURPLE's standalone impact compared to sources, which provided essential for interpreting decrypts and filling gaps in coverage. British contributions, often underemphasized, included assistance from the Government Code and Cypher School (GCCS) starting in 1942, where shared U.S. analog machines enabled collaborative decryption of select PURPLE traffic at . Post-war Japanese assessments, revealed during U.S. congressional hearings, expressed shock at the compromise, with officials like former diplomats admitting the failure to suspect penetration prolonged reliance on the outdated system until 1945, contributing to strategic miscalculations.

References

  1. [1]
    Pre-1952 Historical Timeline - National Security Agency
    1938 Jun Japanese Ministry of Foreign Affairs introduced "PURPLE" cipher machine; 1939 Jan 01 U.S. Army Second Signal Service Company (later Battalion) ...
  2. [2]
    Red and Purple - National Security Agency
    In late 1938, a cipher expert traveled to Japan's major overseas diplomatic posts to install a new cryptodevice, called the "Type B Machine." Japan's ...
  3. [3]
    Part-2 - Naval History and Heritage Command - Navy.mil
    Jul 6, 2015 · The Japanese diplomatic machine ciphers were designated Red for the A machine and, in 1939, Purple for the B machine which replaced it at many ...
  4. [4]
    [PDF] PRELIMINARY HISTORICAL REPORT ON THE SOLUTION OF THE ...
    Sep 27, 2025 · offices as the Type "B" cipher machine. This machine was to replace the then currently used Type "A" machine for highly secret com.'llU."'l ...
  5. [5]
    The Magic of Purple - National Security Agency
    Aug 4, 2021 · Purple was a Japanese diplomatic cipher, more complex than Red, that was broken by a device, and its breaking helped understand Japan's ...Missing: B | Show results with:B
  6. [6]
    The 'Code Girls' of Arlington Hall Station: Women Cryptologists of ...
    Sep 21, 2023 · The SIS named its code “Purple.” Because of her discovery, SIS and the US Navy were able to build a “Purple” analog machine to help decode ...
  7. [7]
    Japanese Red
    From Wikipedia: "In the history of cryptography, 91-shiki injiki (System 91 Printing Machine) or Angoki Taipu-A ("Type A Cipher Machine"), codenamed Red by ...Missing: Angooki | Show results with:Angooki
  8. [8]
    Development of the First Japanese Cipher Machine: RED - Cryptiana
    Mar 27, 2014 · The RED cipher machine, as designated by US codebreakers, was the first cipher machine used for Japanese diplomatic communications.
  9. [9]
    [PDF] Cryptanalysis of Purple, Japanese WWII Cipher Machine - csail
    Purple is also called Type B Machine since it was the successor of a Japanese cipher ... Type B Cipher Machine. In Wikipedia, May 10, 2019. https : //en.
  10. [10]
    [PDF] 9GUV 9KPF %NGCT - National Security Agency
    Purple cipher machines that had taken Rowlett and his codebreakers so long to exploit.17. Rowlett went to the Army brass with his con- cerns about the Navy's ...
  11. [11]
    1939: Japanese first use of PURPLE : Cryptologic Dates in History ...
    20 February 1939: The Japanese first use of the PURPLE machine-generated diplomatic cryptosystem. PURPLE was the codename Americans gave an ...<|control11|><|separator|>
  12. [12]
    Purple - Cipher Machines
    The Japanese Purple machine is based on the rotor technology of the Enigma, and the Japanese called it "97-shiki O-bun In-ji-ki", which means Alphabetical ...Missing: Type B design 1935-1938 deployment 1939
  13. [13]
    [PDF] Simulation and Computer-aided Cryptanalysis of Angooki Taipu B
    The 97-shiki-obun In-ji-ki (Cipher Machine 97) was also referred to as Angooki. Taipu B by the Japanese. When cryptanalysis of the PURPLE machine began, the ...Missing: 91- | Show results with:91-<|control11|><|separator|>
  14. [14]
    [PDF] DOCID: 4001123 - Wikimedia Commons
    Sep 26, 2012 · wiring of the rotary switches ... There were some properties similar to a rotor. ~The Japanese Purple machine used the telephone selector "wheel," ...
  15. [15]
    [PDF] THANG DAO SJSU, CS 180H Purple Cipher
    Dec 9, 2005 · The cryptographic components inside the machine are an input plugboard, an output plugboard, and stepping switches. The two plugboards are ...Missing: mechanism | Show results with:mechanism
  16. [16]
    [PDF] Japan's Purple Machine
    Mar 18, 2004 · The Purple machine was a Japanese cipher used to encrypt diplomatic communications, including messages that broke off negotiations with the US. ...
  17. [17]
    Breaking “Purple” in William Friedman's own words
    Sep 23, 2020 · In late 1938, a decoded Japanese message indicated that in February 1939, the current “A” encryption would no longer be used, but would switch to the new “B” ...Missing: production deployment
  18. [18]
    Purple Crypto - Jerry Proc
    The number 97 came from the Japanese calendar year 2597 (equivalent to 1937). Informally the Americans called the machine "J." the diplomatic "Purple" and the ...Missing: development timeline
  19. [19]
    [PDF] THE "MAGIC" BACKGROUND OF PEARL HARBOR - Ibiblio
    Included in MAGIC were dispatches between the Foreign Office in Tokyo and the Japanese ... Tripartite Pact at some opportune moment, and if Turkey attempted to ...
  20. [20]
    The Atomic Bomb and the End of World War II
    Aug 4, 2020 · Updated National Security Archive Posting Marks 75th Anniversary of the Atomic Bombings of Japan and the End of World War II.
  21. [21]
    Magic Background of Pearl Harbor
    Japan's adherence to the Tripartite Pact as the keystone of its foreign policy indicated that its demands upon Indo-China for military and naval bases, and the ...
  22. [22]
    [PDF] Pearl Harbor Revisited: - National Security Agency
    Despite changes in its government, Japan remained committed to the Tripartite Pact with Germany and Italy. • Japan frequently expressed determination to use ...
  23. [23]
    [PDF] DOCID: 3928846 The Uncertain Summer of 1945
    Dec 1, 2011 · MAGIC made the cables between Sato and Togo available to U.S. leaders, providing them with further confirmation that Japan was looking for an ...
  24. [24]
    [PDF] Eavesdropping on Hell: - National Security Agency
    10 The Enigma and Purple cipher machines are well known from the literature of World War II. Less famous, but important as sources of intelligence, were ...<|separator|>
  25. [25]
    [PDF] A History of U.S. Co1n1nu1z.ications Policy a1zd Ad1ni11istratio11
    Jul 31, 2025 · diplomatic traffic until it was superseded by the PURPLE machine in February 1941. The Japanese PURPLE machine. Elizebeth Friedman.Missing: consequences | Show results with:consequences