Search

Cipher Machines

Menu




CIPHER
TECHNOLOGIES




SECRET
COMMUNICATIONS



MISCELLANEOUS



CHM logo

Transvertex HC-9 Cipher Machine

HC-9
Military version of Transvertex HC-9

The HC-9 is an entirely mechanical cipher machine manufactured in Sweden in the early 1950s by AB Transvertex. It is similar in size and function to another mechanical cipher machine, the Hagelin M-209. The HC-9 is the name for the commercial version of the cipher, the Swedish military version is called the KRYAPP 301 (cryptographic apparatus) which was used until the late 1970s for low level communications, mainly at the company and platoon level.

Transvertex History
The HC-9 was designed by Vigo Lindstein just after WW2. During the war, Lindstein was a graduate engineer working for the LM Ericsson Cash Register division. He was called on to build a device to automatically decrypt Nazi teleprinter ciphers. The German cipher had already been broken but Lindstein showed a real gift in turning cryptologic ideas into working machines. After the war, he went to work as the technical director for Boris Hagelin's Swedish cipher company, AB Cryptoteknik. This connection to the Hagelin cipher explains some of the similarities it shares with the HC-9 and, in fact, the name may be a tribute to that connection with the "HC" short for Hagelin Cipher. Also, the "9" could represent the 9th Hagelin machine, after the B-21, C-35, C-36, C-37, C-38, M-209, C-442 and C-52.


Transvertex Logo
Transvertex logo with "IX" instead of "TX"

When Sweden passed laws nationalizing important military technology and would no longer allow cipher machines to be exported, AB Cryptoteknik moved to Zug, Switzerland and was renamed Crypto AG. AB Transvertex was formed during this time, in April 1951, in a cooperative effort between the 4 founders (including Lindstein) and the Swedish government in order to have a domestic cipher company. They first tried to incorporate with the name AB Invertex, but later discovered that name was already in use. They changed the name to AB Transvertex but kept their original logo with the "I" interwoven with the "X".

Transvertex first manufactured the SA-1 teletype ciphering machine and then developed the HC-9. Lindstein was the only CEO in the history of this company, which remained in business until December of 1969 when the circle was completed and Transvertex was sold to LM Ericsson.



HC-9 Technology

HC-9 Internals
Transvertex HC-9 with lid removed

The cryptographic technology used for the Transvertex HC-9 and the pin and lug Hagelin machines is completely different from the technology used for almost all other rotor based cipher machines. Most cipher machines, like the Enigma, Hebern, NEMA, Fialka, Japanese Purple machine, SIGABA and the earlier B model Hagelin machines all used electro-mechanical rotors to encipher the alphabet. An electrical signal would send a plaintext character through multiple rotors to output a cipher character, and vise versa. Some of the rotors would then rotate in some pattern to give a new cipher algorithm for the next letter in the message.

In contrast, the HC-9 and Hagelin pin and lug machines use a mechanical rotor to engage an adding mechanism which selects a reciprocal alphabet as the cipher. No electrical source was needed. Boris Hagelin got the inspiration for this design from a mechanical money changing machine. The rotors do not have electrical connections, so the mechanical rotor does not directly mix up the alphabet, but is used to select the cipher alphabet. Some of the Hagelin rotors do not have all the letters of the alphabet since they would not be required for the encipherment. They do have a mutually prime number of positions and from the initial setting position each rotor will step consecutively for each letter of a message.


HC-9 Rotors
Note pins protruding on right, center or left side of each rotor

The HC-9 has 5 fixed rotors, each with the 26 letters of the alphabet sequentially around the circumference, plus a varying number of additional blank spaces between the "A" and "Z". Each of the 5 rotors have a mutually prime number of possible positions (left to right): 29, 31, 33, 34 and 35. After each letter is enciphered or deciphered, the rotors all advance one position to the next letter or blank space on the rotor. This gives a maximum message depth of 29 X 31 X 33 X 34 X 35 = 35,303,730 which means the message would have to be that many characters long before the same rotor sequence repeats itself.

The HC-9 uses a punched card and pins to replace the function of the pin and lug mechanism of the Hagelin ciphers. The punched card forms part of the interior setting for the machine and has 3 columns and up to 12 rows of possible hole locations for each of the 5 rotors. This gives up to 36 locations for placing a hole and 35 are used for the wheel with the greatest number of letters and spaces. If a hole is present, a pin protrudes through the hole and the rotor setting for that character is considered active (1). If there is no hole in that position, the character is considered passive (0).

There are 3 pins in each rotor which selects one of the three columns on the punched card to be active. The rotor pins are aligned on the left, middle and right side of the rotor and identifies which of the three columns on the punched card is active. The rotor pin is activated as the rotor revolves into position, such that the active column is directly behind the active pin. After rotating through one third of the letters on that rotor, the next pin gets activated so the next column becomes active. Note these rotor pins (pictured above) are separate from the pins which protrude through the punched card (pictured below).


 
 
 
L   B
K U A
J T 3
I S 2
H R 1
G Q Z
F P Y
E O X
D N W
C M V
 

 
 
    C
