Looking back at Sweden's super-code-cracker

The code-cracking history of World War II, and in particular the Enigma Machine story, are legendary. But a feat of equal or even greater cryptographic virtuosity has been overshadowed by that well-known tale. Naturally, that’s of interest to the hackers and tinkerers at this year’s Chaos Communication Camp. Sven Moritz Hallberg reconstructed the events today […]

The code-cracking history of World War II, and in particular the Enigma Machine story, are legendary. But a feat of equal or even greater cryptographic virtuosity has been overshadowed by that well-known tale.

Naturally, that's of interest to the hackers and tinkerers at this year's Chaos Communication Camp. Sven Moritz Hallberg reconstructed the events today for the campers here.

In fact, the Germans had several devices used to encode messages. The Enigma device was mobile, easily used by field units. But many important messages were encoded using a bigger, more complicated piece of Siemens and Halske machinery called the T52, or the "Geheimschreiber" (the secret-writer).

Early in the war, while the Russians were invading Finland, and the Germans fighting in Norway, the neutral Swedes naturally wanted information on what was happening around them.

Tapping German lines running through their country to Norway, their cryptology unit was able to to decode most ordinary ciphers. But they found some strings of digits that were, in the words of one frustrated report, "severely unreadable."Sweden

Enter the Swede's head of the Russian section, Arne Beurling. The encrypted messages fell to his desk. Just two weeks later, he had figured out a way to decode them, using nothing more than pencil and paper and a bit of inspired reasoning, giving the Swedes a way to read German messages encoded in a way more complicated than Enigma.

Beurling never explained exactly how he'd figured it out, Hallberg said. But a handful of books have given some idea, and Hallberg reconstructed the likely thought process for the CCC audience.

At the time, the prevailing machine technology involved "teleprinter cryptography," or machines which allowed users to type the message in plain text, and let the machine itself encrypt the message.

The Germans often sent a bit of text unencrypted before their scrambled messages. Beurling would likely have studied this to figure out which letter strings were commonly repeated, and then look for encrypted strings that might correspond to this, Hallberg said.

Then it would have gotten complicated. An analysis of the weaknesses of leading ciphers of that time would have shown that the machine was probably using something called an XOR cipher – but something wouldn't have been quite right.

Digits would have been transposed in odd ways, meaning that there was an additional step of complicated scrambling going on.

In short, the next steps involved envisioning the machine itself, with rotating wheels inside spinning like a 10-ring combination lock, and the position of all the rings together creating the algorithm that scrambled each bit of text.

Had the Germans been careful to spin these rings differently with every message, using a different "key," Beurling's job would have been harder. As it was, the Germans got lazy, and reused the same key many times a day. That helped the Swedish cryptologist reconstruct exactly what the machine must be doing, and from there create an actual reverse-engineered version of the machine.

Even allowing for the Germans' mistakes, cryptologists regard Beurling's two-week feat as one of the high points of classic code-breaking. Sweden subsequently developed a range of decryption devices, and so were able to read the T52 messages almost as soon as they were sent.

"The story shows that cryptology isn't all black magic," Hallberg said. "You can have success if you take experience, some intuition and reason, and then just don't give up."

Anyone interested in the T52's further operations can find a simulator online here.