Explanation


There are three steps in the encryption of data with the RSA Algorithm.

Key Generation

Generate two random prime numbers p and q.
Compute n and F so that n=pq and F=(p-1)(q-1)
Choose a number e so that 1
Encryption

Calculate C=M^e mod n where M is the message being encrypted and C is the cipher text.

Decryption

Calculate M=C^d mod n


It is important to realize that in order to convert text using math, you must first use a method to change the text to numerical form. In our program, we simply used a substitution method where every letter and punctuation mark corresponded to a specific number. More complex ways of doing this would result in a more secure encryption.