Skip to content

Lattice Gentle

SVP ยท LWE ยท SIS ยท eprint 2026/1098

Drag a 2D lattice's basis, step a real LLL reduction, solve real LWE and SIS instances over Fq, and watch toy-Kyber and toy-Dilithium stand on them โ€” every number on this page is computed live.

What is a lattice?

Take two arrows and stamp a dot at every whole-number combination of them โ€” that endless, perfectly regular grid of dots is a lattice. The same grid can be described by many different pairs of arrows, and here is the strange part: short, near-perpendicular arrows make the grid's secrets (its shortest dot, its nearest dot to any spot) easy to read off, while long, nearly-parallel arrows describe the identical grid and hide everything. That asymmetry is the guiding intuition of lattice-based cryptography โ€” but hold it loosely: ML-KEM and ML-DSA never hand honest users a secret good basis. Their secrets are short vectors hidden inside noisy modular equations (Exhibits 4โ€“5), and what the schemes stand on is the conjectured hardness of short-vector problems in high dimension, connected to MLWE and MSIS by security reductions.

โ‘  โ€“ โ‘ข geometry: bases, SVP, CVP, LLL โ‘ฃ the same gap over Fq: LWE & SIS โ‘ค module versions: MLWE & MSIS โ‡’ ML-KEM & ML-DSA

โš  Not production crypto โ€” a teaching demo with deliberately tiny parameters. It shows why the problems are believed hard; it does not prove hardness, and 2D lattices themselves are easy (Exhibit 3 solves them before your eyes โ€” the hardness lives in dimension 500+).

Glossary โ€” the eleven words this page leans on
  • Basis โ€” the vectors whose integer combinations generate the lattice; many bases, one lattice.
  • Norm โ€” a vector's length; the infinity norm is the largest absolute coordinate.
  • SVP โ€” Shortest Vector Problem: find a shortest nonzero lattice point.
  • CVP โ€” Closest Vector Problem: find the lattice point nearest a target.
  • BDD โ€” CVP when the target is promised to be very close (LWE's situation).
  • LWE โ€” Learning With Errors: recover s from noisy linear equations b = As + e mod q.
  • SIS โ€” Short Integer Solutions: find a short nonzero z with Az = 0 mod q.
  • MLWE / MSIS โ€” the same problems with polynomials in Zq[x]/(xⁿ+1) as entries.
  • KEM โ€” a scheme that transports a random shared key (not your message).
  • Signature โ€” a scheme where only the key holder can produce values a public verifier accepts.

Sources: Menezes, A gentle introduction to lattice-based cryptography, eprint 2026/1098 (v1.1 โ€” all numbered Examples cited below), and the cryptography101.ca Kyber/Dilithium slides (August 2024 โ€” the V1/V2/V3 page citations). Every worked-example value on this page runs as a regression test against those sources.

Exhibit 1 ยท One lattice, many bases โ€” and decoding by rounding

The dots are a fixed lattice (Example 2.24 of the notes). The arrows bโ‚, bโ‚‚ are a description of it โ€” drag their tips (or type coordinates) and watch the status line prove, by exact integer arithmetic, whether your arrows still generate the same dots. The point t is a target: "decoding" rounds t's coordinates in your current basis to whole numbers โ€” the Closest Vector Problem, solved the naive way. With the good basis the rounding error is small; switch to the bad basis of the same lattice and the same rounding lands far away. (Examples 2.7, 2.8, 2.10, 2.24 of the notes.)

Try first: press "Bad basis B′" โ€” does the dot pattern change? Does the decode?

Next: if bases can hide the near points, can they hide the short ones too? That question has a name โ€” SVP.

Exhibit 2 ยท Good basis, bad basis โ€” the Shortest Vector Problem

The Shortest Vector Problem (SVP) asks: given a basis, find a shortest nonzero lattice point. Here the shortest vector is found by exhaustive search and highlighted; toggle between the two bases of Examples 2.7/2.8 and watch the answer stay put while its visibility changes completely.

Exact vs approximate โ€” and where hardness really lives

Real cryptanalysis rarely needs an exactly-shortest vector: approx-SVP (find a vector at most ฮณ times longer) is the working problem, and it only gets easier as ฮณ grows. In two dimensions everything here is easy โ€” Gauss's algorithm in Exhibit 3 solves SVP outright. The conjectured hardness that Kyber and Dilithium lean on appears when the dimension reaches the hundreds, where the best known algorithms (BKZ with sieving) run in time exponential in the dimension.

Next: if a bad basis is the obstacle, can we compute our way back to a good one? Sometimes โ€” that is lattice reduction.

Exhibit 3 ยท Turning a bad basis good: Gauss and LLL, step by step

Reduction algorithms repair bad bases. Gauss's algorithm (2D) repeatedly subtracts the right whole-number multiple of the shorter vector from the longer one โ€” watch โ€–vโ€– collapse. LLL generalizes exactly that subtraction to any dimension and adds one new idea, the Lovรกsz condition, which decides when two neighbours should swap places. Every line below is replayed from the real algorithm's trace.

โš  What this isn't: LLL at toy sizes, shown honestly. Attacking real 500-dimensional schemes needs BKZ and sieving at scale, which no browser demo can meaningfully show โ€” this lab stops at the mechanism.

Next: cryptography cannot ship pictures of dots. The same geometry, rewritten as matrices mod q, is called LWE and SIS.

Exhibit 4 ยท The same gap, spoken in Fq: LWE and SIS

Cryptography can't ship pictures of dots; it ships matrices modulo q. Learning With Errors hides a secret behind noisy linear equations; Short Integer Solutions asks for a short kernel vector. Both are the geometry you just played with, re-coordinatized: LWE is CVP and SIS is SVP, in a lattice built from the matrix A (an exact formulation, §3–4 of the notes, not an analogy). Type candidates and both sides of each equation are computed for real. (Examples 4.3 and 3.2 of the notes.)

Next: swap the matrix entries for small polynomials and LWE/SIS become MLWE/MSIS โ€” the exact problems under Kyber and Dilithium.

Exhibit 5 ยท Standing on the gap: toy-Kyber and toy-Dilithium

Kyber (ML-KEM, FIPS 203) and Dilithium (ML-DSA, FIPS 204) upgrade LWE and SIS to module versions โ€” the same equations with polynomials in Zq[x]/(xโด+1) as the numbers. Notice what the secret is in both schemes: a short vector, never a good basis โ€” an ML-KEM recipient does not possess one. Basis quality was the geometric lens of Exhibits 1โ€“3; MLWE and MSIS are the exact problems, and the bridge from them to worst-case lattice problems is a security reduction, not a picture. Both demos below run the teaching slides' exact toy parameters, reproduce their worked examples digit for digit, and let you break things and watch the real arithmetic refuse.

Next: five questions. If you can answer them, you did not just watch this page โ€” you learned it.

Check yourself ยท five questions, zero numbers to recall

Every question asks you to transfer an idea to a situation this page never showed โ€” none asks you to remember a displayed value. Answer, then read why; wrong answers teach more than right ones here.

What's real here โ€” and what isn't