Select Page

Wide number arithmetic for modulo arithmetic support

Diffie Hellman Key Exchange

The Diffie–Hellman (DH) Algorithm is a key-exchange protocol that enables two parties communicating over public channel to establish a mutual secret without it being transmitted over the Internet.

Uses:
Password Authenticated Agreement: When two parties share a password, a password-authenticated key agreement can be used to prevent the Man in the middle attack. This key Agreement can be in the form of Diffie-Hellman.

Forward Secrecy: Forward secrecy-based protocols can generate new key pairs for each new session, and they can automatically discard them when the session is finished. In these forward Secrecy protocols, more often than not, the Diffie Hellman key exchange is used.

 

 

 

 

 

 

 

 

 

 

 

 

 

Algorithm 1 to compute:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Algorithm 2 to compute:

Above computation requires
Modulus operation (a mod n)
Multiplication ( b times)

 

 

Flow chart:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flow chart for Multiplication:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Algorithm 3 for

 

 

 

 

 

 

 

 

 

 

ime complexity analysis:

 

 

 

 

 

 

 

 

Validation of implemented algorithms:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Conclusion:

  1. is implemented using three different algorithms and validated with MATLAB and online calculator.
  2. Time complexities of algorithms are compared and following observations are made.
  3. Algorithm 1 is the fastest when the exponent is in power of 2.
  4. For smaller values of inputs, Algorithm 2 and Algorithm 3 are comparable.
  5. For any combination of inputs except for the exponent in power of 2, Algorithm 3 is the fastest among all.

References:

[1] https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange

[2] https://www.dcode.fr/modular-exponentiation

[3] Experimental Study of Diffie-Hellman Key Exchange Algorithm on Embedded Devices by Pratima Deshpande, S Santhanalakshmi, Lakshmi P

 

code: code part