DecodeLabs Cyber Security Training Kit — Project 2
A simple, well-tested implementation of the classic Caesar cipher, available two ways: an interactive Python CLI and a browser-based tool with a live cipher-disk visualization.
- Encrypts text using a Caesar cipher (letter-shift logic)
- Decrypts ciphertext back to the original message
- Handles spaces, punctuation, numbers, and shifts greater than 26 or negative
- Displays both encrypted and decrypted output
- Includes a browser version with a rotating cipher-disk visual that shows the letter mapping live as the shift changes
| File | Description |
|---|---|
caesar_cipher.py |
Main Python program with an interactive menu |
test_cipher.py |
Automated tests to verify correctness, including edge cases |
caesar_cipher.html |
Browser version with an interactive cipher disk — no install needed |
Python 3.6 or later. No external libraries needed.
- Download
caesar_cipher.pyandtest_cipher.pyinto the same folder. - Open a terminal in that folder.
- Run the main program:
(On some systems use
python caesar_cipher.pypython3 caesar_cipher.py) - You'll see a menu:
Type a number and press Enter, then follow the prompts.
1. Encrypt a message 2. Decrypt a message 3. Encrypt then decrypt (verify round-trip) 4. Exit
Enter choice (1-4): 3
Enter your message: Hello, World!
Enter shift key (e.g. 3): 3
Original Text : Hello, World!
Encrypted Text: Khoor, Zruog!
Decrypted Text: Hello, World!
Matches original: YES ✅
python test_cipher.py
This runs several pre-built cases (including edge cases like shift > 26 and negative shifts) and confirms every message decrypts back to its original form.
caesar_cipher.html runs the same encrypt/decrypt logic directly in the browser — no Python required. It includes:
- Encrypt, Decrypt, and Round-trip Verify modes
- A live shift slider with a numeric input
- An animated cipher disk that rotates to visualize the letter shift
- A copy-to-clipboard button on each output
Simplest way — just open the file directly:
- Double-click
caesar_cipher.html, or drag it into any browser tab.
To run it via localhost instead:
python -m http.server 8000
Then open http://localhost:8000/caesar_cipher.html in your browser.
- Let the user pick their own shift key (already supported here)
- Try building a Vigenère cipher, where the shift changes per letter based on a keyword instead of one fixed number