Step 2: Playfair cipher
1. To start, pick a keyword that has no repeating letters. This example will use the word "codes."
2. Next, take the plaintext message (the message you want to encode) and split it into pairs of letters. If there is an odd number of letters, add an X to the end. If there are two of the same letter paired up, split them up by inserting an X. This is shown in the example "Tonight is not possible":
Plaintext: TONIGHT IS NOT POSSIBLE
Split into pairs: TO NI GH TI SN OT PO SX SI BL EX
3. Next, draw a 5x5 grid, and fill in the first boxes with your keyword. Then, fill in the rest of the boxes with the rest of the alphabet, putting I and J in the same box (as shown in the photos).
4. Now you are ready to start encoding. The rule to remember is "Right, and Down." Take the first pair of letters and find them on the grid. They will either be:
Not in the same row or column - this means that the letters will form two corners of a square. The code letters will be the other two corners. In other words, for the pair TO, go right from T until you are in O's column. In this case, this means that the code letter for T is Q. Look at the pictures to get a visual on what is happening (photo 1).
They are in the same row - go right one letter. For the pair NI, go right one letter from N to give you I. Go right from I one letter to give you J (see photo 2).
They are in the same column - Go down one letter. For the pair DL, go down one letter from D to get F. Go down one letter from L to get R. This case does not occur in the example "tonight is not possible," however photo 3 shows how it would work.
5. Finished! The final message for "Tonight is not possible" is "QEIJ HAUM EQQC DZCN FKDY"
To decode the message, just reverse the process in step 4 above. This means that to decode you will use split the coded message into pairs, follow the rule "Left, and Up", and remove the extra X's when you are finished.