Spaces:
Sleeping
Sleeping
| title: Neural Cryptanalysis Lab | |
| emoji: π | |
| colorFrom: purple | |
| colorTo: green | |
| sdk: docker | |
| pinned: true | |
| # π Neural Cryptanalysis Lab | |
| > **Interactive web application** for evaluating ML-based neural distinguishers on 14 modern lightweight block ciphers. | |
| [](https://huggingface.co/spaces/) | |
| --- | |
| ## π Web App Features | |
| Run all experiments **without touching the command line**: | |
| | Experiment | Description | | |
| |---|---| | |
| | β Representation Analysis | Tests all 10 input representations β which format best distinguishes cipher from random? | | |
| | β‘ Model Comparison | Benchmarks MLP, CNN, SiameseNet, and MINE on the same configuration | | |
| | β’ Round Limits Analysis | Sweeps round counts to find the security boundary of each cipher | | |
| | β£ Confusion Matrix | Visual heatmap of true vs predicted labels for selected ciphers | | |
| | β€ Dataset Distribution | Hamming weight distribution of ΞC vs ideal random | | |
| | β‘ Full Pipeline | Runs all 4 experiments sequentially β mirrors `python run_all.py` | | |
| **Bonus Tasks:** | |
| - π Differential Characteristic Search | |
| - βοΈ Classical Cryptanalysis vs ML Comparison | |
| - π Transfer Learning across round counts | |
| - π Partial Key Recovery via distinguisher scoring | |
| ### Key UI Features | |
| - **Multi-select** ciphers, models, representations | |
| - **Round sweep** field (comma-separated, e.g. `3,4,5,6,7`) | |
| - **Live terminal** log during training (SSE streaming) | |
| - **Results table** with colour-coded accuracy + CSV export | |
| - **Pipeline mode** shows all 4 plots in a grid on completion | |
| --- | |
| ## π Running Locally | |
| ```bash | |
| git clone https://huggingface.co/spaces/<your-username>/neural-cryptanalysis | |
| cd neural-cryptanalysis | |
| pip install -r requirements.txt | |
| python3 backend_main.py | |
| # Open http://localhost:7860 | |
| ``` | |
| Or via the original CLI orchestrator: | |
| ```bash | |
| python3 run_all.py | |
| ``` | |
| --- | |
| ## π§± Tech Stack | |
| - **Backend**: FastAPI + Uvicorn, background threading, SSE streaming | |
| - **ML**: PyTorch (MLP, CNN, SiameseNet, MINE), scikit-learn | |
| - **Frontend**: Vanilla HTML/CSS/JS β zero dependencies | |
| - **Ciphers (14)**: SKINNY, CRAFT, ASCON, SATURNIN, GIFT-64/128, XOODOO, GIMLI, SPARKLE, KNOT, QARMA, PIPO, WARP, CHAM | |
| - **Representations (10)**: Raw, Diff, Concat, Bit-Slice, Word, Intermed, Noisy, Joint P-C, Stats, Sequential | |
| --- | |
| ## π Report | |
| See `Neural_Cryptanalysis_Report.pdf` for the full academic write-up. | |