In November of 2007, the National Museum of Computing sponsored an historical code-breaking competition to celebrate the rebuild of Colossus Mark 2 at Bletchley Park. Colossus, the first programmable digital computer, was used in WWII to crack the codes created by the Lorenz cipher machines used by the German High Command. Programmers and code breakers were invited to try to beat the rebuilt Colossus in cracking the 1938 Lorenz SZ42 encrypted message.
Using Ada, IT security specialist, Joachim Schüth, was able to decipher the code and beat Colossus. In the following interview, Joachim explains why he started working with Ada, his impressions of the language, and why it was the perfect choice for the challenge.
How did you first come into contact with the Ada programming language?
I work in IT security consulting and have seen source code in a wide range of quality during software reviews. It was while searching the web for keywords like software and safety that I fully became aware of Ada. Ada was favored so unanimously in the safety community that there had to be more to it than just someone being too lazy to learn another language. So I decided to have a closer look at Ada, and I really was surprised.
Why were you surprised?
I had not expected to find in Ada all the features of a modern programming language. For example, the concepts of object oriented languages like data abstraction, information hiding, inheritance, and overloading of functions and operators are all there, plus useful features like named arguments. I had thought that most of these had been inventions of newer languages. That any discrete type can be used as an array index type, not just the predefined integer type, is a feature that sets Ada aside from most languages that I have seen so far. Array boundaries are inherent attributes of an array in Ada and thus passed along when an array is used as a function or procedure argument, helping the programmer in avoiding index overflows. This list of features is certainly not complete, but I was so impressed by the strengths of Ada that I decided to seriously learn the language
How does it compare to other languages you’ve used?
Although it is not as quickly grasped as Python, for example, the concepts of Ada are clearly thought out, logical and more easily remembered than those of C++ or Java. My impression is that the designers of Ada thought twice before adopting any concept or language feature.
Why did you use Ada in building your software to crack the “Tunny” Code?
I had only studied Ada for about half a year during my spare time, but I had a long-term goal of becoming more proficient in Ada, so I decided to use it in my code development for the Cipher Event, even if it might make reaching that short-term goal more difficult. I had expected that I might be struggling with the features of a language that I did not know for long, but the programming in Ada turned out to be very enjoyable.
How did Ada help you break the code so quickly?
Ada allowed me to concisely express the algorithms I wanted to implement. Computing the Fourier amplitudes of the frequencies of interest, convoluting the demodulated signal with the symbol patterns of the Baudot alphabet, and extracting the teleprinter symbol stream with clock recovery based on a phase locked loop were all easily implemented in Ada. Representing the SZ42 in software by declaring data types for the wheels and putting them together to a data type for the entire machine felt a bit like building a real machine piece by piece. While implementing the cryptographic attacks on the SZ42, I could concentrate on the design of the algorithms, while their representation in Ada was straight forward. Running on a 1.4 GHz CPU, the Ada program that does the code breaking found the correct settings of all 12 key wheels of the SZ42 within 46 seconds. This was way faster than Colossus, which completed the same task within about three and a half hours.
Do you have any recommendations for fellow programmers regarding Ada?
Try it! For a long time, Ada was only accessible to a more or less closed group of programmers due to the lack of a free compiler. But thanks to the GPL version of the GNAT compiler that AdaCore contributed to the GNU Compiler Collection (GCC), there is now an Ada compiler available that computer geeks, software enthusiasts, and students alike can use free of charge. My hope is that someday Ada will achieve the widespread use that the language deserves.