SlideShare a Scribd company logo
Chapter 30 Cryptography Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
30-1  INTRODUCTION Let us introduce the issues involved in cryptography. First, we need to define some terms; then we give some taxonomies. Definitions Two Categories Topics discussed in this section:
Figure 30.1  Cryptography components
Figure 30.2  Categories of cryptography
Figure 30.3  Symmetric-key cryptography
In symmetric-key cryptography, the same key is used by the sender (for encryption)  and the receiver (for decryption). The key is shared. Note
Figure 30.4  Asymmetric-key cryptography
Figure 30.5  Keys used in cryptography
Figure 30.6  Comparison between two categories of cryptography
30-2  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.  Traditional Ciphers Simple Modern Ciphers Modern Round Ciphers Mode of Operation Topics discussed in this section:
Figure 30.7  Traditional ciphers
A substitution cipher replaces one symbol with another. Note
The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.1 Solution The cipher is probably monoalphabetic because both occurrences of L’s are encrypted as O’s.
The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.2 Solution The cipher is not monoalphabetic because each occurrence of L is encrypted by a different character. The first L is encrypted as N; the second as Z.
The shift cipher is sometimes referred to as the Caesar cipher. Note
Use the shift cipher with key = 15 to encrypt the message “HELLO.” Solution We encrypt one character at a time. Each character is shifted 15 characters down. Letter H is encrypted to W. Letter E is encrypted to T. The first L is encrypted to A. The second L is also encrypted to A. And O is encrypted to D. The cipher text is  WTAAD . Example 30.3
Use the shift cipher with key = 15 to decrypt the message “WTAAD.” Solution We decrypt one character at a time. Each character is shifted 15 characters up. Letter W is decrypted to H. Letter T is decrypted to E. The first A is decrypted to L. The second A is decrypted to L. And, finally, D is decrypted to O. The plaintext is  HELLO . Example 30.4
A transposition cipher reorders (permutes) symbols in a block of symbols. Note
Figure 30.8  Transposition cipher
Encrypt the message “HELLO MY DEAR,” using the key shown in Figure 30.8. Solution We first remove the spaces in the message. We then divide the text into blocks of four characters. We add a bogus character Z at the end of the third block. The result is HELL OMYD EARZ. We create a three-block ciphertext  ELHLMDOYAZER . Example 30.5
Using Example 30.5, decrypt the message “ELHLMDOYAZER”. Solution The result is HELL OMYD EARZ. After removing the bogus character and combining the characters, we get the original message “ HELLO MY DEAR .” Example 30.6
Figure 30.9  XOR cipher
Figure 30.10  Rotation cipher
Figure 30.11  S-box
Figure 30.12  P-boxes: straight, expansion, and compression
Figure 30.13  DES
Figure 30.14  One round in DES ciphers
Figure 30.15  DES function
Figure 30.16  Triple DES
Table 30.1  AES configuration
AES has three different configurations with respect to the number of rounds and key size. Note
Figure 30.17  AES
Figure 30.18  Structure of each round
Figure 30.19  Modes of operation for block ciphers
Figure 30.20  ECB mode
Figure 30.21  CBC mode
Figure 30.22  CFB mode
Figure 30.23  OFB mode
30-3  ASYMMETRIC-KEY CRYPTOGRAPHY An asymmetric-key (or public-key) cipher uses two keys: one private and one public. We discuss two algorithms: RSA and Diffie-Hellman. RSA Diffie-Hellman Topics discussed in this section:
Figure 30.24  RSA
In RSA,  e  and  n  are announced to the public;  d  and    are kept secret. Note
Bob chooses 7 and 11 as p and q and calculates  n = 7 · 11 = 77. The value of    = (7 − 1) (11 − 1) or 60. Now he chooses two keys, e and d. If he chooses e to be 13, then d is 37. Now imagine Alice sends the plaintext 5 to Bob. She uses the public key 13 to encrypt 5. Example 30.7
Example 30.7 (continued) Bob receives the ciphertext 26 and uses the private key 37 to decipher the ciphertext: The plaintext  5  sent by Alice is received as plaintext  5  by Bob.
Jennifer creates a pair of keys for herself. She chooses  p = 397 and q = 401. She calculates n = 159,197 and    = 396 · 400 = 158,400. She then chooses e = 343 and  d = 12,007. Show how Ted can send a message to Jennifer if he knows e and n. Example 30.8
Solution Suppose Ted wants to send the message “ NO ” to Jennifer. He changes each character to a number (from 00 to 25) with each character coded as two digits. He then concatenates the two coded characters and gets a four-digit number. The plaintext is 1314. Ted then uses e and n to encrypt the message. The ciphertext is 1314 343  = 33,677 mod 159,197. Jennifer receives the message 33,677 and uses the decryption key d to decipher it as 33,677 12,007  = 1314 mod 159,197. Jennifer then decodes 1314 as the message “NO”. Figure 30.25 shows the process. Example 30.8 (continuted)
Figure 30.25  Example 30.8
Let us give a realistic example. We randomly chose an integer of 512 bits. The integer p is a 159-digit number.  Example 30.9 The integer q is a 160-digit number.
We calculate n. It has 309 digits:  Example 30.9 (continued) We calculate   . It has 309 digits:
We choose e = 35,535. We then find d. Example 30.9 (continued) Alice wants to send the message “THIS IS A TEST” which can be changed to a numeric value by using the 00–26 encoding scheme (26 is the space character).
The ciphertext calculated by Alice is C = P e , which is. Example 30.9 (continued) Bob can recover the plaintext from the ciphertext by using P = C d , which is The recovered plaintext is  THIS IS A TEST  after decoding.
The symmetric (shared) key in the  Diffie-Hellman protocol is K = g xy  mod p. Note
Let us give a trivial example to make the procedure clear. Our example uses small numbers, but note that in a real situation, the numbers are very large. Assume g = 7 and   p = 23. The steps are as follows: 1.  Alice chooses x = 3 and calculates R 1  = 7 3  mod 23 = 21. 2.  Bob chooses y = 6 and calculates R 2  = 7 6  mod 23 = 4. 3.  Alice sends the number 21 to Bob. 4.  Bob sends the number 4 to Alice. 5.  Alice calculates the symmetric key K = 4 3  mod 23 = 18. 6.  Bob calculates the symmetric key K = 21 6  mod 23 = 18. The value of K is the same for both Alice and Bob;  g xy  mod p = 7 18  mod 23 = 18. Example 30.10
Figure 30.27  Diffie-Hellman idea
Figure 30.28  Man-in-the-middle attack

