A comprehensive cryptography toolkit built with Flask that provides implementations of classical ciphers and steganography techniques.
| Substitution Ciphers | Description |
|---|---|
| Shift cipher | Configurable character rotation (Caesar cipher variant) |
| Mixed-alphabet | Keyword-based alphabet substitution |
| Atbash | Ancient Hebrew cipher using alphabet reversal |
| Simple substitution cipher | Custom alphabet substitution with random generation |
| ROT13 | Special case of Caesar cipher with 13-character shift |
| Baconian | Binary encoding cipher using A/B patterns |
| Polybius square | Grid-based substitution cipher |
- LSB Steganography - Hide secret messages within image files
- Message Hiding - Embed text into PNG images using least significant bit manipulation
- Message Extraction - Retrieve hidden messages from steganographic images
- Backend: Flask (Python web framework)
- Frontend: HTML, CSS, JavaScript
- Cryptography: Custom cipher implementations
- Steganography: Stegano library with PIL/Pillow
- Production: Gunicorn WSGI server
- Proxy: Caddy/Nginx reverse proxy support
This project requires Python 3.11 or newer to run.
pip install Flask gunicorn stegano pillow
Development mode:
python app.py
Production with Gunicorn:
gunicorn -w 4 app:app
By default it runs on 127.0.0.1:8000. You can explicitly set your desired port:
gunicorn -w 4 -b 0.0.0.0:5000 app:app
| Part | Meaning |
|---|---|
| gunicorn | Starts the Gunicorn server, a production-grade WSGI HTTP server for running Python web apps (Flask, Django, etc.) |
| -w 4 | Runs 4 worker processes to handle requests concurrently. More workers = better performance under load (adjust based on your CPU cores) |
| app:app | Specifies where to find your Flask app: - First app = Python filename without .py extension (e.g., app.py) - Second app = Flask application object name inside your file (e.g., app = Flask(__name__)) |
Create a systemd service file to run in the background, start on boot, and restart on failure.
Create /etc/systemd/system/crypto-app.service:
[Unit]
Description=Gunicorn instance to serve Crypto Tools Flask app
After=network.target
[Service]
User=root
WorkingDirectory=/usr/share/caddy/crypto-app
ExecStart=/usr/local/bin/gunicorn -w 4 app:app
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
sudo systemctl start crypto-app
sudo systemctl enable crypto-app
sudo systemctl status crypto-app
You can set up a reverse proxy using nginx or caddy. But I have used caddy
Using Caddy web server:
crypto.sarthak.co.in {
reverse_proxy localhost:8000
}
- Navigate to the Ciphers section from the home page
- Select your desired cipher algorithm
- Enter text to encrypt or decrypt
- Configure algorithm-specific parameters (shift values, keywords, etc.)
- Choose encrypt/decrypt action
- View results instantly
- Go to the Steganography section
- Upload a cover image (PNG format recommended)
- Enter your secret message
- Generate steganographic image with hidden message
- Extract hidden messages from steganographic images
GET /- Home page with tool selectionGET/POST /cipher- Cipher encryption/decryption interfaceGET/POST /steganography- Steganography toolsGET /api- API documentation
##Security Notes