Classical Cryptography
Playfair Cipher
The Playfair Cipher is a digraph substitution cipher. It encrypts pairs of letters using a 5x5 key matrix generated from a keyword.
Algorithm Steps
- 1Generate a 5x5 key matrix using the keyword.
- 2Replace J with I.
- 3Remove spaces and non-alphabetic characters.
- 4Divide plaintext into pairs.
- 5Insert X between repeated letters.
- 6Encrypt each pair using Playfair rules.
Formula
Same row: move right for encryption, left for decryption. Same column: move down for encryption, up for decryption. Rectangle rule: swap columns.
Example
Keyword: MONARCHY Plaintext: HELLO Encrypted text: CFSUPM Decrypted text: HELXLO