“RSA is an algorithm for public-key cryptography that is based on the presumed difficulty of factoring large integers, the factoring problem. RSA stands for Ron Rivest, Adi Shamir and Leonard Adleman, who first publicly described it in 1977. Clifford Cocks, an English mathematician, had developed an equivalent system in 1973, but it was classified until 1997. A user of RSA creates and then publishes the product of two large prime numbers, along with an auxiliary value, as their public key. The prime factors must be kept secret. Anyone can use the public key to encrypt a message, but with currently published methods, if the public key is large enough, only someone with knowledge of the prime factors can feasibly decode the message. Whether breaking RSA encryption is as hard as factoring is an open question known as the RSA problem.

[Source: Wikipedia]

# RSA Algorithm Demo

**1. Select 2 Prime Numbers**

**2. Select the Public Key E**

The exponent `E and `Phi are relatively prime.

**3. Select the Priavte Key D**

The private key is calculated by E`*D = 1 mod` Phi(n).

**4. Encryption**

A message `B< n` can `be encrypted using C= B^E mod n`.

**5. Decryption**

The encrypted message C can be decrypted by B` = C^D mod n`.