Cipher-Web is an interactive Flask web application that serves as a demonstration and execution suite for classical cryptography algorithms. Users can encrypt and decrypt plaintext inputs using several historical ciphers, compute mathematical properties (like modular inverses using the Extended Euclidean Algorithm), and interact with a visual web interface.
- Vigenère Cipher: Polyalphabetic substitution cipher that encrypts letters by shifting them based on a repeating keyword.
-
Hill Cipher: Polygraphic substitution cipher based on linear algebra:
- Supports both 2x2 and 3x3 key matrices.
- Performs matrix multiplication and matrix inversion modulo 26 using
SymPy.
- Monoalphabetic Cipher: Simple substitution cipher mapping the alphabet to a user-defined key alphabet.
-
Affine Cipher: Monoalphabetic shift cipher using modular arithmetic:
- Formula:
$E(x) = (ax + b) \pmod{26}$ . - Tuned with post-hoc frequency analysis fallback options for decryption.
- Formula:
-
Playfair Cipher: Encrypts pairs of letters (digraphs) using a dynamically generated
$5 \times 5$ matrix key. - Extended Euclidean Solver: Programmatic calculator for modular multiplicative inverses.
- Frontend: Bootstrap, HTML5, CSS3, Google Fonts
- Backend: Flask (Python)
- Math Engine: NumPy (matrix operations) & SymPy (symbolic mathematics and modular inversion)
To encrypt:
A block of plaintext letters represented as a vector
Cipher-Web/
├── templates/ # HTML template panels (index, vigenere, hill, affine, etc.)
├── static/ # Stylesheets and visual assets
├── app.py # Flask routing and cipher algorithm logic
├── requirements.txt # Package dependencies
└── README.md # Documentation
- Python 3.8+
cd github_repos/Cipher-Web
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtpython app.pyThe app will run on http://127.0.0.1:5000/.
Select a cipher from the navbar menu, input your text and keys, and click Encrypt/Decrypt to verify.