0% found this document useful (0 votes)
50 views

4 - C235 LP2 Lecture 4.1 - Cryptography

The document discusses cryptography and symmetric ciphers. It explains basic concepts in cryptography like encryption, decryption, and cryptanalysis. It also describes different types of symmetric ciphers like substitution ciphers and transposition ciphers. Specific substitution ciphers discussed include the Caesar cipher and Vigenere cipher.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

4 - C235 LP2 Lecture 4.1 - Cryptography

The document discusses cryptography and symmetric ciphers. It explains basic concepts in cryptography like encryption, decryption, and cryptanalysis. It also describes different types of symmetric ciphers like substitution ciphers and transposition ciphers. Specific substitution ciphers discussed include the Caesar cipher and Vigenere cipher.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

C235 – IT Security and

Management
Lecture 4.1 - Cryptography
Learning Objectives

• Explain the basic concepts of cryptography

• Explain the basic workings of symmetric ciphers

• Apply encryption and decryption using symmetric


ciphers
Keywords
• Cryptography
– Ensuring privacy by keeping information hidden from anyone for
whom it is not intended.
• Cryptanalysis
– Finding a method to break encrypted message given incomplete
information (no key, unknown encryption method, etc).
• Encryption
– Transformation of data into a form that is as close to impossible
to read.
• Decryption
– Transformation of encrypted data back into an intelligible form.
Keywords
Encryption method/algorithm that
Original data that is encrypted determines the steps to encrypt the
into an unreadable form original data

Original data that is to be kept secret Piece of information that changes


- Could be a human-readable text file the output of the encryption
- Or a computer binary file process
Chart
Cryptography
Cryptography

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?

• The name substitution cipher comes from the fact


that each letter that you want to encipher is
substituted by another letter .

• The message you want to keep secret (plaintext) is


transformed into the enciphered message
(ciphertext) by substituting each letter by another
letter.
Types of Substitution Cipher

• There are 2 types of substitution cipher


Monoalphabetic cipher
 Polyalphabetic cipher
Cipher - Monoalphabetic
• In a monoalphabetic cipher, substitution letters
are random permutation of the 26 letters of the
alphabet, for example: 
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

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

• Each letter of a plaintext is substituted by one and only


one letter in the permutation to form the ciphertext:

Plain Text: A R R I V E D
Cipher Text: QK KOC TR
Cipher - Polyalphabetic

• In polyalphabetic cipher, each letter can be


substituted by more than one letter.

• For example, the plaintext ARRIVED can be encrypted


as
Plaintext: A R R I V E D
Ciphertext: P T U K L B F

Note that the letter R is substituted as T and U.


Examples of Substitution Ciphers

• 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

Ciphertext: ZH DUH KHUH


Decryption Caesar Ciphers

Decryption is to substitute each letter with another letter


nth places back along the alphabet

Ciphertext: ZH DUH KHUH

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

Decryption is to substitute each letter with another letter


nth places back along the alphabet
Ciphertext: ZH DUH KHUH
Key: 3

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

Plaintext: WE ARE HERE


Quiz

• Caesar cipher is a polyalphabetic cipher


A. True
B. False
Quiz

• In a Caesar cipher, the letter G is encrypted as


the letter K. What is the key of this Caesar
cipher?
A. 3
B. 4
C. 5
D. 6
Quiz

• Given that the key of a Caesar cipher is 7, the


plaintext for the ciphertext ‘ZHPSPUN’ is

A. RESTING
B. TAILING
C. SAILING
D. SINGING
Quiz

• Given that the key of a Caesar cipher is 9, the


ciphertext for the plaintext ‘TERROR’ is

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

For example, to decrypt


the message:
CKBZGHSGYNOGV
Key is SCOT
Cipher
Text C K B Z G H S G Y N O G V

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

• Vigenere cipher is a monoalphabetic


cipher.
A. True
B. False
Quiz

• Given that the key of a Vigenere cipher is


‘CAT’. If the plaintext is ‘CONFIDENTIAL’,
what is the ciphertext?
A. HCMKWCJBSNOK
B. FCTIWJHBZLOR
C. EOGHIWGNMKAE
D. JEOMYELDUPQM
Quiz

• Given that the key of a Vigenere cipher is


‘DARK’. If the ciphertext is ‘GOTEPEED’,
what is the plaintext?
A. SETTINGS
B. DOCUMENT
C. UNKNOWNS
D. WEDDINGS
Encryption One-Time Pad

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

• The One Time Pad can be used to generate


One Time Password in bank Transaction
Quiz

• One Time-pad is a polyalphabetic cipher.


A. True
B. False
Quiz

• Given that the key of a One Time-pad cipher is


GUN. If the plaintext is PEN, what is the
ciphertext?
A. WYA
B. VYA
C. WXA
D. VYB
Quiz

• Given that the key of a One Time-pad cipher is


BIT. If the ciphertext is SCG, what is the
plaintext?
A. GUN
B. RAT
C. RUN
D. RAG
Transposition Cipher
What is Transposition Cipher?

• In Transposition cipher, plaintext characters are


rearranged in some regular pattern to form
ciphertext.

• For example:
Plaintext: YOU ARE IN DANGER
Ciphertext: REGNAD NI ERA UOY
is a form of transposition cipher.
Examples of Transposition Ciphers

• Columnar Transposition Cipher


• Rail Fence Transposition Cipher
Cipher - Columnar Transposition
Encryption
Plaintext: WE ARE DISCOVERED FLEE AT ONCE
Key : SCOT
S C O T Number of columns is
3 1 2 4 defined by the length of the
Message is written out in
rows of a fixed length. key.
W E A R
E D I S
C O V E Columns are ordered by
R E D F the alphabetical order of
Random filler letters the letters in the key.
L E E A
to complete the columns
T O N C
E X Z E
Message is read out
column by column

Ciphertext: EDOEEOX AIVDENZ WECRLTE RSEFACE


Cipher - Columnar Transposition
Decryption
Ciphertext: EDOEEOX AIVDENZ WECRLTE RSEFACE

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    

read from the 1st row till the last row.


The following is the ciphertext
Cipher - Rail Fence Transposition
Decryption
Ciphertext : WECRLTEERDSOEEFEAOCAIVDEN
Key : 3

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,

• Explain the basic concepts of cryptography

• Explain the basic workings of symmetric ciphers

• Apply encryption and decryption using symmetric


ciphers

You might also like