Flaw in the Enigma Code - Numberphile


Uploaded by numberphile on 14.01.2013

Transcript:

DR. JAMES GRIME: So in our first Enigma video, we left
you on a bit of a cliffhanger.
I was just about to show you the flaw
in the Enigma machine.
Now, that video was only meant to be a short follow-up video.
But when we saw the reaction to our first Enigma video, we
decided to come in and film again to show you how that
flaw worked and how they broke the Enigma code.
Now, if you want to see the original Enigma video--
it shows you how the Enigma machine worked--
go check that out.
We'll put the links in the description.
But now let's have a look at that flaw.

So here's the Enigma machine again.
Now, if I press the letter K--
there we go-- the letter Q lights up this time.
Now, if I keep pressing the letter K, a different letter
lights up each time.
So a double-letter would not be a
double-letter in the code.
So it's a very good code indeed.
But it is never K itself.
So this was the flaw.
A letter never becomes itself.
So A is not A, B is not B, and so on.
Z is not Z. This is a clue.
So the way you break the Enigma code is, if you imagine
you have an Enigma message, you try and guess a word or a
phrase that might appear in that message.
Now, every morning, 6 o'clock in the morning, the Germans
would send a weather report.
Now, that was a standard form.
That was always the same every day, apart
from the actual weather.
It was always a standard format.
So we can pick a word that's going to be in
that weather report.
We might pick the word or phrase "weather report," or
"Wetterbericht" in German.
And I apologize now if I've translated that badly.
[SPEAKING GERMAN].
Now, I'm going to write "Wetterbericht"
on a piece of paper.
BRADY HARAN: That's "weather report."
DR. JAMES GRIME: That's "weather
report" there in German.
Here, I've got an Enigma code.
And I'm going to slide my guess underneath the code.
Now, I'm going to try and find where this
phrase fits in the message.
Now, I know a letter can't become itself.
So it can't fit here, because I have a T becoming T. So
that's not where it fits.
Let's try this.
Can it fit here?
No.
I've got this T matching with T again.
Let's try here.
No, I've got no matching, no matching.
From what I can see, no matching letters there.
So it might fit there.
If I tried that--
see, those R's match up, so it can't fit there.
So maybe it's here.
Maybe this is the phrase "weather report." Now, from
this point, we can start breaking the Enigma code.
So you could use different phrases.
Try and imagine what a German officer would send
in World War II.
So for example, messages would end with "Heil Hitler." So is
it "Heil Hitler" at the end of the message?
Now, if it is, we shouldn't have any letters matching with
"Heil Hitler"--
H's, E's, I's, L's.
What the British code breaker Alan Turing had to do was find
a way to use this flaw to break Enigma messages.
So he built a huge machine called the Bombe machine.
It was designed by Alan Turing and another code breaker
called Gordon Welchman.
It was a big machine, noisy thing.
It would rattle around.
And this could help you break the code in under 20 minutes.
So you would have to break the code every morning.
So every morning, the settings for the Enigma
machine would change.
So all the Enigma machines would
change stroke of midnight.
So that's why a machine that could break the code that
quickly was so important.
So the Bombe machine tried to work out the plug board at the
front of the Enigma machine.
If we go back, at the front of the Enigma machine, we have
this thing called the plug board that connects letters
into pairs.
You actually make 10 pairs of letters.
When I press a letter, the signal first goes through the
plug board.
It then goes through the first rotor, through the second
rotor, through the third rotor.
It then loops back, and it goes through the machine again
in reverse order.
So then it goes through the third rotor, the second rotor,
the first rotor.
And finally, it goes through the plug board one more time,
and it lights up one of these bulbs.
Now, I'm going to try and draw it up for you.
But I'm going to make it as simple as I can.
Let's try and do that.
So first of all, it goes through the plug board.
Then it goes through all the rotors.
And I'm going to call that just one big magic box called
R for rotors.
And the last thing it does is it goes
through the plug board.
If we look at our weather report here, let's look in the
second place.
T becomes E. Let me do that.
If I press T, it goes through the plug board, through all
the rotors, through the plug board again, and out comes E.
Now, we're going to use this to work out the plug board.
I'm going to make one guess.
I'm going to guess T is connected to
A on the plug board.
That's a guess, but I'm going to use it.
So let's say that means that T goes through the plug board,
and out comes A.
Now, A goes through the rotors.
Now, we know how the rotors are wired up.
So we know that.
We pick a position and find out what happens to A. That's
not hard to do.
And I don't know-- let's make something up.
Let's say it comes out as P. But if I do that, I can deduce
that P goes through the plug board and becomes E, which
means I can deduce that P is connected to
E on the plug board.
Now, that's pretty cool.
So you've worked out one of the plug board settings.
If that diagram works, P must be connected to E.
So I've done this a few more times doing the same method,
using my weather report crib.
And I've discovered a few more plug board settings.
So the first one we discovered was P-E. Now I've discovered K
and Q are connected on the plug board.
I've discovered X and B are connected on the plug board.
And I've discovered T and G are
connected on the plug board.
But this last one is a problem.
I've discovered that T and G are
connected on the plug board.
But I guessed that T and A were
connected on the plug board.
And it can't be both.
This is called a contradiction.
It can't be both T-A and T-G at the same time.
This means my guess, the T-A, was wrong.
Throw it away.
I got it wrong.
Now I'm going to check the next one-- what, T-B?
I might check T-C, T-D. I have to do all 26 options--
T-A, T-B, T-D, T-Z. If all the 26 options are wrong, that
means your rotor position is wrong.
And what do is you go, click.
You check the next rotor position, and you go through
all that again.
Now, that would take a very long time.
So Alan Turing came up with two ways to
make this a bit quicker.
The first one--
a really clever idea.
He noticed that once you've found one mistake, like T-A
and T-G, this means that all these other deductions are
also wrong, and they don't need to be checked.
So they're all fruit of a poisoned tree.
They can all be rejected at the same time.
And you don't need to check them again.
So that really speeds it up.
The other way to speed it up is you can do this
instantaneously with electrical circuits.
So that's what the Bombe machine did.
It applied an electrical current to my assumption, T-A.
The electrical current flows through the machine.
It flows through T-G, which means wrong.
But it'll also flow through all these other deductions,
which means I can find all my deductions, which are all
wrong, and I can do it instantaneously with
electrical circuits.
And then it will go, click, and check the next.
And it could go through all the rotor positions in about
20 minutes.
So the main thing to remember is the Bombe machine is built
a little bit backwards.
It's a process of elimination.
So what you're left with is what wasn't wrong.
And you would actually check that by hand
and see if it works.
The Bombe machine was named in honor of a Polish code
breaking machine, called Bomba.
Bomba was a completely different machine, worked on a
completely different principle.
It wasn't a huge machine.
You could sit it on your desk if you wanted to.
And it exploited a flaw in the German procedures.
Now, they could use Bomba, the Polish could use Bomba, to
break army and air force Enigma codes.
But they couldn't break naval Enigma codes.
So what Alan Turing had to do was find a way to break army,
air force, and navy Enigma codes.
And it had to be a bit more robust so that if the Germans
choose to change their procedures, that this method
would still work.
What the navy was doing differently is the rotor
starting positions were actually sent at the beginning
of each message, but they were sent in another code entirely.
So it was a completely different code just to send
the rotor starting positions.
So you needed to work out how that worked, as well, before
you could even start breaking the naval code.
BRADY HARAN: Is there anything that the makers of the Enigma
machine could have done to have avoided this problem?
Was there some simple thing that the Enigma makers could
have put into that device there, and it would have not
been broken like this?
DR. JAMES GRIME: Well, hindsight is a fabulous thing.
You wanted to make it so that a letter could become itself.
That was the flaw.
And so the British saw Enigma.
They said, that's a good idea.
We'll have that.
They nicked the idea.
We saw Enigma, and we decided to make one of our own.
We called it the Typex machine, except we
took out the flaw.
So a letter could sometimes become itself.
This made it a more secure machine.
Now, from what I've heard, the Germans tried
to break our code.
But they concluded that it was better than the Enigma
machine, so they gave up trying.
At least that's what I've heard.
It's very difficult to know for sure.
It was all very secret.
BRADY HARAN: So if you've watched our original video
about how the code machine works and this one, and you
still want more, I've got a third video with all the extra
material and off-cuts, which isn't listed, but you can find
the links here on the screen and in the
video description below.
The bits of brown paper used in these videos can also be
found on our eBay site for people who like to get their
hands on them.
And if you've watched all the Enigma videos and all the
Numberphile videos and you still want more, can I
recommend my chemistry channel, Periodicvideos?
Because recently, we got our hands on a super high-speed
camera and filmed a bunch of reactions so we can show them
in ultra slow motion.
The videos are really cool, and there's
loads more to come.
Go and have a look if it sounds like something you
might like.
All the links are below in the video description and here on
the screen.
And as usual, thanks so much for watching.
Talk to you again soon.