Imagine Alice, Bob and Eve sit together inside a room.
None of them have met before.
They get to talk and after some time Alice wants to tell Bob something that Eve should not hear.
Also, Eve is a talented eavesdropper, so whispering is not an option.
Luckily, Alice has heard of the Diffie-Hellman-Merkle key exchange and explains it to Bob.
They perform the key exchange and although Eve heard everything they said, Alice and Bob end up with a shared key that Eve does not know.
They use it to encrypt their further communication and talk about their deepest secrets.
From Eve's perspective Alice and Bob are only talking gibberish.
The first time I heard about the Diffie-Hellman-Merkle key exchange, this sounded like magic to me.
A key exchange entirely taking place over a public channel and still leading to a shared secret between the two parties.
How should this even be possible?
Some years later during my cryptography lectures, naturally the Diffie-Hellman-Merkle key exchange was discussed.
We learned about commutative groups and rings, cyclic groups, the discrete logarithm problem and other advanced topics.
I had the feeling that I understood everything about the key exchange in depth.
Fast forward to my job as penetration tester.
The question came up whether it is secure to use SSH with diffie-hellman-group14-sha256.
With everything learned during my cryptography lectures, I had to admit to myself that I could not answer this question.
What's group14 and where do you even need a hashing algorithm as SHA-256 during the key exchange?
Thus, I decided to take a closer look at the key exchange.