diffie Hellman Key Exchange Algorithm

Diffie – Hellman key exchange is a method of securely exchange cryptographic keys over a public channel and was one of the first public-key protocols as conceived by Ralph Merkle and named after Whitfield Diffie and Martin Hellman. The scheme was published by Whitfield Diffie and Martin Hellman in 1976, but in 1997 it was revealed that James H. Ellis, Clifford Cocks, and Malcolm J. Williamson of GCHQ, the British signals intelligence agency, had previously shown in 1969 how public-key cryptanalysis could be achieved.

diffie Hellman Key Exchange source code, pseudocode and analysis