1. دهـــؤك يا ثوليتــــةكنيكى زانكـــويا
التقـــــنية دهــــــــــوكجامعــــــــة
Duhok Polytechnic University
College: Technical College of Informatics-Akre
Dept. : Computer Networks and Information Security
Course Name : Applied Cryptography
Class : Second Semester: Second
Lecturer : Dr.Shakir Fattah
Academic Title : Lecturer
Study year:2022-2023
2. Autokey Cipher
➢ An Autokey cipher is identical to the Vigenère cipher.
➢ keyword is constructed by appending the keyword to the
beginning of the actual plaintext message.
• For example, if your plain text message was:
This is a secret message
❖ And your keyword was "zebra", then your actual keyword would
be:
zebrathisisasecretmessage
- Enciphering and deciphering the message is performed using the
exact same method as the Vigenère Cipher
Information and Network Security
25 March 2023
3. 25 March 2023 Information and Network Security
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.
Polygraphic Cipher
4. Polygraphic Cipher
1- Playfair Cipher:
➢ The Playfair cipher encrypts pairs of letters (multiple-letter).
➢ This is significantly harder to break.
➢ The Playfair algorithm is based on the use of a 5 × 5 matrix of
letters.
➢ The matrix in constructed by filling in the letters of keyword and
ignoring the duplicate.
➢ The letters I and J count as one letter.
Playfair Matrix
Information and Network Security
25 March 2023
5. • Using the key in playfair it is make the technique more
difficult and more secure as well.
• Using the keyword at the beginning of the grid and leaving out
the repeats.
• Add the alphabetic letter in order starting with letter A.
• figure show the playfair with the keyword.
• The keyword is JIM TRESEEL, we do not
have J we replaced with I.
Information and Network Security
25 March 2023
6. The rules for decoding using Playfair
1. If the letters in the pair are at the corners of a rectangle with at least
two rows and two columns, then the ciphertext has the letters at the
opposite corners of the rectangle. Choose the ciphertext letter that is
in the same row as the corresponding plaintext.
2. Otherwise, if the letters are in the same row, translate each of them
as the next letter on the left. If you fall off the beginning of the row,
wrap around to the end.
3. Otherwise, if the letters are in the same column, translate each of
them as the letter above. If you climb off the top of the column, wrap
around to the bottom.
4. Look at the resulting plaintext. Work out where the word
boundaries are, and where the cipher clerk at the other end has added
in extra Xs. This requires judgment, and is not completely
mechanical.
Information and Network Security
25 March 2023
7. 25 March 2023 Information and Network Security
Encryption Technique
8. 25 March 2023 Information and Network Security
For the encryption process let us consider the
following Question:
Q: Use the Playfair Cipher technique to encrypt for the following
detail:
Plaintext: instruments
Key: monarchy
9. 25 March 2023 Information and Network Security
The Playfair Cipher Encryption Algorithm:
The Algorithm consists 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.
10. 25 March 2023 Information and Network Security
For example:
The key is "monarchy“. Thus the initial entries 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'
11. 25 March 2023 Information and Network Security
Rules for Encryption:
1.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
12. 25 March 2023 Information and Network Security
2.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
13. 25 March 2023 Information and Network Security
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: "nt"
Encrypted Text: rq
Encryption:
n -> r
t -> q
14. 25 March 2023 Information and Network Security
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
15. 25 March 2023 Information and Network Security
Output:
Key text: Monarchy
Plain text: instruments
Cipher text: gatlmzclrqtx
16. 25 March 2023 Information and Network Security
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.
17. 25 March 2023 Information and Network Security
The Playfair Cipher Decryption Algorithm:
The Algorithm consists 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.
18. 25 March 2023 Information and Network Security
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.
19. 25 March 2023 Information and Network Security
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'
20. 25 March 2023 Information and Network Security
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
21. 25 March 2023 Information and Network Security
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
22. 25 March 2023 Information and Network Security
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
23. 25 March 2023 Information and Network Security
For example:
Plain Text: "gatlmzclrqtx"
Decrypted Text: instrumentsz
Decryption:
(red)-> (green)
ga -> in
tl -> st
mz -> ru
cl -> me
rq -> nt
tx -> sz
24. 25 March 2023 Information and Network Security
Output:
Key text: Monarchy
Plain text: gatlmzclrqtx
Deciphered text: instrumentsz
25. 25 March 2023 Information and Network Security
Advantages and Disadvantages
Advantages:
1. It is significantly harder to break since the frequency analysis
technique used to break simple substitution ciphers is difficult
but still can be used on (25*25) = 625 digraphs rather than 25
monographs which is difficult.
2. Frequency analysis thus requires more cipher text to crack the
encryption.
26. 25 March 2023 Information and Network Security
Disadvantages:
1. An interesting weakness is the fact that a digraph in the
ciphertext (AB) and it’s reverse (BA) will have corresponding
plaintexts like UR and RU (and also ciphertext UR and RU
will correspond to plaintext AB and BA, i.e. the substitution is
self-inverse). That can easily be exploited with the aid of
frequency analysis, if the language of the plaintext is known.
2. Another disadvantage is that playfair cipher is a symmetric
cipher thus same key is used for both encryption and
decryption.