ayana123's picture
updated for deployment
f937622
|
Raw
History Blame Contribute Delete
2.45 kB
metadata
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.

HuggingFace Space


🌐 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

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:

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.