M W B
L V A
K U 5
J T 4
I S 3
H R 2
G Q 1
F P Z
E O Y
D N X
 

 
 
N Y C
M X B
L W A
K V 7
J U 6
I T S
H S 4
G R 3
F Q 2
E P 1
D O Z
 

 
    D
O Z C
N Y B
M X A
L W 8
K V 7
J U 6
I T 5
H S 4
G R 3
F Q 2
E P 1
 

 
  1 D
O Z C
N Y B
M X A
L W 9
K V 8
J U 7
I T 6
H S 5
G R 4
F Q 3
E P 2
 

 

29
rotor 1
 

 

31
rotor 2
 

 

33
rotor 3
 

 

34
rotor 4
 

 

35
rotor 5
 

Punch card hole locations for each rotor and character
HC-9 Punch Card
Punched card installed in rear of HC-9 with pins protruding

The chart above, left shows a schematic diagram of the punched card. Note that each rotor has 3 columns of characters, which represents locations on the punched card where a hole may be punched. If a hole is in the location where a character exists, that character on that specific rotor will be active. Otherwise, that character will be passive.

A second card is provided which has a different enciphered alphabet arranged across each of 16 lines and represents the second and final part of the interior setting of the HC-9. This card is wrapped around a spindle and inserted in the front of the machine. The exterior setting is accomplished by rotating the 5 rotors to a specific letter setting on each rotor, chosen at random by the operator.

To operate the machine, the lever on the left side of the machine is pressed and each of the five rotor wheels will rotate one space, the spindle will turn a variable amount and comes to rest with one of the 16 lines of an enciphered alphabet appearing in a window. The letters A to Z are labeled consecutively on the machine above and below this window. The letters appearing on the card are enciphered in pairs so that the HC-9 can either encode or decode with the same machine settings. For example, if the "R" on the machine lines up with a "P" on the card, then the "R" on the card will line up with the "P" on the machine (as seen in the picture below). So this spindle acts like the Enigma reflector, but has 16 different alphabets to select from for each enciphered letter. There is no printed output, so the enciphered or deciphered letter must be written down.


HC-9 Window
One of 16 lines of cipher alphabet shows through window, also note the choice of 2 letters for each digit

The following is a description of how the machine selects one of the 16 lines on the front card. Consider each line of reciprocal alphabets to be numbered from 1 to 16. Then group the 5 rotor wheels into 4 overlapping pairs according to their number of letters and spaces, 29-31, 31-33, 33-34 and 34-35. These are the adjacent pairs of rotors, from left to right. The punched card in the rear of the machine provides the pin settings for each of the 5 rotors. These pin settings determine if the rotor is in an active (1) or passive (0) state for each position of each rotor.

The possible outcomes of active or passive state for each rotor pair is 00, 01, 10 or 11. Then the "exclusive or" (XOR) operation is performed. That is, if the first rotor pair has an outcome of 01 or 10 the result will be 1, a 11 or 00 outcome results in a 0. The same operation is performed on the next 3 pairs of rotors, resulting in a 4 bit number. The 4 bit numbers from 0000 to 1111 represent all the decimal digits from 0 to 15. The four bit number is converted to decimal and subtracted from 16, so for example, if the result of the four bit number is 0011 (decimal 3), then 16 - 3 = 13 so the front spindle will rotate until line 13 is displayed in the window. This XOR operation and spindle rotation is handled mechanically with each press of the lever.

An interesting feature of using the XOR function is that when considering the outcome of the 5 rotors, any pin setting will give the same result as the reciprocal pin setting. For example, if the 5 pin settings are 10110, then the XOR function would generate the 4 bit number 1101 (decimal 13). The reciprocal of the original pin setting of 10110 is 01001, which, after applying the XOR function, would generate the same 4 bit number of 1101 (decimal 13). This feature was designed to add complexity to any cryptanalysis attempt.

HC-9 Operating Procedures
In operation, the Swedish army would only have to insert the two cards and their machine would be ready for action. There would be no tedious and error-prone setting of pins and lugs as is necessary for the Hagelin cipher machine or replacing rotors and plugboard cables in the Enigma machine. Also, it would not be necessary to test the machine with a sample message to make sure the settings were correct, as is the case with the Hagelin cipher. This would be quite an advantage in battlefield conditions.

To send a message, the operator would first rotate the 5 rotors to a setting of his choosing and then encode the message with that setting. This way, every message would be sent with a different key. Note that the blank spaces on the rotors are not used when setting this 5 letter key. The 5 letter key would be sent in the clear and then the encoded message is sent.

To decode the message, the receiver will have the same two cards inserted in his machine (note different sets of users can have different cards) and he will turn the 5 rotor wheels to the key for this message, which was sent to him in the clear. Decoding is performed the same as encoding, since the 16 lines of alphabets on the front card are reciprocal.

Messages were sent without punctuation or spaces in 5 letter blocks. At the end of a sentence, an "XX" is sent. On the front of the HC-9 is an index with the 10 digits and two letters below each digit (see picture above). Either letter can be used to signify that digit, preceded by a "KK" and ending with a "ZZ". To send the time 14:30, you could send "KKCJGBZZ" or "KKDJGAZZ" as two examples. The letter "Z" is also added at the end of a message, if needed, until the last 5 letter block is full.

