Hagelin B-21 Cipher Machine
Home History Hagelin B-21 Hagelin CX-52 M-209 Simulator BC-52 Simulator

   History of the B-21

The B-21 was the first cipher machine, invented by Boris Hagelin and commercialized by the firm A.B Cryptograph. In 1925, the Swedish General Staff was searching for an alternative to the German Enigma machine. Boris Hagelin told them that he was experienced in the design of cipher machines and that he would produce, within six months, a machine that was superior to the Enigma. This was actually quite a display of bluff poker, as Hagelin had nothing to start from. They agreed and Boris managed to get the machine finished in time. The only resemblance with the enigma is the keyboard and the lamps. All images courtesy John Alexander, Leicester.

Technical Description

The B-21 was the breakthrough design that started the commercial success of Hagelin Cryptos. Hagelin started with an existing design of Arvid Damm, the 'simplified rotors' in a five by five grid. These rotors were completely different in design and functioning as the rotors of the German Enigma machine. The Enigma had three rotors, each with 26 contacts, one for each letter of the alphabet, and a reflector to return the signal back into the rotors. The Damm design required only two rotors with five input contacts and ten output contacts.

Beneath the keyboard there are 10 horizontal bars [1] that can be divided into 2 groups of 5 bars. If a key [2] on the keyboard is depressed, one bar of the first group and one bar of the second group is shifted horizontally. All 25 keys have a different combination of 2 bars, one in each group of five. The bars control 10 switches [3] which are also divided into 2 groups of 5 contacts. On the first group of five contacts, one side leads to the positive of the power supply and the other side leads to the first rotor [4]. On the second group of five contacts, one side leads to the negative of the power supply and the other side leads to the second rotor [5].

Each rotor has 5 ring contacts and 10 output contacts. The 5 input contacts are scrambled to the odd output contacts in one manner and scrambled to the even output contacts in another manner. With each of the 10 steps of the rotor there is switched between the odd and even output contacts to pass the signal to the static output rotor [6]. The output of both rotors leads to a five by five matrix [7] with 25 lamps (one letter is omitted or combined with another). The 10 rotor positions are labelled A to K (the letter J is omitted)

The Pin-wheels

The design of these rotors wasn't new, but it did a good job to scramble the electric signals. However, the innovation in the design was how these two rotors were stepped, and this completely new design by Boris Hagelin would determine the unique Hagelin machines for decades. The B-21 is the first machine to use the famous pin-wheels, also called key-wheels. The B-21 has four of these pin-wheels with 17 (A to R), 19 (A to T), 21 (A to V) and 23 (A to X) pins, which all step each time a keyboard key is depressed (the letter J is omitted at the wheels). The combination of these primes, together with the 10 possible positions of the ciphering rotor, produces a maximum periodicity of 1,560,090.

The two left side pin-wheels control the left side rotor and the two on the right side the right rotor. If a pin occurs on one pin-wheel, on the other pin-wheel or on both wheels of such a pair, the controlled rotor is advanced one step. This produces a very irregular stepping of the two ciphering rotors. The number of possible pin combinations for all pin-wheel together is an enormous 1024.

The key setting of the machine consists of two parts. The first part is the setting of the pins on the four pin-wheels (active or passive). This setting was generally changed once every 24 hours. The second part is the initial position of the pin-wheels and the ciphering rotors at the beginning of the message, the so-called message key. This message key had to be unique for every message. To manually change the pin-wheel position, the pin-wheels are disengaged from the gear system with a half turn of an eccentric handle.

B-21 - Image  John Alexander

Hagelin B-21
Image John Alexander

B-21 - Image  John Alexander

Hagelin B-21 with open lid
Image John Alexander

The B-21 Patent for the United States

When the machine cover is removed, we can see in the top left part the ciphering mechanism. The four big pin-wheels are located at the bottom of that compartment. Right above these pin-wheels is the axle with cogs to transfer the position of the pins into a movement of the ciphering rotors. These are the two small rotors at the top, with five slide contacts at its axle on one side and five pin contacts on the other side. Although they don’t look like ordinary rotors they also have an input and output side and the wiring is scramble.

B-21 - Image  John Alexander

The two rotors (top) and four pin-wheels (bottom)
Image John Alexander

Other Machines with Pin-wheels

The use of these pin wheels would return in many later Hagelin machines with huge commercial success for the C-36, M-209 and C(X)-52. The prototype, build in 1925, was approved by the Swedish Army and later on sold also to some other countries. The commercial breakthrough however was an adapted version for the French Army. This portable machine, designated B-211, had a printing mechanism and could be operated with a crank in case of power failure. The rotor ciphering electric circuit was powered by a battery.

In the B-21 and B211, the four pin-wheels are used only to control the stepping of the ciphering rotors in a complex fashion. In later Hagelin machines such as the C-36, C-38/M-209 and C-52, the pins of these pin-wheels are used only to offset a reciprocal alphabet print drum. The CX-52 uses the pins for both offsetting the alphabet drum and to control the very irregular pin-wheel movements, making finally full use of the ingenious pin-wheel design.

More on Hagelin


Web Analytics Made Easy -

Dirk Rijmenants 2004. Last changes: 26 April 2022

Home History Hagelin B-21 Hagelin CX-52 M-209 Simulator BC-52 Simulator