Recently I (re)watched the movie “The imitation game”: the English mathematical genius Alan Turing cracks the German Enigma code with help from fellow mathematicians, using an electro-mechanical device called Bombe. At the end of the movie, I found myself wondering: "Would an Apple-1 be able to decrypt a text ciphered by an Enigma machine? If so, how fast would it be?” The Enigma Machine is well documented in all its versions and variants, and the Internet is full of code and emulators. I am not going to explain the operation principles of the Enigma Machine, on the Internet there is a plenty of valuable sources of knowledge. In the Bibliography section, you will find some link. SEARCHING FOR… THE RIGHT CODE What I was looking for was a short source code that could run in a few kiB of memory. In this article, I will not go deep into the mathematical theories behind the "Enigma", and I will not dwell on the different decryption techniques that could

be used. I found many programs, but unfortunately, many of them needed RAM that the Apple-1 simply does not have. Finally, I found the source code candidate to be adapted for the CC65 cross compiler: http://www.cs.miami.edu/home/harald/enigma/ The small program can encrypt/decrypt messages with an user-defined machine setting or brute-force an encrypted message. How does it work? In the movie they use a word, called crib, they believe was encrypted in the message (i.e. “weather”) to program Turing’s Machine. The machine “simply” tries all the permutations of settings in order to obtain the original crib. Due to the huge number of different initial settings of the Enigma machine, this method was very time consuming: many expedients were put into practice to reduce the number of permutations (i.e. the Diagonal Board method discovered by Turing’s colleague Gordon Welchman). The program, written in C language, needed some adjustment to be compiled by CC65. In this, I…