CoolFace
Apppublic

jatin25027/neural-cryptanalysis

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

๐Ÿ” Neural Cryptanalysis Lab

Interactive web application for evaluating ML-based neural distinguishers on 14 modern lightweight block ciphers.

![HuggingFace Space](https://huggingface.co/spaces/)


๐ŸŒ Web App Features

Run all experiments without touching the command line:

ExperimentDescription
โ‘  Representation AnalysisTests all 10 input representations โ€” which format best distinguishes cipher from random?
โ‘ก Model ComparisonBenchmarks MLP, CNN, SiameseNet, and MINE on the same configuration
โ‘ข Round Limits AnalysisSweeps round counts to find the security boundary of each cipher
โ‘ฃ Confusion MatrixVisual heatmap of true vs predicted labels for selected ciphers
โ‘ค Dataset DistributionHamming weight distribution of ฮ”C vs ideal random
โšก Full PipelineRuns 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.