To the right of the 5 rotors is a message counter, and a lever or clutch mechanism to free the movement of the 5 rotors. While pressing this lever, all the rotors can be spun simultaneously in either direction by turning a knob on the right side of the HC-9. This feature can be used to recheck a message and can also be used to spin the rotors back to the original message position to reset the counter to zero. It is recommended that this counter should be checked during the encipherment or decipherment every 5 or 10 characters, to make sure the message is correctly aligned with the 5 character blocks.

The ingenious design of the HC-9 gave it a simplicity and speed of setup and operation while also providing a robust level of security, especially for such a small, all-mechanical machine. The main drawbacks are the need to issue two cards for the daily settings and the lack of a printing capability, but it served its purpose quite well as a battlefield cipher for several decades.

Calculation of the Key Space of the HC-9

]'?:{For those 76 mathematically inclined, the calculation of the key space is rather straightforward and also enlightening. There are 3 contributors to the key space: (1) the number of possible rotor settings, (2) the number of possible pin settings and (3) the number of possible mixed alphabets on the front card. Item (1) is considered the external setting and Items (2) and (3) are considered the internal settings which are set by the two cards.

  1. The Number of Possible Rotor Settings
    From the explanation above, the HC-9 has a message depth of 35,303,730, which is the number of possible ways to arrange the 5 rotors. But the extra blank spaces were not used for the key in setting the rotors, which reduces the key space by two-thirds. Apparently, it was decided the extra operational complexity was not worth the increase in key space. Also, by only using the letters of the alphabet in the key setting, there would not be hints of which 5 characters in the message represents the key setting or disclosing the type of cipher machine used. So the number of possible arrangements of 26 letters on 5 rotors is:

    265 = 11,881,376.

  2. The Number of Possible Pin Settings
    The pin settings are set by the punched card in the rear of the machine, so the number of possible pin settings is the same as the number of different punch cards possible. Each rotor can be set to active (1) or passive (0) for each position of the rotor, so there are only 2 possibilities for each position of the 5 rotors. This means the key space contribution will vary for each rotor according to the number of these positions, or 2 raised to the power of the number of wheel positions. For each punch card generated, however, the reciprocal card would generate the same output (as explained above), so the total number of pin settings calculated is divided by 2:

    (229 X 231 X 233 X 234 X 235) / 2 = (2162) / 2 = (5.8460 X 1048) / 2 = 2.9230 X 1048

  3. The Number of Possible Mixed Alphabets on the Front Card
    The key space contributed by the front card is the number of possible ways to arrange the alphabet into 13 reciprocal pairs on each of the 16 lines on the card. To calculate this for the first line, you start with any letter, let's say "A", and then select one of the remaining 25 letters to pair with "A", which means there are 25 possibilities at this first step. Now take the next available letter, say "B", and pair that with one of the remaining 23 letters, and so on. The math is 25 X 23 X 21 X ... X 3 X 1 = 7,905,853,530,625.

    The formula is the same as given for the use of plugboard cables in the Calculation of Key Space on the Nazi Enigma machine page, since reciprocal pairs of letters is the same as using Enigma plugboard cables. The general formula is (2p-1) X (2p-3) X ... X 3 X 1, where p is the number of plugboard cables. In the HC-9, all the letters were transposed, so p=13. Varying p from 0 to 13 would have greatly increased the key space.

    So 7,905,853,530,625 is the key space contributed by the first line of the front card, but there are 16 lines on the card. The second line has the same number of possible letter arrangements, minus one, since you do not want to repeat the same letters as the first line. The third line will have this same number of possible letter arrangements, minus 2, and so on. Therefore, the key space contributed by the front card is:

    (7,905,853,530,625) + (7,905,853,530,625-1) + (7,905,853,530,625-2) + ... + (7,905,853,530,625-15) = 126,493,656,489,880

    Counterintuitively, pairing only 20 letters of the alphabet one time (as the Germans did by using 10 plugboard cables) gives a larger key (150,738,274,937,250) than pairing all the letters of the alphabet 16 times!

So the total key space for the HC-9 is the product of the three items above:

(11,881,376) X (2.9230 X 1048) X (126,493,656,489,880) = 4.39 X 1069

Another consideration in key space is the cryptanalysis value of the enemy capturing your cipher machine. In the case of the Enigma, this would give away the entry wheel setting, the rotor wiring and reflector wiring. The theoretical key apace for the Enigma is 3.28 X 10114 but the practical key space was greatly reduced to 1.07 X 1023. In the case of the HC-9, none of the key length contributors would be disclosed if the machine was captured by the enemy.

Therefore, the practical key space of the HC-9 (4.39 X 1069) compares favorably with that of the more famous German Enigma machine. The HC-9 also compares favorably to the M-94, which has a key space of 1.55 X 1025 (25 factorial). Remember, however, key length alone does not constitute cryptologic strength, since ciphers are usually broken with the aid of methods other than pure brute force attacks.


Copyright © 2016 by Ralph Simpson - Creative Commons Attribution 4.0 International License