A simple Python implementation of the classic Caesar Cipher encryption and decryption algorithm. This tool allows you to encrypt or decrypt text by shifting the letters by a specified number of positions.
- Encrypt or decrypt any text using the Caesar Cipher.
- Supports both uppercase and lowercase letters.
- Retains non-alphabetic characters (spaces, punctuation, numbers).
- Input validation for shift value and mode.
-
Run the script:
python caesar cipher.py -
Follow the prompts:
- Enter your text to encrypt or decrypt.
- Enter a shift value (an integer between 1 and 25).
- Choose the mode:
encryptordecrypt.
-
View the result:
- The processed text will be displayed, showing the original text, shift value, mode, and result.
=== Caesar Cipher Tool ===
Enter your text: Hello, World!
Enter shift value (1-25): 3
Choose mode (encrypt/decrypt): encrypt
Original text: Hello, World!
Shift: 3
Mode: encrypt
Result: Khoor, Zruog!
- Encryption: Each letter in the text is shifted forward by the specified value.
- Decryption: Each letter is shifted backward by the specified value.
- Non-alphabetic characters are left unchanged.
-
caesar_cipher(text, shift, mode='encrypt')
Processes the text with the specified shift and mode. -
main()
Command-line interface for user interaction.
- Python 3.x
This project is open source. See LICENSE for details.