A simple and elegant web-based Caesar cipher encryption/decryption tool built with Python Flask. This application allows users to encrypt and decrypt messages using the classic Caesar cipher algorithm through an intuitive web interface.
- Encryption & Decryption: Easily encrypt or decrypt text messages
- Web Interface: Clean, responsive design with gradient styling
- Real-time Processing: Instant results without page refresh
- Case Preservation: Maintains uppercase and lowercase letters
- Non-alphabetic Support: Preserves numbers, spaces, and special characters
- User-friendly: Simple 0-25 shift range with clear instructions
- Python 3.7 or higher
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/yourusername/caesar-cipher.git cd caesar-cipher -
Create a virtual environment (recommended):
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and navigate to:
http://localhost:5000
- Enter your message in the text area
- Set the shift value (0-25)
- Click "Encrypt" to encode your message
- Click "Decrypt" to decode a message
- View results in the output box below
- Original: "Hello World"
- Shift: 3
- Encrypted: "Khoor Zruog"
- Decrypted: "Hello World"
caesar-cipher/
├── app.py # Flask web application
├── caesar.py # Caesar cipher algorithm
├── requirements.txt # Python dependencies
├── README.md # This file
├── LICENSE # MIT License
├── .gitignore # Git ignore rules
└── templates/
└── index.html # Web interface
- GET / - Serve the main web interface
- POST /process - Process encryption/decryption requests
- Request Body:
{"message": "text", "shift": number, "mode": "encrypt|decrypt"} - Response:
{"result": "processed_text"}
- Request Body:
The Caesar cipher shifts each letter in the alphabet by a fixed number of positions:
- Encryption:
(character_position + shift) % 26 - Decryption:
(character_position - shift) % 26 - Non-alphabetic characters remain unchanged
- Case is preserved (uppercase/lowercase)
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Improve documentation
- Submit pull requests
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by classical cryptography techniques
- Built with Flask web framework
- Designed for educational purposes
If you encounter any issues or have questions, please open an issue on GitHub.