This is a basic educational python program based on the Merkle-Diffie-Hellman key exchange. I initially wrote this in C++, but then realised C++ does not handle large numbers so well, so I translated it into Python. This is actually my first Python program.
Computes the public key (X) by raising the generator to the power of the private key (x) and then performing modulo P (Gx mod P). The program iterates over private keys starting from 0, until a matching public key (public_key = X) is found.