More Related Content

What's hot

Greedy Algorithm - Huffman coding
Greedy Algorithm - Huffman codingGreedy Algorithm - Huffman coding
Greedy Algorithm - Huffman coding
Md Monirul Alom
 
Application of bases
Application of basesApplication of bases
Application of bases
Abdur Rehman
 
Dynamic and verifiable hierarchical secret sharing
Dynamic and verifiable hierarchical secret sharingDynamic and verifiable hierarchical secret sharing
Dynamic and verifiable hierarchical secret sharing
National Chengchi University
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
ShivangiSingh241
 
Error Detection and Correction
Error Detection and CorrectionError Detection and Correction
Error Detection and CorrectionTechiNerd
 
Syed Ubaid Ali Jafri - Cryptography Techniques
Syed Ubaid Ali Jafri - Cryptography TechniquesSyed Ubaid Ali Jafri - Cryptography Techniques
Syed Ubaid Ali Jafri - Cryptography Techniques
Syed Ubaid Ali Jafri
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
Intro C# Book
 
IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015
Aron Kondoro
 
data representation
 data representation data representation
data representation
Haroon_007
 
Number Systems
Number SystemsNumber Systems
Number Systems
Infinity Tech Solutions
 
Lesson 2 math 4 alternative
Lesson 2 math 4 alternativeLesson 2 math 4 alternative
Lesson 2 math 4 alternative
AlpheZarriz
 
3.1 Extreme Values of Functions
3.1 Extreme Values of Functions3.1 Extreme Values of Functions
3.1 Extreme Values of FunctionsSharon Henry
 

What's hot (16)

Greedy Algorithm - Huffman coding
Greedy Algorithm - Huffman codingGreedy Algorithm - Huffman coding
Greedy Algorithm - Huffman coding
 
Application of bases
Application of basesApplication of bases
Application of bases
 
Dynamic and verifiable hierarchical secret sharing
Dynamic and verifiable hierarchical secret sharingDynamic and verifiable hierarchical secret sharing
Dynamic and verifiable hierarchical secret sharing
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
 
Error Detection and Correction
Error Detection and CorrectionError Detection and Correction
Error Detection and Correction
 
