A while ago a friend asked me how the Enigma code machine worked, and I wrote the following brief account, which (if I haven't already put it on this blog; I don't think I have) might be of interest. Underneath is a blurry photograph of such a machine.
You will have seen photographs, I expect, of an enigma machine. It looks much like a portable typewriter, with keys in the usual (well, German) layout. But where the carriage, roller and paper would be is instead an array of little light-bulbs, each labelled with a letter of the alphabet.
The operator takes his written-out plain text message, and painstakingly types it out letter by letter. Each time he strikes a key, a little bulb lights up. Not of course the ‘Right’ bulb. He writes down the letter-name of the bulb that in fact lights up and proceeds to the next letter, and finishes up with a big jumble of letters, which is the encoded message, which is then sent — usually by radio. Enigma machines are, as it were, reversible, so the chap at the other end, who has an identical machine, types out the jumble, and lo and behold his bulbs light up giving the plain-text original message.
So far, so absurdly simple: a simple alphabetic substitution code, with ‘wrong’ letters standing in for the right ones. The sort of code made up, and easily broken, by a certain kind of schoolboy.
BUT now I come to the all-important wheels: let us consider that non-existent thing, a ‘One-wheel’ Enigma machine. In between the keyboard and the bulbs is a wheel, which is in fact a multi-position rotary switch. Each time a key is struck, the wheel turns round one click, changing all the keyboard-to-light-bulb connections, so that, in effect, one gets a new alphabetic substitution code for every encrypted letter. So even if you keep typing the same letter repeatedly, you get a different bulb lighting each time, at least until the wheel has gone all the way round and is back where it started. Now in fact most Enigma machines had a row of three of these wheels, so arranged that when the first wheel had clicked all the way round to its original position, it moved the second wheel on one click — just like the little number wheels in the little odometer (usually called ‘Milometer’) window on the speedo of your old 2CV and no doubt your new Fiat.
But no problem for the chap at the other end, he just carried on as previously described, and got his plain text back again, provided that both machines started with their wheels set to the same positions. Various ingenious ways were used to tell signallers ‘Achtung! Today’s wheel-positions will be so-and-so’.
Well that’s it really. The Krauts were quite convinced this fiendish code was unbreakable, and that was their undoing: they got lazy and would keep using the same wheel-positions day after day, or making other mistakes. This enabled various brilliant people eventually to break the code, though there always remained the problem (when the square-heads used the machines properly) of working out each day’s wheel-positions in time to decode stuff before the next day, when everything would change again.