The Playfair cipher is a digraph substitution cipher. It employs a table where one letter of the alphabet is omitted, and the letters are arranged in a 5×5 grid. Typically, the J is removed from the alphabet and an I takes its place in the text that is to be encoded. Below is an unkeyed grid.
To encode a message, one breaks it into two-letter chunks. Repeated letters in the same chunk are usually separated by an X. The message, “HELLO ONE AND ALL” would become “HE LX LO ON EA ND AL LX”. Since there was not an even number of letters in the message, it was padded with a spare X. Next, you take your letter pairs and look at their positions in the grid.
“HE” forms two corners of a rectangle. The other letters in the rectangle are C and K. You start with the H and slide over to underneath the E and write down K. Similarly, you take the E and slide over to the H column to get C. So, the first two letters are “KC”. “LX” becomes “NV” in the same way.
“LO” are in the same row. In this instance, you just slide the characters one position to the right, resulting in “MP”. The same happens for “ON”, resulting in “PO”. “EA” becomes “AB” in the same way, but the E is at the far edge. By shifting one position right, we scroll around back to the left side and get A.