Ch 30
Ch 30Ch 30
Ch 30
 
Syed Ubaid Ali Jafri - Cryptography Techniques
Syed Ubaid Ali Jafri - Cryptography TechniquesSyed Ubaid Ali Jafri - Cryptography Techniques
Syed Ubaid Ali Jafri - Cryptography Techniques
 
Ch 29
Ch 29Ch 29
Ch 29
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
 
IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015
 
data representation
 data representation data representation
data representation
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Lesson 2 math 4 alternative
Lesson 2 math 4 alternativeLesson 2 math 4 alternative
Lesson 2 math 4 alternative
 
3.1 Extreme Values of Functions
3.1 Extreme Values of Functions3.1 Extreme Values of Functions
3.1 Extreme Values of Functions
 
Handout fraction
Handout fractionHandout fraction
Handout fraction
 

Viewers also liked

Lecture 03
Lecture 03Lecture 03
Lecture 03
Faisal Mehmood
 
Lecture 15 sequences
Lecture 15 sequencesLecture 15 sequences
Lecture 15 sequences
Faisal Mehmood
 
Mining from Open Answers in Questionnaire Data
Mining from Open Answers in Questionnaire DataMining from Open Answers in Questionnaire Data
Mining from Open Answers in Questionnaire Datafeiwin
 
Statistics Primer
Statistics PrimerStatistics Primer
Statistics Primer
Paul McDonald
 
Lecture 01
Lecture 01 Lecture 01
Lecture 01
Faisal Mehmood
 
Lecture 02
Lecture 02Lecture 02
Lecture 02
Faisal Mehmood
 
Lecture 14(d)
Lecture 14(d)Lecture 14(d)
Lecture 14(d)
Faisal Mehmood
 
Lecture 20 combinatorics o
Lecture 20 combinatorics oLecture 20 combinatorics o
Lecture 20 combinatorics oFaisal Mehmood
 
Lecture 04
Lecture 04Lecture 04
Lecture 04
Faisal Mehmood
 
Lecture 08
Lecture 08Lecture 08
Lecture 08
Faisal Mehmood
 
Lect1 dr attia
Lect1 dr attiaLect1 dr attia
Lect1 dr attia
qutabsh
 

Viewers also liked (20)

Lecture 03
Lecture 03Lecture 03
Lecture 03
 
Lecture 26
Lecture 26Lecture 26
Lecture 26
 
Lecture 15 sequences
Lecture 15 sequencesLecture 15 sequences
Lecture 15 sequences
 
Mining from Open Answers in Questionnaire Data
Mining from Open Answers in Questionnaire DataMining from Open Answers in Questionnaire Data
Mining from Open Answers in Questionnaire Data
 
Aptitude average
Aptitude averageAptitude average
Aptitude average
 
Statistics Primer
Statistics PrimerStatistics Primer
Statistics Primer
 
Lecture 01
Lecture 01 Lecture 01
Lecture 01
 
Lecture 02
Lecture 02Lecture 02
Lecture 02
 
Lecture 14(d)
Lecture 14(d)Lecture 14(d)
Lecture 14(d)
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 35 prob
Lecture 35 probLecture 35 prob
Lecture 35 prob
 
Lecture 20 combinatorics o
Lecture 20 combinatorics oLecture 20 combinatorics o
Lecture 20 combinatorics o
 
Lecture 04
Lecture 04Lecture 04
Lecture 04
 
Lecture 36
Lecture 36 Lecture 36
Lecture 36
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Searl pk
Searl pkSearl pk
Searl pk
 
Lecture 44
Lecture 44Lecture 44
Lecture 44
 
Lecture 08
Lecture 08Lecture 08
Lecture 08
 
Lect1 dr attia
Lect1 dr attiaLect1 dr attia
Lect1 dr attia
 
Lecture 27
Lecture 27Lecture 27
Lecture 27
 

Similar to Chapter 30

30 Cryptography
30 Cryptography30 Cryptography
30 Cryptography
Ahmar Hashmi
 
1network security encryption_methods-1
1network security encryption_methods-11network security encryption_methods-1
1network security encryption_methods-1
Aman Jaiswal
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt
PrasoonRajpoot
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt
0567Padma
 
#KPC #EE & ETCE #Cryptography
#KPC #EE & ETCE  #Cryptography#KPC #EE & ETCE  #Cryptography
#KPC #EE & ETCE #Cryptography
KEIKolkata
 
Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02
Saif Kassim
 
