Diffie Hellman Key Exchange This is a light-weight example of Diffie-Hellman key exchange with some protections that make sure the choices of g and n are reasonable. This is obviously not intented for real world use.