# eli5 about how rsa algorithm works in cryptography.

31 views

eli5 about how rsa algorithm works in cryptography.

In: 0 RSA is used as way to generate key pairs for asymmetric cryptography. The algorithm creates a public key which can be shared freely, and a private key which should be kept secret.
When the public key is used to encrypt information, it can only be decrypted by someone with the private key. You can also use the private key to encrypt things that can be decrypted with the public key, which can be used for things like digital signatures.

The RSA algorithm makes it very difficult to calculate what the private key is if you know the public key, but very easy to do the reverse. The algorithm itself relies on the properties of modular arithmetic and prime numbers to be implementable, but the base difficulty is trying to figure out what two numbers when multiplied together give a specific remainder when divided by another number. When the numbers are big, this becomes hard. It’s like if you gave everyone a free lock (public key) that only you had the combination for (private key). Anyone could put this lock on their package when they send it to you, but they wouldn’t know the combination. The only way for them to figure out the combination would be to try many possible combinations and see if they work. But since you made the lock you make it with such a huge number of combinations that it would take millions of years to try them all.