Network security
Network securityNetwork security
Network securitySisir Ghosh
 
Asymmetric Cryptography.pptx
Asymmetric Cryptography.pptxAsymmetric Cryptography.pptx
Asymmetric Cryptography.pptx
diaa46
 
Hill code
Hill codeHill code
Hill code
Hussain111321
 
Cryptography
CryptographyCryptography
Cryptography
fsl khan
 
Rsa cryptosystem
Rsa cryptosystemRsa cryptosystem
Rsa cryptosystem
Abhishek Gautam
 
ch-03.ppt
ch-03.pptch-03.ppt
ch-03.ppt
Manoj R. Kharde
 
Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03
Saif Kassim
 
Stallings Kurose and Ross
Stallings Kurose and RossStallings Kurose and Ross
Stallings Kurose and Ross
Information Security Awareness Group
 
Novel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsaNovel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsa
Soham Mondal
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentation
Soham Mondal
 
1329 n 9460
1329 n 94601329 n 9460
1329 n 9460
kicknit123
 

Similar to Chapter 30 (20)

30 Cryptography
30 Cryptography30 Cryptography
30 Cryptography
 
1network security encryption_methods-1
1network security encryption_methods-11network security encryption_methods-1
1network security encryption_methods-1
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt
 
#KPC #EE & ETCE #Cryptography
#KPC #EE & ETCE  #Cryptography#KPC #EE & ETCE  #Cryptography
#KPC #EE & ETCE #Cryptography
 
Unit 3
Unit 3Unit 3
Unit 3
 
Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02
 
Network security
Network securityNetwork security
Network security
 
Asymmetric Cryptography.pptx
Asymmetric Cryptography.pptxAsymmetric Cryptography.pptx
Asymmetric Cryptography.pptx
 
Hill code
Hill codeHill code
Hill code
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography
CryptographyCryptography
Cryptography
 
Rsa cryptosystem
Rsa cryptosystemRsa cryptosystem
Rsa cryptosystem
 
ch-03.ppt
ch-03.pptch-03.ppt
ch-03.ppt
 
G029037043
G029037043G029037043
G029037043
 
Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03
 
Stallings Kurose and Ross
Stallings Kurose and RossStallings Kurose and Ross
Stallings Kurose and Ross
 
Novel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsaNovel encryption algorithm and software development ecc and rsa
Novel encryption algorithm and software development ecc and rsa
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentation
 
1329 n 9460
1329 n 94601329 n 9460
1329 n 9460
 

More from Faisal Mehmood

Indoor Comfort Index Monitoring System using KNN algorithm
Indoor Comfort Index Monitoring System using KNN algorithmIndoor Comfort Index Monitoring System using KNN algorithm
Indoor Comfort Index Monitoring System using KNN algorithm
Faisal Mehmood
 
Raspberry pi and Google Cloud
Raspberry pi and Google CloudRaspberry pi and Google Cloud
Raspberry pi and Google Cloud
Faisal Mehmood
 
Raspberry pi and Azure
Raspberry pi and AzureRaspberry pi and Azure
Raspberry pi and Azure
Faisal Mehmood
 
Raspberry pi and AWS
Raspberry pi and AWSRaspberry pi and AWS
Raspberry pi and AWS
Faisal Mehmood
 
Raspbian Noobs
Raspbian NoobsRaspbian Noobs
Raspbian Noobs
Faisal Mehmood
 
Lecture 36 laws of prob
Lecture 36 laws of probLecture 36 laws of prob
Lecture 36 laws of probFaisal Mehmood
 
Lecture 19 counting
Lecture 19 countingLecture 19 counting
Lecture 19 counting
Faisal Mehmood
 
Lecture 18 recursion
Lecture 18 recursionLecture 18 recursion
Lecture 18 recursion
Faisal Mehmood
 
Lecture 17 induction
Lecture 17 inductionLecture 17 induction
Lecture 17 induction
Faisal Mehmood
 
Lecture 16 SERIES
Lecture 16  SERIESLecture 16  SERIES
Lecture 16 SERIES
Faisal Mehmood
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
Faisal Mehmood
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
Faisal Mehmood
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
Faisal Mehmood
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
Faisal Mehmood
 
Lecture 09
Lecture 09Lecture 09
Lecture 09
Faisal Mehmood
 

