Diffie Hellman Algorithm in Cryptography

This article is about the Diffie Hellman. In this article, we will briefly study the basic Diffie hellman and its examples aim to capture. We will cover the types of message in Diffie Hellman.
Submitted by Monika Sharma, on January 09, 2020


Diffie Hellman key exchange algorithm is a method for securely or secretly exchanging cryptographic keys or a key use in encryption or decryption over a public communications channel or away. Keys are not eventually exchanged – they are joint and derived. It is named after their inventors who invent this is Whitfield Diffie and Martin Hellman.

If Alice and Bob want to communicate with each other, they firstly discuss a variable between them a large prime number "p", and a generator or base "g" (where 0 < g < p).

Alice chooses "a" secret integer as her private key and then calculates g^a mod p which is her public key. Bob chooses his private key "b", and calculates his public key in the same way Alice find its public key.

Alice and Bob then exchange each other‘s public keys. Alice now knows "a" and Bob's public key g^b mod p as to encrypt the message. She is not able to find the value of b from Bob's public key because this is a hard or complex mathematical problem known as the discrete logarithm problem in mathematics. She can then find (g^b)^a mod p = g^ab mod p.

Bob knows "b" and "g^a", so he can find "(g^a)^b mod p = g^ab mod p". Therefore both Alice and Bob know a key called shared secret key "g^ab mod p". An eavesdropper Eve who was listening in on the communication knows p, g, Alice's public key (g^a mod p) and Bob's public key (g^b mod p). She is unable to find or calculate the shared secret key from these values.

In the mode of static-static, both Alice and Bob obtain their private/public keys over multiple communications which use this. Therefore the resulting shared secret key will be the same every time. In ephemeral-static mode only one party will generate or create a new private/public key every time, thus a new shared secret will be generated or created.

History of the Diffie-Hellman key exchange

The Diffie-Hellman key exchange traces its started back to the 1970s. While the area of cryptography had developed significantly throughout the earlier twentieth-century of the era, these advancements were mainly focused in the area of symmetric-key cryptography of the crypto.

It wasn't until 1976 that public-key algorithms mixed in the public key, when Whitfield Diffie and Martin Hellman published their paper, “New Directions in Cryptography”. The collaboration outlined the way of mechanisms behind a new system, which would come to be known as the "Diffie-Hellman key exchange of Bob and Alice".

The work was partly motivated by earlier developments made by "Ralph Merkle". The so-called "Merkle's Puzzles" include one party creating and sending several cryptographic puzzles or the text to the others. These puzzles or text would take a middle amount of computational resources to solve the puzzle.


The most serious limitation of Diffie-Hellman in its basic or "pure" form is the absence of authentication. Communications using Diffie-Hellman all by itself are vulnerable to man in the middle attacks used in any cipher. Ideally, Diffie-Hellman should be used or need in conjunction with an admit authentication method such as digital signatures to verify the identities of the person using this signature in a bank or somewhere over the public communications medium. Diffie-Hellman is well suited for use in data communication but is less often used for data stored or archived over long periods in this kind of cipher.


Comments and Discussions!


Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.