You are on page 1of 42

Information Security

Lecture 3

Lecture Focus

Cryptography
Information Security Cryptography

Cryptography components
Information Security Cryptography

Categories of Cryptography
Information Security Cryptography

Symmetric-key cryptography
Information Security Cryptography

Asymmetric-key cryptography
Information Security Cryptography

Keys used in cryptography


Information Security Cryptography

Comparison between two categories of cryptography


Information Security Cryptography

Symmetric-key cryptography

 Symmetric-key cryptography started thousands


of years ago when people needed to exchange
secrets (for example, in a war).

 We still mainly use symmetric-key cryptography


in our network security.
Information Security Cryptography

Symmetric-key cryptography

 Traditional Ciphers
 Simple Modern Ciphers
 Modern Round Ciphers

 Mode of Operation
Information Security Cryptography

Symmetric-key cryptography Traditional ciphers


Information Security Cryptography

Symmetric-key cryptography Traditional ciphers


Substitution Ciphers

 A substitution cipher replaces one symbol


with another.
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers

Monoalphabetic cipher

1-1 tion

Su

1 - itut
u
stit
bs
M ion
ub

t
S

1 t di y d
(s ffe iff
a b

am re er
e) nt ent
ch p l a ch
ar ce ar
ac s ac
te is te
r a re rs
Simple Complex

pp p l a .
Substitution Substitution

e a ce
rin d
g
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution

 Replaces each letter in the plaintext by a letter some


fixed number of positions further down the alphabet
 It is also called Shift cipher
 It is also called Caesar cipher.
We studied this cipher in the previous lecture.
Implementation

Here:
C = E(p) = (p + k) mod (26) p = plaintext
C= Ciphertext
p = D(C) = [(C – k)+26] mod (26) k= key

Possible Remainders: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution

Shift by 3
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

 Example:
Plaintext: we love pakistan
Ciphertext: ZH ORYH SDNLVWDQ
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution

 Advantages:
 Simple
 Fast

 Disadvantages:
 Easy to break
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution

Cryptanalysis: Brute Forcing

• How to find the key?


• Only 26 possible keys
– try them all!

26 < 25

25 =32
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
Caesar Cipher
 STEPS:
1. Write Alphabets of the language in 1st line in simple order.
A B C D ........X Y Z

2. Again write Alphabets of the language starting from the key


letter and then in simple order in 2nd line. For example, if key
is 3, then we will write
D E F........ Y Z A B C

3. Encrypt the plaintext characters one by one as follows:


a) Pick a plaintext character
b) See the matching character in 1st line (step-1) above.
c) Below that character, pick the character from 2nd line. This is the
ciphertext character.
d) Repeat step-3 above until plaintext characters are finished.
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
If formulae C = E(p) = (p + k) mod (26) and
Caesar Cipher
p = D(C) = [(C – k)+26] mod (26)
are used to calculate the characters, then follow the following steps
 STEPS:
1. Write numbers from 0 to 25 in 1st line. 0 1 2 3 .........24 25

2. Write Alphabets of the language in 2nd line in simple order.


A B C D ........X Y Z

3. Again write Alphabets of the language starting from the key


letter and then in simple order in 3rd line. For example, if key
is 3, then we will write D E F........ Y Z A B C
4. Encrypt the plaintext characters one by one as follows:
a) Pick a plaintext character
b) See the matching character in 2nd line (step-2) above.
c) Below that character, pick the character from 3rd line. This is the
ciphertext character.
d) Repeat step 4 until plaintext characters are finished.
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
Caeser Cipher
 EXAMPLE:
Key = 3
Plaintext = YOU ARE GOOD
What is Ciphertext?.

 SOLUTION:

3
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

ABCDEFGHIJKL MNOPQR S TU VWX Y Z


D E F G H I J K LM N O P Q R S T U V WX Y Z A B C

YOU ARE GOOD


BRX DUH JRRG
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
Beaufort Cipher
 Alphabet written Backwards Sir Francis Beaufort

 STEPS: Simple Version

1. Write Alphabets of the language in 1st line simple order. i.e.


A B C D ........X Y Z .
2. Again write Alphabets of the language starting from the key
letter and then in Reverse Order in 2nd line.
3. Encrypt the plaintext characters one by one as follows:
a) Pick 1st plaintext character
b) See the matching character in 1st line (step-2) above.
c) Below that character, pick the character from 2nd line. This is the
ciphertext character.
d) Repeat step 3 until plaintext characters are finished.
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
Beaufort Cipher
Simple Version
 Alphabet written Backwards

To be replaced

with
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
Beaufort Cipher
Simple Version
 EXAMPLE:
 What is ciphertext when key is d(3) and plaintext is GOOD

Plaintext: GOOD
Ciphertext: XQQA
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution
Beaufort Cipher
Simple Version
 EXAMPLE 2:
 What is ciphertext when key is f(5) and plaintext is GREAT

KEY f

Plaintext 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
Ciphertext F E D C B A Z Y X W V U T S R Q P O N M L K J I H G

Plaintext:
GREAT
Ciphertext:
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution Beaufort Cipher
Complex Version

Choose a keyword.

Write keyword in first row as header.

Write the plaintext in horizontal rows under the


keyword, with each row being the same length as the
keyword.