More from Faisal Mehmood (19)

Indoor Comfort Index Monitoring System using KNN algorithm
Indoor Comfort Index Monitoring System using KNN algorithmIndoor Comfort Index Monitoring System using KNN algorithm
Indoor Comfort Index Monitoring System using KNN algorithm
 
Raspberry pi and Google Cloud
Raspberry pi and Google CloudRaspberry pi and Google Cloud
Raspberry pi and Google Cloud
 
Raspberry pi and Azure
Raspberry pi and AzureRaspberry pi and Azure
Raspberry pi and Azure
 
Raspberry pi and AWS
Raspberry pi and AWSRaspberry pi and AWS
Raspberry pi and AWS
 
Raspbian Noobs
Raspbian NoobsRaspbian Noobs
Raspbian Noobs
 
Lecture 37 cond prob
Lecture 37 cond probLecture 37 cond prob
Lecture 37 cond prob
 
Lecture 36 laws of prob
Lecture 36 laws of probLecture 36 laws of prob
Lecture 36 laws of prob
 
Lecture 25
Lecture 25Lecture 25
Lecture 25
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19 counting
Lecture 19 countingLecture 19 counting
Lecture 19 counting
 
Lecture 18 recursion
Lecture 18 recursionLecture 18 recursion
Lecture 18 recursion
 
Lecture 17 induction
Lecture 17 inductionLecture 17 induction
Lecture 17 induction
 
Lecture 16 SERIES
Lecture 16  SERIESLecture 16  SERIES
Lecture 16 SERIES
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Lecture 09
Lecture 09Lecture 09
Lecture 09
 

Recently uploaded

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 

