Return to Web Labs at ReactorLab.net

RSA Encryption

This is an interactive simulation of RSA public-key encryption. The public key can encrypt a message but cannot decrypt it. Decryption requires use of the private key. This allows anyone to send an encrypted message securely to the holder of the private key. RSA was published in 1977 by Rivest, Shamir and Adleman, and is in wide use today.

Real RSA uses very large starting prime numbers - p and q - but this simulation generates keys fast with p's and q's Generating new keys may take a couple seconds with p's and q's > 5000. In practice, plain text messages are converted to numeric messages before encryption using ASCII or UTF conversion tables.

Link to notes on the basic math involved in RSA encryption. Use your browser's Back button to return here.

or

Enter prime # q

Enter prime # p

ϕ(n)

n

10309499

1030180

n

Public Key

10309499

n

10309499

Private Key

Enter numeric message, an integer <

2128769

3988049

e

d

2633801

Encoded message, c = me (mod n)

hexidecimal

Decoded message, m = cd (mod n)

Buttons below pop up new windows:

Click to Show Functions:

The Reactor Lab provides interactive simulations for active learning. The web site is ReactorLab.net. Web Labs and desktop versions of ReactorLab and SimzLab, which includes PureWaterLab, are available. The lab is provided free of charge and code is open source and available at our GitHub site. The code is structured to allow fast construction of new simulations of reactors and other systems. The author of Reactor Lab is Richard K. Herz, emeritus professor of chemical engineering at the University of California, San Diego, UCSD, in the Department of NanoEngineering. Please let us know if you use the Lab or the code. Thanks! rherz@ucsd.edu