Diffie-Hellman Tools

The following are tools to perform a Diffie-Hellman Key Exchange.

Generating a prime and primitive root

This is a way to generate a prime and a primitive root. You can replace $10^6$ with something else to get a different prime. If you have a prime you want to use, just set p to be that explicit prime.

Generate a random number in the interval from 2 to p-2

This is for generating your random secret exponent. It will use the prime set in the first box above.

Extra box for Modular Exponentiation or Multiplication etc.

You can use this box to do any modular computations (including exponentiations) needed in the ring that was set up in the first box above.