Cryptography, Python, Math, Mathematics, Diffie Hellman.
then g = -2 has order (p-1) modulo p. It is not necessary that g generates (ℤ/pℤ)*, but for security reasons, this is the approach that we will use. If soundness, and not security, is the reader’s greatest objective, then picking a random g such that 1≤g≤p will suffice. PersonA secretly chooses an