SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Downloaden Sie, um offline zu lesen
Diffie-Hellman Key Exchange
The first step in public-key cryptography
Alice and Bob want exchange an encryption key over an insecure communication link where Eve is
listening in. To do this they need to use a prime number. The Diffie-Hellman algorithm uses a simple
concept in mathematics where a prime number can be used to generate a list of numbers in a seemingly
random sequence. This seemingly random sequence is what make the algorithm secure.
Step 1:
Alice and Bob agree on a prime number P.
P=5
Step 2:
Alice and Bob agree on a primitive root of their prime number. A primitive root is simply a number
that has a special relationship with a prime number causing it to generate a random sequence. Primitive
roots are hard to find, so we must manually check if the number we choose generates a list of random
numbers. If it does, then it is a primitive root.
Let us test if the number 3 is a primitive root of 5. We do this by getting the exponentiation/powers of
our prime for every positive whole number less than our prime number (basically between 0 and 5
excluding 0 and 5).
3^1=3
3^2=9
3^3=27
3^4=81
Then we set our upper limit of our output to the value of our prime, by getting the remainder after
division.
3 mod 5 = 3
9 mod 5 = 4
27 mod 5 = 2
81 mod 5 = 1
Notice that the numbers 3, 4, 2 and 1 are all unique (this is called a full period). Also notice that the
order of the numbers is not sequential. This is the random property we were taking about earlier. So
now that we have found our primitive root we will note its value.
g=3
Step 3:
Alice chooses a positive whole number as her secret key.
a=6
Step 4:
Alice computes her public key and sends it to Bob.
A = g^a mod P
or
4 = 3^6 mod 5
A=4
Note: This formula is the same one we used earlier to find our primitive root and we are using the same
values for g and P. This means that whatever number Alice chose for her private key, the output will be
one of the random numbers from our list. This randomness is very important.
Step 5:
Bob chooses a positive whole number as his secret key.
b=7
Step 6:
Bob computer his public key and sends it to Alice.
B = g^b mod P
or
2 = 3^7 mod 5
B=2
Step 7:
Alice and Bob now compute a shared secret key
[Shared Key] = [other persons public key]^[their own secret key] mod P
Bob:
S = 4^7 mod 5
Alice:
S = 2^6 mod 5
S=4
Conclusion:
“P”, “g”, “A” and “B” were transmitted. Can “a” and “b” be calculated? Hint: discrete logarithm.

Weitere ähnliche Inhalte

Was ist angesagt?

Rsa and diffie hellman algorithms
Rsa and diffie hellman algorithmsRsa and diffie hellman algorithms
Rsa and diffie hellman algorithmsdaxesh chauhan
 
Secure Communication (Distributed computing)
Secure Communication (Distributed computing)Secure Communication (Distributed computing)
Secure Communication (Distributed computing)Sri Prasanna
 
Rsa algorithm key generation
Rsa algorithm key generation Rsa algorithm key generation
Rsa algorithm key generation swarnapatil
 
Cryptography using rsa cryptosystem
Cryptography using rsa cryptosystemCryptography using rsa cryptosystem
Cryptography using rsa cryptosystemSamdish Arora
 
Syntax-Directed Translation into Three Address Code
Syntax-Directed Translation into Three Address CodeSyntax-Directed Translation into Three Address Code
Syntax-Directed Translation into Three Address Codesanchi29
 
Elliptic curve Cryptography and Diffie- Hellman Key exchange
Elliptic curve Cryptography and Diffie- Hellman Key exchangeElliptic curve Cryptography and Diffie- Hellman Key exchange
Elliptic curve Cryptography and Diffie- Hellman Key exchangeIOSRJM
 
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE Qualcomm
 
Presentation about RSA
Presentation about RSAPresentation about RSA
Presentation about RSASrilal Buddika
 
A Study of RSA Algorithm in Cryptography
A Study of RSA Algorithm in CryptographyA Study of RSA Algorithm in Cryptography
A Study of RSA Algorithm in Cryptographyijtsrd
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-ittrameshvvv
 
Error detection and correction codes
Error detection and correction codesError detection and correction codes
Error detection and correction codesGargiKhanna1
 
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and DecryptionImplementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and DecryptionMd. Ariful Hoque
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSAMohamed Loey
 
Design And Implementation Of Tiny Encryption Algorithm
Design And Implementation Of Tiny Encryption AlgorithmDesign And Implementation Of Tiny Encryption Algorithm
Design And Implementation Of Tiny Encryption AlgorithmIJERA Editor
 

Was ist angesagt? (20)

Rsa and diffie hellman algorithms
Rsa and diffie hellman algorithmsRsa and diffie hellman algorithms
Rsa and diffie hellman algorithms
 