Chapter 30

  • 1. Chapter 30 Cryptography Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
  • 2. 30-1 INTRODUCTION Let us introduce the issues involved in cryptography. First, we need to define some terms; then we give some taxonomies. Definitions Two Categories Topics discussed in this section:
  • 3. Figure 30.1 Cryptography components
  • 4. Figure 30.2 Categories of cryptography
  • 5. Figure 30.3 Symmetric-key cryptography
  • 6. In symmetric-key cryptography, the same key is used by the sender (for encryption) and the receiver (for decryption). The key is shared. Note
  • 7. Figure 30.4 Asymmetric-key cryptography
  • 8. Figure 30.5 Keys used in cryptography
  • 9. Figure 30.6 Comparison between two categories of cryptography
  • 10. 30-2 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. Traditional Ciphers Simple Modern Ciphers Modern Round Ciphers Mode of Operation Topics discussed in this section:
  • 11. Figure 30.7 Traditional ciphers
  • 12. A substitution cipher replaces one symbol with another. Note
  • 13. The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.1 Solution The cipher is probably monoalphabetic because both occurrences of L’s are encrypted as O’s.
  • 14. The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Example 30.2 Solution The cipher is not monoalphabetic because each occurrence of L is encrypted by a different character. The first L is encrypted as N; the second as Z.
  • 15. The shift cipher is sometimes referred to as the Caesar cipher. Note
  • 16. Use the shift cipher with key = 15 to encrypt the message “HELLO.” Solution We encrypt one character at a time. Each character is shifted 15 characters down. Letter H is encrypted to W. Letter E is encrypted to T. The first L is encrypted to A. The second L is also encrypted to A. And O is encrypted to D. The cipher text is WTAAD . Example 30.3
  • 17. Use the shift cipher with key = 15 to decrypt the message “WTAAD.” Solution We decrypt one character at a time. Each character is shifted 15 characters up. Letter W is decrypted to H. Letter T is decrypted to E. The first A is decrypted to L. The second A is decrypted to L. And, finally, D is decrypted to O. The plaintext is HELLO . Example 30.4
  • 18. A transposition cipher reorders (permutes) symbols in a block of symbols. Note
  • 19. Figure 30.8 Transposition cipher
  • 20. Encrypt the message “HELLO MY DEAR,” using the key shown in Figure 30.8. Solution We first remove the spaces in the message. We then divide the text into blocks of four characters. We add a bogus character Z at the end of the third block. The result is HELL OMYD EARZ. We create a three-block ciphertext ELHLMDOYAZER . Example 30.5
  • 21. Using Example 30.5, decrypt the message “ELHLMDOYAZER”. Solution The result is HELL OMYD EARZ. After removing the bogus character and combining the characters, we get the original message “ HELLO MY DEAR .” Example 30.6
  • 22. Figure 30.9 XOR cipher
  • 23. Figure 30.10 Rotation cipher
  • 24. Figure 30.11 S-box
  • 25. Figure 30.12 P-boxes: straight, expansion, and compression
  • 27. Figure 30.14 One round in DES ciphers
  • 28. Figure 30.15 DES function
  • 29. Figure 30.16 Triple DES
  • 30. Table 30.1 AES configuration
  • 31. AES has three different configurations with respect to the number of rounds and key size. Note
  • 33. Figure 30.18 Structure of each round
  • 34. Figure 30.19 Modes of operation for block ciphers
  • 35. Figure 30.20 ECB mode
  • 36. Figure 30.21 CBC mode
  • 37. Figure 30.22 CFB mode
  • 38. Figure 30.23 OFB mode
  • 39. 30-3 ASYMMETRIC-KEY CRYPTOGRAPHY An asymmetric-key (or public-key) cipher uses two keys: one private and one public. We discuss two algorithms: RSA and Diffie-Hellman. RSA Diffie-Hellman Topics discussed in this section:
  • 41. In RSA, e and n are announced to the public; d and  are kept secret. Note
  • 42. Bob chooses 7 and 11 as p and q and calculates n = 7 · 11 = 77. The value of  = (7 − 1) (11 − 1) or 60. Now he chooses two keys, e and d. If he chooses e to be 13, then d is 37. Now imagine Alice sends the plaintext 5 to Bob. She uses the public key 13 to encrypt 5. Example 30.7
  • 43. Example 30.7 (continued) Bob receives the ciphertext 26 and uses the private key 37 to decipher the ciphertext: The plaintext 5 sent by Alice is received as plaintext 5 by Bob.
  • 44. Jennifer creates a pair of keys for herself. She chooses p = 397 and q = 401. She calculates n = 159,197 and  = 396 · 400 = 158,400. She then chooses e = 343 and d = 12,007. Show how Ted can send a message to Jennifer if he knows e and n. Example 30.8
  • 45. Solution Suppose Ted wants to send the message “ NO ” to Jennifer. He changes each character to a number (from 00 to 25) with each character coded as two digits. He then concatenates the two coded characters and gets a four-digit number. The plaintext is 1314. Ted then uses e and n to encrypt the message. The ciphertext is 1314 343 = 33,677 mod 159,197. Jennifer receives the message 33,677 and uses the decryption key d to decipher it as 33,677 12,007 = 1314 mod 159,197. Jennifer then decodes 1314 as the message “NO”. Figure 30.25 shows the process. Example 30.8 (continuted)
  • 46. Figure 30.25 Example 30.8
  • 47. Let us give a realistic example. We randomly chose an integer of 512 bits. The integer p is a 159-digit number. Example 30.9 The integer q is a 160-digit number.
  • 48. We calculate n. It has 309 digits: Example 30.9 (continued) We calculate  . It has 309 digits:
  • 49. We choose e = 35,535. We then find d. Example 30.9 (continued) Alice wants to send the message “THIS IS A TEST” which can be changed to a numeric value by using the 00–26 encoding scheme (26 is the space character).
  • 50. The ciphertext calculated by Alice is C = P e , which is. Example 30.9 (continued) Bob can recover the plaintext from the ciphertext by using P = C d , which is The recovered plaintext is THIS IS A TEST after decoding.
  • 51. The symmetric (shared) key in the Diffie-Hellman protocol is K = g xy mod p. Note
  • 52. Let us give a trivial example to make the procedure clear. Our example uses small numbers, but note that in a real situation, the numbers are very large. Assume g = 7 and p = 23. The steps are as follows: 1. Alice chooses x = 3 and calculates R 1 = 7 3 mod 23 = 21. 2. Bob chooses y = 6 and calculates R 2 = 7 6 mod 23 = 4. 3. Alice sends the number 21 to Bob. 4. Bob sends the number 4 to Alice. 5. Alice calculates the symmetric key K = 4 3 mod 23 = 18. 6. Bob calculates the symmetric key K = 21 6 mod 23 = 18. The value of K is the same for both Alice and Bob; g xy mod p = 7 18 mod 23 = 18. Example 30.10
  • 53. Figure 30.27 Diffie-Hellman idea
  • 54. Figure 30.28 Man-in-the-middle attack