Skip to content

Repository files navigation

Classical Cipher Toolkit

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 structure

project/
├── backend/
│   ├── main.py            # FastAPI app + endpoints
│   ├── ciphers.py         # Cipher implementations + text helpers
│   └── requirements.txt
└── frontend/
    ├── index.html
    ├── style.css
    └── script.js

Running the backend

cd backend
pip install -r requirements.txt
uvicorn main:app --reload

The API runs at http://127.0.0.1:8000. Interactive docs at http://127.0.0.1:8000/docs.

Endpoints

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.

Running the frontend

Open frontend/index.html directly in a browser, or serve it:

cd frontend
python3 -m http.server 5500

Then visit http://127.0.0.1:5500. CORS is enabled on the backend so the page can call the API.

Notes on the ciphers

  • Caesar — key is an integer shift (0–25).
  • Vigenère — key is a keyword (letters only).
  • Playfair — key is a keyword. J is merged into I, repeated letters in a digraph are split with X (or Q if the letter is already X), and odd-length text is padded with X. Spaces, digits, and punctuation are stripped from all input before processing, and output is uppercase.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages