Chapter 2 Part1
Chapter 2 Part1
Algorithms
12/14/2024 1
Outline
12/14/2024 2
Chapter Objectives
▪ At the end of this chapter, students will be able to understand:
▪ Basics of cryptography
12/14/2024 3
Introduction to Cryptography
▪ Definition
12/14/2024 6
Goal and Services of Cryptography
been monitored
12/14/2024 7
Goal and Services of Cryptography…
▪ Confidentiality (secrecy)
▪ Integrity (anti-tampering)
▪ Authentication
▪ Non-repudiation.
12/14/2024 8
Goal and Services of Cryptography…
1. Confidentiality (secrecy)
▪ Ensuring that no one can read the message except the intended receiver
▪ Data is kept secret from those without the proper credentials, even if
that data travels through an insecure medium.
12/14/2024 9
Goal and Services of Cryptography…
2. Integrity (anti-tampering)
▪ Assuring the receiver that the received message has not been altered in
any way from the original.
12/14/2024 10
Goal and Services of Cryptography…
3. Authentication
12/14/2024 11
Components of Cryptography
▪ Cryptography has five basic components:
1. Plain text: the message that you want to encrypt
2. Cipher text: the encrypted output (transformed message)
▪ [Fig. from Ref1, Stallings & Brown, Figure 2.1 Simplified Model of Symmetric Encryption , P42.]
12/14/2024 13
Components of Cryptography…
▪ Secret Key…
▪ A key can be thought of as simply a collection of
0101001110
bits
10111101110
▪ The more bits, the stronger the key 1100101
12/14/2024 14
Encryption and Decryption in Cryptography
▪ Encryption
12/14/2024 15
Encryption and Decryption in Cryptography…
▪ Decryption
Data
12/14/2024 16
Classical cryptographic systems
h o l Cipher text:
e l w r d
hol elwrd lo
l o
Caesar Cipher
▪ The Caesar Cipher technique is one of the earliest and simplest
methods of encryption technique.
12/14/2024 19
Caesar Cipher…
which indicates the number of positions each letter of the text has been
moved down.
B = 1,…, Z = 25.
12/14/2024 20
Caesar Cipher…
▪ Encryption of a letter by a shift n can be described mathematically as:
𝐸𝑛 𝑥 = 𝑥 + 𝑛 𝑚𝑜𝑑(26)
(Encryption Phase with shift n)
𝐷𝑛 𝐸𝑛 𝑥 = 𝑥 − 𝑛 𝑚𝑜𝑑(26)
Note: If any case (Dn) value becomes negative (-ve), in this case, we will
add 26 in the negative value.
12/14/2024 21
Caesar Cipher…
▪ Use the Caesar cipher to encrypt and decrypt the message “MEET ME AT
TOGA PARTY" and the key (shift) value of this message is 3.
12/14/2024 22
Cont. …
Plain text=M En (12+3)mod 26 Cipher Text:15->P Plain text=T En (19+3)mod 26 Cipher Text:22->W
Plain text=E En (4+3)mod 26 Cipher Text:7->H Plain text=T En (19+3)mod 26 Cipher Text:22->W
Plain text=E En (4+3)mod 26 Cipher Text:7->H Plain text=O En (14+3)mod 26 Cipher Text:17->R
Plain text=T En (19+3)mod 26 Cipher Text:22->W Plain text=G En (6+3)mod 26 Cipher Text:9->J
Plain text=M En (12+3)mod 26 Cipher Text:15->P Plain text=A En (0+3)mod 26 Cipher Text:3->D
Plain text=E En (4+3)mod 26 Cipher Text:7->H Plain text=P En (15+3)mod 26 Cipher Text:18->S
Plain text=A En (0+3)mod 26 Cipher Text:3->D Plain text=A En (0+3)mod 26 Cipher Text:3->D
E_n(x)=(x+n)mod\ 26 Plain text=R En (17+3)mod 26 Cipher Text:20->U
The cypher message will be Plain text=T En (19+3)mod 26 Cipher Text:22->W
“PHHWPHDWWRJDSDUWB”
Plain text=Y En (24+3)mod 26 Cipher Text:27->B
Exercise
Prepare a cypher text for the following message
‘’we are running out of bullet and food the enemy is approaching we can’t keep our position more
than two days”
Caesar Cipher…
▪ Weakness of Caesar Cipher
12/14/2024 24
Caesar Cipher…
▪ Weakness of Caesar Cipher…
▪ After all, there are only 26 viable keys in the ordinary alphabet, and
only 255 useful keys in the ASCII alphabet!
12/14/2024 25
Caesar Cipher…
▪ Weakness of Caesar Cipher…
12/14/2024 26
Cryptanalysis and Types of Attacks
▪ Cryptology has two parts namely, Cryptography which focuses on
creating secret codes and Cryptanalysis which is the study of the
cryptographic algorithm and the breaking of those secret codes.
12/14/2024 27
Cryptanalysis and Types of Attacks…
12/14/2024 28
Cryptanalysis and Types of Attacks…
▪ Types of Cryptanalytic Attacks: cryptanalyst knows [at least] ciphertext &
encryption algorithm
▪ One possible attack: Brute-force – trying all keys, but impractical for large
key space
Table below: Average Time Required for Exhaustive Key Search [from Ref1, P 44]
12/14/2024 29
Cryptanalysis and Types of Attacks…
▪ Types of Cryptanalytic Attacks:
1. Known plain text analysis (KPA)
12/14/2024 30
Cryptanalysis and Types of Attacks…
▪ Types of Cryptanalytic Attacks:
12/14/2024 31
Cryptanalysis and Types of Attacks…
▪ Types of Cryptanalytic Attacks:
▪ In this type of attack, the attacker chooses random plaintexts and obtains
the corresponding ciphertexts and tries to find the encryption key.
▪ Happens if analyst is able to get into source and insert chosen text
patterns that can reveal structure of the key
▪ Its very simple to implement like KPA but the success rate is quite low.
12/14/2024 32
Cryptanalysis and Types of Attacks…
▪ In this type of attack, only some cipher-text is known and the attacker
ciphertext is required.
12/14/2024 33
Cryptanalysis and Types of Attacks…
▪ Types of Cryptanalytic Attacks:
▪ This attack is similar CPA. Here, the attacker requests the cipher texts
12/14/2024 34
Cryptanalysis and Types of Attacks…
▪ Types of Attacks on Encrypted Messages :
12/14/2024 35
• THANK YOU
quiz
• What is cryptography and cryptoanalysis?
• What are advantages and problems with Caesar Cipher?