securityencryptioncryptographydiffie-hellman

Is it possible to "hack" Diffie-Hellman by knowing the prime number and the generator parameters?


I am trying to understand the Diffie-Hellman (DH) algorithm because I would like to have two computers communicating with each other but without a third one knowing what they are saying, but also exchanging the secret key they will use in an insecure channel.

The thing is that the third one also knows how the DH will process, namely, the constant parameters. More specifically p and g:

DH algorithm

So the question is, if I know p and g, can I discover that Bob and Alice will use 8 as their secret key?


Solution

  • No You can't, to compute the secret key you must first be able to compute a (Alice's secret key) or b( Bob's secret key) this will require the evesdropper to compute the discrete logarithm and since there isn't any known efficient algorithm that can compute that, then Deffie_Hellmen is pretty secure, and the third party (the evesdropper) will never know that 8 is the secret key. (note that the right selection of p and g is critical for making a secure key exchange).