256

RSA Encryption

This is an implementation of the RSA encryption algorithm. This page closely follows the original 1977 paper. This page is not suitable for serious cryptographic use (see "Security Considerations" below).

How to Use

Press the "Generate key pair" button below to generate a full public/private key pair. This also automatically fills in the necessary information to encrypt and decrypt messages with your key pair.

The combination of n and d is your private key. The combination of n and e is your public key. To communicate with someone using this scheme, tell them your n and e values, but not d. They can then put them into the appropriate text boxes on this page and encrypt a message, and then send the encrypted message to you. You can then copy/paste their encrypted message, making sure the n and d boxes are properly filled in, and decrypt it.

Key properties

e: ...
d: ...
n: ...
p: ...
q: ...

Encrypt/Decrypt

Modulus (n):
Exponent for encryption (e):
Exponent for decryption (d):

Security Considerations

The main reason the implementation on this page is not cryptographically secure is that the prime numbers are much too small. The modulus could thus easily be factored. Another concern is that a given character + key encodes the same value every time, so a frequency-based attack is possible (i.e. the most common letter is 'e', the second most common is 't', and so on).

Messages are not signed, and there is no protection against replay or truncation attacks.

I think timing attacks are irrelevant, since almost all the time taken is due to human action (mouse movement, etc.).

Padding is not added, so the exact length of a message is visible to snoopers.

If you're aware of a security concern with this implementation that I haven't thought of, please email me.

About | Contact Me | Index
Page last modified on 2026-03-16.