4 - C235 LP2 Lecture 4.1 - Cryptography
4 - C235 LP2 Lecture 4.1 - Cryptography
Management
Lecture 4.1 - Cryptography
Learning Objectives
Symmetric
Symmetric Asymmetric
Asymmetric
Cipher
Cipher Cipher
Cipher
Substitution
Substitution Transposition
Transposition
Cipher
Cipher Cipher
Cipher
Polyalphabetic
Polyalphabetic
Cipher
Cipher
Legend
Topics for this week
Monoalphabetic
Cipher Topics for Week 7
Substitution Cipher
What is Substitution Cipher?
Q W E R T Y U I O P A S D F G H J K L Z X C V B N M
Plain Text: A R R I V E D
Cipher Text: QK KOC TR
Cipher - Polyalphabetic
• Caesar Cipher
• Vigenere Cipher
• One-Time Pad
Encryption Caesar Ciphers
• Encryption is to substitute each letter with another letter
nth places further along the alphabet. For example, if n=3,
the letters are shifted as follows:
Plaintext: WE ARE HERE
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 B C
A B C D E F G H I J K L M N O P Q R S T U V W XX YY ZZ
X Y Z
Plaintext:
Decryption Caesar Ciphers
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
X Y Z
A. RESTING
B. TAILING
C. SAILING
D. SINGING
Quiz
A. YJWWTW
B. CNAAXA
C. ALYYVY
D. VGTTQT
Vigenere Cipher
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
• Requires B
C
B C D
C D E
E
F
F
G
G
H
H
I
I
J
J
K
K
L
L
M
M
N
N
O
O
P
P
Q
Q
R
R
S
S
T
T
U
U
V
V
W
W
X
X
Y
Y
Z
Z
A
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
Vigenere Table E
F
E F G
F G H
H
I
I
J
J
K
K
L
L
M
M
N
N
O
O
P
P
Q
Q
R
R
S
S
T
T
U
U
V
V
W
W
X
X
Y
Y
Z
Z
A
A
B
B
C
C
D
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
Key H
I
H I J
I J K
K
L
L
M
M
N
N
O
O
P
P
Q
Q
R
R
S
S
T
T
U
U
V
V
W
W
X
X
Y
Y
Z
Z
A
A
B
B
C
C
D
D
E
E
F
F
G
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
M 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 L
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 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
Encryption Vigenere Cipher
For example,
encrypt the plaintext
‘KING OF ENGLAND’ with
the key ‘SCOT’
Plaintext K I N G O F E N G L A N D
Key S C O T S C O T S C O T S
Cipher
Text CC KK BB ZZ G H S G Y N O G V
Decryption Vigenere Cipher
Key S C O T S C O T S C O T S
Plaintext
K II NN G
K G O F E N G L A N D
Quiz
Plaintext: 18
S 10
K 24
Y The mod 26 operation
+ 18+2 (mod 26) = 20 (U)
10 + 7 (mod 26) = 17 (R)
Key: C
2 H
7 D
3
24 + 3 (mod 26) = 1 (B)
Ciphertext: U
20 R
17 B
1
Decryption One-Time Pad
Ciphertext: U
20 R
17 B
1 The mod 26 operation
- 20 - 2 (mod 26) = 18 (S)
17 – 7 (mod 26) = 10 (K)
Key: C2 H7 D3
1 – 3 (mod 26) = 24 (Y)
Plaintext: S
18 K
10 Y
24
Application - One-time Pad
• For example:
Plaintext: YOU ARE IN DANGER
Ciphertext: REGNAD NI ERA UOY
is a form of transposition cipher.
Examples of Transposition Ciphers
Key : SCOT
S C O T
3 1 2 4 1. Write down the Key and the
alphabetical order of the letters in
W E A R the key
E D I S
C O V E 2. Write down the letters in the
R E D F appropriate column
L E E A
T O N C 3. Read off the message row by
E X Z E row
Plaintext: WE ARE DISCOVERED FLEE AT ONCE XZE These letters are fillers
Quiz
• If the length of the of a columnar
transposition cipher is 5, how many possible
keys are there?
A. 5
B. 5x5x5x5x5
C. 5x4x3x2x1
D. 50
Quiz
• Given that the key of a columnar transposition
cipher is BOAT. If the plaintext is STAY PUT
WAIT FOR ME, what is the ciphertext?
A. YWFE SPAO TUIR ATTM
B. ATTM SPAO TUIR YWFE
C. SPAO ATTM YWFE TUIR
D. ATTM TUIR SPAO YWFE
Quiz
• Given that the key of a columnar transposition
cipher is PIG. If the ciphertext is GTT OAA DCR,
what is the plaintext?
A. DOG RAT CAT
B. CAT DOG RAT
C. RAT DOG CAT
D. DOG CAT RAT
Cipher - Rail Fence Transposition
Encryption
Plaintext : WE ARE DISCOVERED FLEE AT ONCE
Key : 3
The key refers to number of rows.
Next the text will be arranged in a zig-zag manner as shown below:
W E C R L T E
E R D
R SS O EE EE F EE A O
O C
AA II V D EF N
Step 4:
2:
1: Fill
3: Form
Count
Sinceupakey=3,
the
how
table,
letter
manywith
on
there letters
25
thecolumns
are 31rows
in
st
row
theand
till
and
ciphertext.
the
3 rows.
we position
can of
derive
the last letter
position of case
In this each isrow.
25.
• Followed by the 2nd below and finally the last
25 Columns
1
W 5E 9
C 13
R 17
L 21
T 25
E
3 Rows E
2 R
4 D
6 8 10
S O 12
E 14
E 16
F 18
E 20
A 22
O 24
C
A
3 I 7 11
V 15
D 19
E N
23
Plaintext : WEAREDISCOVEREDFLEEATONCE
Quiz
• Given that the key of a rail fence cipher is 3. If
the plaintext is NEVER GIVE UP ON ME, what
is the ciphertext?
A. NVRIEPNEEEGVUOM
B. NINEGVOMVREPEEU
C. NRENEEGVUOMVIPE
D. NEEVUVIPEEGOMRN
Quiz
• Given that the key of a rail fence cipher is 3. If
the ciphertext is FEISSTATSBGETAISSTGEE,
what is the plaintext?
A. BIGGEST FASTEST EASIEST
B. FASTEST EASIEST BIGGEST
C. EASIEST FASTEST BIGGEST
D. FASTEST BIGGEST EASIEST
At the end of you should be able to:
the lesson,