Introduction
The Japanese Purple machine (97-shiki O-bun In-ji-ki) was the diplomatic cipher that the US Army Signal Intelligence Service broke in 1940, more than a year before Pearl Harbor. Unlike the German Enigma, Purple used stepping switches instead of rotors, with a 6-20 split that separated vowels from consonants. This tool demonstrates that split and the cascaded stepping mechanism in your browser. Set the switch positions, type a message, and watch each letter route through the vowel switch or the three consonant switches. The step trace shows the switch positions after every character. Nothing leaves your device.
What this tool does
- Encrypts and decrypts text using a simplified model of the Japanese Purple cipher machine, demonstrating the 6-20 vowel/consonant split
- Routes vowels (AEIOUY) through a 6-position stepping switch and consonants (BCDFGHJKLMNPQRSTVWXZ) through three cascaded 25-position stepping switches
- Supports independent start positions for the vowel switch (0-5) and each consonant switch (0-24), matching the machine's daily key settings
- Steps the consonant switches in cascade: switch 1 advances every consonant, switch 2 advances when switch 1 completes a 25-step cycle, and switch 3 advances when switch 2 completes a cycle
- Displays a step-by-step trace showing the input letter, output letter, switch type, and switch positions after each character
- Passes non-letter characters through unchanged, so spaces and punctuation in the input are preserved in the output
How this tool works
The tool separates each input letter into one of three categories: vowel (AEIOUY), consonant (the remaining 20 letters), or non-letter. Vowels pass through a 6-position switch that adds the current vowel switch position to the letter's index modulo 6. Consonants pass through three cascaded switches: each switch adds its position to the consonant index modulo 20, and the switches step after every consonant in odometer fashion.
The stepping follows the cascade that the real Purple machine used. Switch 1 advances by one after each consonant. When switch 1 wraps from 24 back to 0, switch 2 advances by one. When switch 2 wraps, switch 3 advances. This produces a long cycle of 25 x 25 x 25 = 15,625 consonant switch states before the pattern repeats, which is what made Purple harder to analyze than a simple polyalphabetic cipher.
The tool displays the current switch positions in a panel and shows the positions after processing the full input. The step trace lists each character with its category (vowel, consonant, or other), the switch positions at that point, and the resulting output letter. Decryption reverses the arithmetic: vowels subtract the switch position, and consonants subtract all three switch positions in reverse order. The stepping is identical for both modes, so the same start positions that encrypted a message will decrypt it.
This is a simplified educational model. The real Purple machine used complex wiring permutations for each switch position rather than simple modular shifts, and its stepping pattern had additional irregularities. The tool captures the 6-20 split and the cascaded switch principle, which are the core ideas that distinguish Purple from rotor machines like Enigma.
How the Purple cipher machine works
The Japanese Foreign Ministry introduced the Purple machine in 1939 for high-level diplomatic traffic. Its formal designation was 97-shiki O-bun In-ji-ki (Alphabet Typewriter 97). David Kahn described its history and cryptanalysis in The Codebreakers, noting that Purple replaced an earlier machine called Red and carried messages between Tokyo and embassies in Berlin, Moscow, and Washington.
The machine's defining feature was the 6-20 split. The six vowels (AEIOUY, with Y treated as a vowel in Japanese romanization) passed through a single 6-position stepping switch. The 20 consonants passed through three 25-position stepping switches wired in cascade. This split reflected the phonetic structure of romanized Japanese and meant that vowels and consonants were encrypted by completely separate mechanisms, a design choice that ultimately helped the American codebreakers.
Frank B. Rowlett led the team that broke Purple at the US Army Signal Intelligence Service (SIS). In The Story of Magic (1976), Rowlett described how the SIS built an analog machine that replicated Purple's behavior without ever capturing a Purple device. The breakthrough came in September 1940, and the resulting intelligence was code-named Magic. President Roosevelt received Purple-derived diplomatic decrypts throughout the war.
The cryptanalysis exploited the 6-20 split. Because vowels and consonants used separate switches, the codebreakers could isolate the vowel subsystem (only 6 positions) and solve it first, then attack the consonant switches. The Enigma Machine used a uniform 26-letter rotor path with no such split, which is one reason the two machines required different analytical approaches. The SIGABA and Typex machines, by contrast, were rotor-based systems that the US and UK trusted for their own traffic. The Lorenz Cipher was another WWII machine cipher, used by the German High Command, that the British broke at Bletchley Park.
How to use this tool
- Choose a mode: Encrypt or Decrypt. Both modes use the same stepping, so the same start positions that encrypted a message will decrypt it
- Set the vowel switch start position (0-5). This controls the offset applied to vowels AEIOUY
- Set the three consonant switch start positions (0-24 each). These control the cascaded offsets applied to the 20 consonants
- Type or paste your message. Vowels route through the vowel switch, consonants through the three consonant switches, and non-letters pass through unchanged
- Read the output in the cipher text field. Toggle Show Switches to see the current positions, and Show Steps to trace each character
- Note the final switch positions displayed after processing, which show how far the switches advanced through the input
Real-world examples
Encrypting a diplomatic-style message
Input: MEETING TOKYO EMBASSY with vowel position 2 and consonant positions 5, 10, 15. The tool routes each M, T, K, Y, B, S through the consonant switches and each E, I, O, A through the vowel switch. The consonant switches step after each consonant, so the second M uses switch positions 6, 10, 15 rather than 5, 10, 15. The output differs from a simple Caesar shift because the shift amount changes with every consonant. A history student can compare this with the Enigma Machine tool to see how stepping switches produce a different encryption pattern than rotors.
Observing the 6-20 split in the step trace
Type a message heavy in vowels, such as AEIOU AEIOU AEIOU. The step trace shows every character routed through the vowel switch with the consonant switches unchanged. Now type a consonant-heavy message like BCDFG BCDFG. The trace shows the consonant switches stepping after each letter while the vowel switch stays still. This separation is the 6-20 split that Rowlett's team exploited in 1940, and it is visible directly in the trace output.
Decrypting with the same start positions
Take the ciphertext from the first example, switch the mode to Decrypt, and enter the same vowel and consonant start positions. The tool subtracts the switch offsets instead of adding them, and the stepping advances identically. The output matches the original plaintext. This works because the stepping is deterministic: given the same start positions and the same input length, the switches reach the same state at each position regardless of whether you are encrypting or decrypting.
Demonstrating the cascade cycle
Set all consonant switch positions to 0 and type a string of 26 consonants (such as BCDFGHJKLMNPQRSTVWXZBCDFGH). The step trace shows switch 1 advancing from 0 to 24, then wrapping to 0 on the 25th consonant. At that point, switch 2 advances from 0 to 1. This is the cascade in action, and it demonstrates why the full consonant switch cycle is 15,625 states long (25 x 25 x 25) before the pattern repeats.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| Caesar cipher | Very low (single shift) | Teaching basic substitution |
| Enigma (3-rotor) | High (rotor-based, 26-letter) | WWII German military communications |
| Purple (simplified) | High (stepping switches, 6-20 split) | WWII Japanese diplomatic communications |
| SIGABA | Very high (irregular rotor stepping) | WWII US high-level communications |
| Typex | High (5 rotors with stators) | WWII British armed forces communications |
| Lorenz SZ40 | Very high (12 wheels) | WWII German High Command traffic |
Limitations or considerations
This is a simplified educational model of Purple. The real machine used complex wiring permutations for each switch position, not simple modular shifts. The real stepping pattern also had irregularities that this tool does not reproduce. The tool demonstrates the 6-20 split and the cascaded stepping principle, which are the core concepts, but it should not be treated as a faithful cryptographic replica.
The simplified model has a small effective key space. The vowel switch has 6 positions and the three consonant switches have 25 each, giving 6 x 25 x 25 x 25 = 93,750 total start states. The real Purple had a much larger effective key space because each switch position applied a distinct permutation rather than a uniform shift.
Purple is completely insecure by modern standards. It was broken by hand and electromechanical methods in 1940, before computers existed. Never use this tool or any Purple simulation for real encryption. For modern security needs, use the AES Encrypt / Decrypt tool or another NIST-approved algorithm.
Frequently asked questions
Why did Purple use a 6-20 split instead of treating all 26 letters uniformly?
The split reflected the phonetic structure of romanized Japanese (Nihon-shiki and Kunrei-shiki), where vowels and consonants play distinct roles. The designers may have believed that separating the two categories added security. In practice, the split helped the American codebreakers because they could solve the smaller vowel subsystem (6 positions) independently before attacking the consonant switches.
How is Purple different from Enigma?
Enigma used rotating wired wheels (rotors) that processed all 26 letters through the same path. Purple used stepping switches (telephone exchange components) with separate mechanisms for vowels and consonants. Enigma was self-reciprocal (a letter never encrypted to itself), while Purple had no such restriction. The two machines required completely different cryptanalytic approaches.
When was Purple broken and by whom?
The US Army Signal Intelligence Service broke Purple in September 1940. Frank B. Rowlett led the cryptanalytic team, which included Leo Rosen and Albert Small. They built an analog machine that replicated Purple's behavior without ever capturing a Purple device. The resulting intelligence was code-named Magic and was delivered to President Roosevelt throughout the war. Rowlett described the effort in his 1976 book The Story of Magic.
What is a stepping switch and how does it differ from a rotor?
A stepping switch is an electromechanical component originally developed for telephone exchanges. It has multiple positions (typically 25 or 50) and advances one step at a time, routing an electrical signal through a different contact at each position. A rotor (as in Enigma) is a rotating wheel with wired contacts on both faces that creates a permutation of the alphabet. Stepping switches are generally simpler mechanically but can be cascaded to produce long cycles.
Did breaking Purple prevent Pearl Harbor?
No. Purple carried diplomatic traffic, not naval operational messages. The Japanese attack on Pearl Harbor on December 7, 1941 was coordinated through naval channels using the JN-25 code, not Purple. However, Purple decrypts did provide the US with valuable intelligence about Japanese diplomatic intentions before and during the war, including the fact that Japan had broken off negotiations with the US shortly before the attack.
Conclusion
The Purple machine is a study in how a novel design (stepping switches with a vowel-consonant split) can still fall to patient cryptanalysis. This tool lets you watch the 6-20 split and the cascaded switches in action, which is the core of what Rowlett's team reverse-engineered without ever seeing the machine. To compare with other WWII cipher machines, try the Enigma Machine, SIGABA, Typex, and Lorenz Cipher tools. For modern encryption, use the AES Encrypt / Decrypt tool instead.