Secure Communication (Distributed computing)
Secure Communication (Distributed computing)Secure Communication (Distributed computing)
Secure Communication (Distributed computing)
 
Rsa algorithm key generation
Rsa algorithm key generation Rsa algorithm key generation
Rsa algorithm key generation
 
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
 
RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
 
Cryptography using rsa cryptosystem
Cryptography using rsa cryptosystemCryptography using rsa cryptosystem
Cryptography using rsa cryptosystem
 
Syntax-Directed Translation into Three Address Code
Syntax-Directed Translation into Three Address CodeSyntax-Directed Translation into Three Address Code
Syntax-Directed Translation into Three Address Code
 
public-key cryptography Shamir
public-key cryptography Shamirpublic-key cryptography Shamir
public-key cryptography Shamir
 
Elliptic curve Cryptography and Diffie- Hellman Key exchange
Elliptic curve Cryptography and Diffie- Hellman Key exchangeElliptic curve Cryptography and Diffie- Hellman Key exchange
Elliptic curve Cryptography and Diffie- Hellman Key exchange
 
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
 
Presentation about RSA
Presentation about RSAPresentation about RSA
Presentation about RSA
 
A Study of RSA Algorithm in Cryptography
A Study of RSA Algorithm in CryptographyA Study of RSA Algorithm in Cryptography
A Study of RSA Algorithm in Cryptography
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
 
Rsa
RsaRsa
Rsa
 
Error detection and correction codes
Error detection and correction codesError detection and correction codes
Error detection and correction codes
 
RSA Algorithm report
RSA Algorithm reportRSA Algorithm report
RSA Algorithm report
 
Rsa Crptosystem
Rsa CrptosystemRsa Crptosystem
Rsa Crptosystem
 
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and DecryptionImplementation of RSA Algorithm for Speech Data Encryption and Decryption
Implementation of RSA Algorithm for Speech Data Encryption and Decryption
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSA
 
Design And Implementation Of Tiny Encryption Algorithm
Design And Implementation Of Tiny Encryption AlgorithmDesign And Implementation Of Tiny Encryption Algorithm
Design And Implementation Of Tiny Encryption Algorithm
 

Andere mochten auch

Pgp pretty good privacy
Pgp pretty good privacyPgp pretty good privacy
Pgp pretty good privacyPawan Arya
 
Information theory
Information theoryInformation theory
Information theoryroger Pitiot
 
Seminar ppt on digital signature
Seminar ppt on digital signatureSeminar ppt on digital signature
Seminar ppt on digital signaturejolly9293
 
Introduction to Digital signatures
Introduction to Digital signaturesIntroduction to Digital signatures
Introduction to Digital signaturesRohit Bhat
 

Andere mochten auch (6)

Pgp pretty good privacy
Pgp pretty good privacyPgp pretty good privacy
Pgp pretty good privacy
 
Information theory
Information theoryInformation theory
Information theory
 
Elliptic curve cryptography
Elliptic curve cryptographyElliptic curve cryptography
Elliptic curve cryptography
 
Seminar ppt on digital signature
Seminar ppt on digital signatureSeminar ppt on digital signature
Seminar ppt on digital signature
 
IPSec and VPN
IPSec and VPNIPSec and VPN
IPSec and VPN
 
Introduction to Digital signatures
Introduction to Digital signaturesIntroduction to Digital signatures
Introduction to Digital signatures
 

Ähnlich wie Diffie-Hellman key exchange

With Math - Diffie-Hellman Rick.ppt
With Math - Diffie-Hellman Rick.pptWith Math - Diffie-Hellman Rick.ppt
With Math - Diffie-Hellman Rick.pptishaankumar39
 
Cryptography-Diffie Hellman Key Exchange Algorithm.pptx
Cryptography-Diffie Hellman Key Exchange Algorithm.pptxCryptography-Diffie Hellman Key Exchange Algorithm.pptx
Cryptography-Diffie Hellman Key Exchange Algorithm.pptxssuser7e0a0e
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.pptMIBrand
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.pptShounakDas16
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptxRavikumarVadana
 

Ähnlich wie Diffie-Hellman key exchange (6)

With Math - Diffie-Hellman Rick.ppt
With Math - Diffie-Hellman Rick.pptWith Math - Diffie-Hellman Rick.ppt
With Math - Diffie-Hellman Rick.ppt
 
Cryptography-Diffie Hellman Key Exchange Algorithm.pptx
Cryptography-Diffie Hellman Key Exchange Algorithm.pptxCryptography-Diffie Hellman Key Exchange Algorithm.pptx
Cryptography-Diffie Hellman Key Exchange Algorithm.pptx
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.ppt
 