Use a tableau, using the row that corresponds to the


keyword letter, and the column that corresponds to
the plaintext letter.
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution Beaufort Cipher
Complex Version

Example:

Plaintext:

Whoever has made a voyage up the Hudson must remember


the Kaatskill mountains.

Keyword:

RIPVANWINKLE
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution Beaufort Cipher
Complex Version
PLAINTEXT LETTERS
Tableau:
KEYWORD LETTERS
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Simple Substitution Beaufort Cipher Complex Version

Encipher step:
R I P V A N W I N K L E

W H O E V E R H A S M A

D E A V O Y A G E U P T

H E H U D S O N M U S T

R E M E M B E R T H E K

A A T S K I L L M O U N

T A I N S

Plaintext:
Whoever has made a voyage up the Hudson
must remember the Kaatskill mountains.
Keyword: RIPVANWINKLE

Ciphertext:
VBBRF JFBNS ZEOEP AMPWC JQWLK EIBXV IVBQT LAEDR OMSRU DHURI WDQFL XBWRR YIHII
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution

 Rather than just shifting the alphabet, shuffle the


letters arbitrarily
 Each plaintext letter maps to a different random
ciphertext letter

 Key is 26 letters long (Difficult to remember!)

 In general, substitution key can be any permutation


of letters
 Need not be a shift
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Here 26! > 288 possible keys! 26 vs 26!

25 vs 288
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution

Plain: 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

Cipher: D K V Q F I B J W P E S C X H T M Y A O U L R G Z N

Example:
 Plaintext: ifwewishtoreplaceletters
 Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution

 How to remember the key?


 Very Difficult

By the way, what was the key in the previous slide?


Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution

Solution:
 Use key as follows:
1. Write key (with repeated letters deleted…STARWAR)
2. Then write all remaining letters row by row
3. Then read off by columns to get ciphertext equivalents

S T A R W
B C D E F
G H I/J K L
M N O P Q
U V X Y Z
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution
S T A R W
B C D E F
G H I/J K L
M N O P Q
U V 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 X cY Z
S B G M U T C H N N V A D I/J O X R E K P Y W F L Q Z
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Monoalphabetic cipher


Complex Substitution

 EXAMPLE: S T A R W
B C D E F
Key = STARWAR G H I/J K L
Plaintext = YOU ARE GOOD M N O P Q
U V X Y Z
What is Ciphertext?.
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
S B G M U T C H N N V A D I/J O X R E K P Y W F L Q Z

c
 SOLUTION:
QOY SEU COOM
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Polyalphabetic cipher

 Use multiple cipher alphabets


 Same plaintext letter could be replaced by several
ciphertext letters

 Makes cryptanalysis harder with more


alphabets to guess
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Polyalphabetic cipher


Vignère Cipher

 Simplest poly-alphabetic substitution cipher


 Key is multiple letters long
 Decryption simply works in reverse
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Polyalphabetic cipher


Vignère Cipher

Method:
 Write the plaintext
 Write the keyword repeated above it
 Use each key letter as a Caesar cipher key
 Encrypt the corresponding plaintext letter
 Use these in turn on the rest of the message
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Polyalphabetic cipher


Vignère Cipher

Example:
 Keyword: deceptive

 key: deceptivedeceptivedeceptive
 plaintext: wearediscoveredsaveyourself
 ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ

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

0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Polyalphabetic cipher


Vignère Cipher
Auto-key Vignère cipher

Method:
 Key as long as the message
 Keyword is prefixed to message as key
 Use each key letter as a Caesar cipher key
 Encrypt the corresponding plaintext letter
 Use these in turn on the rest of the message
Symmetric-key cryptography Traditional ciphers

Substitution Ciphers Polyalphabetic cipher


Vignère Cipher
Auto-key Vignère cipher

Example:
 Keyword: deceptive

 key: deceptivewearediscoveredsav
 plaintext: wearediscoveredsaveyourself
 ciphertext: ZICVTWQNGKZEIIGASXSTSLVVWLA

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

0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
Information Security Cryptography

Assignment # 3
Due: Next Lecture

Review Questions:

1. In symmetric-key cryptography, how many keys are needed if 2


persons want to communicate with each other?
2. In symmetric-key cryptography, can Ali use the same key to
communicate with both Babur and Mateen? Explain your answer.
3. In symmetric-key cryptography, if every person in a group of 10
people needs to communicate with every other person in
another group of 10 people, how many secret keys are needed?
4. In symmetric-key cryptography, if every person in a group of 10
people needs to communicate with every other person in the
group, how many secret keys are needed?
5. Repeat Questions 1 to 4 for asymmetric-key cryptography.
Information Security Cryptography

Assignment #3
Due: Next Lecture

Review Questions:

6. In symmetric-key cryptography, how do you think two persons


can establish a secret key between themselves?
7. In asymmetric-key cryptography, how do you think two persons
can establish two pairs of keys between themselves?
8. Encrypt the message “DO NOT CHEAT PLZ" using a shift cipher
with a key of 10. Ignore the space between words. Decrypt the
message to get the original plaintext.
9. Can we use monoalphabetic substitution if our symbols are just
0 and 1? Is it a good idea?
10.Can we use polyalphabetic substitution if our symbols are just 0
and 1? Is it a good idea?

You might also like