 So now we'll turn to what is arguably the very first true mathematical cipher, which is something that we can call an athine cipher. And so this works as follows. One of the problems that you run into with single substitution ciphers is to remember what that substitution table looks like. So what letter is A assigned to, what letter is B assigned to, and so on. A rotation cipher sacrifices difficulty for simplicity. As soon as you know the value of the rotation, you can decrypt any message on a rotation cipher. So what can we do? Well, one possibility is to use an athine cipher, and we're going to set that up in the following way. First of all, we're going to choose n with an inverse m mod n, where n is the capital N, is the size of our cipher alphabet, 26, 36, however you want to do it. We're going to choose some number k. It doesn't really matter what this value of k is. And we're going to inscript our symbol p using the congruence. Our plain text symbol, value times n plus k mod n, is going to be our encrypted value. And since n has a multiplicative inverse, then I can decrypt c as p congruent to m times c minus k. So for example, let's construct an athine cipher mod 36, so that gives us the 26 letters to the alphabet plus 10 numerical symbols. And then I'll use my standard values a equals 0, b equals 1, and so on. And I'll encrypt the word athine. So we want to choose a number with an inverse mod 36, which means we need to find something that is relatively prime to 36. So what can I do? Well, let's try n equals 11. And just to make sure, let's go ahead and find that inverse mod 36. So that's going to require us to solve a linear diathontine equation, 11x equals 36y plus 1. And if I solve that, I get x equals 23, y equals 7 as a solution. Now, I don't actually care about the value of y. What I do need is x equals 23 is our inverse of 11 mod 36. So I'll pick n equals 11, and I need another value. How about k equals 5? And so my encrypted symbol p is going to be found by c is congruent to 11p plus 5 mod 36. And if I receive this encrypted value, I can decrypt it by using the multiplicative inverse times c minus 5, also mod 36. So let's go ahead and take a look at this. So our letters are a, 0, f, 5, i, a, n, 13, e, 4. So I'm going to encrypt 0, 11 times 0 plus 5, that's going to be 5, 11 times 5 plus 5, 60, taken mod 36, so that's going to reduce to 24, which is y. Our second f is also going to be encrypted as y. One of the limitations of the affine cipher is that we do get nothing more than a single substitution cipher, i, 11 times 8 plus 5, 93, again reduced mod 36. Our next letter, e, and then finally our last letter, n. So affine as a word becomes f, y, y, v, e, n as our encrypted text. Now our decryption value is going to use the multiplicative inverse 23. So I'm going to use the, I'm going to decrypt by taking my cipher text values minus 5 times 23, again working mod 36. And just to verify that that actually works, if 5 is our first letter, the plain text version, 0, y is our second, 24 minus 5 times 23, reduced mod 36, and so on. And that recovers our original message. And what we have is an affine cipher, still a single substitution cipher, but one that is considerably more complex than a rotation cipher. I have two parameters for the affine cipher, and this makes it correspondingly more difficult to break.