page_title: Type B Cipher Machine
section_title: Design of the Type B Cipher Machine
hierarchical_section_title: Type B Cipher Machine / Design of the Type B Cipher Machine
caption_attribution_description: English: Contemporary schematic diagram of the machine built by the U.S. Army Signal Intelligence Service to decrypt the Purple cipher.
context_page_description: In the history of cryptography, the "System 97 Typewriter for European Characters" or "Type B Cipher Machine", codenamed Purple by the United States, was an encryption machine used by the Japanese Foreign Office from February 1939 to the end of World War II. The machine was an electromechanical device that used stepping-switches to encrypt the most sensitive diplomatic traffic. All messages were written in the 26-letter English alphabet, which was commonly used for telegraphy. Any Japanese text had to be transliterated or coded. The 26-letters were separated using a plug board into two groups, of six and twenty letters respectively. The letters in the sixes group were scrambled using a 6 X 25 substitution table, while letters in the twenties group were more thoroughly scrambled using three successive 20 X 25 substitution tables.
  The cipher codenamed "Purple" replaced the Type A Red machine previously used by the Japanese Foreign Office. The sixes and twenties division was familiar to U.S. Army Signals Intelligence Service cryptographers from their work on the Type A cipher and it allowed them to make early progress on the sixes portion of messages.
context_section_description: The Type B Cipher Machine consisted of several components. As reconstructed by the U.S Army, there were electric typewriters at either end, similar to those used with the Type A Machine. The Type B was organized for encryption as follows:
  An input typewriter
  An input plugboard that permutes the letters from the typewriter keyboard and separates them into a group of six letters and a group of 20 letters
  A stepping switch with 6 layers wired to select one out of 25 permutations of the letters in the sixes group
  Three stages of stepping switches (I, II, and III), connected in series. Each stage is effectively a 20 layer switch with 25 outputs on each layer.  Each stage selects one out of 25 permutations of the letters in the twenties group.  The Japanese used three 7-layer stepping switches geared together to build each stage (see photos). The U.S. SIS used four 6-layer switches per stage in their first analog machine.
  An output plug board that reverses the input permutation and sends the letters to the output typewriter for printing
  The output typewriter
  For decryption, the data flow is reversed. The keyboard on the second typewriter becomes the input and the twenties letters pass through the stepping switch stages in the opposite order.
caption: Schematic diagram of SIS Purple analog machine
exif: {"Image Make": "Apple", "Image Model": "iPhone X", "Image Orientation": "Horizontal (normal)", "Image XResolution": "72", "Image YResolution": "72", "Image ResolutionUnit": "Pixels/Inch", "Image Software": "Photos 4.0", "Image DateTime": "2019:05:19 11:43:26", "Image TileWidth": "512", "Image TileLength": "512", "Image ExifOffset": "222", "GPS GPSLatitudeRef": "N", "GPS GPSLatitude": "[42, 21, 2173/50]", "GPS GPSLongitudeRef": "W", "GPS GPSLongitude": "[71, 5, 3261/100]", "GPS GPSAltitudeRef": "0", "GPS GPSAltitude": "8", "GPS GPSTimeStamp": "[15, 43, 26]", "GPS GPSSpeedRef": "K", "GPS GPSSpeed": "32607/32806", "GPS GPSImgDirectionRef": "M", "GPS GPSImgDirection": "358737/1843", "GPS GPSDestBearingRef": "M", "GPS GPSDestBearing": "358737/1843", "GPS GPSDate": "2019:05:19", "GPS Tag 0x001F": "52976/2207", "Image GPSInfo": "1236", "EXIF ExposureTime": "1/15", "EXIF FNumber": "9/5", "EXIF ExposureProgram": "Program Normal", "EXIF ISOSpeedRatings": "40", "EXIF ExifVersion": "0221", "EXIF DateTimeOriginal": "2019:05:19 11:43:26", "EXIF DateTimeDigitized": "2019:05:19 11:43:26", "EXIF ComponentsConfiguration": "YCbCr", "EXIF ShutterSpeedValue": "47539/12167", "EXIF ApertureValue": "54823/32325", "EXIF BrightnessValue": "51635/18987", "EXIF ExposureBiasValue": "0", "EXIF MeteringMode": "Pattern", "EXIF Flash": "Flash did not fire, auto mode", "EXIF FocalLength": "4", "EXIF SubjectArea": "[2015, 1511, 2217, 1330]", "EXIF SubSecTimeOriginal": "967", "EXIF SubSecTimeDigitized": "967", "EXIF FlashPixVersion": "0100", "EXIF ExifImageWidth": "3259", "EXIF ExifImageLength": "2227", "EXIF SensingMethod": "One-chip color area", "EXIF SceneType": "Directly Photographed", "EXIF ExposureMode": "Auto Exposure", "EXIF WhiteBalance": "Auto", "EXIF FocalLengthIn35mmFilm": "28", "EXIF SceneCaptureType": "Standard", "EXIF LensSpecification": "[4, 6, 9/5, 12/5]", "EXIF LensMake": "Apple", "EXIF LensModel": "iPhone X back dual camera 4mm f/1.8"}