Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Substitution Cipher

AFFINE CIPHER
ANSWER???
PLAYFAIR CIPHER
• Here a 5 ×5 matrix is created with characters of English
alphabet.
• First a keyword is chosen. First few adjacent cells are
filled with letters of this keyword (which has no letters
repeating). Remaining cells are filled by alphabets (not
entered) in order.
• For example if the keyword is “SAMPLE” the matrix is
as follows, which is called digram. As the number of
characters is 26 which is one greater than the number
of cells, one cell will have two letters. A
single cell will have I, J.
PLAYFAIR CIPHER
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.
• If both the letters are in the same column: Take the letter
below each one (going back to the top if at the bottom).
• 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).
• 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.
PLAYFAIR CIPHER
• 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‘/INCLUDE J WITH I) in that order.
PLAYFAIR CIPHER
• Let PlainText: "instruments"
• After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz‘
• 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.


PLAYFAIR CIPHER
• Decryption Technique: Decrypting the Playfair
cipher is as simple as doing the same process
in reverse. The receiver has the same key and
can create the same key table, and then
decrypt any messages made using that key.
PLAYFAIR CIPHER
• The Playfair Cipher Decryption Algorithm:
The Algorithm consistes of 2 steps:
• 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.
PLAYFAIR CIPHER
• 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'
PLAYFAIR CIPHER
• 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).
• 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).
• 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.
PLAYFAIR CIPHER
• Cipher Text: "gatlmzclrqtx"
• Decrypted Text: instrumentsz
• Decryption: ga -> in, tl -> st, mz -> ru, cl -> me,
rq -> nt, tx -> sz
PLAYFAIR CIPHER
• Using Playfair cipher encrypt the following
plaintext=“WE ARE DISCOVERED” using Key=
“MONARCHY”.
VIGENERE CIPHER
• The Vigenère cipher uses a 26×26 table
with A to Z as the row heading and column
heading This table is usually referred to as
the Vigenère Tableau, Vigenère
Table or Vigenère Square. We shall use Vigenère
Table.
• The first row of this table has the 26 English
letters. Starting with the second row, each row
has the letters shifted to the left one position in a
cyclic way. For example, when B is shifted to the
first position on the second row, the
letter A moves to the end.
VIGENERE CIPHER
• In addition to the plaintext, the Vigenère cipher
also requires a keyword, which is repeated so
that the total length is equal to that of the
plaintext. For example, suppose the plaintext
is MICHIGAN TECHNOLOGICAL UNIVERSITY and
the keyword is HOUGHTON. Then, the keyword
must be repeated as follows:
• MICHIGAN TECHNOLOGICAL UNIVERSITY
• HOUGHTON HOUGHTONHOUGH TONHOUGNTO
• For generating key, the given keyword is repeated in a
circular manner until it matches the length of the plain
text.
VIGENERE CIPHER
VIGENERE CIPHER
• To encrypt, pick a letter in the plaintext and its
corresponding letter in the keyword, use the
keyword letter and the plaintext letter as the row
index and column index, respectively, and the
entry at the row-column intersection is the letter
in the ciphertext.
• For example, the first letter in the plaintext
is M and its corresponding keyword letter is H.
This means that the row of H and the column
of M are used, and the entry T at the intersection
is the encrypted result.
VIGENERE CIPHER
• Repeating this process until all plaintext letters are
processed, the ciphertext is
• TWWNPZOA ASWNUHZBNWWGS NBVCSLYPMM
• To decrypt, pick a letter in the ciphertext and its corresponding
letter in the keyword, use the keyword letter to find the
corresponding row, and the letter heading of the column that
contains the ciphertext letter is the needed plaintext letter.
• For example, to decrypt the first letter T in the ciphertext, we find
the corresponding letter H in the keyword. Then, the row of H is
used to find the corresponding letter T and the column that
contains T provides the plaintext letter M (see the above figures).
Consider the fifth letter P in the ciphertext. This letter corresponds
to the keyword letter H and row H is used to find P. Since P is on
column I, the corresponding plaintext letter is I.

You might also like