Playfair Cipher
Introduction
Playfair cipher is a symmetric-encryption technique that was invented in 1854 by Charles Wheat Stone but was named after Lord Playfair who promoted the use of the cipher.It is the same as a traditional cipher. The only difference is that it encrypts a pair of alphabets(digraphs) instead of a single letter.
Generating Playfair Matrix/Key Square
The Playfair algorithm uses a 5x5 matrix of letters called Playfair square or Wheatston-square,
constructed using keyword.
Steps for filling a matrix:
• The keyword is filled from left to right in the matrix.
• Here I/J is supposed to be placed in a single block since there are 26 letters in
English.
• Only I/J are supposed to be placed in a single block.
• Repeated letters are ignored.
• After filling the keyword, the remaining letters are filled in alphabetical order in the
matrix.
Rules for Encryption
1. The plaintext is split into pairs of two letters (digraphs).
2. If there is an odd number of letters, dd a filler letter such as x to the last.
3. If a pair contains repeated letters, add a filler letter such as x between them.
4. If a letter is standing alone in the process of pairing, then add an extra filler letter with
the alone letter.
5. If two letters are in the same row, replace them with the immediate right.
6. If two letters are in the same column, replace them with immediate below.
7. If two letters are not in the same row or column, we draw a rectangle enclosed with those
letters and take the letters on the horizontal opposite corner of the rectangle.
8. If two letters are in the same row, but there is no letter to the right, we return to the
first letter from the left.
Rules for Decryption
1. The ciphertext is split into pairs of two letters (digraphs). Remember that ciphertext always
have even number of characters.
2. If two letters are in the same row, replace them with the immediate right.
3. If two letters are in the same column, replace them with immediate below.
4. If two letters are not in the same row or column, we draw a rectangle enclosed with those
letters and take the letters on the horizontal opposite corner of the rectangle.
5. If two letters are in the same row, but there is no letter to the right, we return to the
first letter from the left.
Example: Using Playfair cipher encrypt the plaintext "DITUNIVERSITY" with key "MONARCHY"
Plain Text → DITUNIVERSITY
Key → MONARCHY
Modified Plain Text → DITUNIVERSITYX
M | O | N | A | R |
C | H | Y | B | D |
E | F | G | I/J | K |
L | P | Q | S | T |
U | V | W | X | Z |
For DI:- D → B
I → K
For TU:- T → L
U → Z
For NI:- N → A
I → G
For VE:- V → U
E → F
For RS:- R → A
S → T
For IT:- I → K
T → S
For YX:- Y → B
X → W
Cipher Text -> BKLZAGUFATKSBW
ⓘ Use our web app to get the step by step solution for decryption process.
Limitations
• The Play Fair Cipher is a great advance over simple monoalphabetic ciphers, but even here
it has 26x26=676 diagrams.
• Identification of individual diagrams is not difficult at present.
• Playfair cipher is easily breakable by using statistical or brute-force
methods.