A movie has just come out called "The Imitation Game"
starring Benedict Cumberbatch as Alan Turing and
Keira Knightley as one of the the team that worked with Turing - her name was Joan Clarke.
[ALAN TURING: ... five minutes and 34 seconds ...]
[JOAN CLARKE: ... you said to do it in under six ...] And I'm sure many of you know
Alan Turing worked at the Government Code and Cypher Centre at Bletchley Park
throughout the war, right from when it broke out in 1939
right through until the end the war in 1945.
Alan Turing was at Princeton doing research with another
very famous mathematical logician called Alonzo Church.
He returned from Princeton in 1938 but even in that year,
from '38 to '39, it's very clear
that he was contacted by GC & CS
even though he wasn't employed by them. And became a sort of
consultant; became acquainted with all the difficulties that were going to
hit the Allies when war broke out - as seemed
inevitable - in deciphering German
ciphers that had been done on this Enigma machine. Now an awful lot of the material
that I'm going to be using today, really, uses as a reference book
this one by Andrew Hodges. It's called "Alan Turing - the enigma"
This has been reprinted, republished - I think in a slightly newer edition -
because "The Imitation Game" is based
on this account of Turing's life. Now, Enigma goes back a long way.
Prior to its use by the German armed forces it was just a simple commercial
cipher machine and it was a pretty reasonable system
but I suppose you could say the number of possibilities - the
degree to which it scrambled up the message, was considerable
but not ultra, ultra safe,
I think it was a machine that - as they say in the cryptological trade -
was designed to discourage casual snooping
rather than to withstand serious attention from experts in the field.
And what I want to do is to go through with you, in this video,
the components of the system and then in the later one
summarise and say: "That's the problem they were up against -
how do you make a machine that could help you decipher
that code if you didn't know the settings of the machines that created it
in the first place?" I'm going to cross-refer you to some footage on our sister channel,
Numberphile. James Grime has done a couple of videos,
on Numberphile, which actually use a real-live Enigma machine that
belongs to Simon Singh.
Lucky James gets to use the real thing and I would strongly recommend,
if you're puzzled by all of this, go and watch those two videos.
One of them is just a generalized introduction
to the Enigma, the other one explains precisely why
the Enigma machine's big flaw was that it could never encipher
a letter as itself. Believe it or not that is a big, big security flaw,
and does provide a way in, for people who want to crack that particular code.
The Enigma itself looks, at first sight, a bit like an ordinary typewriter. It's got a typewriter
board layout, there's typewriter keys,
but you then notice that if you switch it on - and it is battery powered -
in the area just above the keys, instead of having 26 further keys, you have 26
places where a lamp can light up a letter.
So you might press a T and it will light up as a G.
What else is there, inside this machine. How does the key-press
get through to illuminating a lamp? Well in the most amazing and convoluted way.
There's a set of rotors here. These rotors have 26 alphabetic letters
engraved around the circumference. Sometimes you don't get letters you
get numbers 0, 1, ... through to 26, but it comes down to the same thing in the end.
When the lid is closed on top of them the letter - as it were - pointing
upwards on the rotor
anywhere between A to Z, shows up in three identical
looking windows. Perhaps the easiest way to think of it - even
for those of you viewing who are relatively young - can you remember back to your family's first
ever car?
Where it had an old-fashioned odometer, you know, a mileage indicator
on the dashboard
which wasn't all done in electronics, it was actually driven off the engine
and you actually had little wheels moving in front of you?
On the right-hand side would be the tenths of a mile, or tenths of a
kilometre, and every time that had got up to a 9 it would nudge
the dial to the left of it, to move on one place, and so on.
The principle is exactly the same on the Enigma.
The right-hand rotor moves the fastest
and at a certain stage will nudge the next one
into moving on a notch. The left hand rotor is the slowest moving of all
and once the lid is closed on the Enigma, all you see is the
letter on the rotor that's uppermost
showing through the windows
at the top. Now - complication upon complication,
Within each rotor there is, if you like,
on the two sides, an input stud and an output stud,
and they are cross-wired. If you could break open
as is shown here, the rotor mechanism,
you would see a whole bunch of 26 wires, in there,
which are cross-wiring an input stud
to an output stud. So you might get A, cross wired
to J, B cross-wired to Q,
C cross-wired to W - something like that. When Enigma first came out there
were three sorts of rotor wheel
numbered I, II, and III, in Roman numerals, typically,
in the German instruction manuals. A rotor of type
II would not be cross-wired in the same way
as a rotor of type I. And similarly a rotor of type III would be a completely
different cross-wiring.
I think many of you will know the number of ways you can arrange three things on a
spindle like that
is 3 factorial, which is 6. Six possible orderings of the rotors on the spindle.
So you can begin to see the multiplication of the number of combinations
about how this thing could be set up in the first place.
You've got different orderings on the spindle; you've got different cross-wirings on the
different sorts of rotors.
So for the very basic machine, then, that
was just about it. You fed the
signals through the right-most rotor through the middle rotor with a different
cross-wiring and mapping, through the left-hand rotor
and then there was what the Germans called a 'reverser',
sometimes in English called the 'reflector'. What it would do
was to return the signal back via a different
stud on the left-hand rotor so it would take a different
journey back through the machine to the way it came in.
Now here is the secret of why
it never mapped a letter to itself. It couldn't because,
to make that effect happen, you'd have had in the reflector drum here,
to say "Ah! it's coming out of the A slot; I'm going to return it back
through the A slot". It wasn't electrically set up to
enable you to do that. You effectively had to decide
to cross-wire in that reflector
to something different. And I think, here, if you look carefully
A is actually cross-wired to something like W.
Now, in the early 3-rotor Enigma, that reflector had fixed cross-wirings
which were the same in all Enigma machines.
So, your current goes back through a different route
and then, finally, lights up a lamp on the lamp array
just ahead on the keyboard. over here So that's the way it was up until about the mid-thirties.
But then, as the German armed forces were taking more and more interest
in these things, and saying: "Oh, if we could beef them up these could be made into
military grade security devices",
they did two things. First thing, they said
we're not just going to have three rotors in
six combinations, we're going to do the following: were going to invent two more rotors
called IV and V, amazingly :-) Here's what you now do:
We will choose any three out of those five rotors
- well the ways of picking three from five is five times four over one times two
Five factorial over three factorial [times two factorial] The answer's 10.
But for each of those 10 ways, you can still jumble them up in six ways on the spindle.
Ten times six is sixty, so classic
Army-Airforce Enigma
used this pretty well throughout the war. You chose three from five
and the three you chose could be put on the spindle
in a certain way. Now comes the real killer.
If that wasn't bad enough, the armed forces decided
that on the input to the machine and on the output
they would have another cross-wiring board, called the Plugboard.
Now this one's simple to understand. It's basically got sockets
numbered from A to Z and you're given chunks of wire.
If the instructions say crosslink A
to J, that's what you did. Crosslink B
to R, you did that as well. In usual operating practice
10 out of 13 of those plugs
would be cross-wired and wired up. You could wire up in the pairs but you didn't
absolutely have to wire up everything. If you left something
unwired - or 'unsteckered' as they would say in German -
then that's fine. I mean a letter Q might have no plug in it - going absolutely nowhere.
Fine. So Q maps to Q - it's not altered to anything else at all.
But, like I said, typically 10 out of 13 would be wired up.
So this is getting to be a pretty complex machine now
and you would think: "By golly! surely this is enough security for anybody?"
Well, what's good enough
for the Army and the Air Force in almost any armed forces in the world
is never good enough for the Navy! I think it's that case in the UK - it's certainly that
way in the US,
and it certainly was that way in Germany. Admiral
Karl Doenitz who was the head
of the German Navy, was a very smart guy. Some people theorize - and maybe they're right -
that he strongly suspected
as the war went on, that maybe Army and Airforce Enigma was being
decrypted successfully, sometimes, by the Allies, and he was determined
to make the German Navy version of Enigma far harder.
So, first thing he did was to say: "All right, we'll stick with three rotors for the moment
but it isn't choose 3 from 5, it's choose
3 from 8", And and by the time you've worked it
out, how many ways to pick 3 from 8, and then multiply by 6 for the number
of ways you can arrange the three you've chosen on the spindle,
the answer is 336.
And that's daunting! One of the things, I think, does need a bit of careful explanation -
it's not very well done
in the various books about Bletchley Park and Enigma, and how it worked -
is to explain what these so-called 'ring settings' were.
Now the straightforward, internal, cross-wiring is simple:
you just look at the top row and for every letter you follow
vertically downwards and you say: "Okay, in a Type I rotor
A on one side gets mapped to
E on the opposite side. B gets mapped to K;
C gets mapped to M - all the way through to
Z gets mapped to J ". But to complicate matters just a little bit further
every one of these rotor rings had a little blob of paint associated with
it showing
which was the proper setting. with A at the top and A against the dot of
paint, but it had the ability to
be able to turn the thing in such way
that instead of A being against the canonical blob
something else was So, so you could
set a little notch that held it in position,
but in a place that actually was not the standard position.
If you put your button - your ring-setting button - against the letter B
it had the effect of making A map across to what
B would normally have turned into. B would normally have turned into K.
B goes to M; C goes to F; D goes to L and so on.
It's just an offsetting mechanism.
It's just moving, as it were, the bunch of wires inside
the rotor. So, that is what a 'ring setting' is.
It's basically an initial offset, that changes the mapping ever so subtly -
makes things even more complicated. The final bit of complication now, just so that we're
completely mind-blown and
think: "How on earth could this ever be decrypted by anybody?"
You might think that just as a car's odometer
would go all the way up to 9, on the right-hand side and the moment it
turns over at 9 it would nudge the next one on the left, some bright spark
had the idea that it might give more security
if you made different wheel types have different turnover points.
And Doenitz's extra rotors VI, VII and VIII -
even worse - they turn over twice!
Once at Z, and once at M - in the middle of the alphabet.
Actually it's not a good idea if you think about it.
And I'll tell you why. Imagine you know -
because you've done a lot of work on this - you're pretty sure that at the moment
the machine has got a Type I rotor at the right.
And you're also pretty sure from the cryptanalytical working
done, that it's currently on the letter N.
You then type in three more of the
received ciphertext letters. And you suddenly see -
you suddenly find things going completely weird. This isn't just the same wheel
turning, something's happening,
It shouldn't have come out looking like this - this sequence! Argh!
it's turned over the middle rotor, so if I think it was on N and
it's turned over the middle rotor on a Q,
then it follows that that right-hand rotor must be of Type I
and I wanted to know that all along. So these turnover points, because they weren't
all at Z to A, which would have made it all look uniform,
you know, whenever anything turns over that's the way it does it,
had this little signature that if you're very careful in your cryptanalysis gives the game away.
How is this all gathered together? If
you were very lucky, in the very early days of the war,
you didn't even have to try and cryptanalyse this incoming ciphertext traffic -
either by hand or by machine. If you could do what Bletchley Park called
'a pinch', If you could actually get a secret agent or an army officer
to just accidentally be able to get hold of the code tables,
issued to the German armed forces, you didn't have to do any cryptanalysis at all
either by hand or by using this very expensive machinery that we'll be talking
about next time,
this electro-mecanical Bombe. You didn't have to use those
it's all here. But as James makes very clear
in his videos
If you did get that bit of luck it never lasted long;
you maybe got a month's worth and then a it ran out, or
someone back at headquarters said: "I'm not happy, one of our code books seems to have been
stolen and disappeared.
I'll tell you what, even though there's six months to go on it, we're throwning it away and
issuing another one -
just to be on the safe side". We've assumed and it's quite right
that the good thing about Enigma from the cryptanalysis point of view
it started off life as a commercially available totally open machine so
you might think: "Well the wiring inside those rotors then -
three of the rotors at least, I, II and III - would be known?"
Yes, but of course the moment the Luftwaffe and the Army started
introducing two more rotors you've then got the problem
of "Can we steal these things or do we have to work out from first principles,
and with rather a lot of advanced Group Theory and mathematics, and a lot of known
ciphertext and plaintext, and all sorts - can we work out what the wiring is
in those rotors without actually having them?" And the answer is,
eventually, "Yes", but it's very very nice
if somebody helps you on this front. What did you need
to know in order to decrypt a cipher stream
done within Enigma, that your listening stations had picked up ?.
It was transmitted in Morse as single letters
sent to Bletchley Park - what do you need to know to make any sense of this?
Number 1: which rotor wheels are in use?
Number 2: what is the ordering,
left to right, of those rotor wheels ? Number 3:
for each of those rotor wheels where has that stud
been located that does the ring
setting - against which letter ? The fourth thing, which
we haven't mentioned very much, but which in the next video we'll say a lot about
the operator himself - usually himself not herself -
had to also do what was called a 'message setting'.
for this particular message. Every
separate message had to have a different message setting.
It wouldn't have been safe just to keep using the ring settings alone
without any alteration to those. So that had to be worked out as well.
And finally - last but not least - the plug board cross-connections had to be worked out.
Now that's a lot of stuff. In the very early days of simple Enigma,
where therw were only three rotors, not chosen from anything else,
just three, we'll find out next time that the Polish Cipher Bureau had a lot of success
by hand, and with a very simple machine, in
getting things decrypted. But the moment you start adding more rotors,
plugboard and all the complications you rapidly find
the you just don't have enough time in the day to decrypt all that you'd like to do.
The sheer weight of cipher traffic takes over.
You have to mechanise.