Lattice Cryptography Visualizer
Understanding the Math Behind Post-Quantum Security
3D Lattice Visualization
Why Lattice Cryptography?
โ ๏ธ The Quantum Threat
Quantum computers can break RSA and ECC using Shor's Algorithm. These algorithms protect most of today's internet!
โ The Solution: Lattices
Lattice-based cryptography relies on problems that are hard for both classical AND quantum computers.
NIST Standardized (2024)
๐ Use the 3D view to explore. Toggle buttons to see basis vectors, target points, and search animations.
What is a Lattice?
A lattice is a regular grid of points in n-dimensional space, generated by integer combinations of basis vectors.
Mathematical Definition
B = basis matrix, x = any integer vector
๐ Try It!
Click "Basis Vectors" to see the three vectors that generate this lattice. Every blue point is an integer combination!
Hard Lattice Problems
๐ Shortest Vector Problem (SVP)
Find the shortest non-zero vector in the lattice. Easy in 3D, impossible in 256D!
๐ Closest Vector Problem (CVP)
Given a target point, find the closest lattice point.
๐ Enable "Target Point" + "Search Animation" to visualize!
๐ข Dimension Explosion
Learning With Errors (LWE)
LWE adds noise to make lattice problems even harder. It's the core of Kyber and Dilithium.
The LWE Equation
๐ Visualize the Error
Enable "Target Point" and "Error Region". The orange sphere shows where the actual point could be!
Why is LWE Hard?
- Without error โ Simple linear algebra
- With error โ Becomes CVP problem!
- High dimensions โ Exponentially hard
๐ ML-KEM (Kyber)
FIPS 203 - Key Encapsulation Mechanism
How Kyber Works
Generate secret s, compute public Aยทs + e
Sender creates ciphertext with shared secret
Receiver uses secret s to recover key
Polynomial Rings
Kyber uses R_q = Z_q[X]/(Xยฒโตโถ+1) for efficiency - matrices of polynomials instead of numbers!
โ๏ธ ML-DSA (Dilithium)
FIPS 204 - Digital Signature Algorithm
How Dilithium Works
Generate secret vectors sโ, sโ
Fiat-Shamir transform, may retry
Anyone verifies with public key
Module-SIS Problem
Security relies on finding a short vector satisfying a system of equations - hard even for quantum!
๐ก๏ธ Why Quantum-Safe?
Shor's Algorithm Breaks...
- โ RSA (factoring)
- โ ECC (elliptic curves)
- โ Diffie-Hellman
Lattice Problems Resist...
- โ Shor's Algorithm (wrong type)
- โ Grover's (only โ speedup)
- โ All known quantum algorithms
Best Known Attack
At n=768, this is ~2ยฒยฒโด operations - impossible!
NIST Confidence
After 8+ years of analysis, NIST standardized these algorithms in 2024 with high confidence.