SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
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.

Contenu connexe

Tendances

Secure Communication (Distributed computing)
Secure Communication (Distributed computing)Secure Communication (Distributed computing)
Secure Communication (Distributed computing)
Sri Prasanna
 
Rsa diffi-network security-itt
Rsa diffi-network security-ittRsa diffi-network security-itt
Rsa diffi-network security-itt
rameshvvv
 

Tendances (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
 

En vedette (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
 

Similaire à 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
 

Plus de hughpearse

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

Plus de 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.