A from-scratch implementation of the Minicrypt reduction chain: foundational cryptographic primitives, symmetric cryptography, hashing, public-key cryptography, and secure multi-party computation — with an interactive web explorer for visualizing how each primitive reduces to the next.
No external cryptographic libraries are used. AES, Miller–Rabin primality testing, RSA, ElGamal, Diffie–Hellman, Oblivious Transfer, and Yao/GMW boolean circuits are all implemented in pure Python on top of standard integer arithmetic and os.urandom.
A FastAPI backend and React frontend that visualize the Minicrypt equivalence theorem:
- Build & Reduce: Start with a foundation (AES or DLP), build a source primitive, and reduce it to a target primitive (e.g.
AES → PRG → PRF). - View Proofs: See the cryptographic theorems (HILL, GGM, Luby-Rackoff) mapped to each reduction step.
- Interactive Demos: Run live simulations in the browser — birthday attacks on toy hashes, malleability attacks on raw RSA, IND-CPA security games, a Secure AND gate over Oblivious Transfer, and more.
- Dependency Graph: A live SVG map showing how the modules build on each other.
Requires Python 3.8+ and Node.js.
Install the backend dependencies (the cryptography itself needs none):
pip install fastapi uvicornStart the API server from the repository root:
python3 -m uvicorn api.server:app --host 0.0.0.0 --port 8000 --reloadStart the frontend dev server:
cd frontend && npm install && npm run devThen open http://localhost:5173.
Every cryptographic module runs independently from the command line, printing its internal operations and security-game simulations.
# Birthday attack simulation
python3 -m crypto.birthday
# 1-of-2 Oblivious Transfer protocol
python3 -m crypto.ot
# Two-party MPC circuit evaluation
python3 -m crypto.mpccrypto/— the pure-Python cryptographic implementations, one module per primitive or protocol.api/server.py— the FastAPI backend exposing the crypto modules and the reduction engine over REST.frontend/— the React + Vite explorer UI.