I want am making an application, demonstrating an attack on a weakly performed diffie-hellman. I need to implement an algorithm that can use the shared variables in order to compute the key. Searching for resources, I keep running into the logjam attack. However I can't really filter out the number crunching from all the HTTP protocol information.
If anyone could provide som resources to point me in the right direction, or a formula to how to successfully compute the key from the known variables. It would be greatly appreciated!
I have found this resource, which seems really promising. http://index-of.es/Miscellanous/How%20To%20Backdoor%20Diffie-Hellman.pdf
page 6 it says
To attack a Diffie-Hellman key exchange, one could extract the secret key a from one of the peer's public key ya = g a (mod p). One could then compute the shared key g ab (mod p) using the other peer's public key yb = g b (mod p).
The naive way to go about this is to compute each power of g (while tracking the exponent) until the public key is found. This is called trial multiplication and would need on average q 2 operations to find a solution (with q the order of the base). More efficiently, algorithms that compute discrete logarithm in expected √q steps
I translate this to
compute each power of g
g^1 mod(p), g^2 mod(p), g^3 mod(p)..g^n mod(p)
This would work, however it requires to isolate the exponent from the formula to work. Which is pretty difficult to me.
How would you isolate