Playfair Cipher — Flask Web App Project Structure playfair_flask/ ├── app.py # Flask backend (Python Playfair cipher logic) ├── requirements.txt # Dependencies ├── templates/ │ └── index.html # Frontend (Terminal/Hacker aesthetic) └── README.md Setup & Run 1. Install Flask pip install -r requirements.txt 2. Run the App python app.py 3. Open Browser http://127.0.0.1:5000 Flask API Endpoints Endpoint Method Description / GET Main page /encrypt POST Encrypt plaintext /decrypt POST Decrypt ciphertext /matrix POST Get 5x5 key matrix only Example Request POST /encrypt { "text": "HIDE THE GOLD", "key": "MONARCHY" } Example Response { "result": "BM OD ZB XD NA", "matrix": [["M","O","N","A","R"],["C","H","Y","B","D"],...], "digraphs": ["HI","DE","TH","EG","OL","DX"] } How Playfair Works Build 5x5 matrix from key (I/J merged) Split plaintext into digraphs (letter pairs) If same row → shift right If same column → shift down If rectangle → swap corners