- Open the application in your web browser.
- In the text area, enter the text you want to encrypt or decrypt.
- Enter a key value between 0 and 25 in the "Key" input field. This determines how many positions each letter in the alphabet will be shifted.
- Select either "Encrypt" or "Decrypt" from the dropdown menu.
- Click the button to process your action.
- The result will be displayed in the "Result" section below the form.
This application is built using React and implements the Caesar Cipher algorithm without relying on any external encryption libraries. Here's an overview of the key components:
App.jsx
: The main component that manages the application state and renders other components.InputForm.jsx
: Handles user input for text, key, and operation type.OutputDisplay.jsx
: Displays the result of the encryption or decryption process.caesarCipher.js
: Contains the core logic for the Caesar Cipher algorithm.
The encryption and decryption functions work by shifting each letter in the input text by the specified key value. Non-alphabetic characters are left unchanged.
To install and run this application locally, follow these steps:
-
Clone the repository:
git clone https://github.com/yusufroqib/caesar-cipher.git cd caesar-cipher
-
Install dependencies:
Using npm:
npm install
-
Start the development server:
Using npm:
npm run dev
This project includes basic unit tests for the Caesar Cipher algorithm. To run the tests, use the following command:
Using npm:
npm test