[Cryptography] An observation on the Japanese PURPLE machine

Arnold Reinhold agr at me.com
Mon Apr 29 14:09:06 EDT 2019

The breaking of the Japanese PURPLE cipher in 1940 was a legendary moment in U.S. cryptographic history. A complex cipher machine was completely reconstructed based solely on the cryptanalytic analysis and ingenuity of a team led by William Friedman, without any information whatsoever about the design of the machine under attack, other than intercepted ciphertext. In particular, Leo Rosen deduced that the machine was implemented using 25-pole stepping switches, commonly used in telephone switching, unlike the rotor machines like Enigma and SIGABA that were in vogue at the time. After some brilliant work by the team and a breakthrough by Genevieve Grotjan, they were able to build an equivalent machine using 13 six-layer stepping switches, one for the “sixes” cipher and four each for the three stages of the twenties cipher. (The PURPLE machine followed the design of the earlier RED cipher machine, both based on the English alphabet, of having the ability to encode 6 vowels and 20 consonants separately. This was  apparently to save money on telegram charges. Pronounceable words were charged less and foreign ministry budgets are always tight.)

At the end of the war, all the Japanese machines were throughly destroyed, with the exception of a few fragments found at the Japanese Embassy in Berlin. Lo and behold, the largest fragment contained three stepping switches.  Many sources report, in amazement, that the stepping switches in the captured fragment are exactly identical to the ones selected by Rosen.

Except they aren’t. The Japanese stepping switches have seven layers, not six. The big fragment is on display at the NSA’s National Cryptologic Museum in Baltimore and there are several high resolution photos of the device available on Wikimedia Commons in the category “PURPLE cipher machine”. Here is a good one:


If you look closely at the middle unit you will see the the stepping switch in the fragment have seven sets of contacts. This can be verified in other photos as well. Be sure to select the “original image” on the Commons page for full resolution.

Seven layers makes complete sense and helps explain what the fragment is. To implement the twenties cipher one needs effectively a twenty layer switch at each stage to select a permutation of the 20 inputs. Three synchronized 7-layer switches provide 21 layers, one more than was needed to implement a Purple cipher stage. The extra layer may have been used to control stepping of the stages, the order of which was a cryptovariable in the keying system. Rosen used four 6-layer switches that he found readily available, but there is nothing special about 6 layers. The switches themselves are modular in design and the manufacturers could easily make them with whatever number of layers a customer wants, within reason. 

The U.S. captured a Japanese JADE cipher machine during the war. It’s on display at NCM as well and here is a good photo:


It contains five blocks of four stepping switches, each with seven layers. That’s 28 layers per stage , enough for the 25 character alphabet the machine used (50 katakana characters with a shift function). Interestingly, there is one 2-layer switch just to the right of the plugboard, perhaps for stepping.  (My guess for why there are five blocks of steppers is to allow both encryption and decryption with only one typewriter. To accomplish this without extremely elaborate switching, they could have added blocks with the inverses of the first and last stage permutations. The middle stage could have been wired to work both ways.)

The mechanical design of the JADE four-switch module matches the Purple fragment. This explains the two bushing mounts on the PURPLE fragment: they would have held a shaft with gears that engaged the ratchet gears on the steppers, keeping the switches synchronized. The shaft would have also held a wheel with the stepper positions marked on its circumference to allow setting the initial position of each stage at the start of a message, another part of the message key. The moving contact wiper on semicircular stepping switches has two arms so that when one arm leaves the 25th contact the other engages the first contact. Thus a 2 to 1 gear ratio provides one revolution per sweep of the 25 contacts. 

None of this diminishes the brilliance of what the SIS team accomplished, but it does shed light on the fragment’s function. Based on the numbers stamped on the switches, I would guess it is the middle stage, but similar numbers on the Jade machine make no sense to me. An ohmmeter or telephone signal tracer could verify that the fragment’s wiring matched one of the Purple permutation sets. 

I can’t believe I’m the first person to notice that the Japanese PURPLE stepping switches have seven layers, not six. Does anyone know another reference?

Arnold Reinhold

More information about the cryptography mailing list