cipher.ink Write a message

Ciphers · Machine ciphers

The Purple cipher machine

Japan's 1939 diplomatic machine used stepping switches and a 6/20 split. The US rebuilt it without ever seeing one, and Magic was the result.

Purple was the American name for the machine that carried Japan's most secret diplomatic messages from 1939 until the end of the war. It had no rotors. It used stepping switches of the kind found in telephone exchanges, and it handled six letters of the alphabet differently from the other twenty. William Friedman's team in the US Army rebuilt it from ciphertext alone, without ever seeing the machine, in September 1940. The intelligence it produced was code-named Magic.

What it was

The Japanese Foreign Ministry called it the 97-shiki Ôbun Injiki, "System 97 typewriter for European characters", and finished it in 1937. Kazuo Tanabe was the designer, and Eikichi Suzuki proposed the stepping switch. It went into service in February 1939 and stayed there until the Second World War ended, replacing an older, weaker machine the Americans had named Red. A clerk typed the plaintext and the machine printed the ciphertext, and the machine at the other end did the reverse.

Purple looked nothing like the Enigma, which was built from rotors and a reflector. Its heart was a set of stepping switches. Each one advances to its next contact whenever it gets a pulse, so the electrical path through it changes after every letter. There was no reflector, and a plugboard let the operators rewire the input each day. The odd part was how it split the alphabet.

Purple split the alphabet into two groups, 6 and 20, and handled them separatelyABCDEFGHIJKLMNOPQRSTUVWXYZthe "sixes": A E I O U Ythe "twenties": the other 20 letters
The 6 and the 20. The "sixes" group is the vowels A, E, I, O, U and Y; the other twenty letters, the consonants, make up the twenties.

Six letters ran through one set of switches and the other twenty through a different set. A vowel always came out as a vowel and a consonant as a consonant. That "sixes and twenties" pattern showed through in the ciphertext, and it was the flaw that sank the machine.

How it was broken

The Signal Intelligence Service (SIS), the US Army's cryptanalysis office, started on Purple in 1939 under Friedman. By 10 April 1939 the analysts had worked out the permutations for the six-letter group. In August of that year Friedman was put in charge of the attack on the machine as a whole. The twenties were the harder half. The break came in September 1940, when a cryptanalyst named Genevieve Grotjan spotted cycles in the twenties: patterns in the ciphertext that showed how the switches stepped. With that, the SIS could build a working replica, and two messages were read by 27 September 1940. Leo Rosen helped build the first analog, with real stepping switches, in late 1940.

It was a remarkable piece of reconstruction. Nobody on the American side had seen a Purple machine. They inferred its structure from intercepted messages and built their own copy.

In January 1941 an analog went to Britain, in exchange for British results against German ciphers. It was one of the first working examples of the Anglo-American cryptologic partnership.

Magic

The Americans' own top-grade machine, SIGABA, had no known break in service. Purple, in Japanese hands, had one.

The intelligence from Purple was called Magic. Japan's ambassadors in Berlin and Rome reported back by Purple on what their hosts told them, and US codebreakers read every word. On 3 June 1941, Ambassador Hiroshi Ôshima reported that Hitler had told him war with Russia "cannot be avoided", three weeks before Germany invaded. His later reports included a tour of the Atlantic Wall defenses in 1944. On 7 December 1941, American decoders had already read Japan's 14-part message breaking off negotiations before the Japanese embassy in Washington delivered it. That message never mentioned an attack on Pearl Harbor, and historians still argue over how much anyone could have understood from Magic beforehand.

Japan never realized. In April 1941 a German diplomat, Hans Thomsen, warned Berlin that the Americans were reading Japanese messages. Berlin passed the warning on to Tokyo, and Purple stayed in use anyway. Japan seems to have learned about the break only from the US congressional hearings after the war.

What it teaches

  • Structure is a weakness. The 6/20 split let analysts attack each group separately. A good cipher shouldn't leak the shape of its input.
  • A machine can be rebuilt from what it outputs. The SIS rebuilt Purple without the hardware, much as Poland did with the Enigma and Tutte did with the Lorenz. That's why modern cryptography assumes the attacker knows the algorithm (Kerckhoffs's principle) and puts all its trust in the key.
  • Confidence isn't security. The Japanese believed Purple was safe, and they even got a warning. If you have no way of checking whether a cipher is being read, the sensible assumption is that it is.

Common questions

Why was it called Purple?

US cryptanalysts gave colors to Japanese systems. The earlier machine was Red, and the new one, whose Japanese designation was Type B, became Purple.

Did the Americans ever capture a Purple machine?

Not before they broke it. They worked out how it functioned from intercepted messages and built replicas in late 1940.

Did Magic warn of Pearl Harbor?

US decoders read Japan's final diplomatic message on 7 December 1941 before the Japanese embassy delivered it, but the message didn't name an attack. How much could have been understood from Magic is still debated.

On the timeline

  • 1937 to 1939 Japan completes the Type B cipher machine (Purple); it is in service from February 1939.

Further reading

  1. Wikipedia: Type B Cipher Machine
  2. Wikipedia: Purple (cipher machine)
  3. NSA: Pearl Harbor revisited