CS283-PublicKey.ppt
CS283-PublicKey.pptCS283-PublicKey.ppt
CS283-PublicKey.ppt
 
Cyber Security Part-3.pptx
Cyber Security Part-3.pptxCyber Security Part-3.pptx
Cyber Security Part-3.pptx
 
Cryptography and Network security # Lecture 6
Cryptography and Network security # Lecture 6Cryptography and Network security # Lecture 6
Cryptography and Network security # Lecture 6
 

Mehr von hughpearse

HughPearseEsriTraining
HughPearseEsriTrainingHughPearseEsriTraining
HughPearseEsriTraininghughpearse
 
HughPearse-ACE-Forensics-Certification
HughPearse-ACE-Forensics-CertificationHughPearse-ACE-Forensics-Certification
HughPearse-ACE-Forensics-Certificationhughpearse
 
Prism-Proof Cloud Email Services
Prism-Proof Cloud Email ServicesPrism-Proof Cloud Email Services
Prism-Proof Cloud Email Serviceshughpearse
 
Nmap flags table
Nmap flags tableNmap flags table
Nmap flags tablehughpearse
 
ACE forensics certification
ACE forensics certificationACE forensics certification
ACE forensics certificationhughpearse
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 
Metasploit cheat sheet
Metasploit cheat sheetMetasploit cheat sheet
Metasploit cheat sheethughpearse
 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploitshughpearse
 

Mehr von hughpearse (8)

HughPearseEsriTraining
HughPearseEsriTrainingHughPearseEsriTraining
HughPearseEsriTraining
 
HughPearse-ACE-Forensics-Certification
HughPearse-ACE-Forensics-CertificationHughPearse-ACE-Forensics-Certification
HughPearse-ACE-Forensics-Certification
 
Prism-Proof Cloud Email Services
Prism-Proof Cloud Email ServicesPrism-Proof Cloud Email Services
Prism-Proof Cloud Email Services
 
Nmap flags table
Nmap flags tableNmap flags table
Nmap flags table
 
ACE forensics certification
ACE forensics certificationACE forensics certification
ACE forensics certification
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
Metasploit cheat sheet
Metasploit cheat sheetMetasploit cheat sheet
Metasploit cheat sheet
 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
 

Diffie-Hellman key exchange

  • 1. Diffie-Hellman Key Exchange The first step in public-key cryptography Alice and Bob want exchange an encryption key over an insecure communication link where Eve is listening in. To do this they need to use a prime number. The Diffie-Hellman algorithm uses a simple concept in mathematics where a prime number can be used to generate a list of numbers in a seemingly random sequence. This seemingly random sequence is what make the algorithm secure. Step 1: Alice and Bob agree on a prime number P. P=5 Step 2: Alice and Bob agree on a primitive root of their prime number. A primitive root is simply a number that has a special relationship with a prime number causing it to generate a random sequence. Primitive roots are hard to find, so we must manually check if the number we choose generates a list of random numbers. If it does, then it is a primitive root. Let us test if the number 3 is a primitive root of 5. We do this by getting the exponentiation/powers of our prime for every positive whole number less than our prime number (basically between 0 and 5 excluding 0 and 5). 3^1=3 3^2=9 3^3=27 3^4=81 Then we set our upper limit of our output to the value of our prime, by getting the remainder after division. 3 mod 5 = 3 9 mod 5 = 4 27 mod 5 = 2 81 mod 5 = 1 Notice that the numbers 3, 4, 2 and 1 are all unique (this is called a full period). Also notice that the order of the numbers is not sequential. This is the random property we were taking about earlier. So now that we have found our primitive root we will note its value. g=3 Step 3: Alice chooses a positive whole number as her secret key. a=6
  • 2. Step 4: Alice computes her public key and sends it to Bob. A = g^a mod P or 4 = 3^6 mod 5 A=4 Note: This formula is the same one we used earlier to find our primitive root and we are using the same values for g and P. This means that whatever number Alice chose for her private key, the output will be one of the random numbers from our list. This randomness is very important. Step 5: Bob chooses a positive whole number as his secret key. b=7 Step 6: Bob computer his public key and sends it to Alice. B = g^b mod P or 2 = 3^7 mod 5 B=2 Step 7: Alice and Bob now compute a shared secret key [Shared Key] = [other persons public key]^[their own secret key] mod P Bob: S = 4^7 mod 5 Alice: S = 2^6 mod 5 S=4 Conclusion: “P”, “g”, “A” and “B” were transmitted. Can “a” and “b” be calculated? Hint: discrete logarithm.