Click for homepage
B-211 →
Hagelin B-21
Electromechanical cipher machine

The B-21 was an electromechanical cipher machine developed by Boris Hagelin in 1925, whilst working with Arvid Gerhard Damm for A.B. Cryptograph in Stockholm (Sweden). The machine was in production for many years, even after the activities had been taken over by Hagelin's own company A.B. Ingeniörsfirman Teknik (later: A.B. Cryptoteknik), first in Stockholm (Sweden) and later also in Zug (Switzerland) as Crypto AG. The B-21 was available in a number of versions.

To secure the investment of the Nobel 1 family, Boris Hagelin was placed in AB Cryptograph in 1922. First as a (financial) controller, but from 1925 onwards as the acting director, whilst Arvid Gerhard Damm was doing business in France.

When the Swedish Army showed an interest in Enigma machines in 1925, Hagelin proposed his own machine: the B-21. It was based on Damm's patented design of the B-13, 2 that had two coding wheels. Hagelin improved the design by adding two of his famous pin-wheels to control the stepping of each of the coding wheels [1].
Early B-21 machine by AB Cryptograph

Over the years, the design of the B-21 was changed and improved a number of times. The image above shows one of the first versions and was probably conceived in 1927, or shortly thereafter, as it still carries the original company name: AB Cryptograph. It is battery powered and is likely to have been modified at least once during its lifetime. The relays have been replaced by a large array of Selenium diodes. The machine was delivered to L.M. Ericsson (the phone company) for use by its subsidaries in South America, as indicated by the Ericsson label on the transit case.

At the request of the French Army, an improved version of the B-21, the B-211, was developed. It featured a printer instead of the light bulbs. Eventually, the developments for the French Army led to a range of power-less designs, the so-called C-machines, starting in 1935 with the C-35. It marked the beginning of Hagelin's successful crypto business that existed until 2018/2019.

  1. The Nobel family once owned the largest oil company in Europe, based in Baku (Russia), headed by Alfred Nobel and later by his son Emanuel Nobel. In 1918, following the Russian Revolution, the family fled to Sweden, where Emanual Nobel was a major investor in AB Cryptograph, at the time headed by Arvid Gerhard Damm. His uncle, Alfred Nobel, is the founder of the Nobel Foundation and the Nobel Prizes.  Wikipedia
  2. This machine is often erroneously identified as the B-18 (which never existed). Boris Hagelin makes this mistake himself in his memoirs [6], probably because he misread the '3' as an '8'.

Wooden transit case Ericsson Mexico label Early B-21 machine by AB Cryptograph B-21 without the top lid showing the interior The coding wheels (rear) and the driving pin-wheels The programmable matrix Commutator Diode array with five groups of five diodes each
1 / 8
Wooden transit case
2 / 8
Ericsson Mexico label
3 / 8
Early B-21 machine by AB Cryptograph
4 / 8
B-21 without the top lid showing the interior
5 / 8
The coding wheels (rear) and the driving pin-wheels
6 / 8
The programmable matrix
7 / 8
8 / 8
Diode array with five groups of five diodes each

Enigma alternative
At first glance the B-21 resembles a German Enigma machine. It has a similar keyboard, is battery powered and uses a lamp panel for its output. But that's where the similarity ends. Probably to avoid patent infringement, Hagelin used a completely different operating principle. Rather than using alphabet substitution, he used coding wheels to scramble an n x m matrix. Although the original patent [9] describes a 4 x 5 matrix, the actual machine had a 5 x 5 matrix. 1 This allowed only 25 letters to be used (5 x 5), which was solved by replacing the letter W with VV (2 x 'V').

Another difference with the Enigma was that the coding wheels were stepped irregularly, whereas most of the Enigma variants featured regular stepping. According to Hagelin, this made the machine far less predictable. The B-21 was therefore considered more secure than the Enigma. Although the latter isn't true — Arne Beurling of the Swedish Cipher Bureau broke it in 1931 in less than 24 hours [3] — it was good enough for its time and it was Hagelin's first commercially successful machine. Many of his later machines would be based on the pin-wheel principle.

  1. The Russian K-37 — basically a clone of the B-211 — later used a 6 × 5 matrix.

Technical description
The design of the B-21 is based on an earlier patient by Arvid Gerhard Damm, modified by Boris Hagelin in 1925. It is based on two electrical coding wheels and four so-called pin-wheels that control the stepping of the coding wheels. Although the actual circuit is far more complex, the simplified circuit diagram below shows the situation when the machine is in Ciphering Mode.

The keyboard consists of a mechanical matrix and two groups of five electrical switches each. One group of switches represents the rows, the other one the columns. Pressing a key activates one switch in each of the two groups. It also turns on power by activating the ACT-switch for the duration of the key-press. One group of switches is connected to the negative pole of the battery (rows, marked 1 to 5). The other group is connected to the positive pole (columns, I to V).

Each of the +/- signals is then fed through a coding wheel, followed by a programmable matrix. The outputs of the two programmable matrices are then used to active a lamp on the lamp panel matrix. In order to avoid current through all of the lamps, a diode is connected in series with each lamp. In the (modified) B-21 shown here, the diodes take the form of an array of selenium diodes at the right hand side of the machine. In the initial version of the B-21, relays were used instead. The layout of the lamp-matrix is identical to the layout of the keyboard-matrix (QERTY).

The machine described in the circuit diagram above is not reciproke. For deciphering, a complex system of contacts and wires is used to reverse the operation of each of the coding wheels and matrices. This is mainly done by means of a cleverly designed switching mechanism, controlled by a rotary knob at the left, that is combined with the slide contacts of the two coding wheels.

