Encryption using Playfair Cipher
Overview
The best-known multiple letter encryption cipher is the Playfair.
It is a symmetric-encryption technique that was invented in 1854 by Charles Wheat Stone.
The Playfair treats diagrams in plaintext as single units and translates them into ciphertext.
The Play-Fair algorithm uses a 5x5 matrix of letters called Playfair square or Wheatston-square, constructed using keyword.
Note:
Keyword: Gitam UniversityPlain Text: Gaming academy
Steps for filling a matrix:
Procedure
-
The keyword is filled from left to right in the matrix.
-
Here
i/jis supposed to be placed in a single block since there are 26 letters in English. -
Only
i/jare supposed to be placed in a single block. -
Repeated letters are ignored.
-
After filling the keyword, the remaining letters are filled in alphabetical order.
Rules
- Divide Plain text into pairs of letters.
Note: Plain Text: ga|mi|ng|ac|ad|em|y
x. When a letter is left alone, we can add “x” in the end.
- If a pair contains repeated letters, we can use a filler letter such as
x:
Note:
- Ex: “hello” he|l
x|lo- Ex:“balloon” ba|l
x|lo|on
-
If two letters are in the same row, replace them with the immediate right.
-
If two letters are in the same column, replace them with immediate below.
-
If two letters are not in the same row or column, we draw a rectangle enclosed with those letters.
-
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.
Output
- PLAIN TEXT: |GA|MI|NG|AC|AD|EM|YX|
- CIPHER TEXT: |IM|GT|UI|EL|MC|RA|CQ|
Note: Since I/J are in the same cell, we can use either I or J throughout while solving. So, we can have an output even in this way: |JM|GT|UJ|EL|MC|RA|CQ|
Limitations
- The Play Fair Cipher is a great advance over simple monoalphabetic ciphers, but even here it has
26x26=676 diagrams. - So, Identification of individual diagrams is not
difficult at present. - In today’s time, Playfair cipher is easily breakable by using statistical or brute-force methods.
Playfair implementation
Explanation
- As discussed in the rules, the plaintext is divided into |GA|MI|NG|AC|AD|EM|YX|.
- We create a PlayFair matrix using Keyword “Gitam University.”
- Now, both
GandAare in the same row, so we take the immediate next to them:I/JandM. - Similarly,
Mand I are in the same row; No letter is present next to. So, we move to the immediate left, which isG. The next to I/J isT. NandGare neither in the same row nor a column, so we draw a rectangle enclosing both the letters.- We consider the next of
NasUand G asI/J. AandCare in the same column, so we take the next letter in theEandLcolumns.AandDare neither in the same row nor a column, so we draw a rectangle enclosing both the letters.- Next to
AisMand next toDisC. - Similarly,
EandMare neither in the same row nor a column, so we draw a rectangle enclosing both the letters. - Replace
EandMwithAandR. - So, with
YandX, we form a rectangle enclosing both the letters and replaceYwithCandXwithQ.