Professional Documents
Culture Documents
Chapter Two Part Two
Chapter Two Part Two
ELEMENTARY CRYPTOGRAPHY
Part Two
Substitution Ciphers
1
Objectives
Discus about Substitution ciphers
Multiplicative Cipher
Affine Cipher
Pigpen Cipher
2. Polyalphabetic cipher
2 Playfair cipher
Introduction
3
Monoalphabetic cipher
In monoalphabetic substitution, the relationship between a symbol
E.g., ABCDEFGHIJKLMNOPQRSTUVWXYZ
DEFGHIJKLMNOPQRSTUVWXYZABC
but the term additive cipher better reveals its mathematical nature.
officers.
character:
force cryptanalysis:
1. The encryption and decryption algorithms are known.
2. There are only 25 keys to try.
3. The language of the plaintext is known and easily recognizable.
In most networking situations, we can assume that the algorithms are
known.
What generally makes brute-force cryptanalysis impractical is the use of an
algorithm that employs a large number of keys and if the language of the
plain text is unknown.
8
Example
Eve has intercepted the ciphertext “UVACLYFZLJBYL”. Show
how she can use a brute-force attack to break the cipher.
Solution
Eve tries keys from 1 to 7. With a key of 7, the plaintext is “not very
9
Contd.
10
Multiplicative Ciphers
12
Affine Ciphers
13
Example
Use an affine cipher to encrypt the message “hello” with the key pair
(7, 2).
Solution
Example
Use the affine cipher to decrypt the message “ZEBBW” with the key
pair (7, 2) in modulus 26.
Solution
14
Monoalphabetic Substitution Cipher
With only 25 keys, the Caesar cipher is far from secure. A
character.
16
Fig. An example key for monoalphabetic substitution cipher
Contd.
We can use the key in the above figure to encrypt the message:
The ciphertext is
17
Pigpen Cipher
Pigpen cipher is a variation on letter substitution
A B C J K L
D E F
M N O
G H I
P Q R
18
Contd.
S W
T U X Y
V Z
A G W
C
diagram
19
Polyalphabetic Cipher
In monoalphabetic cipher the problem was that each character
sequence. First row starts with ‘A’, second row starts with ‘B’, etc.
time
22
Vigenère cipher Table
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
B B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
C C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
D D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
E E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
F F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
23 M N O P Q R S T U V W X Y Z A B C D E F G H I
M J K L
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
N N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
Q Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U U V W X Y Z A B C D E F G H I J K L M N O P Q R S T
V V W X Y Z A B C D E F G H I J K L M N O P Q R S T U
W W X Y Z A B C D E F G H I J K L M N O P Q R S T U V
X X Y Z A B C D E F G H I J K L M N O P Q R S T U V W
Y Y Z A B C D E F G H I J K L M N O P Q R S T U V W X
Z
24 Z A B C D E F G H I J K L M N O P Q R S T U V W X Y
Contd.
Example
Given a Message = SEE ME IN MALL and a keyword as
INFOSEC. By using Vigenère cipher find the ciphertext?
Solution
S E E M E I N M A L L
I N F O S E C I N F O
----------------------------------
A R J A W M P U N Q Z
25
Keyword is converted to numbers and corresponding numbers in
Decryption of Ciphertext
Example
To decrypt, the receiver places the keyword characters below each ciphertext character
Using the table, choose the row corresponding to the keyword character and look for
the ciphertext character in that row
Plaintext character is then at the top of that column
Solution
A R J A W M P U N Q Z
I N F O S E C I N F O
----------------------------------
S E E M E I N M A L L
Vigenère cipher uses the fact that the keyword character helps to
ciphers.
[Reading Assignment]
29
Hill Cipher
Is a polyalphabetic cipher invented by Lester S. Hill.
The blocks are encrypted one at a time in a such away that each
the block.
Is a block cipher but the others we studied so far belongs to the stream
30
cipher category.
Contd.
In Hill cipher, the key is a square matrix of size mm in which m
31
Contd.
The substitution is determined by m linear equations in which each
C=KP mod 26
32
Contd.
Example
Given a plaintext = PAY MORE MONEY and the encryption key
17 17 5
21 18 21
2 2 19
The first three letters of the plaintext are represented as
15 375 11
K 0 819 mod 26 13 LNS
24 486 18
C = E(K,P) = KP mod 26
Note
Keyword “Infosec”
I/J N F O S
E C A B D
G H K L M
P Q R T U
V W X Y Z
36
Playfair Cipher Rules
Keyword is “INFOSEC”
Grouped text: CR YP TO IS TO XO EA SY
Ciphertext: AQ VT YB NI YB YF CB OZ
the keyword and then uses the same rules as for encryption
38
Contd.
An example of a secret key in the Playfair cipher
Example
Let us encrypt the plaintext “hello” using the key in Figure
3.13.
39
Vernam Cipher
One of the goals of cryptography is perfect secrecy. A study by Shannon
has shown that perfect secrecy can be achieved if each plaintext symbol is
encrypted with a key
randomly chosen from a key domain. This idea is used in a cipher called
40
Contd.
distinct
E.g., Plaintext: HELLO
Key: KTBXZ
--------------
Ciphertext : RXMIN (using addition mod 26)
Key: KTBXZ
--------------
Plaintext: HELLO (using subtraction mod 26)
41
STREAM AND BLOCK CIPHERS
42
Stream Ciphers
Call the plaintext stream P, the ciphertext stream C, and the key stream K.
43
Contd.
Additive ciphers can be categorized as stream ciphers in which the key
stream is the repeated value of the key. In other words, the key stream
is considered as a predetermined stream of keys or K = (k, k, …, k).
In this cipher, however, each character in the ciphertext depends
definition.
In this case, the key stream is a repetition of m values, where m
45
character in the plaintext stream; otherwise, the cipher is
Contd.
Additive ciphers are definitely monoalphabetic because Ki in the
47
Contd.
48
ciphertext block depends on all characters in the plaintext block.
Combination
by block.
49