A simple Caesar Cipher encryption and decryption program built with Python.
This project was created as a beginner Python project to practice functions, loops, conditionals, lists, user input, and error handling.
- 🔐 Encrypt messages using the Caesar Cipher
- 🔓 Decrypt encrypted messages
- 🔄 Supports repeated encryption/decryption
- 🔢 Custom shift values
⚠️ Handles invalid numeric input- 🔤 Preserves spaces and special characters
The Caesar Cipher is a simple substitution cipher that shifts each letter in the alphabet by a specified number.
For example, with a shift of 3:
a → d
b → e
c → f
...
x → a
y → b
z → c
Type 'encode' to encrypt, type 'decode' to decrypt:
encode
Type your message:
hello
Type the shift number:
3
Your encode result is: khoor
To decrypt the same message with a shift of 3:
khoor → hello
- Python 3.x
- No external libraries are required.
Make sure Python 3.x is installed on your computer.
You can check your Python installation with:
python --versiongit clone https://github.com/Ramtinexe/python-caesar-cipher.gitcd python-caesar-cipherThe main Python file is called main.py.
Run it with:
python main.pyThe program will then ask you whether you want to encode or decode a message.
python-caesar-cipher/
│
├── main.py
└── README.md
This project helped me practice:
- Variables
- Lists
- Functions
if / elseforloopswhileloops- User input
- String manipulation
- Modulo operator (
%) try / except- Basic input validation
- Add support for uppercase letters
- Improve input validation
- Separate encryption/decryption logic from user interface
- Add a graphical user interface
- Add automated tests