Home > Miscellany > RSA Demo
I created this demonstration of the RSA algorithm for a course that I took about data structures and algorithms. Javascript has some limitations on handling large numbers  I compensated for some of these with the Extended Euclidean and Russian Peasant algorithms, but there are still some problems, depending on the choice of P and Q. The defaults values work. For more information on the RSA algorithm, follow the links at the end of the page.
Step 1: 
Select two numbers which have no common factors. Call them P and Q. Since they have no common factors, they are said to be "relatively prime." You can enter your own values for P and Q, or use the default values provided. 

Step 2: 
Select the public key, E to be relatively prime to M. 

Step 3: 
Select the private key, D, so that (D * E) % M = 1. 

Step 4: 
Encrypt and Decrypt your message. The message must be an integer with a magnitude less than (N1). 

Web Resources (for further information): 
RSA AlgorithmPaj's Home: Cryptography:
RSA Algorithm: Cyber RSA@Crypto.Center Extended Euclidean AlgorithmExtended Euclidean
Algorithm Wilkipedia
article on the Euclidean Algorithm and its extension Art Lew's
PDF File Russian Peasant AlgorithmComputation
 Exponentiation via the Russian Peasant Algorithm Ask Dr. Math:
Russian Peasant Multiplication JavascriptWeb Developers Virtual
Library (WDVL): Javascript Javascript FAQ Netscape's
Online Documentation for Javascript 