Not everyone was here, so this is very quickly rehearsed.
This whole idea of cryptography
and then connect it to Math a little bit. So we're just gonna jump into it without talking about it. OK?
So we're looking at this word
and we recall that there's an adjective that we use that comes from the same word. Right?
What was the adjective?
Cryptic!
Which means ... which means mysterious.
OK? So the idea of something being unclear, not sure what it means. OK?
And so the verbs that go along with that, right?
are ... well, to make something cryptic is to encrypt it. Right?
So the process of doing that is Encryption
The opposite of Encryption (or to Encrypt something) is to Decrypt it. OK?
And these pairs of words are very closely related to the word Cipher.
So you can Encipher something, which the same as Encryption
or you can Decipher it.
Same idea.OK?
So then we had a look at a Cipher. We had a look at a very famous one. What was it?
It was the Caesar Cipher! Right? The Caesar Cipher.
And it used two simple kinds of Maths. Right?
How did the Caesar Cipher work? What was the first thing that you did?
It took all that is, you made them as numbers, and what did you do to those numbers?
You shifted them! Just add something, right?
So you add, you take some of course and you add at it , and the second thing
to make sure that you got a letter at the end of it, what was the second thing?
There was a second field of Maths that we used.
It started with an M...
Modular Arithmetic, righ!
So the idea of taking a remainder in case you add things on and add things on
but then you would divide by 26 and find the remainder
so that you got a letter. OK?
Right? Not only were there one-letter words, of which there are not many
OK? What was the main weakness that we found?
OK, so we did see the spaces is a problem, but more of a problem than spaces were that in normal English
and in other languages it's the same in a different distribution
the main weakness - right?- is the frequency of letters. Right? Letter Frequency.
Because in normal English and you can even see it on the words that are on the board right now -OK?-
In normal English some letters are far more common than others. Yes!
Student: (inaudible) - Prof. Woo: Yeah, main weakness, OK?
So does that make sense?
Student speaks:(inaudible)
OK. So this was the main weakness, right? Now what I'm going to ... yeah, question?
Student: (inaudible)
Do you remember? Can someone help him out?
Why is that a frequency? Why is that a weakness? Why is that a problem?
(inaudible student answers)
Yeah! (inaudible student comments)
Good! Fantastic! So let me repeat that 'cause that's exactly right!
You can have a look on the board, right?
For instance, far and away the most common letter on the board is e. There, there, there, there
there, there, there, there, there, there, there, and there again.
And there again!
And did I miss some?
Oh wait, this has two, cipher has, oh sorry, these two there and there.
So look, there are e's in almost every word and in some words you double up! Right?
So if I were to take this whole board and you apply the Caesar Cipher to it -right?- here is the problem:
all the e's will become some other letter, but they will be the same letter every time.
So it might turn into a t. And then you can have t's everywhere,
and you can make an educated guess, and you can crack the cipher. You can break it. OK?
So we have two solutions to this problem.
So this is where we're now breaking into newer ground, alright? We look into this yesterday.
Two solutions to this main weakness. OK?
I'll tell you the first one first, it's more detailed, and we're gonna spend more time with it next week.
The first technique, the first solution is to see this -see this?- adding the visionary remains -they're really easy.
The Maths of this is very simple. OK? Which is part of why it is so easy to break.
So one of the solutions is to use more complicated Maths, right?
If you do like weird functions like exponentials and trig functions or bring in complex numbers
or something crazy like that, you can use more complicated Maths like this.
And so what you end up with is more complex and hard to break. OK?
So there's the first solution. We're gonna look a bit at an example of that, or a few examples like that next week.
But there's a simpler way, it's a much simpler way, and that's what we're gonna focus on today. Right?
The problem with this is because you're adding the same number to every letter,
that's why all the e's are converted into all the t's or into whatever. OK?
So what if we could fix that?
What if we could not shift by a constant each time, right?
So it's still using the idea of addition, and it's still the idea of using modular and remainders and division. OK?
So it retains the easy Maths, which is a good thing,
'cause you're gonna be incurring all these long messages, and it's not easy for a computer to do.
We're still using the same Maths, but we're gonna make it -and I'm gonna show you in a minute
that if it's used properly, it is UNBREAKABLE!
Like literally UNBREAKABLE.
It's not an exaggeration. It is ... there is a mathematical proof
for why this new method I'm about to show you
is INVULNERABLE. It cannot be broken.
And the method is called a One Time Pad. OK?
And what is a One Time Pad?
I made one, so I could show you. In fact, as you will import it in a second,
I made two, you'll see why. Here is a One Time Pad. Can you all see it?
I tried to make sure the numbers were big enough so that you could vaguely see what's going on. OK?
So here's a One Time Pad, and I have two of them, exact copies, OK?
So what I'm gonna do is, I got one, and I'm gonna hand the other one to Brandon, OK?
So now he and I have copies, identical, of the same One Time Pad.
And you can read the numbers across the top, right?
19, 13, 4, 23, and so on.
So what I'm gonna do is, the way the One Time Pad works, is the same principle
as this Caesar Cipher, which is shifting letters along, OK?
So the same principle. I'm still shifting letters, OK?
But this time, instead of adding the same number, same number, same number,
all of the characters, I'm going to add different numbers.
Every single time. OK?
So suppose I have a five-letter word, OK? Let's actually try and do this.
And we'll see if we can help each other out here.
A five-letter word like, say, what's a five-letter word, guys?
Happy!
That's a good example actually, and you'll see why in a second, right?
If I wanted to send the word Happy, the first thing I'd do is, I got to convert them all to numbers.
OK, so help me out. I happen to know that's 8, that's 1. What would the letter P be?
(Laughs)
Sure, everybody write this down. Go back to yesterday's work. Didn't we?
16! See? So this will be 16, this will also be 16, and Y will be 25 'cause it's the second last letter.
OK.
So then, what I will do, is I'll say "OK, I've got my One Time Pad, right?"
And for the first letter I'm going to add the first number: 8, right?
So this is gonna become +8, which is 16, OK?
Then I move over to the next one.
I've got 19 here, so I should add 19 to this, so it will become 20.
What am I gonna add to this? 13. So this is gonna become... OK, now we need to run back to Arithmetic, don't we? Right?
So this will become 29, but that should really be 3, shouldn't it?
Minus 26, because 29 really doesn't equal to 3. It's only equal to 3 when we take off 26.
Now the next letter is 16, but I've moved over to the next one. I've moved over to 4 now.
So I'm gonna add 4, so that will be 20. And then the last one, 23, that's a big one, so that's gonna be 48.
which is the same as 22 (minus 26).
Is that OK?
Right. So what I am actually going to transit? What do these letters correspond to?
Come on. Just by coincidence you got 16, yeah. I mean that's going to be a ... let me take a look...
that's gonna be a P. OK.
What's 20? T? Oh, hold on, T? Yes.
3. That will be a C.
I'm gonna say the T again.
And then 22? To V. V? OK
So this is what I'm going to send now: PTCTV.
OK. Now can you see why, despite its simplicity, why this is so superior and why it's unbreakable.
You see what's going on? Look at this.
See this T and this T? They don't even represent the same letter in the original (HAPPY). Right?
This T came from an A. And this T came from a P. Right?
And in exactly the same way, I had a repeat letter here (P in the original HAPPY),
but they didn't become repeat letters later on.
So if you come back into this, and I look at all my e's, which occur so many times,
almost certainly, every one of these e's will become -after it's enciphered, right?-
become a different letter.
So you can't do this letter frequency thing. It's all gonna be completely jumbled up.
So that's how I encode. OK?
And what I would do, we could say, as the name suggests, One Time Pad, right?
I never want to use this Pad again, right?
I'm gonna say "Oh, look, I've used these five already.
OK, if I were to continue the message, I'd keep going. When I get to the end of this page,
I tear it off, I destroy it, and I never see it again. And then I keep going, OK?
Yeah. Student: (inaudible) Prof. Woo: OK, so why is this better than the Caesar Cipher?
Student (inaudible) Prof. Woo: OK. No obvious patterns will emerge unlike here, OK?
So now Brendan receives my message (PTCTV), OK?
And because he's in possession of the exact same One Time Pad that I have,
he can go it through, and he can start with the first letter, and he can ... that I added, right?
So what should he need to?
He should subtract, OK?
So he's gonna convert these all into numbers, so you'll get this, then he's going to subtract,
and again you'll have to do minus 26, right?
So for instance, this is 3. This 3, this is a tricky one 'cause you're like
oh, he would subtract the third number which is 13, right? So 3-13 is -10.
Ah, but when you do min 26, that's gonna be the same as 16, right?
Because these are 26 letters apart, can you see that?
So they are really the same letter, OK?
And he will get back the P that I started. OK?
So this is a way to securely transmit things between Brandon and I, OK? And it's unbreakable.
Here's the point: even if you intercept this message -right?
if you don't have the same One Time Pad that I have and Brandon does, you have no chance.
No chance. OK?
So, it sounds pretty good, doesn't it? Right?