The first script (generate_keys.pl) creates the public and the private key. It takes two prime numbers as arguments, in this context commonly referred to as
Now, I can encrypt a message with the second script (encrypt_decrypt.pl) and the public key: the first two parameters are the public key, the third parameter the message to be encrypted.
The message I want to encrypt is the number
In order to decrypt
166097, I use encrypt_decrypt.pl again, this time with the private key:
LinksRSA key generation example with python was a very helpful page for me.
Modular multiplicative inverse on wikipedia.
Extended euclidean algorithm on wikipedia.
RSA (cryptosystem) on wikipedia.