A web app for encrypting and decrypting text with three classical ciphers: Caesar, Vigenère, and Playfair.
- Backend: Python + FastAPI (CORS-enabled REST API)
- Frontend: Vanilla HTML / CSS / JavaScript (no external libraries)
project/
├── backend/
│ ├── main.py # FastAPI app + endpoints
│ ├── ciphers.py # Cipher implementations + text helpers
│ └── requirements.txt
└── frontend/
├── index.html
├── style.css
└── script.js
cd backend
pip install -r requirements.txt
uvicorn main:app --reloadThe API runs at http://127.0.0.1:8000. Interactive docs at http://127.0.0.1:8000/docs.
| Method | Path | Body | Returns |
|---|---|---|---|
| GET | /ciphers |
— | cipher metadata |
| POST | /encrypt |
{cipher_type, plaintext, key} |
{result, cipher_type} |
| POST | /decrypt |
{cipher_type, ciphertext, key} |
{result, cipher_type} |
cipher_type is one of caesar, vigenere, playfair.
Open frontend/index.html directly in a browser, or serve it:
cd frontend
python3 -m http.server 5500Then visit http://127.0.0.1:5500. CORS is enabled on the backend so the page can
call the API.
- Caesar — key is an integer shift (0–25).
- Vigenère — key is a keyword (letters only).
- Playfair — key is a keyword.
Jis merged intoI, repeated letters in a digraph are split withX(orQif the letter is alreadyX), and odd-length text is padded withX. Spaces, digits, and punctuation are stripped from all input before processing, and output is uppercase.