0% found this document useful (0 votes)
2K views6 pages

Playfair Cipher With Examples

The Playfair cipher was one of the first practical digraph substitution ciphers, encrypting pairs of letters rather than single letters. It was invented in 1854 and used during World War I and World War II by British and Australian forces due to its speed and lack of equipment needs. The encryption process involves arranging the key into a 5x5 grid and using the letters' positions to encrypt each pair of letters according to three rules. Decryption follows the same process in reverse order.

Uploaded by

Brian Matts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views6 pages

Playfair Cipher With Examples

The Playfair cipher was one of the first practical digraph substitution ciphers, encrypting pairs of letters rather than single letters. It was invented in 1854 and used during World War I and World War II by British and Australian forces due to its speed and lack of equipment needs. The encryption process involves arranging the key into a 5x5 grid and using the letters' positions to encrypt each pair of letters according to three rules. Decryption follows the same process in reverse order.

Uploaded by

Brian Matts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Playfair Cipher with Examples

The Playfair cipher was the first practical digraph substitution cipher. The scheme was invented
in 1854 by Charles Wheatstone but was named after Lord Playfair who promoted the use of the cipher.
In playfair cipher unlike traditional cipher we encrypt a pair of alphabets(digraphs) instead of a single
alphabet.
It was used for tactical purposes by British forces in the Second Boer War and in World War I and for the
same purpose by the Australians during World War II. This was because Playfair is reasonably fast to use
and requires no special equipment.

Encryption Technique

For the encryption process let us consider the following example:

The Playfair Cipher Encryption Algorithm:


The Algorithm consistes of 2 steps:
1. Generate the key Square(5×5):
 The key square is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext.
Each of the 25 alphabets must be unique and one letter of the alphabet (usually J) is omitted
from the table (as the table can hold only 25 alphabets). If the plaintext contains J, then it is
replaced by I.
 The initial alphabets in the key square are the unique alphabets of the key in the order in
which they appear followed by the remaining letters of the alphabet in order.
For example:
The key is "monarchy"
Thus the initial entires are
'm', 'o', 'n', 'a', 'r', 'c', 'h', 'y'
followed by remaining characters of a-z(except 'j') in that order.

2. Algorithm to encrypt the plain text: The plaintext is split into pairs of two letters (digraphs). If
there is an odd number of letters, a Z is added to the last letter.
For example:
PlainText: "instruments"
After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz'
Rules for Encryption:
 If both the letters are in the same column: Take the letter below each one (going back to the top
if at the bottom).
For example:
Diagraph: "me"
Encrypted Text: cl
Encryption:
m -> c
e -> l

If both the letters are in the same row: Take the letter to the right of each one (going back to the
leftmost if at the rightmost position).
For example:

Diagraph: "st"
Encrypted Text: tl
Encryption:
s -> t
t -> l
f neither of the above rules is true: Form a rectangle with the two letters and take the letters on the
horizontal opposite corner of the rectangle.
For example:
Diagraph: "nt"
Encrypted Text: rq
Encryption:
n -> r
t -> q

For example:
Plain Text: "instrumentsz"
Encrypted Text: gatlmzclrqtx
Encryption:
i -> g
n -> a
s -> t
t -> l
r -> m
u -> z
m -> c
e -> l
n -> r
t -> q
s -> t
z -> x
The Playfair Cipher Decryption Algorithm:
The Algorithm consistes of 2 steps:
1. Generate the key Square(5×5) at the receiver’s end:
 The key square is a 5×5 grid of alphabets that acts as the key for encrypting the plaintext.
Each of the 25 alphabets must be unique and one letter of the alphabet (usually J) is omitted
from the table (as the table can hold only 25 alphabets). If the plaintext contains J, then it is
replaced by I.
 The initial alphabets in the key square are the unique alphabets of the key in the order in
which they appear followed by the remaining letters of the alphabet in order.
Note:  For both  encryption  and  decryption, the  same key  is to be used.
For example:
The key is "monarchy"
Thus the initial entires are
'm', 'o', 'n', 'a', 'r', 'c', 'h', 'y'
followed by remaining characters of
a-z(except 'j') in that order.

2. Algorithm to decrypt the ciphertext: The ciphertext is split into pairs of two letters (digraphs).

Note: The  ciphertext  always have  even  number of characters.


For example:
CipherText: "gatlmzclrqtx"
After Split: 'ga' 'tl' 'mz' 'cl' 'rq' 'tx'
Rules for Decryption:
 If both the letters are in the same column: Take the letter above each one (going back to
the bottom if at the top).
For example:
Diagraph: "cl"
Decrypted Text: me
Decryption:
c -> m
l -> e
 If both the letters are in the same row: Take the letter to the left of each one (going back to
the rightmost if at the leftmost position).
For example:

Diagraph: "tl"
Decrypted Text: st
Decryption:
t -> s
l -> t

 If neither of the above rules is true: Form a rectangle with the two letters and take the
letters on the horizontal opposite corner of the rectangle.
For example:
Diagraph: "rq"
Decrypted Text: nt
Decryption:
r -> n
q -> t
For example:
Plain Text: "gatlmzclrqtx"
Decrypted Text: instrumentsz
Decryption:
(red)-> (green)
ga -> in
tl -> st
mz -> ru
cl -> me
rq -> nt
tx -> sz

You might also like