Hello my dear friends. Today we are going to discuss about what is Diffie – Helman algorithm. The Diffie – Helman algorithm is a very important algorithm in computer security. Then without wasting many time let’s learn about what is Diffie – Helman algorithm. For what purpose it is using.
The Diffie – Helman algorithm invented in the year 1976. The invention is a collaboration of two people. They are Whitfield Diffie and Martin Helman. Diffie – Helman algorithm is a specific method of exchanging keys. This is the one of the earliest practical examples of key exchange implemented in the cryptography field. The Diffie – Helman key exchange method allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure communication channel.
The usage of Diffie – Helman algorithm
What you have to keep in mind is Diffie – Helman is a key exchange protocol. It can’t use for encryption and decryption. Many people have the doubt of can Diffie – Helman use as a encryption or decryption algorithm. The answer is it cannot. This is only use as a key exchange protocol.
How Diffie – Helman algorithm works
The algorithm is simple. First, A and B agree on a large prime, n and g. These two integers don’t have to be secret; A and B can agree to them over some insecure channel. They can even be common among a group of users. It doesn’t matter. Then, the protocol goes as follows:
- A chooses a random large integer x and sends B, X = gx mod n
- B chooses a random large integer y and sends A, Y = gy mod n
- Alice computes, k = Yx mod n
- Bob computes, k‘ = Xy mod n
Both k and k’ are equal to gxy mod n. No one listening on the channel can compute that value; they only know n,g,X and Y. Unless they can compute the discrete logarithm and recover x or y, they do not solve the problem. So, k is the secret key that both A and B computed independently.
Example of Diffie – Helman algorithm
An example of Diffie – Hellman algorithm is as follows:
- A and B agree to use a prime number n = 23 and base g = 3.
- A chooses a secret integer a =4, then sends B. A = ga mod n -> A = 34 mod 23 -> A = 12
- B chooses a secret integer b=7, then sends A. B = gb mod n -> B = 37 mod 23 -> B =2
- A computes K = Ba mod n = 24 mod 23 = 16
- B computes K = Ab mod n = 127 mod 23 = 16
- Shared secret key would be 16.
Diffie – Hellman algorithm is used by several protocols, including SSL/TLS (Secure Sockets Layer / Transport Layer Security), Secure Shell (SSH) and Internet Protocol Security (IPSec).
So far we learned about what is Diffie – Helman algorithm and it’s usage. It is a key exchange protocol and not a encryption/ decryption algorithm. We also discussed how to calculate the Diffie Hellman algorithm. Hope you understood it well. We will meet soon with interesting topic again. Until then good bye for all. If you like please like, comment and share.