Professional Documents
Culture Documents
…Experiment-4...
Aim: - write a c program to implement of ‘play-fair cipher’ encryption order.
Theory: -
Play-fair cipher: Playfair ciphers are a type of block cipher: the ciphertext character
that replaces a particular plaintext character in the encryption will depend in part on an
adjacent character in the plaintext. They are named for an English lord, Lyon Playfair,
who advocated their use, but they were invented by Charles Wheatstone (1854).
Encryption: -
Encryption is accomplished using a square array of characters, constructed
from the encryption key. Because our set of plaintext characters is the 26-
For example: Suppose the encryption key is the word ‘Larkspur’ and we want to
encrypt the message “Rocky Mountain Meadow” using a Playfair cipher with this
keyword. First, we construct the 5 × 5 array below:
L A R K S
P U B C D
E F G H I/J
M N O Q T
V W X Y Z 5*5
Now that we have the encryption array, we proceed with encryption of the
plaintext message as follows. We separate the characters in the plaintext into
pairs, to get
RO CK YM OU NT AI NM EA DO WX
L A R K S
P U B C D
E F G H I/J
M Q
M N O Q T
V W X Y Z
Continuing through all the plaintext diagrams in our example, we obtain the
ciphertext: BXHCVQNBOMSFONFLBTXY.
char arr[5][5]={"MONAR","CHYBD","EFGIK","LPQST","UVWXZ"};
char pt[10];
OUTPUT:
APPLY THE RULES OF OUTPUT
==================
MONAR
CHYBD
EFGIK
LPQST
UVWXZ
==================
MONAR
CHYBD
EFGIK
LPQST
UVWXZ
Ciphertext = RF