This is a React-based implementation of the Vernam Cipher, a symmetric key cipher used for encryption and decryption of text. The component allows users to input text, generate a key, encrypt the text using the Vernam Cipher, and decrypt it back using the same key.
- Input text to encrypt
- Generate a random key for encryption
- Encrypt text using the Vernam Cipher
- Decrypt encrypted text using the same key
- Displays the generated key in hexadecimal format
- Responsive UI for better user interaction
- React (v17 or higher)
- Basic understanding of the Vernam Cipher
-
Clone this repository:
git clone https://github.com/yourusername/vernam-cipher-react.git
-
Navigate into the project directory:
cd vernam-cipher-react
-
Install the dependencies:
npm install
-
Start the development server:
npm start
Visit
http://localhost:3000
in your browser to see the component in action.
- Enter Text: Type the text you want to encrypt into the "Enter Text" field.
- Generate Key: Click the "Generate Key" button to generate a random key for encryption. The key is displayed in hexadecimal format.
- Encrypt: Click the "Encrypt" button to encrypt the entered text using the generated key. The encrypted output will be displayed in hexadecimal.
- Decrypt: If you have encrypted text, click the "Decrypt" button to decrypt the text back to its original form.
- Enter a text, e.g., "Hello World".
- Click "Generate Key" to generate a random key.
- Click "Encrypt" to encrypt the text.
- Click "Decrypt" to decrypt the text back to "Hello World".
The component uses a simple, clean layout that you can customize in the accompanying VernamCipher.css
file.
inputText
: Holds the user input text to be encrypted.key
: Holds the random key used for encryption and decryption.keyDisplay
: Displays the key in hexadecimal format.outputText
: Displays the output text (either encrypted or decrypted).encryptedText
: Stores the encrypted text for decryption.
This project is licensed under the MIT License - see the LICENSE file for details.
- Adrian Statescu
Feel free to open issues or submit pull requests for any improvements or suggestions.