This tool will help you generate and manage RSA keys for secure data encryption and decryption.

## How to Use the RSA Calculator

To use the RSA calculator, you’ll need to input the following values:

**Prime 1 (p):**The first prime number.**Prime 2 (q):**The second prime number.**Public Exponent (e):**A number that is coprime with (p-1)*(q-1).**Message (n):**The message you want to encrypt and decrypt.

Once you’ve filled out these values, press the “Calculate” button to see the encrypted and decrypted results.

## Explanation of How It Works

The calculator performs the following steps:

- Calculates
**n**as the product of the two primes**p**and**q**. - Calculates Euler’s totient function
**phi**as (p-1)*(q-1). - Checks that the public exponent
**e**is coprime with**phi**. - Computes the private key
**d**as the modular multiplicative inverse of**e**mod**phi**. - Encrypts the message by raising it to the power of
**e**and taking modulo**n**. - Decrypts the message by raising the encrypted result to the power of
**d**and taking modulo**n**.

## Limitations

Due to the computational limits of JavaScript:

- The calculator may not handle very large primes efficiently.
- The calculations are done using simple arithmetic operations and may not be suitable for cryptographic purposes in a real-world context.