Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Interactive RSA Cryptography Demo

This is a fully browser-based web application that demonstrates the RSA encryption/decryption process. It uses the Square and Multiply algorithm for efficient modular exponentiation and is designed as an educational tool.

Live Demo: [Link to your GitHub Pages URL]

Technologies Used

  • HTML5
  • CSS3
  • Vanilla JavaScript (with BigInt for large number arithmetic)

Features

  • RSA Key Generation: Input two primes p and q to generate a public/private key pair.
  • Encryption/Decryption: Encrypt a numeric message with the public key and decrypt it with the private key.
  • Square and Multiply: The application uses and displays the step-by-step process of the Square and Multiply algorithm for all exponentiation operations.
  • Input Validation: Ensures that inputs are prime and that messages are valid.
  • No Backend: All computations are performed in the client's browser.

Setup Instructions

To run this project locally:

  1. Clone the repository: git clone https://github.com/<your-username>/<your-repo-name>.git
  2. Navigate to the project directory: cd <your-repo-name>
  3. Open the index.html file in your web browser.

Explanation of a Key Algorithm

Square and Multiply

The Square and Multiply algorithm (also known as binary exponentiation) is used to compute b^e mod m efficiently. Instead of performing e-1 multiplications, it reduces the complexity significantly.

The algorithm works by processing the bits of the exponent e from left to right.

  1. Start with a result of 1.
  2. For each bit in the binary representation of e: a. Square the current result: result = (result * result) mod m. b. If the bit is 1, multiply the result by the base: result = (result * b) mod m.
  3. After iterating through all bits, the final result is the answer.

This implementation uses JavaScript's native BigInt to handle the large numbers that are common in RSA.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages