Category Archives: Programming

RSA Made Simple

In response to a question, I wrote up a beginner-friendly implementation of RSA cryptography using Python. You specify your two prime numbers at the top, and then it derives the public and private key from that, and allows you to test out encryption/decryption using the keys you just generated.

Obviously the numbers this code deals in are way too small for it to be even remotely secure, but the concepts are all there and explained reasonably clearly with copious comments. This should be enough to help a beginner understand the basics of this algorithm.

Here’s the code: