SlideShare ist ein Scribd-Unternehmen logo
1 von 54
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

Weitere Àhnliche Inhalte

Was ist angesagt?

Greedy Algorithm - Huffman coding
Greedy Algorithm - Huffman codingGreedy Algorithm - Huffman coding
Greedy Algorithm - Huffman codingMd Monirul Alom
 
Application of bases
Application of basesApplication of bases
Application of basesAbdur Rehman
 
Dynamic and verifiable hierarchical secret sharing
Dynamic and verifiable hierarchical secret sharingDynamic and verifiable hierarchical secret sharing
Dynamic and verifiable hierarchical secret sharingNational 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 TechniquesSyed Ubaid Ali Jafri
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral SystemsIntro C# Book
 
IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015IS 139 Lecture 4 - 2015
IS 139 Lecture 4 - 2015Aron Kondoro
 
data representation
 data representation data representation
data representationHaroon_007
 
Lesson 2 math 4 alternative
Lesson 2 math 4 alternativeLesson 2 math 4 alternative
Lesson 2 math 4 alternativeAlpheZarriz
 
3.1 Extreme Values of Functions
3.1 Extreme Values of Functions3.1 Extreme Values of Functions
3.1 Extreme Values of FunctionsSharon Henry
 

Was ist angesagt? (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
 

Andere mochten auch

Andere mochten auch (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
 

Ähnlich wie Chapter 30

30 Cryptography
30 Cryptography30 Cryptography
30 CryptographyAhmar Hashmi
 
1network security encryption_methods-1
1network security encryption_methods-11network security encryption_methods-1
1network security encryption_methods-1Aman Jaiswal
 
ch30.ppt
ch30.pptch30.ppt
ch30.ppt0567Padma
 
#KPC #EE & ETCE #Cryptography
#KPC #EE & ETCE  #Cryptography#KPC #EE & ETCE  #Cryptography
#KPC #EE & ETCE #CryptographyKEIKolkata
 
Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02Computer Security (Cryptography) Ch02
Computer Security (Cryptography) Ch02Saif Kassim
 
Network security
Network securityNetwork security
Network securitySisir Ghosh
 
Asymmetric Cryptography.pptx
Asymmetric Cryptography.pptxAsymmetric Cryptography.pptx
Asymmetric Cryptography.pptxdiaa46
 
Cryptography
CryptographyCryptography
Cryptographyfsl khan
 
Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03Computer Security (Cryptography) Ch03
Computer Security (Cryptography) Ch03Saif Kassim
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentationSoham Mondal
 
1329 n 9460
1329 n 94601329 n 9460
1329 n 9460kicknit123
 
2 Unit 1. Traditional Symmetric Ciphers.pdf
2 Unit 1. Traditional Symmetric Ciphers.pdf2 Unit 1. Traditional Symmetric Ciphers.pdf
2 Unit 1. Traditional Symmetric Ciphers.pdfNandiniLokanath1
 

Ähnlich wie 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
 
Convolution presentation
Convolution presentationConvolution presentation
Convolution presentation
 
1329 n 9460
1329 n 94601329 n 9460
1329 n 9460
 
2 Unit 1. Traditional Symmetric Ciphers.pdf
2 Unit 1. Traditional Symmetric Ciphers.pdf2 Unit 1. Traditional Symmetric Ciphers.pdf
2 Unit 1. Traditional Symmetric Ciphers.pdf
 

Mehr von 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 algorithmFaisal Mehmood
 
Raspberry pi and Google Cloud
Raspberry pi and Google CloudRaspberry pi and Google Cloud
Raspberry pi and Google CloudFaisal Mehmood
 
Raspberry pi and Azure
Raspberry pi and AzureRaspberry pi and Azure
Raspberry pi and AzureFaisal Mehmood
 
Raspberry pi and AWS
Raspberry pi and AWSRaspberry pi and AWS
Raspberry pi and AWSFaisal Mehmood
 
Lecture 37 cond prob
Lecture 37 cond probLecture 37 cond prob
Lecture 37 cond probFaisal 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 countingFaisal Mehmood
 
Lecture 18 recursion
Lecture 18 recursionLecture 18 recursion
Lecture 18 recursionFaisal Mehmood
 
Lecture 17 induction
Lecture 17 inductionLecture 17 induction
Lecture 17 inductionFaisal Mehmood
 
Lecture 16 SERIES
Lecture 16  SERIESLecture 16  SERIES
Lecture 16 SERIESFaisal Mehmood
 

Mehr von 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
 

KĂŒrzlich hochgeladen

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)lakshayb543
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 

KĂŒrzlich hochgeladen (20)

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
Visit to a blind student's school🧑‍🩯🧑‍🩯(community medicine)
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 

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