Playfair Cipher
The Playfair cipher is a manual symmetric encryption technique that encrypts pairs of letters instead of single letters. Here's how it works: First, create a 5x5 grid filled with the alphabet, typically using a keyword to start and omitting one letter (usually J, combining it with I). To encrypt, divide the plaintext into pairs of letters. For each pair, locate the letters in the grid and apply these rules: If the letters are in different rows and columns, replace them with the letters in the same row as each input letter but at the intersection with the other letter's column. If they're in the same row, use the letters to their right (wrapping around if needed). If in the same column, use the letters below them. For identical letters or odd-length messages, insert a filler letter (like X) between them. This digraph approach makes the Playfair cipher stronger than simple substitution ciphers, as it obscures single-letter frequencies. However, it's still vulnerable to frequency analysis of letter pairs. Decryption follows the same process in reverse. While more secure than earlier ciphers, Playfair can be broken with sufficient ciphertext and is now primarily of historical interest.
Time Complexity
Best CaseO(n)
Average CaseO(n)
Worst CaseO(n+m)
Implementation
Encryption
Encode your message using the Playfair Cipher