What you should be able to explain by the end
Foundations
Describe a lattice, a basis, short-vector intuition, modular arithmetic, polynomial rings, and why adding a small error can make a linear problem difficult.
Mechanisms
Explain KeyGen → Encaps → Decaps, and distinguish a key-encapsulation mechanism from bulk data encryption and from a digital signature.
Algorithms
Compare FrodoKEM, NTRU, and CRYSTALS-Kyber/ML-KEM by their algebraic structure, underlying hard problem, implementation tradeoffs, and standardization status.
The big picture
Classical public-key cryptography often relies on integer factoring or discrete logarithms. A sufficiently capable quantum computer running Shor’s algorithm would threaten those assumptions. Lattice-based systems instead build security from problems involving high-dimensional geometric or algebraic structures for which no comparably devastating quantum algorithm is known.
A recurring teaching idea in this tutorial is simple: linear algebra is easy; linear algebra with carefully chosen uncertainty can be hard. LWE turns that intuition into a rigorous cryptographic problem.
What is a lattice?
A lattice is an infinite, regularly repeating set of points obtained by taking integer combinations of basis vectors. In two dimensions, choose two linearly independent vectors b₁ and b₂. Every lattice point has the form:
The same lattice can have many different bases. A “nice” basis may consist of short, nearly orthogonal vectors; an awkward basis can consist of long, skewed vectors. This difference between an easy description and a difficult-looking description helps build intuition for lattice cryptography.
Try this
Move the basis sliders, then click anywhere in the plot. The demo searches nearby integer combinations and marks a close lattice point.
Real cryptographic lattices have hundreds or thousands of dimensions. Two dimensions are used only to build geometric intuition.
Basis ≠ lattice
A basis is a description of a lattice, not the lattice itself. Different bases can generate the same set of points.
Which lattice problems are supposed to be hard?
SVP
Shortest Vector Problem: find a shortest nonzero vector in a lattice. Exact and strong approximation variants become computationally difficult in high dimension.
CVP
Closest Vector Problem: given a target point not necessarily on the lattice, find the closest lattice point. Again, the high-dimensional problem is the important one.
SIS / LWE
Short Integer Solution and Learning With Errors are algebraic problems closely tied to lattice hardness and are especially useful for constructing cryptographic primitives.
Why quantum resistance is plausible
Shor’s algorithm exploits special algebraic structure in factoring and discrete logarithms. No known quantum algorithm solves the lattice problems used by modern lattice cryptography with a similar exponential-to-polynomial collapse. “Post-quantum” therefore means designed around problems currently believed to resist both classical and quantum attacks; it does not mean mathematically proven invulnerable.
Learning With Errors: linear equations plus tiny mistakes
Suppose a secret value is s. If an attacker sees many exact modular equations of the form b = a·s mod q, recovering s is usually straightforward. LWE changes the equation by adding a small random error:
Each sample is almost consistent with the same secret, but not exactly. In the real problem, s, a, and e are vectors (or structured vectors of polynomials), and the dimension is large.
Generate toy LWE samples
Three related flavors
| Flavor | Objects | Intuition | Seen in this tutorial |
|---|---|---|---|
| LWE | ordinary vectors / matrices mod q | least additional algebraic structure | FrodoKEM |
| Ring-LWE | polynomials in a quotient ring | more structure; efficient polynomial arithmetic | background for ring-based systems |
| Module-LWE | vectors of ring elements | middle ground between plain LWE and a single ring element | CRYSTALS-Kyber / ML-KEM |
What is a KEM?
A key-encapsulation mechanism is not normally used to encrypt an entire file directly. Its job is to let two parties agree on a fresh shared secret over a public channel. That secret then feeds a symmetric cipher or authenticated-encryption scheme.
Generates a public/secret key pair.
Uses Alice’s public key to encapsulate.
FrodoKEM: “plain” LWE with large matrices
FrodoKEM is designed around comparatively conservative algebraic structure: rather than using polynomial-ring structure for its main LWE computation, it works with large matrices over modular integers. That makes the connection to plain LWE especially direct, at the cost of larger keys/ciphertexts and heavier matrix arithmetic than highly structured schemes.
Core public-key shape
A is a large public matrix (often generated from a compact seed). S is secret and small. E is small random error. The public information contains A and a noisy product B.
Encapsulation intuition
The encapsulator uses fresh small secrets/errors. The recipient combines the ciphertext with the secret matrix S; matching products largely cancel, leaving an encoded value plus manageable noise.
Mini matrix laboratory
The following uses tiny 3×3 matrices and tiny numbers so you can see every operation. This is a teaching model only.
A (public)
S (small secret)
E (small error)
B = A·S + E mod q
What to remember
- FrodoKEM is an excellent teaching example for seeing the connection between matrix algebra and LWE noise.
- It deliberately avoids the same degree of algebraic structure exploited for efficiency in ring/module schemes.
- That design choice changes engineering tradeoffs; it does not mean “structure is insecure.” Modern structured schemes are parameterized and analyzed specifically around their chosen assumptions.
NTRU: small polynomials, modular rings, and convolution
NTRU predates the modern LWE family and has its own long line of analysis. Its arithmetic is built from polynomials with small coefficients in a quotient ring. Instead of multiplying ordinary integers or matrices, the algorithm repeatedly multiplies polynomials and reduces them by a polynomial relation and by an integer modulus.
Why polynomial rings?
A polynomial such as 2 − x + x³ can act like a compact vector. Multiplication becomes convolution. Reducing by xⁿ−1 “wraps” high-degree terms around.
Key intuition
Private polynomials are chosen to be small and to have required inverses modulo selected moduli. A public polynomial hides the private relationship. Encapsulation/encryption mixes a message or key-dependent value with fresh small randomness.
Polynomial convolution lab
Enter coefficient lists for two degree-<7 polynomials. The demo multiplies them using cyclic convolution (the behavior created by reducing by x⁷−1), then reduces coefficients mod q.
NTRU and the NIST process
NTRU reached the third-round finalist stage of NIST’s post-quantum standardization process. NIST ultimately standardized CRYSTALS-Kyber as the initial lattice-based KEM rather than NTRU. NTRU remains important historically, academically, and in continuing standardization and implementation work outside that specific NIST selection.
CRYSTALS: Kyber → ML-KEM, Dilithium → ML-DSA
CRYSTALS-Kyber is the submission from which NIST’s ML-KEM standard was derived. CRYSTALS-Dilithium is a related lattice-based signature design from which NIST’s ML-DSA was derived. One establishes keys; the other signs data. Do not mix their roles.
| CRYSTALS line | NIST standardized name | Purpose | Primary standard |
|---|---|---|---|
| CRYSTALS-Kyber | ML-KEM | Key encapsulation / shared-secret establishment | FIPS 203 |
| CRYSTALS-Dilithium | ML-DSA | Digital signatures | FIPS 204 |
Module-LWE in one picture
ML-KEM works with short vectors of polynomials rather than one giant ordinary matrix or a single polynomial. Its base polynomial ring is:
At a conceptual level, a public value again resembles a noisy linear map:
But now entries of A, s, e, and t are polynomials in Rq. ML-KEM uses fast polynomial arithmetic, including number-theoretic-transform techniques, to make these operations efficient.
Interactive miniature module demo
Real ML-KEM polynomials have 256 coefficients. This toy version uses four coefficients so you can watch the algebra. It uses negacyclic reduction, corresponding to x⁴ = −1.
Secret vector s
Error vector e
Public t = A·s + e
The three standardized ML-KEM parameter sets
Lowest of the three standardized security-strength options and generally the smallest/fastest of the set.
Middle parameter set. A common teaching and deployment reference point because it balances security strength and overhead.
Highest security-strength option among the three, with correspondingly greater bandwidth/computation costs.
Side-by-side comparison
| Feature | FrodoKEM | NTRU | CRYSTALS-Kyber / ML-KEM |
|---|---|---|---|
| Main teaching lens | Plain LWE with matrices | NTRU polynomial-ring arithmetic | Module-LWE with vectors of polynomials |
| Algebraic structure | Less structured large matrices | Strong polynomial quotient-ring structure | Module over a polynomial quotient ring |
| Typical engineering character | Comparatively large data and heavier matrix work | Compact polynomial operations; long research history | Compact and fast; designed for efficient software/hardware arithmetic |
| NIST PQC outcome | Evaluated candidate; not the selected NIST KEM standard | Round-3 finalist; not selected as the initial NIST KEM standard | Kyber selected; standardized derivative ML-KEM in FIPS 203 |
| Best first concept to remember | “A·S + noise” | “small polynomials + convolution + modular inverses” | “matrix algebra where each entry is itself a polynomial” |
Three common misconceptions
No. These algorithms run on ordinary computers. They are designed to remain secure even if attackers later obtain powerful quantum computers.
Usually not. A KEM establishes a shared secret; symmetric authenticated encryption handles bulk data.
No. Structure can enable efficiency, but its security implications must be analyzed for the specific construction and parameters.
Why migration matters before a large quantum computer exists
An adversary can collect encrypted traffic today and attempt to decrypt it later if cryptanalytic capabilities improve. This “harvest now, decrypt later” risk is most important for information that must remain confidential for many years. Migration also takes time because cryptography is embedded in protocols, certificates, hardware, firmware, key-management systems, and compliance processes.
Interactive laboratory checklist
Use the controls in the earlier modules, then record your answers. The browser stores completion locally on this device.
Optional implementation lab with Open Quantum Safe
If students have a separate development machine, the Open Quantum Safe liboqs project provides a common API for experimenting with post-quantum KEMs and signatures. Use it as a prototyping/learning environment and follow the project’s current algorithm-status notes rather than assuming every experimental algorithm is production-ready.
Knowledge check
Glossary
Basis: a set of linearly independent vectors whose integer combinations generate a lattice.
Ciphertext / encapsulation: public data produced during encryption or KEM encapsulation and sent to the recipient.
CVP: Closest Vector Problem.
Error / noise: deliberately sampled small values that obscure exact linear relationships in LWE-style systems.
KEM: Key-Encapsulation Mechanism; establishes a shared secret using a public/secret key pair.
Lattice: a discrete set of points generated by integer combinations of basis vectors.
LWE: Learning With Errors, a noisy linear-equation problem connected to lattice hardness.
ML-KEM: NIST’s Module-Lattice-Based Key-Encapsulation Mechanism standardized in FIPS 203 and derived from CRYSTALS-Kyber.
ML-DSA: NIST’s Module-Lattice-Based Digital Signature Algorithm standardized in FIPS 204 and derived from CRYSTALS-Dilithium.
Module-LWE: an LWE variant using vectors whose entries are elements of a polynomial ring.
Modulus q: the integer used for modular reduction; values “wrap around” modulo q.
NTT: Number Theoretic Transform; a finite-field analogue of FFT-style techniques used to accelerate certain polynomial operations.
Negacyclic convolution: polynomial convolution under a relation such as xⁿ = −1.
PQC: Post-Quantum Cryptography.
Quotient ring: a polynomial ring in which a selected polynomial relation is treated as zero, causing high-degree terms to reduce or wrap.
Ring-LWE: LWE formulated in a polynomial ring.
SIS: Short Integer Solution problem.
SVP: Shortest Vector Problem.
Authoritative and useful external sources
The links below are intentionally weighted toward standards bodies, algorithm-team specifications, peer-reviewed/ePrint papers, and maintained implementation projects.
Standards and NIST project material
FIPS 203 — ML-KEM
Final U.S. standard for the Module-Lattice-Based Key-Encapsulation Mechanism.
Open NIST FIPS 203FIPS 204 — ML-DSA
Final U.S. standard for the Module-Lattice-Based Digital Signature Algorithm.
Open NIST FIPS 204Post-Quantum Cryptography Project
Standardization history, selected algorithms, submissions, reports, and updates.
Open NIST PQC projectSelected algorithms
Official page identifying CRYSTALS-Kyber, CRYSTALS-Dilithium, and other selected algorithms.
Open selected-algorithms pageNIST IR 8309
Second-round status report; useful for seeing how FrodoKEM, NTRU, Kyber, and peers were evaluated in the competition.
Open IR 8309Round 3 submissions
Official finalist/alternate information, including NTRU and CRYSTALS-Kyber.
Open Round 3 pageFrodoKEM
FrodoKEM project
Algorithm information, specification, software, and project material.
Open FrodoKEM siteFrodoKEM written specification
Detailed mathematical and algorithmic description of FrodoPKE/FrodoKEM.
Open specification PDFNTRU
NTRU project site
NIST submission history, news, and current project links.
Open NTRU siteNTRU resources
Submission packages, specifications, implementations, test vectors, and presentations.
Open NTRU resourcesCRYSTALS / Kyber / Dilithium
CRYSTALS-Kyber
Original Kyber project material and submission documentation.
Open Kyber siteKyber resources
Specifications, papers, implementation work, and presentations.
Open Kyber resourcesCRYSTALS-Dilithium
Original Dilithium project material for the signature side of CRYSTALS.
Open Dilithium siteDilithium resources
Algorithm specifications and supporting research.
Open Dilithium resourcesLattice foundations and deeper reading
Regev — Learning With Errors
Foundational work linking LWE to worst-case lattice problems.
Open ACM recordPeikert — A Decade of Lattice Cryptography
Widely used survey covering lattice problems, LWE/SIS, reductions, and constructions.
Open IACR ePrint PDFPeikert — Lattices in Cryptography
Graduate-level course page with lecture notes and mathematical background.
Open course pageOpen Quantum Safe / liboqs
Open-source experimentation framework with a common API for PQC KEMs and signatures.
Open liboqsOQS ML-KEM page
Algorithm metadata, source links, and implementation status for ML-KEM.
Open OQS ML-KEM pageliboqs example code
Small examples illustrating KEM encapsulation/decapsulation and digital signatures.
Open examples