 Hey guys, Mr. Gibson here. Thanks for watching the video here in cryptography. Today, we're going to be talking about the Caesar cipher. So as you mentioned in our last lesson, substitution ciphers are any ciphers where we can map a plain text alphabet to a singular cipher text alphabet. And we saw we could do that in a whole bunch of different ways, 26 factorial different ways. But today, we're going to focus on just one particular way of doing that through the Caesar cipher. So the Caesar cipher allows us to set up mappings using what's called an additive operation. So we're going to need to use some arithmetic in order to set up our cipher text alphabet. The first step in doing any sort of algorithm that requires a mathematical operation is assigning a number to each character in the alphabet. And the way that we're going to do that is say the character a is 0, b is 1, c is 2, and so on all the way on to z being 25. This is a real kind of computer science idea to start counting as 0. We're going to see there's a nice reason that we do this when we start programming this up in Python. But for now, let's just run with the fact that a is 0, even though that might be a little bit counterintuitive, all people want to make a 1. So the idea behind the Caesar cipher is we're going to need a key and the key is a single integer. So I'm going to use a key value here of 10 to go with my plain text message of airport. And the way that the key works is that we're going to take each each plain text letter and we're going to add the key value to it to determine our cipher text letter. So for example, our first letter in our message a, we convert that to 0, and then we're going to add 10 to that to get our cipher text of value of 10, which corresponds to the cipher text letter of K. And we can do that for the same thing for letter i. So plain text letter i is the same thing as an 8. We add 10 to that. That gives us 18, which corresponds to s. Now, when we get to r, something different is going to happen here. r is 17. We'll add 10. That gives us 27, but there is no letter 27. So what we need to do is kind of wrap around. So we need to find an equivalent value between 0 and 25 to 27. And the way we can do that is you could kind of physically count it. So from r, we can go ahead 1, 2, 3, 4, 5, 6, 7, 8. The z to a is 9. And then a to b is 10. Another way we can do that is we could mathematically just think about, if I get to 27 and there's 26 letters in the alphabet and I need to wrap it back around, we can just subtract 26 from 27. And 1 is equivalent to b. So that kind of wrap around idea is going to be really important because we're going to do a lot of operations that are going to take our plain text number and try and map it to a cipher text number. But a lot of times we're going to try and we're going to end up calculating a number much bigger than 25. And we need to find the equivalent value. I'm going to go ahead and continue through with the rest here real quick. And once we've finished our complete message, we can write that as k, s, b, z, y. The algorithm to undo this message works almost identically. We would convert our cipher text to a number, subtract off the key value, and if the key value happens to go below zero, we'll just add 26 to map it back to a corresponding value between zero and 25. And that should do it for the Caesar cipher. Next up, we'll look at using operations that are a little more complicated than addition. We're going to try some multiplication and then combining the two. Thanks for watching. We'll catch you in the next one.