One of the projects I’m starting to work on lately is factoring large RSA keys with Python. This project has always interested me, I like the challenge of something that is impossible because I don’t believe in them until I try and it gves me something to send my ADHD brain into a problem.
Now I’m under no illusion this is an easy task for factoring RSA keys. I’ve read plenty of posts on the web and reddit, and so far nobody has factored RSA617 or RSA2048 keys. Simply because of the computational power required.
I believe this can be done, and I want to prove it. For me this is a learning experience though. I don’t know Python, so I’m using it as opportunity to learn. I’m busy writing myself a Python code (utilising ChatGPT helps immensely with learning) for outputting different features that I want.
It’s then a case of building my Python script and running in on the Raspberry PI, or my CUDA card when I receive it.
All factoring laws follows basic laws in mathematics. So I’m aiming to remove unncessary calculations (somehow) I’m not sure how yet in Python, so could be adding to this post as I go.
The way I see it with this calculation, even though the number of possiblities stays the same. If I can remove the other 8 number chains in the pool to verify if they’re not needed. I’ve removed 80% of the numbers that I need to work with. If for example for RSA2047 the starting factors begin with 5, and 9. Then I can basically ignore any formulas using the other 8 numbers (1,2,3,4,6,7,8,0). The more I can remove the less that the Python has to calculate.
I did initially try using the script to generate a file as if I would do a dictionary attack using the number outputs which would be way faster. However I underestimated how much space those digits take up. I computed 7 digits out of the 600 digits and the file filled up my 30GB SD card.
In order to store everything I’d probably need a hard disk several TB in size. This would at least benefit me if created however long it would be as I’d have the full list of numbers then. I do have a method in mind to speed it up and find only the numbers I need but again that relies on me with Python. I’m developing the knowledge the more I run the scripts and learn what to use from Googling so hoping my knowledge gets better to improve the efficiency on the scripts.
I tried running as a test on my Python, whilst it did work on the easier numbers, it was running endlessly on the larger ones in it’s current state. The CPU core also nearly hit 80’c , so I added a copper heatsink with some thermal glue to reduce the operating temperature. As carrying out RSA factoring hammers the CPU on almost any computer.
My goal for calculating RSA simply involves removing every possibility until I only have to work with correct numbers. I would like to brute force it, and go from there. I’ve been making lots of notes, so also worked out (I think) on how to verify numbers are in incorrect order in the sequences.
I’d like to write a windows program as it would be faster than Python I think based on how I want to calculate the results but one step at a time.
At the moment I’m starting on the smaller known numbers like RSA-100 just as initial testing, so that I can learn where I need to go from, and how to improve it. Then when I’m ready for the final run, I’m going to leave the computer switched on and have it run. Once I factor RSA-100 with Python successfully, i can go from there.
