In order to understand the Diffie-Hellman algorithm, one must understand the discrete logarithm problem in Maths.