The image on the right shows a complex system of brushes and contacts that form in fact five cross-switches. When in ciphering mode, the rearmost brush contacts are touching the rings of the coding wheel. The frontmost contacts are disengaged and are instead connected to a fork-contact immediately below it.

The contacts are moved in tandem with the contacts of the other coding wheel, so that they are always switched simultaneously. Contrary to the Enigma, the coding wheels are fixed in place and cannot be removed, swapped or replaced.

The diagram below shows how the cross switches work electrically. The switch has four contacts that are connected in pairs. The leftmost digram shows how the contacts are connected when the machine is in ciphering mode. The rightmost image shows how the contact are connected when the machine is in deciphering mode. The colours correspond to the circuit diagram below.

Adding the cross-switches to the simplified circuit diagram above, results in the complete, but more complex, circuit diagram below. This diagram is also available for download at the bottom of this page [5]. The diagram shows the machine in Ciphering mode. Switching to Deciphering, by rotating the C/D knob to the D-position, reverses the current through each of the coding wheel/matrix combinations. The operation of the cross-switches is illustrated at the centre.

Click to see more

It is unlikely that the selenium diodes on the lamp panel are original parts, as in 1925, when the B-21 was developed, selenium diodes had not yet been invented. Furthermore, Boris Hagelin describes in the Hagelin Story [2] that he used electric relays in the initial design. It is therefore likely, that the machine was refurbished and retrofitted with selenium diodes at a later date.

 B-21 circuit diagram in PDF

Later variant of the B-21
The images below were taken in Basel (Switzerland) in 2008, during the presentation of the book Mythos Enigma by Dominik Landwehr. Hagelin's first employee Oskar Stürzinger was present as the meeting and demonstrated some historical Hagelin machines, including a variant of the B-21.

As becomes clear from the image on the right, the mechanical parts are identical to the machine shown above, but electrically it is somewhat different. The programmable matrix has been removed and is now situated behind the coding wheels as a series of 10 plugs. The space at the right (where the matrix used to be) is taken up by a mains transformer.

The serial number plate at the front shows the manufacturer name A.B. Ingeniörsfirman Teknik, which was the name of the company after it was taken over by Boris Hagelin in 1932.
A view at the interior of the B-21

This particular machine is quite different from the one at the top of this page, but carries the designation B-21 nevertheless. The layout of the keyboard and the lamp panel is different and was probably tailored for the Swedish language. It features the standard Latin alphabet, but the letters W, X and Z have been omitted. Instead, keys for Sk and Me have been added, resulting in the maximum number of 25 keys. Strangely enough, the layout of the lamp panel is different.

In the image, there is no sign of a relay bank or a diode array, but it is entirely possible that this is mounted below the lamp panel. The machine was mains-powered and the external mains cable was present. At the time, we were not able to investigate this machine any further.

Close-up of the B-21 keyboard and lamp panel Perspective view of the closed machine The B-21 with the lid open Close-up of the permutation mechanics Front view of the permutation mechanics Close-up of the wheels Side-view of the machine
1 / 7
Close-up of the B-21 keyboard and lamp panel
2 / 7
Perspective view of the closed machine
3 / 7
The B-21 with the lid open
4 / 7
Close-up of the permutation mechanics
5 / 7
Front view of the permutation mechanics
6 / 7
Close-up of the wheels
7 / 7
Side-view of the machine

A later variant of The B-21 is the B-211, which had a built-in printer and was motor-driven. It became very popular in France, where it was used during the Algerian war (1954-1962).

The B-211 was built in France by an Ericsson subsidary in Colombes (Paris) under licence from the Hagelin company in Sweden. The popularity of the machine within the French Army and the reliability of the Hagelin Company, eventually led to the development of the portable C-35.

 More information

Click to see more

  1. Boris Hagelin, 100 Jahre Boris Hagelin 1892-1992
    Memoires of Boris Hagelin (German).
    Crypto A.G., Crypto Hauszeitung Nr. 11, September 1992.

  2. Boris Hagelin, The Story of Hagelin-Cryptos
    Crypto A.G., Zug, Spring 1981. Based on [6].

  3. Bengt Beckman, Arne Beurling and the Swedish crypto program during WWII
    2002, American Methematical Society (English translation). p. 31-32.
    (Original publication 1996.)
    ISBN 0-8218-2889-4

  4. US Patent US1846105
    Hagelin's patent for the B-21 filed in the US in 1928.

  5. Paul Reuvers, B-21 Dircuit Diagram
    Crypto Museum, 2010.

  6. Boris Hagelin, Die Geschichte der Hagelin-Cryptos
    Original manuscript by Boris Hagelin in German language. Zug, Fall 1979. pp. 21-22.

  7. TICOM I-58, Interrogation of Dr. Otto Buggisch of OKW.CHI
    8 August 1945. Declassified. p. 5.

  8. VV Babievsky, LS Butyrsky, DA Larin; Soviet cryptographic service 1920-1940
    Website (Russian). Retrieved June 2012.

  9. German Patent DE430599
    Aktiebolaget Cryptograph, Stockholm, 24 July 1925. 1
  1. Thanks to Arthur Bauer for bringing this to our attention. November 2012.

Further information
Any links shown in red are currently unavailable. If you like the information on this website, why not make a donation?
Crypto Museum. Created: Wednesday 05 August 2009. Last changed: Monday, 15 June 2020 - 14:15 CET.
Click for homepage