 Hey y'all, Mr. Gibson here. Welcome to the next lesson in cryptography. In this video, we'll be taking a look at the rail fence cipher and how to use it to in cipher and decipher messages by hand. Rail fence ciphers are a type of transposition cipher that uses rows or rails to separate out letters into the plaintext message and then regroup them to form the cipher text. In this first example, we'll use the plaintext message mathematics. We start by creating this grid two rails of 11 spaces. Then we zigzag the plaintext letters starting in the top row and continuing into a run out of characters. So M would go in the top left box and then A would go down one to the right and then back up to the top row for T and so on. Once we've completed the grid, we can reassemble these letters putting the top row letters first and then joining them with the bottom row letters. Notice that I've written the characters in the standard formatting for cipher text, uppercase blocked into groups of five characters. You don't have enough characters to make a full group of five like I did. That's okay, just write as many as you can until you run out. So we have the cipher text message MTEAISAHMTC. A variation on the cipher is to use more than two rows. In this example, we'll use three, but in general, you can use as many as you'd like. The number of rows used is acting as the key for this algorithm, changing the ciphertext for the same plaintext, even though the process is the same. So we'll zigzag our letters starting in the top left and then we'll collect the letters in the top row MTEAI, followed by letters in the middle row AHMTC, wrapping up with the letters in the bottom row. You can see we do get a different cipher text message even though we have the same plaintext because we altered the number of rails used in the cipher. These ciphering, these types of messages are only a little bit tricky. I like to take that grid and then highlight which of the boxes would have had letters in them during the ciphering process. Now, starting at the beginning of the cipher text, we can write the letters across the top row until we run out of spaces and then continue on in our cipher text words with the bottom row. R-E-T-E. And once we filled in the grid, we can now zigzag our way back through the message to recreate the cipher text, or sorry, the plaintext. In this case, we'd have A or B. And here, once you've got plaintext and you know where the spacing goes, we can write it with our conventional lowercase to reintroduce some spaces where we think they fit best. We can use this algorithm one more time on the three-row rail fence. So I know we're gonna have one in the following boxes. Speed things up. I'll just use a little dot to denote where the letter goes. In here, we would have a T-O-I in the top row, A-L-W-F in the middle row, and then Y-S-T in the bottom row. And again, we can follow the zigzag pattern to realize that our plaintext message is my favorite part of stuff. And that's it. You should now be able to do a cipher and de-cypher messages using the rail fence transposition cycle. Thanks for watching, and we'll catch you on the next one.