Thursday 28 May 2020

Purple - The Japanese Secret

Hello, there fellow readers! We are back with episode 2 of the mini-series “Decrypting World War II communications”. Different countries developed different encoded forms of communication influenced by their language and culture and infused them with technology. Previously, we decoded the most popular cipher machine in Germany, and today, it will be Japan’s.

The “Type B Cipher Machine” or popularly known by “Purple” as coined by the United States, was an encryption machine used by Japanese Foreign Office right from Feb 1939 till the end of World War II, pretty consistent, right?

Purple was called Type B Cipher Machine because it was the successor of a Japanese machine called “Red” from which most of the properties were inherited but with positive modifications to cover the flaws.



97 shiki-obun In-ji-ki or Alphabetical Typerwriter’97 or Purple was important for Japanese to send diplomatic and military messages like the 14-part message, 5000 characters long note sent to the Washington embassy of Japan stating the broken-off negotiations between the United States and Japan which were considered as “The Failed Attempt To Avert The War with Japan, 1941”.


History


In 1937, the Japanese completed the next generation "Type 97 Typewriter". The Ministry of Foreign Affairs machine was the "Type B Cipher Machine", codenamed Purple by United States cryptanalysts.

The chief designer of Purple was Kazuo Tanabe. His engineers were Masaji Yamamoto and Eikichi Suzuki. Eikichi Suzuki suggested the use of a stepping switch instead of the more troublesome half-rotor switch.

Clearly, the Purple machine was more secure than Red, but the Navy did not recognize that Red had already been broken. The Purple machine inherited weakness from the Red machine that six letters of the alphabet were encrypted separately. It differed from Red in that the group of letters was changed and announced every nine days, whereas in Red they were permanently fixed as the Latin vowels 'a', 'e', 'i', 'o', 'u' and 'y'. Thus US Army SIS was able to break the cipher used for the six letters before it was able to break the one used for the 20 others.


Working


The System overview mentioned below is based on the replicate of the original one because the original was made sure never to be found. Find the reference to the overview here, Cryptoanalysis of Purple - presented by Barjol Lami, Gledis Kallco, Nicholas Guo, Sean Shi.


Elements of the Purple machine




Type B cipher machine has three main elements: input plugboard, permutation switches, and output plugboard.


Input Plugboard


It consists of two parts - the internal and the external alphabets. The external alphabet is the input from the user and each external letter was mapped manually to one of the internal alphabets so that every permutation of mapping would be valid. The internal alphabets were used in the encryption. They were further categorized as sixes and twenties; the vowels and the consonants respectively and each internal letter were encrypted in either a vowel or a consonant. This was actually a step of improvement because in Type A Cipher Machine, “like mapped to like” which made it easy to recognize.


Switches


After a letter goes through the input plugboard, it can be encrypted in two varied ways depending on whether it maps to one of the sixes (the vowels) or one the twenties (the consonants). Sixes get permuted through a switch called the sixes switch. It has 25 possible positions, which means 25 possible permutations of the sixes out of 6! = 720 that is the total space of permutations. The twenties have bigger space of possible permutations. They get permuted through 3 consecutive switches called twenties switches, each of which has 25 possible positions. Combined, 3 twenties rotors can produce 253 possible permutations for the twenties. Every time a letter gets encrypted by the machine, the sixes switch and one of the twenties switches will change the position. By doing this the machine generates a new alphabet permutation for the next letter to be encrypted.


Output Plugboard


The switches permute the input of the internal alphabet of input plugboard to the internal alphabets of output plugboard. From the internal alphabet of the output plugboard, letters then map to the output typewriter through the same identical mapping as the input plugboard.


Stepping Switches


The machine only uses the rotors to change the permutation alphabet for each letter. Each of the positions of the switches does a unique permutation of its respective input space. The permutation by each of the positions is created in a manner such that no two of the 3125 permutations from the twenties are the same.

The twenties switch advance based on the label they have. Each of them can get labeled as ”fast”, ”middle” and ”slow” so that gives 6 different possible labelings. Based on their names, the ”fast” switch will advance more quickly than the ”middle” one, which will advance more frequently than the ”slow” one. More precisely, the ”slow” switch advances every time the sixes reach position 24 and the ”middle” switch is at position 25. The ”middle” switch advances every time the sixes switch is at position 25 and the ”fast” switch is at position 25 and the ”fast” switch moves every other time.
If we analyze the structure of the machine, we see that there are 253 possible starting positions for the twenties switches. In addition, are 6 different ways we can label them as ”fast”, ”middle” and ”slow”. There also 25 different starting positions for the sixes.

Considering also the 26! possible permutations of the alphabet that depends on the wiring the user decides to use in the plugboard, in total we get: 6 •253 •25•26! ≈ 9.45∗1032 possible keys.


An Example


Here, we can see the encryption of a letter that is mapped to one of the sixes. On the left, there’s the input plugboard. In our case, it takes K as external input from Typewriter and outputs U as internal input. On the right of the figure we see the output plugboard which gets E from the internal output and outputs S. In the middle, the sixes switch permutes letter U depending on the permutation in position 3 of the 25-position switch and outputs E. For the Typewriter, this is equivalent to encrypting K to S, due to the plugboards.





How the US cracked Purple?


The Japanese built the machine based on its previous version Red, where the 6 vowels were permuted within themselves and used the same separation for the internal plugboard. They added the permutation from the external alphabet to the internal plugboard, but that turned out to not add complete security to the fact that these 6 letters are treated separately, especially since Americans had previous messages from Red and knew about the 6-20 split.



In 1939, cryptography expert William Friedman was chosen by the U.S. Army to work on breaking the Purple cipher. Fortunately, in eighteen months, he was able to make some progress before this, and, using his incomplete work, other members of his team were able to make continued progress. A precise chunk of the code was broken, and even though a Purple Machine had never been seen by American codebreakers, eight functional replicas of the Machine were created. Eventually, Purple Machine’s method of encryption was completely discovered. In time, Lt. Francis A. Raven discovered a pattern being used by the Japanese in their daily keys. He noticed that each month was broken into three ten-day

segments in which a pattern was discerned. With the final touches made to the puzzle by Lt. Raven, the Purple cipher was effectively broken and Japanese secrets were exposed.

Purple was considered to be a pretty wonderful cipher machine that displayed the advancement of technology with purpose. But every problem has a solution because we are humans. Somewhere in olden days, far away communication was impossible but with need, an invention was born. The US army utilized this decoding and broke a multitude of Japanese secret messages, even some containing the plans for the attack on Pearl Harbor which could have been used to prepare. However, as history reveals, not all of these were used to their full potential.

We hope you find this article insightful. Our sole motto is to elevate your knowledge in cryptography and who knows someone among you can invent the amazing cipher machine which can be called as the next unbreakable. Do like and share it and stay tuned till next Thursday. We will be back!

3 comments:

  1. This turned the tides in favour of USA in the Battle of Midway, which otherwise would have resulted in the US Navy butchered by Japanese Carriers from two sides.

    ReplyDelete
  2. That was really insightful. It was a pleasant read!🤩

    ReplyDelete
    Replies
    1. Thank You. We hope for your reviews and suggestions ahead as well.

      Delete