In 1925 Mr Hagelin learnt that the Swedish General Staff had obtained, through a German company, one of the notoriuos
Enigma machines, and were testing the Enigma to see if it was good enough for the Swedish Armed Forces. Mr Hagelin got
in touch with the officer in charge, and told him that the company AB Cryptograph surely could come up with something
better than the Enigma. Hagelin was given 6 months to prove that the company could.
Mr Hagelin was successful, and came up with the B-21 machine, using the modest
sum of 500 Swedish Crowns (about $110 at that time). The B-21 was adopted by the Swedish Armed Forces under the designation KRYAPP 101 (designation later re-used for the SA-1 teletype cipher machine) instead of the German Enigma.
The B-21 used, like it's competitor Enigma, illuminating bulbs, which lit up to show the cryptoletter when one operated it's keyboard. For stationary use, a modified model, which one could connect to an electrical typewriter to get the text printed automatically, labelled B-22 (probably designated KRYAPP 101B in the Swedish Armed Forces), was also manufactured. Later, in 1932, the French army wanted a cipher machine, but it had to print the text and had to be portable, so the B-21, with or without a typewriter, was ruled out. Mr Hagelin constructed a new machine based on the B-21 which could print the text on a paper strip, and so the B-211 was born.
Here's a picture of the B-21 model: B21A.JPG
And here's a Soviet copy of the B-211 with the lid open. Note the Cyrillic keyboard: B211KA.JPG
The B-211 fractionates the text entered by means of a 5x5 grid containing 25 of the letters of the alphabet,
meaning that one letter - normally one having low frequency in the user's language (Z in the sample program; the Swedish version of the machine lacks the letter W since it is only used in proper names
and a very few foreign loan words in Swedish) - has to be sacrificed. The row- and column
coordinates, where the letter in question is found in the grid, are enciphered by two separate rotors and finally recombined by the same grid to give the cryptoletter.
By means of a plugboard, the row- and column coordinates can be substituted, thus increasing the number of possible keys.
The rotors are of a different kind than the ones used in the Enigma. Instead of having 26 entry-contacts mapped to 26 exit-contacts, the B-211 rotors have five contacts on the entry side. Each of these are connected to two exit-contacts - there are ten such contacts - so that two groups of permutations arise. The connections in a pair must be chosen, so that they consist of one of the odd numbered exit-contacts, and one of the even-numbered exit-contacts (but since the rotors were pre-wired from factory, the users needn't take this into consideration).
The stepping of the rotors are controlled by four pin wheels, all having different divisions. The pins on the wheels can be set in active or inactive position individually. Wheel one - having a total of 23 pins - together with wheel two - having a total of 21 pins - control the stepping of the first rotor in the following way:
If, at a given time, either or both of the pin wheels have an active pin in the current wheel position to be used, the rotor will move forward one step.
In practice, this is achieved by having pins on the 23-wheel protruding to the right, and pins on the 21-wheel protruding to the left, act as cogs to drive the first rotor, which is placed between and in front of these pin wheels. Hence no gears or electrical relays are needed.
In a similar way, wheel three - having 19 pins - together with wheel four - having 17 pins - controls the stepping of the second rotor. The effect of this is that the rotors are stepped irregular, instead of regular (odometric) as is the case in the Enigma.
The four wheels all move one step with each letter processed by the machine. Since the wheel divisions don't have any factors in common, the period will be - at least - 17x19x21x23, or 156.009.
When one are to process a cleartext or received cryptogram, the machine must be set up with a message key,
and a knob must be turned to indicate encipherment or decipherment. The message key consists of six letters.
The first two give the starting positions of the rotors, using the letters A through K
(skipping J), since the rotors can be set in one of ten starting positions each.
The next four letters indicate the starting positions of the four pin wheels. Since all four wheels differ
in length, the range of letters valid for this setting also differ. The first pin wheel-letter can lie in
the range A to X, the second in the range A to V, the third in the range A
to T, and the last can lie in the range A to R.
After turning the rotors and pin wheels to their starting positions - these positions should vary from message to message for security reasons - the operator can begin to type in the text.
The message key used when enciphering a text, must - of course - be appended to the cryptogram to be sent, so that the receiver can set up his machine accordingly. It would probably be good cryptoprocedure to guard the message key in some way, and not transmit it in clear.
I have provided simulations in Qbasic and C, which you can download. The QBasic program uses the same pin settings as the example given in the book "Military Cryptanalytics part II - Volume 2" by Lambros D. Callimahos and William F. Friedman, available from Aegean Park Press, and you can test the program by deciphering the following cryptogram (also from the book) using the message key "AAAAAA":
NCYQH BWIUP ESEAE HUDRL UMYFY PQUUX AWMBN RIQCT TJLIW OYLMB
The C-program reads the key from file (the key used in the QBasic program is provided). I have provided an executable for Windows systems (run in DOS-mode) as well as the source code for those of you with other operating systems. It should compile OK on most systems.
Here are the programs:
QBasic - B211.ZIP
C-source and executable (Windows DOS-mode) - B211C.ZIP
If you feel up to it, you can try and break the following B-211 message, allegebly intercepted on a shortwave morsecode link, probably belonging to Enemy High Command. It uses the pin settings and plug connections used in the simulation program, but the message key is being withheld:
Those of you familiar with morsecode procedure will recognize the callsigns separated by DE as well as the international Q-code signal QTC, meaning "I have a message for you", together with some obvious abbrevations usually found in this type of communications. The Q-code signal QXK - repeated at the end - on the other hand, belongs to the military Q-code signals and can't be translated with certainty. Probably it has something to do with the message key...LW DE RF = QTC NR 17 GR 42 D/T 280746 = QXK 71679 46191 = TXT =
QWJHP GNLYM LOYCN RBIPP RXJHE QYBEA HQLWL TPITF WFOEN SKSGR
SOMGH GXDUW BREID PLSDQ TXNGE VPNFF KTQAO RLMMA STDIF VNSXF
HLPYI UDXYQ ORMQN UCUTV QGCVB BFMHE COPKD TBRPS PGTLH FDLUI
QTCRX VLXRA NPVSV KSOGD DNAYV CGRXK SQUAF ECLYQ PMOSS HWJDJ
CPOQP CQRIT = QXK 71679 46191 = AR