An implementation of the RSA encryption algorithm to generate a private key and a public key, along with various methods to attempt to factor the modulus of the private key.
This project was for my Design and Analysis of Algorithms class at UMBC (CMSC 441). The project outline can be found here: course website, web archive
- Presuming you already have python3 the only non-standard package used is gmpy2.
- If you're on windows you'll need to install anaconda to get gmpy2
conda install gmpy2
- If you're on linux/mac you can just use pip
pip3 install gmpy2
- If you're on windows you'll need to install anaconda to get gmpy2
-
To generate a public/private key pair you can run part1a
python3 part1a.py
-
To factor a modulus, run part2 with the modulus as an argument
python3 part2.py [modulus]
E.g.
python3 part2.py 21421376143373
Will return:
##### Part 2 ##### Attempting to find factors of 21421376143373 Modulo size: 45 Start Time: 20:49:42.451780 1 p1 factor found: 5071501 End Time: 20:49:42.620936