← Learning Duc V. Le

Learning with AI · study companion

Learning Lattice Cryptography

A companion to Vadim Lyubashevsky, Basic Lattice Cryptography: The concepts behind Kyber (ML-KEM) and Dilithium (ML-DSA) (2024; version last updated June 18, 2025) — following the paper section by section, with every skipped step spelled out and the key ideas made interactive.

by Duc V. Le · section, equation, figure and table numbers are the paper's

Contents

How to read this page

The page follows the paper exactly: same section order, same section, equation, figure and table numbers, same notation. Each numbered subsection has up to four parts, always in this order and always marked the same way:

The paper saysA faithful restatement of the paper, with the exact source in grey, e.g. §2.3, Eq. (6). Conditions and the direction of every “if” are kept exactly as the paper states them.
Spelled outThe steps the paper skips: expanded algebra, filled-in proofs, intuition, and analogies to ElGamal and Schnorr. These come from my companion guide (pdf), which was checked against the paper.
IllustrationToy parameters and numbers chosen for teaching. They are computed live, but they are not the paper's numbers, and they are always labelled like this.
Try it

Interactive boxes

Each one lets you change a definition's inputs or step through an algorithm. When the paper gives a worked example or a parameter set, the box starts on it and reproduces the paper's values exactly; every chart also has a table view.

NoteUsed sparingly, where the paper has a typo or an inconsistency that would otherwise mislead you.

At the end of each subsection, a recap box ends with the question the next subsection answers. You can tick “mark as read”; the ticks are saved only in your browser.

What you should know first

Public-key encryption and CPA security; ElGamal, and the DDH assumption behind it; Schnorr identification and signatures; the hybrid argument. Nothing about lattices is assumed.

Notation cheat-sheet (paper §2.1, §4.2)
SymbolMeaning
$\mathbb{Z}_q$integers modulo $q$; to measure size we use the centred representatives $\{-\lfloor q/2\rfloor,\ldots,\lfloor q/2\rfloor\}$
$[\beta]$the set $\{-\beta,\ldots,\beta\}$
$s \leftarrow [\beta]$, $\mathbf{s}\leftarrow[\beta]^m$every coefficient sampled uniformly from $[\beta]$ (for polynomials: every coefficient of every polynomial)
$\mathbf{A}\leftarrow\mathbb{Z}_q^{n\times m}$uniformly random matrix
$\|\mathbf{v}\|_\infty$, $\|\mathbf{v}\|$largest absolute coefficient; Euclidean length
$\lceil x\rfloor_{q\to p}$modulus switching $\lceil xp/q\rfloor \in\mathbb{Z}_p$ (Definition 3)
$\mathcal{R}_f$, $\mathcal{R}_{q,f}$polynomials modulo $f$ with integer / $\mathbb{Z}_q$ coefficients
$\mathcal{V}_a$, $\mathcal{M}_a$coefficient vector of $a$; the matrix of multiplication by $a$ (Eq. (44))
$\psi_\eta$centred binomial distribution (Definition 8)
$\mathrm{HIGH}_\mathcal{S}$, $\mathrm{LOW}_\mathcal{S}$nearest point of $\mathcal{S}$; the remainder (Section 2.5.1)

§1Prelude

The paper says

The road to the NIST standards

Modern lattice cryptography starts with two works from the mid 1990s. Ajtai [Ajt96] showed that solving a random instance of the Small Integer Solution (SIS) problem is as hard as solving some believed-to-be-difficult problem for every lattice. NTRU [HPS98] was an efficient public-key cryptosystem based on a new, potentially-hard problem over polynomial rings. Ajtai's line had strong guarantees but impractical instantiations; NTRU was practical but lacked a theoretical underpinning, and several NTRU-style constructions were later weakened or broken.

The two threads were woven together in the next decade: [Mic02, PR06, LM06] distilled the algebraic structure that gives lattice primitives NTRU-like efficiency with Ajtai-like guarantees, and Regev [Reg05] introduced the Learning with Errors (LWE) problem and showed that random LWE is as hard as (quantumly) solving worst-case lattice problems. The first fully-homomorphic encryption scheme [Gen09] and the threat of quantum computers [Sho97] added momentum; by the start of the NIST post-quantum process in 2017, lattice schemes were among the fastest and most compact quantum-resistant primitives. §1, p. 2

Scope and audience

The tutorial covers the mathematical concepts and design decisions behind the two main NIST lattice standards: the KEM / encryption scheme CRYSTALS-Kyber (ML-KEM) and the signature scheme CRYSTALS-Dilithium (ML-DSA), plus the ideas behind Frodo and NTRU. It assumes familiarity with indistinguishability, the hybrid argument, CPA-secure encryption, random oracles and the Fiat–Shamir transform; keeping ElGamal and Schnorr in mind helps. §1, pp. 2–3

Lattice cryptography is “messy”: security depends on several parameters, and there are many optimization tricks (dropping low-order bits, rounding). But it needs very few “deep” mathematical concepts. The advice is to work through the details with pencil and paper once, then keep the high-level ideas. §1, p. 3

Not covered: advanced constructions beyond encryption and signatures, precise cryptanalysis, the geometric side needed for FALCON and trapdoor sampling [GPV08, Pei10, MP12], and quantum aspects (the ROM versus the QROM). §1, pp. 3–4

Outline

§2 builds encryption over $\mathbb{Z}_q$ from LWE, plus compression tricks; §3 introduces lattices and connects LWE and SIS to the hardness of lattice problems; §4 moves to polynomial rings and ends with Kyber and the NTT; §5 builds a lattice analogue of Schnorr signatures, ending with Dilithium. §1, p. 4

How this page follows it

Every heading below carries the paper's own section number, and every equation, figure, lemma and table number is the paper's. Where the paper skips a step we fill it in (marked spelled out); where we compute toy numbers, they are marked illustration. The companion PDF guide covers the same material in more depth.

§2Encryption

The paper says

We start with a CPA-secure public-key encryption scheme: three algorithms (key generation, encryption, decryption), and CPA security means that for any two messages of the adversary's choosing, their encryptions are computationally indistinguishable. Generic transformations such as Fujisaki–Okamoto [FO99] later turn CPA security into CCA security (§4.8).

Unlike discrete-log and factoring schemes, lattice schemes are most efficient when they allow decryption errors: even when everything is run correctly, a ciphertext may, with very small probability, decrypt wrongly. An error around $2^{-150}$ does not appear to hurt practical security, as long as the transformations' proofs account for it. §2, p. 5; footnote 5

Some Notation

The paper says

All operations are in the ring $(\mathbb{Z}_q, +, \times)$. $a \leftarrow S$ means $a$ is chosen uniformly from the set $S$. For a positive integer $\beta$,

$$[\beta] = \{-\beta, \ldots, -1, 0, 1, \ldots, \beta\}. \qquad (1)$$

$[\beta]^{n\times m}$ is an $n\times m$ matrix with coefficients in $[\beta]$; vectors are column vectors; $\mathbf{v} \in [\beta]^m$ can also be written $\|\mathbf{v}\|_\infty \le \beta$. $\lceil x \rfloor$ is the closest integer to $x$, with ties broken upwards. For polynomials $a = \sum a_i X^i$, $a \leftarrow [\beta]$ means every coefficient is uniform in $[\beta]$; a distribution $\psi$ can replace $[\beta]$. §2.1, Eq. (1)

Spelled out

We measure “smallness” with the centred representative: think of $\mathbb{Z}_q$ as $\{-\lfloor q/2\rfloor, \ldots, \lfloor q/2\rfloor\}$, so $q-1$ is really $-1$, a small number. $|[\beta]| = 2\beta+1$. Rounding ties up means $\lceil 6.5 \rfloor = 7$ and $\lceil -6.5 \rfloor = -6$.

Recap$[\beta]$ is the set of small integers; everything lives in $\mathbb{Z}_q$ read with centred representatives. Why can't we just use “$\mathbf{A}\mathbf{s}$ looks random” as an assumption?

A Motivating Example

The paper says

Pretend that for $n \ge m$ and $\beta \ll q$ the distributions $(\mathbf{A}, \mathbf{A}\mathbf{s})$ with $\mathbf{A} \leftarrow \mathbb{Z}_q^{n\times m}$, $\mathbf{s} \leftarrow [\beta]^m$, and $(\mathbf{A}, \mathbf{u})$ with $\mathbf{u} \leftarrow \mathbb{Z}_q^n$, are indistinguishable. This assumption is clearly false: Gaussian elimination inverts $\mathbf{A}$ (or an $m\times m$ sub-matrix) and checks whether some $\mathbf{s} \in [\beta]^m$ satisfies $\mathbf{A}\mathbf{s} = \mathbf{u}$. But it gives an ElGamal-like scheme: §2.2

$$\mathsf{sk}: \mathbf{s} \leftarrow [\beta]^m,\quad \mathsf{pk}: (\mathbf{A} \leftarrow \mathbb{Z}_q^{m\times m},\; \mathbf{t} = \mathbf{A}\mathbf{s}) \qquad (2)$$ $$(\mathbf{u}^T = \mathbf{r}^T\mathbf{A},\; v = \mathbf{r}^T\mathbf{t} + \mu), \quad \mathbf{r} \leftarrow [\beta]^m \qquad (3)$$ $$v - \mathbf{u}^T\mathbf{s} = \mathbf{r}^T\mathbf{A}\mathbf{s} + \mu - \mathbf{r}^T\mathbf{A}\mathbf{s} = \mu. \qquad (4),(5)$$

Security would follow from the assumption used twice: once for the public key, once (with $n$ and $m$ swapped) for $(\mathbf{A}', \mathbf{r}^T\mathbf{A}')$ with $\mathbf{A}' = [\mathbf{A} \mid \mathbf{t}]$. If $m \gg n$ the public key could be statistically uniform (§2.5.5), but the ciphertext would still need the assumption. §2.2, Eqs. (2)–(5)

Spelled out — the ElGamal skeleton

The paper's footnote 6 makes the comparison explicit. ElGamal: $\mathsf{pk} = (A, t = A^s)$, ciphertext $(u = A^r, v = t^r\mu)$, decrypt $v/u^s = A^{sr}\mu/A^{rs} = \mu$. Here: $\mathbf{r}^T$ multiplies from the left, $\mathbf{s}$ from the right, and $\mathbf{A}$ sits in the middle, so $\mathbf{r}^T\mathbf{A}\mathbf{s}$ cancels without needing commutativity. The only problem is that the assumption is false, as the demo shows.

Try it

Break the noiseless scheme with Gaussian elimination

A toy instance (illustration: $q = 97$, $m = 4$, $\beta = 1$). Gaussian elimination mod $q$ recovers the short secret from $\mathbf{t} = \mathbf{A}\mathbf{s}$. Then switch the noise on: the same algorithm returns $\mathbf{A}^{-1}\mathbf{t} = \mathbf{s} + \mathbf{A}^{-1}\mathbf{e}$, which is not small any more.

RecapThe ElGamal skeleton works over matrices, but $(\mathbf{A},\mathbf{A}\mathbf{s})$ is trivially distinguishable. What “small” change makes the assumption plausible?

The LWE Problem

The paper says

Definition 1 (LWE)

For positive integers $m, n, q$ and $\beta < q$, the $\mathsf{LWE}_{n,m,q,\beta}$ problem asks to distinguish

  1. $(\mathbf{A}, \mathbf{A}\mathbf{s} + \mathbf{e})$, where $\mathbf{A} \leftarrow \mathbb{Z}_q^{n\times m}$, $\mathbf{s} \leftarrow [\beta]^m$, $\mathbf{e} \leftarrow [\beta]^n$, from
  2. $(\mathbf{A}, \mathbf{u})$, where $\mathbf{A} \leftarrow \mathbb{Z}_q^{n\times m}$ and $\mathbf{u} \leftarrow \mathbb{Z}_q^n$.

The error $\mathbf{e}$ is what makes Gaussian elimination inapplicable. The problem becomes harder as $m$ and $\beta/q$ grow; $n$ has no known large impact unless it is as large as about $m^{2\beta+1}$ (linearization [AG11]), so we often write $\mathsf{LWE}_{m,q,\beta}$. §2.3, Definition 1

Uniform errors are for illustration: Regev's worst-case reductions [Reg09, Pei09] used rounded Gaussians, but this is not strictly necessary [DM13, MP13], and Kyber uses a binomial distribution because it is faster to sample. Definition 2 ($\mathsf{LWE}_{n,m,q,\psi}$) replaces $[\beta]$ by any distribution $\psi$. Some parameters make LWE trivially hard but useless (if $n < m$ and $\beta$ is large, $(\mathbf{A}, \mathbf{A}\mathbf{s}+\mathbf{e})$ can be statistically close to uniform), and some make it easy (if $m = 1$ it is not difficult to see whether $\mathbf{A}\mathbf{s}+\mathbf{e}$ is close to a multiple of the vector $\mathbf{A}$). Taking $\mathbf{s}$ from the same distribution as $\mathbf{e}$ gives an essentially equally hard problem [ACPS09]. §2.3, Definition 2, p. 7

Distinguishing $(\mathbf{A}, \mathbf{s}^T\mathbf{A} + \mathbf{e}^T)$ is also LWE, with $n$ and $m$ interchanged; by a hybrid argument, many samples $\mathbf{A}\mathbf{s}_i + \mathbf{e}_i$ and $\mathbf{s}_j'^T\mathbf{A} + \mathbf{e}_j'^T$ are indistinguishable from uniform, losing a factor of at most $(t + t')$. §2.3, p. 8

Spelled out — which way does the noise push hardness?

Close to the lattice, yet hard to tell: $\mathbf{t}$ sits near a lattice point, a random $\mathbf{u}$ does not, but no one knows how to see this efficiently. The natural attack (§3.3, Eqs. (37)–(38)) finds short $\mathbf{r}_1, \mathbf{r}_2$ with $\mathbf{r}_1^T\mathbf{A} + \mathbf{r}_2^T = \mathbf{0}$ and looks at $\mathbf{r}_1^T\mathbf{t} = -\mathbf{r}_2^T\mathbf{s} + \mathbf{r}_1^T\mathbf{e}$. The larger $\beta$ is, the shorter the vectors the attacker needs, so the harder the attack.

noise $\beta$ vs. $q$distinguishing LWEdecryption
zeroeasy (Gaussian elimination, §2.2)always correct
smallharder as $\beta/q$ growscorrect
too largehardestfails (noise $\ge q/4$)

Security wants $\beta/q$ large; correctness wants it small. A cryptosystem lives where both hold.

RecapLWE = the §2.2 assumption plus a small error; it is believed hard, and gets harder as $m$ and $\beta/q$ grow. Can we rebuild the §2.2 scheme on top of it?

An LWE-Based Encryption Scheme

The paper says

The message becomes a bit $\mu \in \{0,1\}$, and every product gets an error term:

$$\mathsf{sk}: \mathbf{s} \leftarrow [\beta]^m,\quad \mathsf{pk}: (\mathbf{A} \leftarrow \mathbb{Z}_q^{m\times m},\; \mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e}_1),\; \mathbf{e}_1 \leftarrow [\beta]^m \qquad (6)$$ $$\Bigl(\mathbf{u}^T = \mathbf{r}^T\mathbf{A} + \mathbf{e}_2^T,\;\; v = \mathbf{r}^T\mathbf{t} + e_3 + \bigl\lceil \tfrac q2 \bigr\rfloor \mu\Bigr),\quad \mathbf{r}, \mathbf{e}_2 \leftarrow [\beta]^m,\; e_3 \leftarrow [\beta] \qquad (7)$$

$\lceil q/2 \rfloor$ is the element of $\mathbb{Z}_q$ closest to the rational $q/2$ (e.g. if $q = 13$, then $\lceil q/2 \rfloor = 7$). Security: $(\mathbf{A}, \mathbf{t})$ is indistinguishable from uniform by $\mathsf{LWE}_{m,q,\beta}$; then, with $\mathbf{A}' = [\mathbf{A} \mid \mathbf{t}]$, so is $(\mathbf{A}', \mathbf{r}^T\mathbf{A}' + [\mathbf{e}_2^T \mid e_3])$. LWE is used twice, with $m$ as the number of columns and then as the number of rows. §2.3.1, Eqs. (6)–(7)

$$v - \mathbf{u}^T\mathbf{s} = \mathbf{r}^T\mathbf{e}_1 + e_3 + \tfrac q2\mu - \mathbf{e}_2^T\mathbf{s} \qquad (8),(9)$$

The error terms have coefficients bounded by $\pm\beta$, so $\mathbf{r}^T\mathbf{e}_1$ and $\mathbf{e}_2^T\mathbf{s}$ each consist of $m$ terms of magnitude at most $\beta^2$: the error lies in $[2m\beta^2 + \beta]$. If $2m\beta^2 + \beta < q/4$, the decryptor recovers $\mu$ by checking whether $v - \mathbf{u}^T\mathbf{s}$ is closer to $0$ or to $q/2$. §2.3.1, p. 9

Spelled out — the security proof as game hops

Game 0: real CPA game. Game 1: replace $\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e}_1$ by uniform — exactly an $\mathsf{LWE}_{m,q,\beta}$ instance. Game 2: now $\mathbf{A}' = [\mathbf{A}\mid\mathbf{t}]$ is uniform, so $(\mathbf{u}^T, v) = \mathbf{r}^T\mathbf{A}' + (\mathbf{e}_2^T, e_3 + \frac q2\mu_b)$ can be replaced by uniform — LWE again, rows and columns swapped. In Game 2 the ciphertext is independent of $b$. So $\mathrm{Adv}^{\mathrm{CPA}} \le 2\,\mathrm{Adv}^{\mathrm{LWE}}_{m,q,\beta}$ — the same two hops as ElGamal's proof under DDH.

On the circle, $\mu = 0$ sits at $0$ and $\mu = 1$ at $q/2$; the noise jiggles the point, and decoding picks the nearer half. That is why $|\text{noise}| < q/4$ suffices.

Try it

Encrypt, decrypt, and push the noise past $q/4$

Illustration with toy parameters (real schemes use $m$ in the hundreds). Choose a bit, re-sample the randomness, and scale the noise: once $|v - \mathbf{u}^T\mathbf{s} - \lceil q/2\rfloor\mu|$ reaches $q/4$, decryption fails. The worst-case bound $2m\beta^2 + \beta$ is shown for comparison.

RecapLWE encryption = ElGamal over matrices + noise; correctness needs the accumulated noise below $q/4$. The worst case $2m\beta^2+\beta$ is pessimistic — how likely is a large error really?

Bounding the Total Error, Exactly

The paper says

$2m\beta^2 + \beta$ is an upper bound, but the coefficients are random and centred, so the error is closer to $O(\sqrt m\,\beta^2)$. We want a bound that holds with very high probability (say $1 - 2^{-150}$), and for concrete parameters we can compute exactly §2.3.2

$$\Pr_{\mathbf{s},\mathbf{r},\mathbf{e}_1,\mathbf{e}_2 \leftarrow [\beta]^m,\, e_3 \leftarrow [\beta]}\bigl[\mathbf{r}^T\mathbf{e}_1 + e_3 - \mathbf{e}_2^T\mathbf{s} \in [\alpha]\bigr] \qquad (10)$$

using the fact that distributions of sums of independent random variables are products of polynomials: with $A(X) = \sum A_i X^i$, $B(X) = \sum B_i X^i$ and $C(X) = A(X)B(X) = \sum C_i X^i$,

$$\Pr[A + B = i] = C_i, \qquad \Pr[A+B \in [\alpha]] = \sum_{i=-\alpha}^{\alpha} C_i. \qquad (11),(12)$$

$\mathbf{r}^T\mathbf{e}_1 - \mathbf{e}_2^T\mathbf{s}$ is a sum of $2m$ independent variables with $A_i = \Pr_{x,y \leftarrow [\beta]}[xy = i]$, and $e_3$ is uniform over $[\beta]$. For $\beta = 2$: $A_{\pm4} = \frac{2}{25}$, $A_{\pm2} = \frac{4}{25}$, $A_{\pm1} = \frac{2}{25}$, $A_0 = \frac{9}{25}$. Setting $\alpha = q/4 - 1$ gives the exact probability of correct decryption. §2.3.2, pp. 9–10

Note

The paper's Eq. (12) prints the summand as $C_\alpha$; it should be $C_i$, as the paper itself writes a few lines later.

Spelled out

Multiplying the polynomials collects every pair of exponents that add up to $i$: $C_i = \sum_j A_j B_{i-j} = \sum_j \Pr[A = j]\Pr[B = i-j] = \Pr[A+B = i]$ by independence. It is the dice trick: the coefficient of $X^7$ in $\bigl(\frac16(X + \cdots + X^6)\bigr)^2$ is $\frac{6}{36}$. For $\beta = 2$ there are 25 equally likely pairs $(x,y)$: $xy = 0$ in 9 of them, $\pm1$ in 2 each, $\pm2$ in 4 each, $\pm4$ in 2 each, and $\pm3$ never. The minus sign in front of $\mathbf{e}_2^T\mathbf{s}$ does not matter because $[\beta]$ is symmetric.

Try it

The exact noise distribution, by polynomial multiplication

The table is the distribution of one product $xy$, $x,y \leftarrow [\beta]$ (the paper's preset $\beta = 2$). The chart raises its polynomial to the power $2m$ and multiplies by the uniform $e_3$, computed live in your browser. Slide $m$ and $\beta$; the read-outs compare the exact tail with the worst case.

RecapExact computation shows the noise is far below the worst case; for $\beta = 2$, $m = 256$ it lets $q$ shrink by about a factor of 3. So how big are the keys and ciphertexts?

Public Key and Ciphertext Size Trade-offs

The paper says

$\mathbf{A}$ is uniform, so it can be expanded from a 256-bit seed $\rho$ by a PRF (e.g. SHAKE); the public key costs $256 + m\log q$ bits. The ciphertext $(\mathbf{u}, v)$ costs $(m+1)\log q$ bits; secure parameters need $m \approx 700$ and $q \approx 2^{13}$, which is a lot for one bit. To amortize [PVW08, MR09, BCD+16], encrypt $N = k\ell$ bits arranged in $\mathbf{M} \in \{0,1\}^{k\times\ell}$: §2.4

$$\mathsf{sk}: \mathbf{S} \leftarrow [\beta]^{m\times\ell},\quad \mathsf{pk}: (\mathbf{A} \leftarrow \mathbb{Z}_q^{m\times m},\; \mathbf{T} = \mathbf{A}\mathbf{S} + \mathbf{E}_1) \qquad (13)$$ $$\Bigl(\mathbf{U} = \mathbf{R}\mathbf{A} + \mathbf{E}_2,\;\; \mathbf{V} = \mathbf{R}\mathbf{T} + \mathbf{E}_3 + \tfrac q2\mathbf{M}\Bigr) \qquad (14)$$

The public key grows to $256 + \ell m\log q$ bits; the ciphertext is $km\log q + k\ell\log q$ bits. For the minimum combined size set $k \approx \ell \approx \sqrt N$: about $256 + 2\sqrt N m\log q + N\log q$ bits, dominated by $2\sqrt N m\log q$ (one rarely needs more than $N = 256$). Security follows from $\mathsf{LWE}_{m,q,\beta}$ with a hybrid argument, losing $\log\ell$ bits (footnote 7: it is not clear in this case whether the loss is real). Each coefficient of $\mathbf{V} - \mathbf{U}\mathbf{S} = \mathbf{R}\mathbf{E}_1 + \mathbf{E}_3 + \frac q2\mathbf{M} - \mathbf{E}_2\mathbf{S}$ has exactly the single-bit noise (Eqs. (16)–(17)); a union bound over coefficients gives the total error (footnote 8). §2.4, Eqs. (13)–(17)

Spelled out

The $(i,j)$ coefficient of $\mathbf{V} - \mathbf{U}\mathbf{S}$ is $\mathbf{r}_i^T\mathbf{e}_{1,j} + e_{3,ij} + \frac q2\mu_{ij} - \mathbf{e}_{2,i}^T\mathbf{s}_j$ — row $i$ of $\mathbf{R}$, $\mathbf{E}_2$ and column $j$ of $\mathbf{S}$, $\mathbf{E}_1$ — exactly the §2.3.1 expression. So parameters are set exactly as before.

Try it

Size calculator

Preset: the paper's $m = 700$, $q = 2^{13}$, $N = 256$. Change $k$ (with $\ell = N/k$) to trade public-key size against ciphertext size.

RecapAmortizing turns linear ciphertext expansion into square-root expansion, paid for in public-key size. Which further tricks shrink things in practice?

Some Variations and Optimizations

The paper says

The scheme above is a general framework; when instantiating it there are several optimizations. It is not easy to know which to use and how to set parameters optimally without actually trying some possibilities. §2.5

Reducing the Ciphertext Size by Removing the Low-Order Part

The paper says

Send only $\kappa$ bits per coefficient of $\mathbf{V}$. Pick $\mathcal{S} \subset \mathbb{Z}_q$ of size $2^\kappa$ with neighbouring points as evenly spaced as possible ($q/2^\kappa$ is the best one can hope for): §2.5.1

$$\mathcal{S} = \bigl\{\lceil i\cdot q/2^\kappa \rfloor : 0 \le i < 2^\kappa\bigr\}. \qquad (18)$$

Every $v \in \mathbb{Z}_q$ is within $\lceil q/2^{\kappa+1}\rceil$ of $\mathcal{S}$. $\mathrm{HIGH}_\mathcal{S}(v)$ is the closest element of $\mathcal{S}$ and $\mathrm{LOW}_\mathcal{S}(v) = v - \mathrm{HIGH}_\mathcal{S}(v)$. Sending $\mathbf{V}' = \mathrm{HIGH}_\mathcal{S}(\mathbf{V})$ adds one term $\mathbf{E}' = \mathrm{LOW}_\mathcal{S}(\mathbf{V})$:

$$\mathbf{V}' - \mathbf{U}\mathbf{S} = \mathbf{R}\mathbf{E}_1 + \mathbf{E}_3 - \mathbf{E}' + \tfrac q2\mathbf{M} - \mathbf{E}_2\mathbf{S}. \qquad (19)$$

$\mathbf{E}'$ has limited effect because the other terms are inner products with much larger coefficients; $\kappa$ can usually be 3 or 4. Compressing $\mathbf{U}$ is harder: its error is multiplied by $\mathbf{S}$ (a term $\mathbf{E}''\mathbf{S}$), so one balances error against size by trial and error. §2.5.1, Figure 1, Eq. (19)

Spelled out — Figure 1

For $q = 13$, $\kappa = 2$: $i\cdot 13/4 = 0, 3.25, 6.5, 9.75$ round to $0, 3, 7, 10$ (6.5 rounds up). The gaps are $3, 4, 3, 3$, so every point is within half the largest gap, $2 = \lceil 13/8\rceil$, of $\mathcal{S}$; the point $5$ sits exactly between $3$ and $7$.

Try it

The paper's Figure 1: $\mathbb{Z}_{13}$ on a circle

Preset $q = 13$, $\kappa = 2$ (Figure 1). Click a point (or use the slider) to see $\mathrm{HIGH}_\mathcal{S}$ and $\mathrm{LOW}_\mathcal{S}$; change $q$ and $\kappa$ to see Eq. (18) for other moduli.

RecapDropping low-order bits of $\mathbf{V}$ adds one small error term and saves most of $\mathbf{V}$'s bits. Can we describe this compression by one clean rounding map?

Modulus Switching / Compression / Decompression

The paper says

Definition 3

For $x \in \mathbb{Z}_q$ and a positive integer $p$: $\;\lceil x \rfloor_{q\to p} = \bigl\lceil \frac{x\cdot p}{q} \bigr\rfloor \in \mathbb{Z}_p$.

Lemma 1

For integers $p < q$ and $x \in \mathbb{Z}_q$: $\;\bigl\lceil\lceil x\rfloor_{q\to p}\bigr\rfloor_{p\to q} = x + \eta \in \mathbb{Z}_q$ for some $\eta \in \mathbb{Z}$ with $|\eta| \le \frac{q}{2p} + \frac12$.

With $2^\kappa = p$, $\mathcal{S} = \{\lceil x\rfloor_{p\to q} : x \in \mathbb{Z}_p\}$, $\mathrm{HIGH}_\mathcal{S}(x) = \lceil\lceil x\rfloor_{q\to p}\rfloor_{p\to q}$, Lemma 1 proves $\mathrm{LOW}_\mathcal{S}(x) \in [\lceil q/2p\rceil]$. One transmits $\lceil x\rfloor_{q\to p} \in \mathbb{Z}_p$, not $\mathrm{HIGH}_\mathcal{S}(x)$. Decryption itself is compression to one bit: $\mu = \lceil v - \mathbf{u}^T\mathbf{s}\rfloor_{q\to2}$ (20). Other $\mathcal{S}$ can be equally good, e.g. $p = 4$, $q = 33$, $\mathcal{S} = \{0, 8, 16, 24\}$, needing only reductions and divisions mod 8. Kyber ($q$ small) uses the generic $\mathcal{S}$; Dilithium ($q$ larger) gets a nice $\mathcal{S}$ and fast multiplication. §2.5.2, Definition 3, Lemma 1, Eq. (20)

Spelled out — the proof of Lemma 1

Well-defined: replacing $x$ by $x + qk$ adds the integer $pk \equiv 0 \pmod p$. Proof: $\lceil x\rfloor_{q\to p} = \frac{xp}{q} + \delta$ with $|\delta| \le \frac12$; decompressing gives $\bigl\lceil x + \frac{\delta q}{p}\bigr\rfloor = x + \frac{\delta q}{p} + \delta'$ with $|\delta'| \le \frac12$. So $|\eta| \le \frac{q}{2p} + \frac12$: the first rounding loses at most $\frac12$ in units of $q/p$, the second adds at most $\frac12$.

Try it

Lemma 1, for every $x$

Preset $q = 13$, $p = 4$ (our illustration of Lemma 1; the decompressed values are exactly Figure 1's $\mathcal{S}$). Change $q$ and $p$: the largest $|\eta|$ never exceeds $\frac{q}{2p}+\frac12$.

Recap$\lceil\cdot\rfloor_{q\to p}$ is compression, $\lceil\cdot\rfloor_{p\to q}$ decompression, and their round trip moves $x$ by at most $\frac q{2p}+\frac12$. If rounding already adds error, do we still need $\mathbf{e}$?

Learning with Rounding

The paper says

By LWE, $(\mathbf{A}, \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{s} + \mathbf{e}))$ is indistinguishable from $(\mathbf{A}, \mathrm{HIGH}_\mathcal{S}(\mathbf{u}))$. But $\mathbf{e}$ may not change the rounded value at all: $\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{s}+\mathbf{e}) = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{s})$ with probability about $\bigl(1 - \frac{\beta|\mathcal{S}|}{2q}\bigr)^n$, because a coefficient changes only if $\mathbf{A}\mathbf{s}$ is within $\beta$ of a midpoint; per coefficient

$$\frac{2|\mathcal{S}|}{q}\sum_{i=1}^{\beta}\frac{i}{2\beta+1} \approx \frac{\beta|\mathcal{S}|}{2q}.$$

Distinguishing $(\mathbf{A}, \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{s}))$ from $(\mathbf{A}, \mathrm{HIGH}_\mathcal{S}(\mathbf{u}))$ is the Learning with Rounding (LWR) problem, at least as hard as LWE whenever adding $\mathbf{e}$ does not affect the rounded output [BPR12, AKPW13, BGM+16]. It is sometimes used even when $q$ is too small for a reduction, as a separate assumption. The best attacks treat it as LWE with implicit noise $\mathbf{e} = -\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{s})$, which is larger than the reduction's noise. Under LWR, rounding does two jobs: in (19), $\mathbf{E}'$ may make $\mathbf{E}_3$ unnecessary, and rounding $\mathbf{U}$ may make $\mathbf{E}_2$ unnecessary. §2.5.3, pp. 14–15

Spelled out — counting the bad cases

Fix a coefficient $a$ of $\mathbf{A}\mathbf{s}$ at distance $\beta - i$ from a midpoint ($i = 1..\beta$). Of the $2\beta+1$ values of $e$, exactly $i$ push $a+e$ across. There are $2|\mathcal{S}|$ such positions (two sides of each midpoint), each with probability $1/q$. Summing: $\frac{2|\mathcal{S}|}{q}\sum_{i=1}^{\beta}\frac{i}{2\beta+1} = \frac{|\mathcal{S}|\beta(\beta+1)}{q(2\beta+1)} \approx \frac{\beta|\mathcal{S}|}{2q}$.

Try it

When does rounding swallow the error?

The formula is the paper's; the Monte-Carlo column (illustration) samples uniform $a \in \mathbb{Z}_q$ and $e \leftarrow [\beta]$ and counts how often $\mathrm{HIGH}_\mathcal{S}(a+e) \ne \mathrm{HIGH}_\mathcal{S}(a)$.

RecapWhen $q \gg \beta|\mathcal{S}|$, rounding makes the explicit error redundant. Can one slot carry more than one bit?

Encrypting More Bits per Slot

The paper says

Pack the $N$ bits into $\mathbf{M} \in \{0, \ldots, 2^b-1\}^{(k/\sqrt b)\times(\ell/\sqrt b)}$ and use $\frac{q}{2^b}\mathbf{M}$ instead of $\frac q2\mathbf{M}$. The other error terms in (17) must then lie in $[q/2^{b+1}]$ instead of $[q/4]$. The trivial fix is to increase $q$ by about $2^{b-1}$. That can still shrink the public key: if $\ell$ halves, $256 + \ell m\log q$ becomes $256 + \frac{\ell m}{2}(\log q + b - 1)$, smaller if $b - 1 < \log q$. But a larger $q$ with everything else fixed lowers security (the problem gets harder as $\beta/q$ grows), so one must increase $\beta$ or $m$ — best found by a script. §2.5.4

Spelled out

$2^b$ message points sit evenly on the circle, so each decision region has width $q/2^b$ and the noise must stay below half of it, $q/2^{b+1}$. $\ell$ halves when, e.g., $b = 4$ (each dimension shrinks by $\sqrt b = 2$). The comparison is $\frac12(\log q + b - 1) < \log q \iff b - 1 < \log q$.

Try it

More message points, less room for noise

Illustration: choose $b$; the clock shows the $2^b$ message points and the tolerable noise $q/2^{b+1}$, and the calculator applies the paper's key-size formula with $q$ increased by $2^{b-1}$ and $\ell$ halved.

RecapEach extra bit per slot halves the noise budget. Can we make the public key truly uniform instead of computationally?

LWE Encryption with a “Non-Square” Public Key

The paper says

The leftover hash lemma [IZ89, IN96], roughly: if $\mathbf{A} \leftarrow \mathbb{Z}_q^{n\times m}$ ($q$ prime), $\mathbf{s} \leftarrow [\beta]^m$ and $(2\beta+1)^m \gg q^n$, then $(\mathbf{A}, \mathbf{A}\mathbf{s})$ is statistically close to $(\mathbf{A}, \mathbf{u})$. For a uniform public key, replace (13) by

$$\mathsf{sk}: \mathbf{S} \leftarrow [\beta']^{m\times\ell},\quad \mathsf{pk}: (\mathbf{A} \leftarrow \mathbb{Z}_q^{n\times m},\; \mathbf{T} = \mathbf{A}\mathbf{S}),\quad (2\beta'+1)^m > q^n. \qquad (21)$$

LWE is not used twice any more, so $\beta'$ need not equal $\beta$. Encryption and decryption stay as in (14) and (17), but $\mathbf{E}_2\mathbf{S}$ grows (larger $m$ and/or $\beta'$) and $\mathbf{R}\mathbf{E}_1 = 0$. A uniform ciphertext works the same way: choose $\mathbf{A}$'s dimension and $\mathbf{R}$'s distribution so that $([\mathbf{A}\mid\mathbf{T}], \mathbf{R}[\mathbf{A}\mid\mathbf{T}])$ is indistinguishable from $([\mathbf{A}\mid\mathbf{T}], [\mathbf{U}\mid\mathbf{V}])$. Applications: identity-based encryption [GPV08], where $\mathbf{t}_x = \mathcal{H}(x)$ is uniform and a trapdoor lets the authority find a short $\mathbf{s}_x$ with $\mathbf{A}\mathbf{s}_x = \mathbf{t}_x$ (the secret key is created after the public key); and leakage of $\mathbf{r}$ [AGV09]. §2.5.5, Eq. (21)

Spelled out — what discrete log gets for free

$\mathbf{s} \mapsto \mathbf{A}\mathbf{s}$ maps $(2\beta+1)^m$ inputs to $q^n$ outputs; with far more inputs than outputs a random $\mathbf{A}$ spreads them almost evenly. In ElGamal, $g^s$ for uniform $s$ is exactly uniform because $s \mapsto g^s$ is a bijection; lattices must pay for it with a wider $\mathbf{A}$ or larger coefficients (analogy ours).

RecapWith enough short secrets, $\mathbf{A}\mathbf{s}$ is statistically uniform and LWE is needed only once. Should secret and error even come from the same distribution?

Using Distinct Distributions for the Secret and the Error

The paper says

Take $\mathbf{r}, \mathbf{s} \leftarrow \psi_1$ and $\mathbf{e}_1, \mathbf{e}_2 \leftarrow \psi_2$ [ZYF+20]. Against the best known algorithms, hardness depends on the norm of $(\mathbf{s}, \mathbf{e}_1)$ (§3.3), while decryption wants $\mathbf{r}^T\mathbf{e}_1 + \mathbf{e}_2^T\mathbf{s}$ (22) small. With normal distributions ($\|\mathbf{v}\| \approx \sigma\sqrt n$ for $\mathbf{v} \leftarrow \mathcal{N}_\sigma^n$; $\langle\mathbf{s},\mathbf{v}\rangle \sim \mathcal{N}_{\sigma\|\mathbf{v}\|}$), $\mathbf{s},\mathbf{r} \leftarrow \mathcal{N}_{\sigma_1}$ and $\mathbf{e}_1, \mathbf{e}_2 \leftarrow \mathcal{N}_{\sigma_2}$ give (22) $\sim \mathcal{N}_{\sigma_1\sigma_2\sqrt{2n}}$ and $\|(\mathbf{s},\mathbf{e}_1)\| \approx \sqrt{\sigma_1^2+\sigma_2^2}\sqrt n$. §2.5.6, Eqs. (22)–(24)

$$\sigma_1 = \sigma_2 = \sigma:\;\; \|(\mathbf{s},\mathbf{e}_1)\| \approx \sigma\sqrt{2n},\; (22) \sim \mathcal{N}_{\sigma^2\sqrt{2n}} \qquad (23)$$ $$\sigma_1 = \tfrac43\sigma,\; \sigma_2 = \tfrac{\sqrt2}{3}\sigma:\;\; \|(\mathbf{s},\mathbf{e}_1)\| \approx \sigma\sqrt{2n},\; (22) \sim \mathcal{N}_{\frac{4\sqrt2}{9}\sigma^2\sqrt{2n}} \qquad (24)$$

Same norms, smaller decryption noise. Whether to do this depends on believing the two LWE problems (Definition 2 and the one with different distributions) are equally hard. §2.5.6

Spelled out

With $\sigma_1^2 + \sigma_2^2 = 2\sigma^2$ fixed, $\sigma_1\sigma_2 \le \frac12(\sigma_1^2+\sigma_2^2)$ (AM–GM) is largest when they are equal, so any imbalance reduces the noise. Pushed to the limit $\sigma_2 \to 0$, though, the error vanishes and LWE collapses to §2.2's linear algebra.

Try it

Split a fixed norm between secret and error

Preset: the paper's Eq. (24), $\sigma_1 = \frac43\sigma$. The total $\sigma_1^2+\sigma_2^2 = 2\sigma^2$ stays fixed (so the heuristic hardness stays fixed) while the decryption noise $\sigma_1\sigma_2\sqrt{2n}$ changes.

RecapUnequal secret/error distributions keep the norm (hardness) and cut decryption noise — under a belief, not a theorem. Can two parties agree on a key without anyone going first?

Non-Interactive Key Exchange (NIKE)

The paper says

Encryption gives a passively-secure key transport: party 1 sends a public key (13), party 2 encrypts an AES key as $\mathbf{M}$ (14). But party 2 must wait for party 1; in Diffie–Hellman either party can send $g^{x_i}$ first. An LWE protocol with that property exists but is much less efficient. For one shared bit: public random $\mathbf{A} \in \mathbb{Z}_q^{m\times m}$ trusted by everyone (e.g. expanded by SHAKE from seed 0); party $i$ picks $\mathbf{s}_i, \mathbf{e}_i \leftarrow [\beta]^m$; party 1 sends $\mathbf{u}_1^T = \mathbf{s}_1^T\mathbf{A} + \mathbf{e}_1^T$, party 2 sends $\mathbf{u}_2 = \mathbf{A}\mathbf{s}_2 + \mathbf{e}_2$. Each sets its bit to 1 if its value is between $q/4$ and $3q/4$: §2.6

$$\mathbf{s}_1^T\mathbf{u}_2 = \mathbf{s}_1^T\mathbf{A}\mathbf{s}_2 + \mathbf{s}_1^T\mathbf{e}_2, \qquad \mathbf{u}_1^T\mathbf{s}_2 = \mathbf{s}_1^T\mathbf{A}\mathbf{s}_2 + \mathbf{e}_1^T\mathbf{s}_2. \qquad (25),(26)$$

The errors have magnitude at most $m\beta^2$, so $b_1 \ne b_2$ only if $\mathbf{s}_1^T\mathbf{A}\mathbf{s}_2$ falls within $m\beta^2$ of $q/4$ or $3q/4$ (27). That value is uniform, so the probability is at most $4m\beta^2/q$. The techniques of §2.3.2 still leave $\Omega(\beta^2\sqrt m/q)$ — unlike encryption, where the error can be made exponentially small. A negligible mismatch needs a very large $q$ [GdKQ+24], and this may be intrinsic to using LWE in the natural way [GKRS22]. §2.6, Eqs. (25)–(27)

Note

The paper's Eq. (27) prints both intervals with their endpoints swapped (e.g. $[\frac{3q}4 + m\beta^2, \frac{3q}4 - m\beta^2]$); the intended windows are $[\frac{q}{4} \pm m\beta^2]$ and $[\frac{3q}{4} \pm m\beta^2]$, centred on the boundaries.

Spelled out — why NIKE is worse than encryption

In encryption the encryptor places the message at $0$ or $q/2$, as far as possible from the boundaries. In the NIKE no one chooses $c = \mathbf{s}_1^T\mathbf{A}\mathbf{s}_2$: it is uniform, so it lands next to a boundary with probability proportional to the window width over $q$. Diffie–Hellman agrees exactly, $(g^{x_1})^{x_2} = (g^{x_2})^{x_1}$; the LWE parties only agree approximately, so they must round, and rounding can disagree (analogy ours).

Try it

Two parties, two noisy copies of one value

Preset (our worked example from the guide): $q = 97$, $m = 2$, $\beta = 1$. Both parties land on the same bit because $c$ is far from the dashed boundaries. Press “new random run” until $c$ falls into a shaded window; the table estimates the mismatch rate against the bound $4m\beta^2/q$.

RecapLWE gives a Diffie–Hellman-style exchange, but with a mismatch probability of order $\beta^2\sqrt m/q$ that is hard to make negligible. Why should LWE be hard at all? That is the geometry of §3.

§3Hardness of LWE and Other Lattice Problems

The paper says

Section 3 gives a geometric view of the LWE problem. The connection is not really necessary for understanding how most cryptographic constructions work, but it is crucial for understanding their security. §3, p. 19

Spelled out · the one-sentence version

An LWE public key $(\mathbf{A}, \mathbf{t} = \mathbf{A}\mathbf{s}+\mathbf{e})$ is a point that sits close to a lattice; a random $\mathbf{t}$ sits far from it. Telling the two apart seems to require finding short lattice vectors, and the best algorithms for that take exponential time. This section makes each of those words precise.

Prerequisite recap (only what §3 uses): determinant and quotient group

Determinant. For a square integer matrix $\mathbf{B}$, $|\det\mathbf{B}|$ is the volume of the parallelepiped spanned by its columns. A block-triangular matrix has determinant equal to the product of the determinants of its diagonal blocks, e.g. $\det\begin{pmatrix}-\mathbf{I}_m & \mathbf{0}\\ \mathbf{A} & q\mathbf{I}_n\end{pmatrix} = (-1)^m q^n$.

Quotient group. If $\Lambda \subseteq \mathbb{Z}^m$ is a subgroup, the cosets $\mathbf{z} + \Lambda$ partition $\mathbb{Z}^m$; $\mathbf{z}_1, \mathbf{z}_2$ are in the same coset iff $\mathbf{z}_1 - \mathbf{z}_2 \in \Lambda$. The set of cosets, $\mathbb{Z}^m/\Lambda$, is itself a group (like $\mathbb{Z}/q\mathbb{Z} = \mathbb{Z}_q$ for $\Lambda = q\mathbb{Z}$).

3.1Lattices

The paper says

An $m$-dimensional integer lattice $\Lambda$ is a subgroup of $(\mathbb{Z}^m, +)$. It can be described by a (full-rank) basis $\mathbf{B} \in \mathbb{Z}^{m\times m}$: $$\Lambda = \mathcal{L}(\mathbf{B}) = \{\mathbf{v} \in \mathbb{Z}^m : \exists\, \mathbf{z} \in \mathbb{Z}^m \text{ s.t. } \mathbf{B}\mathbf{z} = \mathbf{v}\}. \qquad (28)$$ The paper restricts to $q$-ary lattices, which are the ones used in cryptography and which, asymptotically, make solving random instances as hard as solving some problem on any lattice (the worst-case to average-case line of work [Ajt96, Reg09]). For $\mathbf{A} \in \mathbb{Z}_q^{n\times m}$: $$\Lambda = \mathcal{L}_q^\perp(\mathbf{A}) = \{\mathbf{v} \in \mathbb{Z}^m : \mathbf{A}\mathbf{v} \equiv \mathbf{0} \pmod q\}. \qquad (29)$$ The two definitions are like describing a linear code by a generating matrix (28) or a parity-check matrix (29). The lattices used from now on are $$\Lambda = \mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n]), \qquad (30)$$ which is "not much of a restriction": if $\mathbf{A} = [\mathbf{A}_1 \mid \mathbf{A}_2]$ with $\mathbf{A}_2 \in \mathbb{Z}_q^{n\times n}$ invertible, then $\mathcal{L}_q^\perp(\mathbf{A}) = \mathcal{L}_q^\perp(\mathbf{A}_2^{-1}\mathbf{A}) = \mathcal{L}_q^\perp([\mathbf{A}_2^{-1}\mathbf{A}_1 \mid \mathbf{I}])$. For such lattices it is easy to switch between the two representations: $$\mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n]) = \mathcal{L}\left(\begin{bmatrix}-\mathbf{I}_m & \mathbf{0}\\ \mathbf{A} & q\mathbf{I}_n\end{bmatrix}\right). \qquad (31)$$ §3.1, Eqs. (28)–(32), p. 19

Spelled out

Why (31) holds (the paper's Eq. (32)). If $(\mathbf{v}_1, \mathbf{v}_2)$ is in the parity-check lattice, then $\mathbf{A}\mathbf{v}_1 + \mathbf{v}_2 \equiv \mathbf{0} \pmod q$, so $\mathbf{A}\mathbf{v}_1 + \mathbf{v}_2 = q\mathbf{r}$ for some integer vector $\mathbf{r}$. Then $$\begin{bmatrix}-\mathbf{I}_m & \mathbf{0}\\ \mathbf{A} & q\mathbf{I}_n\end{bmatrix}\begin{bmatrix}-\mathbf{v}_1\\ \mathbf{r}\end{bmatrix} = \begin{bmatrix}\mathbf{v}_1\\ -\mathbf{A}\mathbf{v}_1 + q\mathbf{r}\end{bmatrix} = \begin{bmatrix}\mathbf{v}_1\\ \mathbf{v}_2\end{bmatrix},$$ so the vector is generated by the basis. Conversely every column of the basis satisfies the parity check ($\mathbf{A}(-\mathbf{e}_i) + \mathbf{a}_i = \mathbf{0}$, and $q\mathbf{e}_j \equiv \mathbf{0}$), so everything the basis generates does too.

Why the $\mathbf{I}_n$? It lets the LWE error live inside the lattice picture. $\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e}$ is the same as $[\mathbf{A} \mid \mathbf{I}_n]\binom{\mathbf{s}}{\mathbf{e}} \equiv \mathbf{t}$, with the combined vector $(\mathbf{s}, \mathbf{e})$ short. Without $\mathbf{I}_n$, $\mathbf{A}\mathbf{s} \equiv \mathbf{t}$ would be a plain linear system, solvable by Gaussian elimination (§2.2).

Try it

A $q$-ary lattice in two dimensions: $\mathcal{L}_q^\perp([a \mid 1])$

With $n = m = 1$ the lattice is $\{(v_1, v_2) \in \mathbb{Z}^2 : a v_1 + v_2 \equiv 0 \pmod q\}$. Change $q$ and $a$; hover (or tap) a point to see the parity check and its coordinates in the basis of (31). This is a 2D illustration — real parameters have hundreds of dimensions.

RecapA $q$-ary lattice is the set of integer vectors passing a parity check mod $q$; $\mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n])$ has the explicit basis (31). How "dense" is it, and what are its cosets?

3.1.1The Quotient Group and Determinant

The paper says

The determinant of a full-rank lattice $\Lambda \subseteq \mathbb{Z}^m$ is the inverse of its density: with $S_r = \{\mathbf{z} \in \mathbb{Z}^m : \|\mathbf{z}\| < r\}$, $$\det(\Lambda) = \lim_{r\to\infty}\frac{|S_r|}{|\Lambda \cap S_r|}.$$ If $\Lambda = \mathcal{L}(\mathbf{B})$ for a full-rank $\mathbf{B} \in \mathbb{Z}^{m\times m}$, then $\det(\Lambda) = |\det(\mathbf{B})|$; for the $(n+m)$-dimensional lattice in (31) this is $q^n$. Equivalently, $\det(\Lambda)$ is the size of the quotient group $\mathbb{Z}^m/\Lambda$. The parity-check form makes cosets easy to test: for $\Lambda = \mathcal{L}_q^\perp(\mathbf{A})$, $\mathbf{z}_1, \mathbf{z}_2$ are in the same coset iff $\mathbf{A}\mathbf{z}_1 \equiv \mathbf{A}\mathbf{z}_2 \pmod q$; for $\Lambda = \mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n])$ there are exactly $q^n$ cosets, consistent with $\det = q^n$. §3.1.1, pp. 19–20

Spelled out

For $\Lambda = \mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n]) \subseteq \mathbb{Z}^{m+n}$ the parity-check matrix is $[\mathbf{A} \mid \mathbf{I}_n]$, so two vectors are in the same coset iff $[\mathbf{A} \mid \mathbf{I}_n]\mathbf{z}_1 \equiv [\mathbf{A} \mid \mathbf{I}_n]\mathbf{z}_2$. Each coset is therefore labelled by $\mathbf{t} = [\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} \bmod q \in \mathbb{Z}_q^n$, and every label occurs (take $\mathbf{z} = (\mathbf{0}, \mathbf{t})$): $q^n$ cosets. The determinant of the basis in (31) is $|\det(-\mathbf{I}_m)\cdot\det(q\mathbf{I}_n)| = q^n$ — the same number, as it must be. In the 2D picture above, one point in every $q$ is a lattice point: the density is $1/q$.

Recap$\det \Lambda = q^n$ = number of cosets; a coset is named by its label $\mathbf{t} \in \mathbb{Z}_q^n$ — exactly the shape of an LWE value $\mathbf{t}$. How far is a coset from the lattice?

3.1.2Distance to the Lattice

The paper says

For an $m$-dimensional lattice and any $\mathbf{r} \in \mathbb{Z}^m$, the $\ell_p$ distance to the lattice is $$\Delta_p(\mathbf{r}, \Lambda) = \min_{\mathbf{v}\in\Lambda}\|\mathbf{v} - \mathbf{r}\|_p. \qquad (33)$$ All members of a coset have the same distance, so for $\Lambda = \mathcal{L}_q^\perp(\mathbf{A})$ and $\mathbf{t} \equiv \mathbf{A}\mathbf{z} \pmod q$ one writes $\Delta_p^C(\mathbf{t}, \Lambda) = \Delta_p(\mathbf{z}, \Lambda)$. The lemmas below are proved for prime $q$ only, for simplicity ("with more care, one can prove similar statements for all $q$"). §3.1.2, p. 20

Lemma 2 (p. 20)

For any prime $q$ and any $\mathbf{t} \in \mathbb{Z}_q^n \setminus \{\mathbf{0}\}$: $$\Pr_{\mathbf{A}\leftarrow\mathbb{Z}_q^{n\times m}}\bigl[\exists\,\mathbf{z} \in [\beta]^{n+m} \text{ s.t. } [\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} \equiv \mathbf{t} \pmod q\bigr] \le (2\beta+1)^{n+m}/q^n.$$

Corollary 1 (p. 20)

$$\Pr_{\mathbf{A}\leftarrow\mathbb{Z}_q^{n\times m},\,\mathbf{t}\leftarrow\mathbb{Z}_q^n}\bigl[\Delta^C_\infty(\mathbf{t}, \Lambda) \le \beta\bigr] \le (1 - |\mathbb{Z}_q^*|/q)^n + (2\beta+1)^{n+m}/q^n,\quad \Lambda = \mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n]).$$ For prime $q$ the first term is $(1/q)^n$, for $q$ a power of 2 it is $2^{-n}$; so whenever $\beta^{1+m/n} \ll q$, random cosets are more than distance $\beta$ from $\Lambda$.

Lemma 3 (p. 21)

For any prime $q$: $\;\Pr_{\mathbf{A}}\bigl[\exists\,\mathbf{z} \in [\beta]^{n+m}\setminus\{\mathbf{0}\} \text{ s.t. } [\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} \equiv \mathbf{0}\bigr] \le (2\beta+1)^{n+m}/q^n.$

Lemma 4 (p. 21)

For any $q$ and any $\mathbf{A} \in \mathbb{Z}_q^{n\times m}$: $\;\exists\,\mathbf{z} \in \bigl[q^{n/(n+m)}\bigr]^{n+m}\setminus\{\mathbf{0}\}$ with $[\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} \equiv \mathbf{0} \pmod q$.

The boundary is sharp: at $\beta = q^{n/(n+m)}$ a vector with coefficients in $[\beta]$ always exists (Lemma 4), while for $\beta < \tfrac14 q^{n/(n+m)}$ the probability that one exists is less than $2^{-(n+m)}$ (Lemma 3). §3.1.2, p. 21

Spelled out

Lemma 2, by counting. Fix one $\mathbf{z}$. Because $\mathbf{t} \ne \mathbf{0}$ some coefficient of $\mathbf{z}$ is non-zero, say $z_1$, which multiplies the first column $\mathbf{a}$ of $\mathbf{A}$. The equation becomes $\mathbf{a} \equiv z_1^{-1}(\mathbf{t} - [\mathbf{A}' \mid \mathbf{I}_n]\mathbf{z}')$ — $z_1^{-1}$ exists because $q$ is prime — which a uniform $\mathbf{a}$ hits with probability exactly $q^{-n}$. A union bound over the $(2\beta+1)^{n+m}$ short vectors gives the lemma. In words: there are only $(2\beta+1)^{n+m}$ short vectors and $q^n$ cosets, so if the former is much smaller, most cosets contain no short vector.

Lemma 4, by pigeonhole. There are more than $(q^{n/(n+m)})^{n+m} = q^n$ vectors with coefficients in $\{0, \ldots, q^{n/(n+m)}\}$, but only $q^n$ values of $[\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} \bmod q$. Two must collide, and their difference is a non-zero lattice vector in $[q^{n/(n+m)}]^{n+m}$. The proof says a short vector exists, but gives no way to find it — that gap is where the hardness lives.

Note · a gap in Lemma 2 (our observation)

The proof assumes the non-zero coefficient of $\mathbf{z}$ multiplies a column of $\mathbf{A}$. But $\mathbf{z} = (\mathbf{0}, \mathbf{t})$ gives $[\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} = \mathbf{t}$ for every $\mathbf{A}$, so for $\mathbf{t} \in [\beta]^n\setminus\{\mathbf{0}\}$ the probability is 1. The lemma holds for $\mathbf{t} \notin [\beta]^n$; Corollary 1 survives, since a random $\mathbf{t}$ lies in $[\beta]^n$ with probability $((2\beta+1)/q)^n$, at most its second term.

Try it

Close cosets vs. random cosets (Corollary 1 by exhaustive count)

Same 2D lattice $\mathcal{L}_q^\perp([a \mid 1])$ with $q = 101$ (prime). Every $t \in \mathbb{Z}_{101}$ labels a coset; we compute its $\ell_\infty$ distance $\Delta^C_\infty(t, \Lambda)$ exactly, by brute force. Draw an LWE-style $t = a s + e$ with $s, e \in [\beta]$ or a uniformly random $t$, and compare with the count Corollary 1 allows. Illustration: $n = m = 1$ is far too small to be secure.

Try it

Where do short vectors appear? Lemmas 3 and 4 at real sizes

Choose $n$, $m$, $q$ and $\beta$. The bound of Lemma 3 (for prime $q$) and the pigeonhole guarantee of Lemma 4 are evaluated exactly (in $\log_2$).

RecapShort vectors almost surely don't exist below $\beta \approx q^{n/(n+m)}$ and always exist above it; random cosets are far from the lattice when $\beta^{1+m/n} \ll q$. Existence is settled — how hard is it to find a short vector?

3.2Finding Short Vectors in Random Lattices (the SIS Problem)

The paper says

Lemma 4 guarantees a non-zero $\mathbf{z} \in [q^{n/(n+m)}]^{n+m}$ with $[\mathbf{A} \mid \mathbf{I}_n]\mathbf{z} \equiv \mathbf{0}$, but all known (quantum) algorithms for finding such vectors for uniformly random $\mathbf{A}$ take $2^{\Omega(m+n)}$ time [AKS01, ADRS15, AS18]. The problem gets easier as $\beta$ grows; at $\beta = q/2$ it is trivial (set the coefficients multiplied by $\mathbf{I}_n$ to the target). All modern (i.e. polynomial-time) algorithms are descendants of LLL [LLL82], which guarantees a vector at most $2^{O(n+m)}$ times longer than the shortest; in practice the factor is exponential but with a small base. Experiments [GN08, MR09] show that one can find non-trivial vectors of length approximately $$\det(\Lambda)^{1/(n+m)}\cdot\delta^{n+m} = q^{n/(n+m)}\cdot\delta^{n+m}, \qquad (34)$$ where $\delta$ depends on the running time. "As a very rough rule of thumb, $\delta = 1.01$ is considered within reach, whereas $\delta = 1.005$ may never be achieved for lattices of high-enough dimension (e.g. more than 500)." Since one may drop columns of $\mathbf{A}$, it is optimal to use a lattice of dimension $$\sqrt{n\log q/\log\delta}, \qquad (35)$$ which yields a found vector of $\ell_2$-norm $$2^{2\sqrt{n\log q\log\delta}}. \qquad (36)$$ §3.2, Eqs. (34)–(36), pp. 21–22

Definition 4 (p. 22): $\mathrm{SIS}_{n,m,q,\beta}$

For positive integers $m, n, q$ and $\beta < q$: given a random $\mathbf{A} \leftarrow \mathbb{Z}_q^{n\times m}$, find $\mathbf{s}_1 \in [\beta]^m$ and $\mathbf{s}_2 \in [\beta]^n$ such that $\mathbf{A}\mathbf{s}_1 + \mathbf{s}_2 = \mathbf{0} \pmod q$.

By Lemma 3, SIS is vacuously hard when $\beta \ll \frac12 q^{n/(n+m)}$, and by (36) it gets easier as $\beta$ grows. Once $m > \sqrt{n\log q/\log\delta}$, $m$ has no impact on hardness, so one writes $\mathrm{SIS}_{n,q,\beta}$. SIS is defined in the $\ell_\infty$ norm (natural for Dilithium, which avoids complicated operations; all its sampling is uniform, footnote 11), while (36) is an $\ell_2$ norm: finding a vector of $\ell_\infty$ norm $\beta$ requires at least finding one of $\ell_2$ norm (36) multiplied by the square root of the dimension. Footnote 10: [MR09] only state the bound when the found vector is shorter than $q$. §3.2, p. 22

Spelled out · where (35) and (36) come from

Keep only $k - n$ columns of $\mathbf{A}$. The lattice $\mathcal{L}_q^\perp([\mathbf{A}' \mid \mathbf{I}_n])$ then has dimension $k$ and determinant still $q^n$, so by (34) reduction finds a vector of length about $q^{n/k}\delta^k$, i.e. $\log_2(\text{length}) = \frac{n\log q}{k} + k\log\delta$. The first term falls with $k$, the second rises; the minimum is at $k^* = \sqrt{n\log q/\log\delta}$ (set the derivative $-\frac{n\log q}{k^2} + \log\delta$ to zero), where both terms equal $\sqrt{n\log q\log\delta}$ — total $2\sqrt{n\log q\log\delta}$. That is (35) and (36).

Try it

The lattice-reduction trade-off: $\log_2$ length $= \frac{n\log q}{k} + k\log\delta$

Slide $\delta$ (the quality of reduction; smaller = more work) and see the length of the vector found in a sub-lattice of dimension $k$. The dot marks the optimum (35)–(36).

Try it

After the paper's Figure 2: LWE vs. SIS hardness as $\beta$ varies

The paper's Figure 2 is a sketch ("not meant to describe the concrete hardness"). Here the two curves are computed from the paper's own estimates — LWE from Eq. (41) of §3.3, SIS from Eq. (36) — using $1/\log_2\delta$ as a hardness proxy (higher = harder), for $n = m$. Move $\beta$. Illustration (ours).

RecapShort vectors of length $\approx q^{n/(n+m)}\delta^{n+m}$ are findable; $\delta$ measures effort; SIS gets easier and LWE harder as $\beta$ grows. How exactly does a short vector break LWE?

3.3The LWE Lattices

The paper says

Outputting $(\mathbf{A}, \mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e})$ with $\mathbf{s} \leftarrow [\beta]^m$, $\mathbf{e} \leftarrow [\beta]^n$ is the same as outputting a lattice $\Lambda = \mathcal{L}_q^\perp([\mathbf{A} \mid \mathbf{I}_n])$ and a coset $\mathbf{t}$ with $\Delta^C_\infty(\mathbf{t}, \Lambda) \le \beta$; a uniform $\mathbf{u}$ is a random coset. So $\mathrm{LWE}_{n,m,q,\beta}$ is distinguishing cosets close to the lattice from random cosets. The encryption scheme had $m = n$ and needed $\beta^2 = O(q/\sqrt m)$ for correctness, so $\beta \ll \sqrt q$; by Corollary 1 random cosets are then further than $\beta$ from the lattice.

To distinguish, find short $\mathbf{r}_1, \mathbf{r}_2$ with $$\mathbf{r}_1^T\mathbf{A} + \mathbf{r}_2^T = \mathbf{0}. \qquad (37)$$ If $\mathbf{t}$ is uniform, $\mathbf{r}_1^T\mathbf{t}$ is random in $\mathbb{Z}_q$; if $\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e}$, $$\mathbf{r}_1^T\mathbf{t} = \mathbf{r}_1^T\mathbf{A}\mathbf{s} + \mathbf{r}_1^T\mathbf{e} = -\mathbf{r}_2^T\mathbf{s} + \mathbf{r}_1^T\mathbf{e}, \qquad (38)$$ which is small. Finding $\mathbf{r}_1, \mathbf{r}_2$ is finding a short vector in $\mathcal{L}_q^\perp([\mathbf{A}^T \mid \mathbf{I}_m])$; by (36) (with $n$ replaced by $m$, because $\mathbf{A}^T$ is used) its norm is about $2^{2\sqrt{m\log q\log\delta}}$. A coefficient uniform in $[\beta]$ has variance $$\frac{1}{2\beta+1}\sum_{i=-\beta}^{\beta} i^2 = \frac{\beta(\beta+1)}{3}, \qquad (39)$$ and, treating coefficients as normal (justified asymptotically by the CLT, "already a very good approximation"), $-\mathbf{r}_2^T\mathbf{s} + \mathbf{r}_1^T\mathbf{e}$ is normal with standard deviation $$\|(\mathbf{r}_1, \mathbf{r}_2)\|\cdot\sqrt{\tfrac{\beta(\beta+1)}{3}} \approx 2^{2\sqrt{m\log q\log\delta}}\cdot\sqrt{\tfrac{\beta(\beta+1)}{3}}. \qquad (40)$$ A normal variable with standard deviation greater than $\sqrt3\cdot q$, reduced mod $q$, is within $\approx 2^{-80}$ of uniform [MR07]. So $\mathrm{LWE}_{n,m,q,\beta}$ is secure "at least against this attack, which seems to be as good as any other known approach" whenever $$\sqrt{\beta(\beta+1)} > 3\cdot q\cdot 2^{-2\sqrt{m\log q\log\delta}}. \qquad (41)$$ §3.3, Eqs. (37)–(41), pp. 23–24

Spelled out

Dimensions. With $\mathbf{A} \in \mathbb{Z}_q^{n\times m}$, $\mathbf{r}_1^T\mathbf{A}$ needs $\mathbf{r}_1 \in \mathbb{Z}^n$ and then $\mathbf{r}_2 \in \mathbb{Z}^m$. The extra $\mathbf{r}_2$ is essential: for a random square $\mathbf{A}$ there is no short non-zero $\mathbf{r}$ with $\mathbf{r}^T\mathbf{A} = \mathbf{0}$ alone.

Variance (39). $\frac{1}{2\beta+1}\sum_{i=-\beta}^{\beta}i^2 = \frac{2}{2\beta+1}\cdot\frac{\beta(\beta+1)(2\beta+1)}{6} = \frac{\beta(\beta+1)}{3}$; e.g. $\beta = 2$ gives $2$.

From (40) to (41). Require $\sqrt{\beta(\beta+1)/3}\cdot 2^{2\sqrt{m\log q\log\delta}} > \sqrt3\,q$; multiply by $\sqrt3$ and move the power of 2 across. Solving for $\delta$: $\log_2\delta = \bigl(\tfrac12\log_2\tfrac{3q}{\sqrt{\beta(\beta+1)}}\bigr)^2/(m\log_2 q)$ — the $\delta$ an attacker would need. The smaller it is, the harder the attack.

Where the parameters sit. Encryption uses $\beta \ll \sqrt q = q^{n/(n+m)}$ (for $m = n$) — below the existence threshold of §3.1.2, so random cosets really are far. Signatures (§5) use SIS with much larger $\beta$.

Try it

Solve Eq. (41) for the $\delta$ an attacker needs

Pick $m$, $\beta$, $\log_2 q$ (or a row of the paper's tables). We compute the variance (39), the required $\delta$ from (41), and, at that $\delta$, the norm of $(\mathbf{r}_1, \mathbf{r}_2)$ and the standard deviation (40) against the $\sqrt3\,q$ threshold. The table below reproduces the paper's Tables 1–2 from (41).

RecapA short $(\mathbf{r}_1, \mathbf{r}_2)$ turns $\mathbf{t}$ into a small number iff $\mathbf{t}$ is LWE; (41) says how short it must be, i.e. which $\delta$ an attacker needs. What does that give for real parameter sets?

3.4Practical Parameters

The paper says

Table 1 lists sample $\mathrm{LWE}_{m,q,\beta}$ parameters similar to those used in Kyber (ML-KEM, §4.7); the signature scheme of §5 depends on both SIS and LWE, and Table 2 gives parameters resembling Dilithium (ML-DSA). The tables are set from the best currently-known lattice-reduction algorithms (cf. the Lattice Estimator [APS15]). §3.4, Tables 1–2, pp. 24–25

Table 1 — resembles Kyber
$m$$\beta$$q$$\delta$
5122$2^{12}$1.0043
7682$2^{12}$1.0029
10242$2^{12}$1.0022
Table 2 — LWE, resembles DilithiumTable 2 — SIS, resembles Dilithium
$m$$\beta$$q$$\delta$$n$$\beta$$q$$\delta$
10242$2^{23}$1.0041024$2^{18}$$2^{23}$1.0041
12804$2^{23}$1.0031536$2^{20}$$2^{23}$1.0032
17922$2^{23}$1.00232048$2^{20}$$2^{23}$1.0025

Looking at Figure 2, LWE hardness increases monotonically in $\beta$, without jumps: if $q/\beta = 2^{m/k}$ with $1 \le k \le m$, the best known algorithm takes time about $2^k$ (ignoring polynomial factors). But a sudden jump is not out of the realm of possibility: it is exactly what happens for short vectors in lattices corresponding to an ideal of some algebraic ring [CGS14, BS16, CDPR16, CDW17]. When $q/\beta > 2^{\sqrt m}$ (i.e. $k < \sqrt m$) that problem can be solved in quantum polynomial time, but as soon as $k > \sqrt m$ the hardness jumps back to $2^k$. Some not-yet-invented (quantum) algorithm might do much better on a particular range of $q/\beta$, so "it may therefore be prudent" to build cryptography on LWE with $q/\beta$ as small as possible. §3.4, pp. 24–25

Spelled out

Every required $\delta$ in both tables is below $1.005$, which by the rough rule of thumb of §3.2 may never be reached in these dimensions. The rows only resemble the standards: Kyber actually works over a polynomial ring with $q = 3329$ (§4.7), and its LWE dimension $d\cdot k = 256\cdot\{2,3,4\}$ is what matches $m = 512, 768, 1024$ (§4.3.2).

Try it

$q/\beta = 2^{m/k}$: generic time $\approx 2^k$, and the ideal-lattice jump

Choose the dimension $m$ and $\log_2(q/\beta)$. We compute $k$, the generic cost $2^k$, and whether the ratio lies in the range where the ideal-lattice short-vector problem (not LWE itself) is known to be quantum-easy.

What to remember from §3

  1. LWE is geometric: distinguish cosets at $\ell_\infty$ distance $\le \beta$ from random cosets of a $q$-ary lattice.
  2. Threshold $\beta \approx q^{n/(n+m)}$: below it short vectors almost surely don't exist (Lemma 3, prime $q$); above, they always do (Lemma 4). Encryption lives below it; SIS for signatures uses much larger $\beta$.
  3. SIS is the search problem (Definition 4); it gets easier as $\beta$ grows, LWE harder.
  4. Solving SIS breaks LWE: short $\mathbf{r}_1, \mathbf{r}_2$ with $\mathbf{r}_1^T\mathbf{A} + \mathbf{r}_2^T = \mathbf{0}$ make $\mathbf{r}_1^T\mathbf{t}$ small exactly for LWE samples.
  5. Concrete security via $\delta$: (41) gives the $\delta$ needed; as a very rough rule of thumb $\delta = 1.01$ is in reach, $1.005$ may never be for dimension above about 500.
RecapTables 1–2 turn the attack into numbers; keeping $q/\beta$ small is a hedge against unknown algorithms. §4: the same problems over polynomial rings — and how that makes everything smaller and faster.

§4Encryption Over Polynomial Rings

The paper says

The LWE scheme of Section 2.3 needs a ciphertext of $(m+1)\log q$ bits for one message bit: its expansion is linear in the security parameter. The scheme of Section 2.4 reduced this to a square-root expansion, at the price of blowing up the public key by the same factor. Section 4 removes the square-root blow-up by doing LWE not over $\mathbb{Z}_q$ but over higher-degree polynomial rings. §4, p. 26

Spelled out

The route through this section: polynomial rings and their matrix view (4.1) → LWE and SIS over rings (4.2) → the ring encryption scheme (4.3) → NTRU (4.4) → how algebraic structure can help an attacker (4.5) or the implementer, via the NTT (4.6) → Kyber (4.7) → turning CPA encryption into a CCA-secure KEM (4.8).

Polynomial Rings

The paper says

$\mathbb{Z}[X]$ is the ring of polynomials $a = \sum_i a_i X^i$ with integer coefficients. $\deg(a)$ is the largest $i$ with $a_i \neq 0$; $a$ is monic if $a_{\deg(a)} = 1$; $a$ is irreducible if it cannot be written as $a = bc$ with $\deg(b), \deg(c) < \deg(a)$. §4.1

For a monic $f \in \mathbb{Z}[X]$ of degree $d$, the ring $\mathcal{R}_f$ (often written $\mathbb{Z}[X]/(f(X))$, footnote 12) consists of the polynomials $a = \sum_{i=0}^{d-1} a_i X^i$. Addition is coefficient-wise, so $\mathcal{R}_f$ under addition is $\mathbb{Z}^d$. Multiplication is ordinary multiplication followed by reduction modulo $f$: every $a$ can be written uniquely as $a = bf + r$ with $\deg(r) < d$, and $a \bmod f = r$. The usual $\mathbb{Z}$ is the special case $f = X$ (or $f = X - \alpha$). §4.1, p. 26–27

Spelled out

Existence (the paper's induction): if $\deg(a) < d$ take $b = 0$, $r = a$. Otherwise let $a'$ have degree $k \ge d$ and leading coefficient $a'_k$. Because $f$ is monic, $a'_k f X^{k-d}$ has the same leading term as $a'$, so $a' - a'_k f X^{k-d}$ has degree at most $k-1$ and, by induction, equals $bf + r$. Hence $a' = (a'_k X^{k-d} + b)f + r$. Monic matters: we never divide by a leading coefficient, so everything stays in $\mathbb{Z}[X]$.

Uniqueness: if $bf + r = b'f + r'$ then $(b-b')f = r' - r$. The right side has degree $< d$; if $b \ne b'$ the left side has degree $\ge d$. So $b = b'$ and $r = r'$.

The algorithm hidden in the proof: repeatedly subtract a multiple $\alpha X^i f$ that kills the leading term, until the degree drops below $d$.

Analogy (ours)

$\mathbb{Z}_q$ is "integers, reduced modulo the number $q$". $\mathcal{R}_f$ is the same idea one level up: "polynomials, reduced modulo the polynomial $f$". Later, $\mathcal{R}_{q,f}$ does both at once.

Try it

Division with remainder, one leading term at a time

Preset: the paper's example $2X^3 + 8X^2 + 5X + 1 \bmod (X^2 - 2X + 1)$. Press step to subtract one multiple of $f$; edit the coefficients (highest degree first) to try your own. $f$ must be monic.

Recap$\mathcal{R}_f$ = polynomials of degree $< d$; multiply, then reduce modulo the monic $f$ — the remainder always exists and is unique.Next: multiplication by a fixed $a$ is linear — so it is a matrix.

Polynomials and Linear Algebra

The paper says

Multiplication modulo $f$ is a matrix times a vector (Eq. (42)): $$ab \bmod f = a\cdot\Big(\sum_{i=0}^{d-1} b_iX^i\Big) \bmod f = \sum_{i=0}^{d-1}(aX^i \bmod f)\,b_i.$$ With $\mathcal{V}_a = (a_0,\dots,a_{d-1})^T \in \mathbb{Z}^d$ and $\mathcal{M}_a = [\,\mathcal{V}_a \;\; \mathcal{V}_{aX \bmod f} \;\cdots\; \mathcal{V}_{aX^{d-1} \bmod f}\,] \in \mathbb{Z}^{d\times d}$ (Eq. (44)) we get $\mathcal{M}_a\mathcal{V}_b = \mathcal{V}_{ab}$. For $\mathbf{A} \in \mathcal{R}_f^{n\times m}$ and $\mathbf{b} \in \mathcal{R}_f^m$, stacking blocks gives $\mathcal{M}_\mathbf{A}\cdot\mathcal{V}_\mathbf{b} = \mathcal{V}_{\mathbf{A}\mathbf{b}} \in \mathbb{Z}^{dn}$ (Eqs. (45)–(46)). Example (Eq. (43)): $(2X^2-1)(X^2-X+2) \bmod X^3-X+1 = 5X^2 - 3X$. §4.1.1, Eqs. (42)–(46)

Spelled out

Modulo $X^3 - X + 1$ we have $X^3 \equiv X - 1$. With $a = 2X^2 - 1$: $a \mapsto (-1,0,2)$; $aX = 2X^3 - X \equiv -2 + X \mapsto (-2,1,0)$; $aX^2 \equiv -2X + X^2 \mapsto (0,-2,1)$. These are the three columns of $\mathcal{M}_a$. Direct check: $(2X^2-1)(X^2-X+2) = 2X^4 - 2X^3 + 3X^2 + X - 2$, and with $X^4 \equiv X^2 - X$ this is $5X^2 - 3X$.

Why it matters: everything about ring elements can be translated into integer linear algebra — that is how Ring/Module-LWE connects back to the integer lattices of §3 (see 4.3.2).

Try it

Build $\mathcal{M}_a$ column by column

Each new column is the previous one multiplied by $X$ and reduced modulo $f$. Preset: Eq. (43). Coefficients are entered highest degree first; vectors are shown lowest first, as $\mathcal{V}_a = (a_0, a_1, \dots)$.

Recap$ab = \mathcal{M}_a\mathcal{V}_b$: multiplying by $a$ is a $d\times d$ integer matrix whose columns are $aX^i \bmod f$.Next: how big do the entries of $\mathcal{M}_a$ get? That depends on $f$.

Coefficient Growth

The paper says

Since $ab = \mathcal{M}_a\mathcal{V}_b$, a simple bound on the largest coefficient is $d\,\|\mathcal{M}_a\|_\infty\cdot\|\mathcal{V}_b\|_\infty$ (better $\ell_2$ bounds use the largest singular value of $\mathcal{M}_a$). The best we could hope for is $\|\mathcal{M}_a\|_\infty = \|\mathcal{V}_a\|_\infty$; the only $f$ with this property are $X^d \pm 1$. For $X^d \pm X^{d/2} + 1$ and $\sum_{i=0}^{d} X^i$, $\|\mathcal{M}_a\|_\infty \le 2\|\mathcal{V}_a\|_\infty$ (Eqs. (47)–(50) show $d = 4$). Some $f$ with small coefficients, e.g. $X^d + 2X^{d-1} + 1$, give $\mathcal{M}_a$ with exponentially larger coefficients than $a$; such $f$ are not useful for cryptography. We prefer a ratio of 1 or 2. §4.1.2, p. 28

Note — typo in the paper

In Eq. (49) ($f = X^4 - X^2 + 1$) the entry in row 3, column 4 should be $a_1$; the paper prints $-a_3 + a_1$. Modulo $f$: $X^4 \equiv X^2 - 1$, $X^5 \equiv X^3 - X$, $X^6 \equiv -1$, so $aX^3 \equiv (-a_1 - a_3) - a_2X + a_1X^2 + (a_0 + a_2)X^3$. The widget below computes the matrices, so it shows the corrected entry.

Spelled out

For $X^4 - 1$, $X^4 \equiv 1$: multiplying by $X$ shifts coefficients up and wraps the top one to the bottom unchanged — a cyclic matrix. For $X^4 + 1$, $X^4 \equiv -1$: the wrapped coefficient changes sign — a negacyclic matrix. Every entry is $\pm$ some $a_i$, hence the ratio 1. For the other two $f$, reduction combines pairs of coefficients (sums or differences), so entries reach up to twice $\|\mathcal{V}_a\|_\infty$. Why it matters: decryption noise is a product of small elements; if products of small elements are not small, the noise explodes.

Try it

Which $f$ keeps products small?

Pick $f$. For $d = 4$ the symbolic $\mathcal{M}_a$ is computed from the definition (compare with Eqs. (47)–(50)). The ratio uses a random $a$ with coefficients in $\{-1,0,1\}$; the chart shows the bad $f = X^d + 2X^{d-1} + 1$ for growing $d$.

Recap$X^d \pm 1$ are ideal (ratio 1); some innocent-looking $f$ are catastrophic (exponential growth).Next: LWE and SIS over these rings.

The Generalized-LWE and SIS Problems

The paper says

$\mathcal{R}_{q,f}$ is like $\mathcal{R}_f$ but with coefficients in $\mathbb{Z}_q$ (written $\mathbb{Z}_q[X]/(f(X))$ in the literature). §4.2

Definition 5 — $\mathcal{R}_{q,f}$-$\mathsf{LWE}_{n,m,\beta}$

For positive integers $m, n, q$, $\beta < q$, distinguish (1) $(\mathbf{A}, \mathbf{A}\mathbf{s} + \mathbf{e})$ with $\mathbf{A} \leftarrow \mathcal{R}_{q,f}^{n\times m}$, $\mathbf{s} \leftarrow [\beta]^m$, $\mathbf{e} \leftarrow [\beta]^n$, from (2) $(\mathbf{A}, \mathbf{u})$ with $\mathbf{u} \leftarrow \mathcal{R}_{q,f}^n$.

Definition 6 — $\mathcal{R}_{q,f}$-$\mathsf{SIS}_{n,m,\beta}$

For a random $\mathbf{A} \leftarrow \mathcal{R}_{q,f}^{n\times m}$, find $\mathbf{s}_1 \in [\beta]^m$ and $\mathbf{s}_2 \in [\beta]^n$, not both $\mathbf{0}$, with $\mathbf{A}\mathbf{s}_1 + \mathbf{s}_2 = \mathbf{0} \pmod q$.

As before, $n$ has no known effect on hardness unless it is large, so one writes $\mathcal{R}_{q,f}$-$\mathsf{LWE}_{m,\beta}$. The definition and the cryptosystem follow [LPR10, BV11, LPR13b, LS15]; SIS is generalized following [PR06, LM06, LS15]. In the literature these are called Ring-LWE / Ring-SIS or Module-LWE / Module-SIS; in ML-KEM and ML-DSA, "ML" stands for "Module Lattice". §4.2, Definitions 5–6

Spelled out

"$s \leftarrow [\beta]$" for a polynomial means every coefficient is uniform in $[\beta]$ (the notation $[\beta]$ is from Section 2.1; footnote 21 repeats it). Standard usage: $f = X$ ($d = 1$) is plain LWE; a single column of ring elements ($m = 1$) over a large ring is usually called Ring-LWE; a small $k \times k$ matrix of ring elements, as in Kyber, is Module-LWE.

Analogy (ours)

Definitions 5–6 are the paper's Definitions 1 (LWE) and 4 (SIS) with every integer replaced by a ring element — the shape of the problem is unchanged, just as ElGamal over an elliptic curve is ElGamal over $\mathbb{Z}_p^*$ with a different group underneath.

RecapSame LWE and SIS, with ring elements in place of integers.Next: the encryption scheme over $\mathcal{R}_{q,f}$ — and what it buys.

Generalized-LWE Encryption

The paper says

The scheme is virtually identical to Section 2.3.1 with $\mathbb{Z}$ replaced by $\mathcal{R}_f$; its main advantage is that $\mu \in \mathcal{R}_f$ packs $d$ bits. §4.3, Eqs. (51)–(55)

Generalized-LWE encryption

$\mathsf{sk}: \mathbf{s} \leftarrow [\beta]^m$; $\;\mathsf{pk}: (\mathbf{A} \leftarrow \mathcal{R}_{q,f}^{m\times m},\ \mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e}_1)$ with $\mathbf{e}_1 \leftarrow [\beta]^m$. (51)

To encrypt $\mu \in \mathcal{R}_f$ with $0/1$ coefficients: sample $\mathbf{r}, \mathbf{e}_2 \leftarrow [\beta]^m$, $e_3 \leftarrow [\beta]$, output $(\mathbf{u}^T = \mathbf{r}^T\mathbf{A} + \mathbf{e}_2^T,\ v = \mathbf{r}^T\mathbf{t} + e_3 + \tfrac{q}{2}\mu)$. (52)

Decrypt: $v - \mathbf{u}^T\mathbf{s} = \mathbf{r}^T\mathbf{e}_1 + e_3 + \tfrac{q}{2}\mu - \mathbf{e}_2^T\mathbf{s}$ (53)–(54).

Security based on $\mathcal{R}_{q,f}$-$\mathsf{LWE}_{m,\beta}$ is identical to the proof for $\mathsf{LWE}_{m,q,\beta}$. The decryption noise is $\mathcal{M}_{\mathbf{r}^T}\mathcal{V}_{\mathbf{e}_1} + \mathcal{V}_{e_3} - \mathcal{M}_{\mathbf{e}_2^T}\mathcal{V}_\mathbf{s}$ (55), handled with the techniques of Section 2.3.2. For $f = X^d \pm 1$ each coefficient is computed exactly as over the integers, because each row of $\mathcal{M}_{\mathbf{r}^T}$ and $\mathcal{M}_{\mathbf{e}_2^T}$ has independent coefficients (see (47) and (48)); a union bound over the $d$ coefficients finishes. For other $f$ the technique still applies if the product can be rewritten as a sum of independent random variables.

Spelled out

The $\mathbf{r}^T\mathbf{A}\mathbf{s}$ terms cancel exactly as in §2, because ring multiplication is associative and commutative: $(\mathbf{r}^T\mathbf{A})\mathbf{s} = \mathbf{r}^T(\mathbf{A}\mathbf{s})$.

Optimizations and Efficiency

The paper says

One no longer needs to enlarge the public key (as in Section 2.4) to encrypt a longer message: a degree-$d$ ring carries $d$ bits, so with $d \ge 256$ — the length of an AES key — the public key is optimally small. There is no need to pack several bits per coefficient (Section 2.5.4). The compression of Section 2.5.1 still applies, and LWR (2.5.3) and the NIKE (2.6) are defined analogously over $\mathcal{R}_f$. §4.3.1

Try it

Encrypting $d$ bits: plain LWE vs. the ring scheme (our accounting)

Uncompressed sizes, with $\mathbf{A}$ generated from a 256-bit seed (Section 2.4). For a fair comparison the plain scheme uses the same LWE dimension $dm$ as the ring scheme (see 4.3.2). The formulas are the paper's Section 2.3.1, 2.4 and 4.3 sizes; the comparison is ours.

Analogy (ours)

An ElGamal ciphertext $(g^r, h^r\mu)$ carries one group element's worth of message. Plain LWE is like an ElGamal whose "group elements" carry one bit each — hence the balloon. The ring version restores the ElGamal-like ratio: one ciphertext element carries a whole 256-bit key.

Security and Connection to Integer Lattices

The paper says

By (46), distinguishing $(\mathbf{A}, \mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e})$ from uniform over $\mathcal{R}_{q,f}$ is distinguishing $(\mathcal{M}_\mathbf{A}, \mathcal{V}_\mathbf{t} = \mathcal{M}_\mathbf{A}\mathcal{V}_\mathbf{s} + \mathcal{V}_\mathbf{e})$ from $(\mathcal{M}_\mathbf{A}, \mathcal{V}_\mathbf{u})$ — a problem over $\mathbb{Z}_q$, attacked (as in Section 3.3, lattice (56) $\mathcal{L}_q^\perp([\mathbf{A}^T \mid \mathbf{I}_m])$) by finding short vectors in $\mathcal{L}_q^\perp([\mathcal{M}_\mathbf{A}^T \mid \mathbf{I}_{dm}])$, a lattice of dimension $d(m+n)$. If $\mathcal{R}_f$'s algebraic structure has no weaknesses (Section 4.5), this is as hard as the $\mathsf{LWE}_{n',m',q,\beta}$ lattice with $n' = dn$, $m' = dm$. So for $\mathcal{R}_{q,f}$-$\mathsf{LWE}_{n,m,\beta}$ the important value is $dm$ (degree of $f$ × columns of $\mathbf{A}$); for $\mathcal{R}_{q,f}$-$\mathsf{SIS}_{n,m,\beta}$ it is $dn$ (degree × rows). §4.3.2, Eq. (56)

Spelled out

This is why the paper's Table 1 (plain LWE with $m = 512, 768, 1024$) "resembles" Kyber: Kyber uses $d = 256$ and $k = 2, 3, 4$, so $dk = 512, 768, 1024$.

RecapRing LWE packs $d$ bits per ciphertext element; its security-relevant dimension is $d \times$ (matrix dimension).Next: NTRU — the first scheme to use polynomial rings.

NTRU

The paper says

NTRU [HPS98] was the first truly efficient lattice-based encryption scheme and the first to use polynomial rings — specifically $\mathcal{R}_{q,X^d-1}$. It was proposed as a trapdoor one-way function, which can be seen as a OW-CPA cryptosystem (footnote 13: an attacker holding the public key cannot recover the message of a ciphertext of a randomly chosen message). A simple modification gives CPA security [SS11], but usually the one-way function suffices, since there are black-box transformations to CCA-secure encryption (cf. [Den02]). §4.4, p. 30

The NTRU Trapdoor 1-way Function

The paper says

Search Generalized-LWE: given $(a, as + e)$ with $a \leftarrow \mathcal{R}_{q,f}$, $s, e \leftarrow [\beta]$, find $e$ (if $a$ is invertible this also gives $s$). NTRU is the same problem (with $n = m = 1$) except $a = pg_1g_2^{-1}$ for small $g_1, g_2 \leftarrow [\beta]$ and $p = 2\beta + 1$ relatively prime to $q$ ($\beta = 1$ is popular). §4.4.1

Definition 7 — the NTRU problem

Let $p = 2\beta + 1$. Given $(a, as + e)$ where $a = pg_1g_2^{-1}$ for $g_1, g_2, s, e \leftarrow [\beta]$ and $g_2$ invertible in $\mathcal{R}_{q,f}$ and $\mathcal{R}_{p,f}$, find $e$.

Trapdoor function: public key $a = pg_1g_2^{-1}$ (57), secret key $g_2$; evaluate $b = as + e \in \mathcal{R}_{q,f}$ (58); invert via $g_2b \bmod p = pg_1s + g_2e \bmod p = g_2e \bmod p$ (59), then $(g_2b \bmod p)g_2^{-1} \bmod p = e$ (60) and $(b - e)a^{-1} = s$ (61). It suffices to recover $s, e$ modulo $p$, since elements of $[\beta]$ and residues mod $p = 2\beta+1$ correspond one-to-one. The paper urges first-time readers to appreciate that (59) holds despite using two relatively prime moduli, "which is very rarely an idea that leads to any meaningful results". §4.4.1, Eqs. (57)–(61)

Spelled out — why it works
  1. No wraparound. $g_2b = pg_1s + g_2e$ in $\mathcal{R}_{q,f}$, but every coefficient of $pg_1s + g_2e$ is small — strictly between $-q/2$ and $q/2$ — so the centred $g_2b$ equals $pg_1s + g_2e$ over the integers.
  2. Mod $p$ kills the $a$-part. An equation over $\mathcal{R}_f$ stays true mod $p$, and $pg_1s \equiv 0$. Multiply by $g_2^{-1}$ in $\mathcal{R}_{p,f}$ to get $e \bmod p$.
  3. Mod $p$ is enough. $[\beta]$ holds exactly one representative per residue mod $2\beta+1$, so $e \bmod p$ determines $e$; (61) gives $s$.
Try it

NTRU inversion, and what breaks when $q$ is too small

Toy parameters (ours): $f = X^4 + 1$, $\beta = 1$, $p = 3$, $g_1 = 1 - X + X^3$, $g_2 = 1 + X - X^3$, $s = X - X^2 + X^3$, $e = 1 + X^2 - X^3$. Shrink $q$ to watch step 1 (no wraparound) fail.

Analogy (ours)

NTRU plays the role RSA plays in classical crypto: anyone can evaluate $b = as + e$ (like $x^e \bmod N$), only the holder of the trapdoor $g_2$ (like the factorization of $N$) can invert it. LWE encryption, by contrast, follows the ElGamal template.

Security

The paper says

Ignoring the special form of $a$, recovering $s, e$ from (58) is the Generalized-LWE key attack: a short vector in $\mathcal{L}_q^\perp([\mathcal{M}_a \mid \mathcal{V}_b \mid \mathbf{I}_d])$ (62). One can also try to recover $g_1, g_2$ (or related short polynomials) from $a$ via $\mathcal{L}_q^\perp([\mathcal{M}_{p^{-1}a} \mid \mathbf{I}_d])$ (63). The two lattices differ only by the extra vector $\mathcal{V}_b$, yet when $q$ is significantly larger than $\beta$ (but not so large that generic reduction clearly works), finding short vectors in (63) was found to be significantly easier than in (62) [ABD16, CJL16, KF17]. This does not affect NTRU's parameters, but rules the NTRU assumption out of advanced primitives (e.g. FHE) needing large moduli and small noise; there, Generalized-LWE (security resting essentially on (62)) is used. §4.4.2, Eqs. (62)–(63)

Spelled out

$(p^{-1}a)\,g_2 - g_1 = 0$, so $(g_2, -g_1)$ is a short vector in lattice (63) — that is why (63) reveals the key.

RecapNTRU = a trapdoor one-way function $b = as + e$ with a special $a$; it inverts because nothing wraps around mod $q$ and mod $p$ removes the public part.Next: structure can help the attacker.

Exploiting the Algebraic Structure … for Attacks

The paper says

Over $\mathcal{R}_{q,f}$ with $f = X^d - 1$, since $X - 1$ divides $f$ there is a ring homomorphism to $\mathcal{R}_{q,X-1} = \mathbb{Z}_q$: $a = \sum a_iX^i \mapsto a' = \sum a_i$. If $a$'s coefficients are small, so is $a'$ (at most a factor $d$ larger). Attack (adapted from [PR06, LM06]): map $\mathbf{A}, \mathbf{t}$ to $\mathbf{A}' \in \mathbb{Z}_q^{n\times m}$, $\mathbf{t}' \in \mathbb{Z}_q^n$. If $\mathbf{s} \in [\beta]^m$, $\mathbf{e} \in [\beta]^n$ with $\mathbf{A}\mathbf{s} + \mathbf{e} = \mathbf{t}$ exist, then $\mathbf{s}' \in [d\beta]^m$, $\mathbf{e}' \in [d\beta]^n$ satisfy $\mathbf{A}'\mathbf{s}' + \mathbf{e}' = \mathbf{t}'$ — a small-dimensional LWE problem, solvable as in Section 3.3. If $f$ had a factor like $X - 2$ instead, the image $\sum a_i2^i$ would be exponentially large in $d$. Interestingly, the worst-case to average-case reductions [PR06, LM06, LPR13a, LS15, PRS17] only need $f$ irreducible (or, for SIS, with a large-degree irreducible factor) over $\mathbb{Z}[X]$, not over $\mathbb{Z}_q[X]$ — and many low-degree factors in $\mathbb{Z}_q[X]$ are good for efficiency. §4.5, p. 32

Spelled out

The map is "evaluate at $X = 1$". It respects multiplication because $f(1) = 0$, so reducing modulo $f$ does not change the value at $1$.

Try it

Evaluate at 1: a ring LWE instance collapses to a 1-dimensional one

Toy instance (ours): $n = m = 1$, $q = 3329$, $\beta = 1$ over $\mathbb{Z}_q[X]/(X^d - 1)$. The attacker maps everything to $\mathbb{Z}_q$ and tries every $s' \in [d\beta]$, keeping those for which $t' - a's'$ is also in $[d\beta]$.

Analogy (ours)

Pohlig–Hellman: if a group's order has small factors, project the discrete log into small subgroups and solve it there. Here the projection is a ring homomorphism into a small ring that keeps coefficients small; the defence is to make sure no such cheap projection exists.

RecapA small-coefficient-preserving homomorphism to a smaller ring breaks Ring-LWE; so choose $f$ irreducible over $\mathbb{Z}$.Next: factors of $f$ modulo $q$ are a gift — for speed.

Exploiting the Algebraic Structure … for Efficiency (The NTT)

The paper says

Schoolbook multiplication of degree-$d$ polynomials takes $O(d^2)$ operations; Karatsuba and Toom–Cook take approximately $O(d^{1.5})$. The Number Theoretic Transform needs as few as $O(d\log d)$ operations over $\mathbb{Z}_q$: it is the FFT over $\mathbb{Z}_q$. It was first used for lattice primitives in SWIFFT [LMPR08], and is now standard in encryption [ADPS16, BDK+18] and signatures [DKL+18, PFH+17]. §4.6, p. 32–33

Over $\mathbb{Z}_q[X]/(X^d + \alpha)$, $d$ a power of 2, if $-\alpha$ has a square root $r$: $X^d + \alpha \equiv (X^{d/2} - r)(X^{d/2} + r)$, and by the CRT one computes $ab$ by reducing $a, b$ modulo both factors (64)–(65), multiplying component-wise (66), and reconstructing. Eqs. (64)–(66)

Lemma 5

If $X^n + \alpha \equiv (X^{n/2} - r)(X^{n/2} + r) \pmod q$ and $\phi(a) = (a \bmod X^{n/2} - r,\ a \bmod X^{n/2} + r)$, then with $r$ and $r^{-1}$ precomputed, $\phi$ and $2\cdot\phi^{-1}$ can each be computed using $n$ additions/subtractions and $n/2$ multiplications over $\mathbb{Z}_q$.

Proof: $b_i = a_i + r\,a_{i+n/2}$, $c_i = a_i - r\,a_{i+n/2}$; in reverse $2a_i = b_i + c_i$, $2a_{i+n/2} = r^{-1}(b_i - c_i)$. Computing $2\phi^{-1}$ instead of $\phi^{-1}$ saves multiplications: the factor 2 accumulates to $2^{\log d} = d$ and is removed once, by multiplying by $d^{-1}$ at the end. Recurrence (67): $T(d) = 2T(d/2) + 2dA + dM$; solution (68): $T(d) = dT(1) + 2d\log d\cdot A + d\log d\cdot M$ with $T(1) = M$. Splitting $X^d + 1$ down to linear factors needs a $2d$-th root of unity in $\mathbb{Z}_q^*$, which exists for primes $q \equiv 1 \pmod{2d}$ (Lemma 7). If only $q \equiv 1 \pmod d$, the recursion stops at quadratic factors $X^2 - r_i$, whose base multiplication costs a small constant (5 multiplications and 2 additions); the total is virtually identical. Lemma 5, Eqs. (67)–(68), footnotes 14–16

Note — small inconsistency in the paper

The proof of Lemma 5 says the reverse direction takes "$2n$ additions (or subtractions)"; the lemma states $n$. The formulas above use $n/2$ additions plus $n/2$ subtractions: $n$, matching the statement.

Spelled out

Why the reduction formulas: write $a = \sum_{i<n/2} a_iX^i + X^{n/2}\sum_{i<n/2}a_{i+n/2}X^i$ and replace $X^{n/2}$ by $r$ (modulo $X^{n/2} - r$) or by $-r$. The two factors are coprime because their difference $2r$ is invertible (e.g. $q$ an odd prime, $r \ne 0$). Unrolling (67): every level of the recursion costs $2dA + dM$ in total, there are $\log d$ levels, and the bottom costs $d\cdot T(1)$. (Counting both forward transforms and the inverse separately changes the constant, not the $O(d\log d)$.)

Try it

The full NTT for $q = 17$, $d = 4$ (illustration, our numbers)

$17 \equiv 1 \pmod 8$, so $X^4 + 1$ splits completely: $4^2 \equiv -1$, $2^2 = 4$, $8^2 = 64 \equiv -4$, giving $X^4 + 1 \equiv (X^2-4)(X^2+4) \equiv (X-2)(X+2)(X-8)(X+8)$. Press next step to run Lemma 5 forward, multiply pointwise, then run $2\phi^{-1}$ back and divide by $d$.

Useful Algebraic Properties of the Ring $\mathcal{R}_{q,X^d+1}$

The paper says

Lemma 6

$X^d + 1$ is irreducible over $\mathbb{Z}[X]$ if and only if $d$ is a power of 2.

Proof: $X^d + 1 = \frac{X^{2d}-1}{X^d-1} = \prod_{k \mid 2d,\ k \nmid d}\Phi_k(X)$. If $d = 2^\ell$ this is $\Phi_{2d}$, irreducible; if $d = 2^\ell d'$ with $d' > 1$ odd, $\Phi_{2d}$ and $\Phi_{2d/d'}$ are distinct factors.

Lemma 7

Let $d \ge k \ge 1$ with $k \mid d$ and $q \equiv 1 \pmod{2k}$ prime. Then there are $k$ distinct $r_i \in \mathbb{Z}_q^*$ with $r_i^k \equiv -1$ such that $X^d + 1 \equiv \prod_{i=1}^k (X^{d/k} - r_i) \pmod q$ (69).

Proof: take $r$ of order $2k$ (so $r^k \equiv -1$); the $r^{2i+1}$ for $i \in \{0,\dots,k-1\}$ are distinct roots of $X^k + 1$; substitute $X^{d/k}$ for $X$.

Lemma 8

For an odd prime $q$ and $d$ a multiple of 4, $X^d + 1$ factors into at least 2 polynomials over $\mathbb{Z}_q[X]$: $\mathcal{R}_{q,X^d+1}$ is never a field. (Not used later; for an "almost-field" choose parameters where it factors into two irreducibles $X^{d/2} \pm r$ [LS18].)

§4.6.1, Lemmas 6–8, footnote 17

Spelled out

$d = 3$: $X^3 + 1 = (X+1)(X^2 - X + 1) = \Phi_2\Phi_6$. Lemma 8 when $q \equiv 3 \pmod 4$: exactly one of $\pm 2$ is a square; let $b = \pm1$ accordingly and $r^2 \equiv 2b$; then $X^d + 1 \equiv (X^{d/2} + b)^2 - r^2X^{d/2} = (X^{d/2} + b + rX^{d/4})(X^{d/2} + b - rX^{d/4})$. (The paper's proof of Lemma 7 says "for all odd $i$"; it is the exponents $2i + 1$ that are odd, for all $i$.)

Try it

Lemma 7: find the $r_i$

For a prime $q$ and a power of two $k$ with $q \equiv 1 \pmod{2k}$, find the smallest $r$ with $r^k \equiv -1$ (then $r$ has order $2k$) and list the odd powers $r^{2i+1}$. Preset: the $q = 17$ example above.

Analogy (ours)

The NTT is "evaluate at the $2d$-th roots of unity, multiply pointwise, interpolate back" — the FFT with $\mathbb{Z}_q$ in place of $\mathbb{C}$. The leaves of the tree above are $a$ evaluated at the four primitive 8th roots of unity mod 17. The paper notes (Section 4.8) that NTT-based operations are very fast compared with exponentiation or elliptic-curve operations.

RecapPick $f = X^d + 1$ with $d$ a power of 2 (irreducible over $\mathbb{Z}$) and $q \equiv 1 \pmod{2k}$ (many factors mod $q$): secure and $O(d\log d)$ multiplication.Next: Kyber puts it all together.

The Encryption Scheme CRYSTALS-Kyber (ML-KEM)

The paper says

Kyber, standardized by NIST as ML-KEM, is based on generalized LWE over $\mathcal{R}_{3329,X^{256}+1}$ with secrets from the binomial distribution, mainly because it is easier to sample. §4.7, p. 36–37

Definition 8 — binomial distribution $\psi_\eta$

Generate $a_1,\dots,a_\eta,b_1,\dots,b_\eta \leftarrow \{0,1\}$ and output $\sum a_i - \sum b_i$. For polynomials, every coefficient is sampled independently; $\mathbf{a} \leftarrow \psi_\eta^k$ means every element of a dimension-$k$ vector is sampled so.

Note — typo in the paper

Definition 8 ends "sampled according to $\psi_k$"; it means $\psi_\eta$.

Try it

Sample $\psi_\eta$ by counting coin flips

Exact probabilities $\binom{2\eta}{\eta+x}/4^\eta$ next to an empirical histogram of samples drawn exactly as in Definition 8.

The paper says — Figure 3 (Kyber CPA encryption)

Public parameters $k, \eta_1, \eta_2, d_u, d_v \in \mathbb{Z}^+$. Figure 3

CPA-KeyGenCPA-Encrypt$(pk, m)$CPA-Decrypt$(sk, ct)$
$\mathbf{A} \leftarrow \mathcal{R}^{k\times k}_{3329,X^{256}+1}$$(\mathbf{r}, \mathbf{e}_1, e_2) \leftarrow \psi_{\eta_1}^k \times \psi_{\eta_2}^k \times \psi_{\eta_2}$$\mathbf{u}' := \lceil\mathbf{u}\rfloor_{2^{d_u}\to q}$
$(\mathbf{s}, \mathbf{e}) \leftarrow \psi_{\eta_1}^k \times \psi_{\eta_1}^k$$\mathbf{u}^T := \lceil \mathbf{r}^T\mathbf{A} + \mathbf{e}_1^T\rfloor_{q\to 2^{d_u}}$$v' := \lceil v\rfloor_{2^{d_v}\to q}$
$\mathbf{t} := \mathbf{A}\mathbf{s} + \mathbf{e}$$v := \lceil \mathbf{r}^T\mathbf{t} + e_2 + \tfrac{q-1}{2}m\rfloor_{q\to 2^{d_v}}$$m' := \lceil v' - \mathbf{u}'^T\mathbf{s}\rfloor_{q\to 2}$
$pk = (\mathbf{A}, \mathbf{t}),\ sk = \mathbf{s}$$ciphertext = (\mathbf{u}, v)$

$k$ is the main parameter varied between security levels; $d_u, d_v$ give the log of the size of the set $\mathcal{S}$ (Figure 1, (18)) the ciphertext parts are rounded to, and determine ciphertext size and decryption error. Key generation is (51) with binomial secrets; encryption computes (52) and compresses it (Sections 2.5.1–2.5.2); decryption is (54) with compression recovering the 0/1 coefficients as in (20).

Table 3 — parameters for the three instantiations; their security is supposedly, in practice, no worse than AES-128, AES-192 and AES-256. Table 3

$k$$\eta_1$$\eta_2$$d_u$$d_v$decryption errorpk sizeciphertext size
Kyber-512232104$2^{-139}$800 B768 B
Kyber-768322104$2^{-164}$1184 B1088 B
Kyber-1024422115$2^{-174}$1568 B1568 B
Spelled out

$q = 3329$ is odd, so $q/2$ is not an integer; the message is scaled by $\frac{q-1}{2} = 1664$. Each coefficient mod $3329 < 2^{12}$ takes 12 bits.

Correctness and decryption error

The paper says

With $e'$, $\mathbf{e}''$ the compression errors (coefficients as the $\eta$ of Lemma 1), and $\mathbf{t} = \mathbf{A}\mathbf{s} + \mathbf{e}$: $$\lceil v' - \mathbf{u}'^T\mathbf{s}\rfloor_{q\to2} = \Big\lceil \mathbf{r}^T\mathbf{e} + e_2 + \tfrac{q-1}{2}m + e' - (\mathbf{e}_1 + \mathbf{e}'')^T\mathbf{s}\Big\rfloor_{q\to 2}\quad(70)$$ which is $m$ if every coefficient of $\mathbf{r}^T\mathbf{e} + e_2 + e' - (\mathbf{e}_1 + \mathbf{e}'')^T\mathbf{s}$ (71) is less than $q/4$ in magnitude. Compute this as in Section 2.3.2 (adapted to rings via (55)), assuming the compressed values are uniform so that $e'$ is distributed as $\lceil\lceil x\rfloor_{q\to2^{d_v}}\rfloor_{2^{d_v}\to q} - x$ for random $x \in \mathbb{Z}_q$ (resp. $d_u$); then multiply the one-coefficient probability by 256 (union bound). Eqs. (70)–(71)

Try it

Reproduce Table 3: sizes and decryption error, computed in your browser

Sizes: $32 + 384k$ bytes (seed + $\mathbf{t}$) and $32k\,d_u + 32d_v$ bytes. Error: the exact distribution of (71) by direct convolution — $256k$ products $\psi_{\eta_1}\cdot\psi_{\eta_1}$ for $\mathbf{r}^T\mathbf{e}$, $256k$ products $(\psi_{\eta_2} + \text{compression error})\cdot\psi_{\eta_1}$, plus $e_2$ and $e'$ — then $\Pr[|\text{noise}| > 832]\times 256$. (Our computation; Table 3 is the paper's.)

Security

The paper says

Security is based on $\mathcal{R}_{3329,X^{256}+1}$-$\mathsf{LWE}_{k,\psi_2}$, with the proof of Sections 2.3.1 and 4.3. In Kyber-512, $\eta_1 = 3$ but $\eta_2 = 2$: the public key rests on $\mathcal{R}$-$\mathsf{LWE}_{k,\psi_3}$, while the ciphertext rests on a "hybrid" distribution ($\mathbf{r}$ from $\psi_3$, $\mathbf{e}_1, e_2$ from $\psi_2$), at least as hard as $\mathcal{R}$-$\mathsf{LWE}_{k,\psi_2}$. But the output is the rounded $\lceil\mathbf{r}^T\mathbf{A} + \mathbf{e}_1^T\rfloor_{q\to 2^{d_u}}$, adding error as in LWR (Section 2.5.3); $\psi_2$ plus compression from 3329 to $2^{d_u} = 1024$ values is somewhat larger than $\psi_3$, so in practice one gets a few extra bits of heuristic security. The price of $\psi_3$ is a larger decryption error. §4.7 Security

Computational efficiency

The paper says

Store a 256-bit seed $\rho$ and create $\mathbf{A} = \mathcal{H}(\rho)$ (e.g. SHAKE); the public key is $(\rho, \mathbf{t})$. $3329 \equiv 1 \pmod{256}$, so (Lemma 7) $X^{256} + 1$ splits into 128 quadratics $X^2 - r_i$; the NTT representation is $\hat a = (a \bmod X^2 - r_1, \dots, a \bmod X^2 - r_{128})$ (72), and converting $a \leftrightarrow \hat a$ takes $O(d\log d)$. No prime of similar size splits $X^{256} + 1$ into linear factors (that needs $q \equiv 1 \bmod 512$, footnote 18), and there is virtually no computational difference. Since the NTT is a bijection, sample $\mathbf{A}$ directly in NTT form, and store $\mathbf{t}$ in NTT form (needed anyway for $\mathbf{r}^T\mathbf{t}$) — a double win that avoids $k^2$ NTT computations. $\mathbf{s}, \mathbf{e}, \mathbf{r}, \mathbf{e}_1, e$ cannot be sampled in NTT form (not uniform), and compression cannot be done in NTT form. §4.7, Eq. (72), footnote 18

Note — slip in the paper

The paper says "the matrix $\mathbf{A}$ consists of $k$ polynomials"; a $k\times k$ matrix has $k^2$ — as the paper's own "avoid doing $k^2$ NTT computations" implies.

Spelled out

$3328 = 2^8\cdot 13$: divisible by 256 but not 512. The widget in 4.6.1 finds $r = 17$ of order 256 mod 3329.

RecapKyber = Module-LWE over $\mathcal{R}_{3329,X^{256}+1}$ + binomial noise + compression + NTT; Table 3's error and sizes follow from (71) and simple counting.Next: from CPA encryption to a CCA-secure KEM.

From CPA Encryption to a CCA-KEM

The paper says

A KEM has KEM-KeyGen, KEM-Encaps (public key → shared key + ciphertext) and KEM-Decaps (ciphertext + secret key → the same shared key). CPA-secure: the adversary cannot distinguish the shared key from uniform given public key and ciphertext; any CPA-secure encryption gives one by encrypting a random message (footnote 19: for slightly more advanced notions output a hash of it with the public key, as in Figure 4). CCA-secure: this remains true even with a decapsulation oracle usable on anything but the given ciphertext. The Fujisaki–Okamoto transform makes the decapsulation oracle "useless": it outputs non-$\perp$ only on ciphertexts whose message the adversary already knows — by making the encryption randomness depend on the message (encryption becomes deterministic, harmless since messages are random, footnote 20) and having decapsulation decrypt, re-encrypt, and output $\perp$ if the ciphertexts differ. §4.8, Figure 4

KEM-KeyGenKEM-Encaps$(pk)$KEM-Decaps$(sk, c, h, z)$
$(pk, sk) \leftarrow$ CPA-KeyGen$m \leftarrow \{0,1\}^{256} \in \mathcal{R}_{X^{256}+1}$$m' :=$ CPA-Decrypt$(sk, c)$
$pk := (\mathbf{A}, \mathbf{t}),\ sk := \mathbf{s}$$(K, \rho) := \mathcal{H}(m, pk) \in \{0,1\}^{512}$$(K', \rho') := \mathcal{H}(m', pk)$
$c :=$ CPA-Encrypt$(pk, m, \rho)$$c' :=$ CPA-Encrypt$(pk, m', \rho')$
Shared Key $:= K$, ctxt $:= c$if $c \ne c'$ then $K' := \perp$; Shared Key $:= K'$

$\mathcal{H}$ and $\mathcal{G}$ are modelled as random oracles; $\rho \in \{0,1\}^{256}$ is the random coins of CPA-Encrypt (used to generate $(\mathbf{r}, \mathbf{e}_1, e_2)$). The Decaps inputs $h, z$ belong to the ML-KEM modifications below.

Try it

FO on a toy scheme: honest vs. mauled ciphertexts

Illustration (ours): a tiny deterministic LWE scheme ($q = 257$, 4 message bits, the amortized scheme of Section 2.4 with $k = 1$, $\ell = 4$) and a toy 32-bit hash standing in for $\mathcal{H}$ — not cryptographic. Mauling adds $\lfloor q/2\rfloor$ to one coordinate of $v$, which flips one message bit.

Spelled out — why re-encryption makes the oracle useless (informal, not in the paper)

A non-$\perp$ answer on $c$ needs $c = $ CPA-Encrypt$(pk, m', \rho')$ with $(K', \rho') = \mathcal{H}(m', pk)$. In the random-oracle model the only practical way to produce such $c$ is to query $\mathcal{H}(m', pk)$ and encrypt yourself — but then you already know $m'$ and $K'$. A simulator can answer decapsulation queries by scanning the adversary's hash queries, without the secret key. The rigorous proof, including the effect of decryption errors, is beyond the paper — one reason Section 2.3.2 aims for error probabilities like $2^{-150}$.

Analogy (ours) — malleability

Plain ElGamal is malleable: $(c_1, c_2\cdot g)$ decrypts to $\mu\cdot g$, so a decryption oracle on the mauled ciphertext reveals $\mu$. LWE encryption is malleable the same way: adding $q/2$ to $v$ flips the bit. FO's re-encryption check rejects every such mauled ciphertext, because it is not the deterministic encryption of its own decryption.

The paper says — modifications in ML-KEM

Pre-hashing the public key. Lattice public keys are large ($\approx$ 1 KB) and NTT operations are fast compared with exponentiation or elliptic-curve operations, so hashing $pk$ in Encaps/Decaps is noticeable — between 30 and 50 percent of the running time with AVX-2. Since in many practical scenarios decapsulation runs more often than key generation, compute $h = \mathcal{G}(pk)$ in KeyGen, store it, and use $h$ instead of $pk$ as input to $\mathcal{H}$ in Decaps (nothing is saved in Encaps; Decaps hashes 32 bytes instead of $\approx$ 1 KB). Implicit rejection. Kyber never outputs $\perp$: on a mismatch it outputs a random key computed as a hash of the input ciphertext and a secret random value created at key generation. The reasoning is "somewhat technical, and it is not really clear whether this adds any security in practice". §4.8, p. 40

What to remember from Section 4

  1. Rings pack $d$ bits per element. Replacing $\mathbb{Z}_q$ by $\mathcal{R}_{q,f}$ removes the ciphertext blow-up without growing the public key; the security-relevant dimension becomes $d \times$ (matrix dimension).
  2. Multiplication by $a$ is the matrix $\mathcal{M}_a$. For $f = X^d \pm 1$ it is (nega)cyclic, so products of small elements stay small.
  3. $f$ irreducible over $\mathbb{Z}$ ($X^d + 1$, $d$ a power of 2, Lemma 6) avoids cheap homomorphisms (Section 4.5) — but highly reducible mod $q$ (Lemma 7) gives the $O(d\log d)$ NTT.
  4. NTRU is a trapdoor one-way function $b = as + e$ with $a = pg_1g_2^{-1}$; inversion uses two coprime moduli and no wraparound.
  5. Kyber = Module-LWE over $\mathcal{R}_{3329,X^{256}+1}$ + binomial noise + compression + NTT, made a CCA-secure KEM by the Fujisaki–Okamoto transform.
RecapFO: randomness from the message, re-encrypt on decapsulation, reject mismatches.Next (§5): signatures — the same rings, now in a Schnorr-like Σ-protocol.

§5Digital Signatures from Σ-Protocols

The paper says

The goal is a lattice signature whose high-level structure is like Schnorr's [Sch89]. In a Schnorr signature the public key is $g, h$ and the signature is a non-interactive zero-knowledge proof of knowledge (ZKPoK) of $x$ with $g^x = h$. It is built in two steps: (1) a 3-move interactive Σ-protocol that is an honest-verifier ZKPoK of $x$; (2) the Fiat–Shamir transform, which makes it non-interactive. Section 5 follows the same road map with $\mathcal{R}_{q,f}$-LWE and $\mathcal{R}_{q,f}$-SIS, and ends with Dilithium (ML-DSA). §5, p. 41

The Statements and Witnesses

The paper says

Start from an $\mathcal{R}_{q,f}$-$\mathrm{LWE}_{n,m,\beta}$ instance: $\mathbf{A} \leftarrow \mathcal{R}_{q,f}^{n\times m}$, $\mathbf{s}_1 \leftarrow [\beta]^m$, $\mathbf{s}_2 \leftarrow [\beta]^n$, $\mathbf{t} = \mathbf{A}\mathbf{s}_1 + \mathbf{s}_2$. The public key is $(\mathbf{A}, \mathbf{t})$; we want to prove knowledge of $\mathbf{s}_1, \mathbf{s}_2$ in the right range. This is harder than for discrete log: besides the algebraic relation we must also prove that the coefficients are small (ideally in $[\beta]$, but $[\bar\beta]$ for some $\bar\beta$ a little larger is fine).

The most efficient signatures do not prove knowledge of small $\mathbf{s}_1, \mathbf{s}_2$ with $\mathbf{A}\mathbf{s}_1 + \mathbf{s}_2 = \mathbf{t}$ (Eq. (73)), but of a relaxed solution: $\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2$ with coefficients in a somewhat larger interval and a small $\bar c$ with

$$\mathbf{A}\bar{\mathbf{s}}_1 + \bar{\mathbf{s}}_2 = \bar c\,\mathbf{t}. \qquad (74)$$

Lemma 9

Suppose an algorithm, given $\mathbf{A} \leftarrow \mathcal{R}_{q,f}^{n\times m}$ and $\mathbf{t} = \mathbf{A}\mathbf{s}_1 + \mathbf{s}_2$ for $\mathbf{s}_1 \leftarrow [\beta]^m$, $\mathbf{s}_2 \leftarrow [\beta]^n$, outputs $\bar{\mathbf{s}}_1 \in [\bar\beta]^m$, $\bar{\mathbf{s}}_2 \in [\bar\beta]^n$ and $\bar c \in [2]$ with $\mathbf{A}\bar{\mathbf{s}}_1 + \bar{\mathbf{s}}_2 = \bar c\,\mathbf{t}$. Then another algorithm, with the same running time and success probability, solves either $\mathcal{R}_{q,f}$-$\mathrm{LWE}_{n,m,\beta}$ or $\mathcal{R}_{q,f}$-$\mathrm{SIS}_{n,m+1,\bar\beta}$.

§5.1, Eqs. (73)–(74), Lemma 9, p. 41

Spelled out

Why the size condition matters. Without it the statement is trivial: any $\mathbf{s}_1$ works with $\mathbf{s}_2 = \mathbf{t} - \mathbf{A}\mathbf{s}_1$.

Proof of Lemma 9. Take a uniformly random SIS instance $\bar{\mathbf{A}} = [\mathbf{A} \mid \mathbf{t}] \in \mathcal{R}_{q,f}^{n\times(m+1)}$ and hand $(\mathbf{A}, \mathbf{t})$ to the algorithm.

  • By $\mathcal{R}_{q,f}$-$\mathrm{LWE}_{n,m,\beta}$, a uniform $\mathbf{t}$ is indistinguishable from $\mathbf{A}\mathbf{s}_1 + \mathbf{s}_2$, which is what the algorithm expects. If it behaves differently on a uniform $\mathbf{t}$, that difference is itself an LWE distinguisher.
  • If it succeeds, rearrange: $[\mathbf{A} \mid \mathbf{t}]\binom{\bar{\mathbf{s}}_1}{-\bar c} + \bar{\mathbf{s}}_2 = \mathbf{0}$. The vector $(\bar{\mathbf{s}}_1, -\bar c)$ has coefficients in $[\bar\beta]$ (since $\bar c \in [2]$ and $\bar\beta \ge 2$), and it is non-zero when $\bar c \neq 0$. That is an $\mathcal{R}_{q,f}$-$\mathrm{SIS}_{n,m+1,\bar\beta}$ solution.

(Implicit, as in the paper: the output must be non-trivial, $\bar c \neq 0$. In use, $\bar c \in \bar{\mathcal C}$ is non-zero by (76).)

The discrete-log counterpart. Schnorr extraction also yields a relaxed statement, $g^{\bar z} = h^{\bar c}$. In a prime-order group this costs nothing, because $\bar c$ is invertible and $x = \bar z/\bar c$. In lattices, dividing by $\bar c$ would destroy smallness, so we keep form (74) and use Lemma 9 instead. (Analogy ours.)

RecapWe will prove knowledge of a relaxed short solution to $\mathbf{A}\bar{\mathbf{s}}_1 + \bar{\mathbf{s}}_2 = \bar c\,\mathbf{t}$. By Lemma 9, producing one is as hard as Ring-LWE or Ring-SIS. But how small is $\bar c$? That depends on the challenge space.

The Challenge Space

The paper says

The coefficients of $\bar c$ (and of $\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2$) depend on the challenge space, so we want challenges with small norms. Over $\mathcal{R}_f$ with $\deg f = d$, let $\eta$ be the smallest integer with $2^\eta\binom{d}{\eta} > 2^{256}$ (assuming $d$ is large enough). Define

$$\mathcal{C} = \{c \in [1] : \|c\|_1 = \eta\}, \qquad \bar{\mathcal{C}} = \{\bar c = c_1 - c_2 : c_1 \neq c_2 \in \mathcal{C}\}. \qquad (75),(76)$$

So $\mathcal{C}$ contains the polynomials with exactly $\eta$ non-zero coefficients from $\{-1, 1\}$, and $|\mathcal{C}| = 2^\eta\binom{d}{\eta}$. Allowing fewer non-zero coefficients would complicate sampling without increasing the size by much. Footnote 22: to sample, start from a length-$d$ vector with $\eta$ ones, shuffle it (e.g. Fisher–Yates), then randomly negate each $1$. §5.1.1, Eqs. (75)–(76), p. 42

Spelled out

Why $2^\eta\binom{d}{\eta}$: choose which $\eta$ of the $d$ positions are non-zero, then a sign for each. A difference of two challenges has coefficients in $\{-2, \ldots, 2\}$, so $\bar c \in [2]$ (this is why Lemma 9 has $\bar c \in [2]$), and $\|\bar c\|_1 \le 2\eta$.

Try it

How big is the challenge space?

Pick the ring degree $d$ to get the paper's $\eta$ (the smallest with $|\mathcal C| > 2^{256}$). Pick any $\eta$ to see $\log_2|\mathcal C|$. Then sample a challenge the footnote-22 way.

RecapChallenges are sparse $\pm1$ polynomials: small norm, but at least $2^{256}$ of them. Now the protocol itself.

The Basic Σ-Protocol

The paper says

Figure 5 — the basic zero-knowledge proof system (from [Lyu09])

Private: $\mathbf{s}_1 \in [\beta]^m$, $\mathbf{s}_2 \in [\beta]^n$. Public: $\mathbf{A} \in \mathcal{R}_{q,f}^{n\times m}$, $\mathbf{t} = \mathbf{A}\mathbf{s}_1 + \mathbf{s}_2$.

  1. Prover: $\mathbf{y}_1 \leftarrow [\gamma + \bar\beta]^m$, $\mathbf{y}_2 \leftarrow [\gamma + \bar\beta]^n$; send $\mathbf{w} := \mathbf{A}\mathbf{y}_1 + \mathbf{y}_2$.
  2. Verifier: send $c \leftarrow \mathcal{C}$.
  3. Prover: $\mathbf{z}_1 := c\mathbf{s}_1 + \mathbf{y}_1$, $\mathbf{z}_2 := c\mathbf{s}_2 + \mathbf{y}_2$. If $\mathbf{z}_1 \notin [\bar\beta]^m$ or $\mathbf{z}_2 \notin [\bar\beta]^n$, then $(\mathbf{z}_1, \mathbf{z}_2) := \perp$. Send $(\mathbf{z}_1, \mathbf{z}_2)$.
  4. Verifier: accept iff $\mathbf{z}_1 \in [\bar\beta]^m$, $\mathbf{z}_2 \in [\bar\beta]^n$ and $\mathbf{A}\mathbf{z}_1 + \mathbf{z}_2 - c\mathbf{t} = \mathbf{w}$.

It is a ZKPoK of $\bar{\mathbf{s}}_1 \in [2\bar\beta]^m$, $\bar{\mathbf{s}}_2 \in [2\bar\beta]^n$, $\bar c \in \bar{\mathcal C}$ satisfying (74). $\gamma$ is defined in Lemma 10; $\bar\beta$ affects how often $\perp$ is sent.

An unusual feature: the protocol does not have perfect completeness. To keep the output small and independent of the secret, the last round uses rejection sampling. Here it is simply a check that all coefficients lie in a range. Discrete-Gaussian rejection gives slightly smaller outputs [Lyu12, DDLL13], but it is more complex: a slightly incorrect implementation may leak the secret key, and it may be harder to defend against side channels. As a result, the signer's running time is a random variable, but one independent of $\mathbf{s}_1, \mathbf{s}_2$. Sending a hash of the first message is a common compaction trick, and with rejection it would also let one simulate aborting transcripts. It is unnecessary for signature security, because the signer's aborted attempts are never seen. So the paper proves zero-knowledge only for non-aborting transcripts. §5.2, Figure 5, pp. 42–43

Spelled out

Completeness. $\mathbf{A}\mathbf{z}_1 + \mathbf{z}_2 - c\mathbf{t} = \mathbf{A}(c\mathbf{s}_1 + \mathbf{y}_1) + c\mathbf{s}_2 + \mathbf{y}_2 - c(\mathbf{A}\mathbf{s}_1 + \mathbf{s}_2) = \mathbf{A}\mathbf{y}_1 + \mathbf{y}_2 = \mathbf{w}$. So whenever the prover does not abort, the verifier accepts.

The Schnorr shape. Mask ($\mathbf{y}$), commit ($\mathbf{w}$), challenge ($c$), respond with “mask + challenge × secret” ($\mathbf{z} = \mathbf{y} + c\mathbf{s}$). The lattice-only extra is the rejection step.

Try it

Run Figure 5 at toy size, then extract

This toy uses degree $d = 1$ (so $\mathcal{R}_{q,f} = \mathbb{Z}_q$), $q = 97$, $m = n = 2$, $\beta = 1$, $\mathcal{C} = \{-1, 1\}$ ($\eta = 1$, so $\gamma = 1$), and $\bar\beta = \gamma d(m+n) = 4$. Run repeats the protocol until the prover does not abort. Rewind replays the same $\mathbf{w}$ with the other challenge and extracts a solution to (81). These are illustration parameters, far too small to be secure.

RecapFigure 5 is Schnorr plus a range check that sometimes aborts. Why does the abort make the transcript safe to reveal? Lemma 10.

Honest-Verifier Zero-Knowledge

The paper says

Lemma 10

Let $\gamma \in \mathbb{Z}^+$ be such that $cs \in [\gamma]$ for all $s \in [\beta]$, $c \in \mathcal C$ (footnote 23: when $\|c\|_1 = \eta$ and $s \in [\beta]$, simply $\gamma = \eta\beta$). Then for all $\mathbf{s}_i, c$ as in Figure 5,

$$\Pr_{\mathbf{y}_1,\mathbf{y}_2}\bigl[(\mathbf{z}_1,\mathbf{z}_2) \neq \perp\bigr] = \left(\frac{2\bar\beta+1}{2(\bar\beta+\gamma)+1}\right)^{d(m+n)} \qquad (77)$$ $$\forall\,\mathbf{z}_1' \in [\bar\beta]^m, \mathbf{z}_2' \in [\bar\beta]^n:\ \Pr\bigl[(\mathbf{z}_1,\mathbf{z}_2) = (\mathbf{z}_1',\mathbf{z}_2') \mid (\mathbf{z}_1,\mathbf{z}_2) \neq \perp\bigr] = \left(\frac{1}{2\bar\beta+1}\right)^{d(m+n)}. \qquad (78)$$

Proof idea. Look at one integer coefficient. For $z$ to equal a target $\nu_z \in [\bar\beta]$ when the secret coefficient is $\nu_s \in [\gamma]$, the mask must be exactly $\nu_y = \nu_z - \nu_s$. That value lies in $[\bar\beta + \gamma]$, the very range $\nu_y$ is drawn from, so it happens with probability exactly $\frac{1}{2(\bar\beta+\gamma)+1}$ whatever $\nu_s$ is (Eq. (79)). Summing over the $(2\bar\beta+1)^{d(m+n)}$ valid outputs gives (77); dividing gives (78). §5.2.1, Lemma 10, Eqs. (77)–(79), pp. 43–44

Note on the paper's text

In (78) the paper quantifies over $\mathbf{z}_1' \in [\beta]^m$, $\mathbf{z}_2' \in [\beta]^n$; it must be $[\bar\beta]$, as in (79) and the proof. On p. 44 the proof's first sentence gives the probability that a coefficient equals $\nu_z$ as “exactly $\frac{1}{2\bar\beta+1}$”. That is the conditional probability (78); the unconditional value, which the argument shows and (79) states, is $\frac{1}{2(\bar\beta+\gamma)+1}$.

Try it

Rejection sampling, one coefficient

$y$ is uniform on $[\gamma + \bar\beta]$, so $z = cs + y$ is uniform on a window shifted by the secret. Keep $z$ only if $z \in [\bar\beta]$. Move the secret $cs$: the kept values never change. The preset $\gamma = 2$, $\bar\beta = 4$ is our illustration from the companion guide.

The paper says

The probability of not aborting is (Eq. (80))

$$\left(\frac{2\bar\beta+1}{2(\bar\beta+\gamma)+1}\right)^{d(m+n)} > \left(\frac{\bar\beta}{\bar\beta+\gamma}\right)^{d(m+n)} = \left(1+\frac{\gamma}{\bar\beta}\right)^{-d(m+n)} \approx e^{-\gamma d(m+n)/\bar\beta},$$

so setting $\bar\beta = \gamma d(m+n)$ needs an expected $e$ repetitions before a non-$\perp$ value is sent. A smaller $\bar\beta$ is possible at the cost of more repetitions. §5.2.1, Eq. (80), p. 44

Spelled out

The inequality $(2\bar\beta+1)(\bar\beta+\gamma) > \bar\beta(2\bar\beta+2\gamma+1)$ reduces, after expanding, to $\gamma > 0$. The approximation is $(1+x)^{-N} \approx e^{-xN}$ for small $x$. With $\bar\beta = \gamma d(m+n)$ the exponent is $-1$, so the success probability is about $1/e$ and the expected number of repetitions is about $e \approx 2.72$.

Try it

How often does the prover abort? (Eq. (80))

The defaults are the Dilithium-like $\gamma = 196$, $d = 256$, $(m, n) = (5, 6)$, with the paper's rule of thumb $\bar\beta = \gamma d(m+n)$.

The paper says

The simulator. Choose $\mathbf{z}_1 \leftarrow [\bar\beta]^m$, $\mathbf{z}_2 \leftarrow [\bar\beta]^n$, $c \leftarrow \mathcal C$, set $\mathbf{w} := \mathbf{A}\mathbf{z}_1 + \mathbf{z}_2 - c\mathbf{t}$, and output $(\mathbf{w}, c, \mathbf{z}_1, \mathbf{z}_2)$. This perfectly simulates a non-aborting transcript: $c$ is uniform, by Lemma 10 $(\mathbf{z}_1, \mathbf{z}_2)$ is uniform for any $c$, and $\mathbf{w}$ is determined by the other values. So Figure 5 is HVZK when $\perp$ is not sent. Also, the probability of sending $\perp$ is independent of the secret. A running time that depended on the secret would enable side-channel attacks; the protocol is immune to that particular attack. §5.2.1, p. 44

RecapAccepted responses are uniform on $[\bar\beta]$ whatever the secret, and the abort rate reveals nothing. Zero-knowledge is half the story; the other half is that a cheating prover must know something.

Proof of Knowledge

The paper says

Use the usual rewinding argument (Figure 6): after the prover sends $\mathbf{w}$, get answers to two challenges $c \neq c'$. If both transcripts $(\mathbf{w}, c, \mathbf{z}_1, \mathbf{z}_2)$ and $(\mathbf{w}, c', \mathbf{z}_1', \mathbf{z}_2')$ verify, then $\mathbf{A}\mathbf{z}_1 + \mathbf{z}_2 - c\mathbf{t} = \mathbf{A}\mathbf{z}_1' + \mathbf{z}_2' - c'\mathbf{t}$, which simplifies to

$$\mathbf{A}(\mathbf{z}_1 - \mathbf{z}_1') + (\mathbf{z}_2 - \mathbf{z}_2') = (c - c')\mathbf{t}, \qquad (81)$$

exactly the statement (74) with $\bar{\mathbf{s}}_1 \in [2\bar\beta]^m$, $\bar{\mathbf{s}}_2 \in [2\bar\beta]^n$, $\bar c \in [2]$. §5.2.2, Figure 6, Eq. (81), p. 44

Spelled out

The difference of two elements of $[\bar\beta]$ lies in $[2\bar\beta]$, which is where the factor 2 comes from. The Rewind button in the Figure 5 demo above performs exactly this extraction. With an honest prover the same mask is reused, so $\bar{\mathbf{s}}_i = (c - c')\mathbf{s}_i$.

RecapTwo accepting answers to one commitment give a relaxed solution (74). Combine the two properties.

Putting It All Together

The paper says

HVZK means an adversary learns nothing from non-aborted transcripts. Proof of knowledge means an adversary who can impersonate the prover can produce a solution to (74), which by Lemma 9 solves Ring-LWE or Ring-SIS. Together, assuming Ring-SIS and Ring-LWE are hard, an adversary cannot impersonate the prover even after observing valid interactions. Fiat–Shamir then yields a signature scheme secure in the random oracle model, based on the hardness of Ring-SIS and Ring-LWE. §5.2.3, pp. 44–45

RecapHVZK + PoK + Lemma 9 = an identification scheme as hard as Ring-LWE/SIS. How large must $\bar\beta$ be?

Setting the Parameters

The paper says

Extraction gives $\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2$ with coefficients in $[2\bar\beta]$ and $\|\bar c\|_1 \le 2\eta$. By Lemma 9, if $\mathcal{R}_{q,f}$-$\mathrm{LWE}_{n,m,\beta}$ is hard, this implies solving an $\mathcal{R}_{q,f}$-SIS problem with $m+1$ columns. The optimal setting makes the two problems equally hard, i.e. on the same vertical line in Figure 2. $\bar\beta$ is dictated by Lemma 10: by (80) it should be around $\gamma d(m+n)$, and with $\|c\|_1 \le \eta$, $\gamma = \eta\beta$. So $\bar\beta$ is roughly a factor $\eta d(m+n)$ larger than $\beta$. §5.2.4, p. 45

Note on the paper's text

Here the paper writes the SIS problem as $\mathcal{R}_{q,f}$-$\mathrm{SIS}_{n,m+1,\bar\beta}$. Since the extracted coefficients lie in $[2\bar\beta]$, applying Lemma 9 gives bound $2\bar\beta$, which is what the paper itself writes in §5.7 ($\mathcal{R}_{q,f}$-$\mathrm{SIS}_{n,m+1,2\bar\beta}$).

Recap$\bar\beta \approx \eta d(m+n)\cdot\beta$: LWE is hard at small $\beta$, SIS must be hard at the much larger $2\bar\beta$. Changing $\beta$ alone turns this into lattice versions of other classic protocols.

Analogies to Discrete-Log Schemes: Schnorr, Okamoto, and Katz–Wang

The paper says

This section is not needed for the sequel (footnote 24). By changing only $\beta$ (and the derived $\bar\beta$), the lattice protocol mimics three discrete-log schemes with different security properties. The Schnorr-like variant, with $\beta$ unconstrained, is the most efficient. The common blueprint: a homomorphic one-way function family $\mathcal F$; the public key is $f, f(x)$; the prover sends $w = f(y)$ for a random mask $y$ and answers $c$ with $z = y + xc$. Different properties come from changing the relation between the domain and range sizes of $f$. §5.3, p. 45–46

Schnorr

The paper says

Public key $g$, $h = g^x$. The prover sends $w = g^y$ and answers $c$ with $z = y + xc$; the verifier checks $g^z = h^c\cdot w$. To reduce from discrete log, use the challenge $(g, h)$ as the public key. Without $x$, simulate by picking random $z, c$ and setting $w = g^z/h^c$. If the adversary impersonates, rewinding gives $g^{\bar z} = h^{\bar c}$ with $\bar z = z - z'$, $\bar c = c - c'$, and the discrete log is $\bar z/\bar c$. The lattice analogue (Figure 5) extracts (74) and applies Lemma 9 to $[\mathbf{A} \mid \mathbf{t}]$. One difference: Schnorr's public key $(g, g^x)$ is random, while in lattices Ring-LWE is needed to argue the key looks random. §5.3, p. 46

Note on the paper's text

The paper writes Schnorr's verification check as $g^z = t^c\cdot w$, using $t$ for $h$.

Spelled out
SchnorrLattice (Figure 5)
one-way function$x \mapsto g^x$$(\mathbf{s}_1,\mathbf{s}_2) \mapsto \mathbf{A}\mathbf{s}_1 + \mathbf{s}_2$
commitment$w = g^y$$\mathbf{w} = \mathbf{A}\mathbf{y}_1 + \mathbf{y}_2$
response$z = y + xc$$\mathbf{z}_i = \mathbf{y}_i + c\mathbf{s}_i$ + rejection
check$g^z = h^c w$$\mathbf{A}\mathbf{z}_1 + \mathbf{z}_2 - c\mathbf{t} = \mathbf{w}$ + size check
extracted$x = \bar z/\bar c$$(\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2, \bar c)$ with (74)
assumptiondiscrete logRing-LWE (key looks random) + Ring-SIS

Why Schnorr needs no rejection: $y$ is uniform in $\mathbb{Z}_p$, so $y + xc$ is exactly uniform whatever $x$ is. Lattices need $\mathbf{z}$ small, so $\mathbf{y}$ cannot be uniform over everything. Rejection sampling restores “uniform whatever the secret”.

Okamoto

The paper says

Okamoto [Oka92] can be proven secure against active adversaries, who choose challenges maliciously. This is not really needed for signatures, since Fiat–Shamir only needs HVZK (footnote 25: there is no reduction from discrete log or DDH to actively secure Schnorr, though it can be proven under “knowledge assumptions” [BP02]). The public key is $(g_1, g_2)$, $h = g_1^{x_1}g_2^{x_2}$. The prover sends $w = g_1^{y_1}g_2^{y_2}$ and answers with $z_i = y_i + cx_i$; the verifier checks $g_1^{z_1}g_2^{z_2} = h^c w$.

The reduction picks its own valid secret key and runs the protocol honestly, with no simulation. Rewinding an impersonator gives $h^{\bar c} = g_1^{\bar z_1}g_2^{\bar z_2}$, i.e. $1 = g_1^{\bar z_1 - x_1\bar c}g_2^{\bar z_2 - x_2\bar c}$ (Eqs. (82)–(83)). This yields $\log_{g_1} g_2$ unless both exponents are $0$. Many secret keys are consistent with $h$, and the transcripts are identically distributed for all of them (footnote 26), even with adversarial $c$. So even an unbounded impersonator hits exactly $\bar z_i = x_i\bar c$ only with small probability. (This fails for Schnorr: $h = g^x$ has only one secret key.)

Lattice analogue: choose $\beta$ so large that the public key does not determine the secret. If $(2\beta+1)^{n+m} > q^n\cdot 2^{128/d}$, any algorithm recovers the exact $(\mathbf{s}_1, \mathbf{s}_2)$ with probability only $2^{-128}$ (footnote 27). Lemma 10 shows the transcripts leak nothing about the $\mathbf{s}_i$. But, as with Okamoto versus Schnorr, the requirement on $\beta$ makes it less efficient. §5.3, Eqs. (82)–(83), pp. 46–47

Katz–Wang

The paper says

Katz–Wang [KW03, Section 3] rests entirely on DDH and needs no rewinding, which gives a tighter reduction (footnote 28). Tightness matters more in the quantum random oracle model, where adversaries cannot be straightforwardly rewound. But it does not seem to affect actual security, so Okamoto, Katz–Wang and their lattice versions “remain mostly of only theoretical interest.” The public key is $(g_1, g_2)$, $(h_1 = g_1^x, h_2 = g_2^x)$. The prover sends $w_i = g_i^y$ and answers with $z = y + cx$; the verifier checks $g_i^z = h_i^c w_i$.

Given a DDH instance, publish it as the key and simulate as for Schnorr. If the tuple is random ($h_i = g_i^{x_i}$, $x_1 \neq x_2$, $w_i = g_i^{r_i}$), a valid $z$ needs $z = x_1c + r_1 = x_2c + r_2$, which happens with probability $1/|\mathcal C|$ over $c$. So the adversary's success decides DDH.

Lattice analogue: make $\bar\beta$ so small that, for a uniformly random key $(\mathbf{A}, \mathbf{t})$, valid responses do not exist information-theoretically. Two accepting challenges for one $\mathbf{w}$ would give $\mathbf{A}\bar{\mathbf{z}}_1 + \bar{\mathbf{z}}_2 = \mathbf{t}\bar c$ (Eq. (84)), and a Lemma-2-style argument shows such $\bar{\mathbf{z}}_i \in [2\bar\beta]$ do not exist for random $(\mathbf{A}, \mathbf{t})$ with high probability (footnote 30: this needs the polynomials in $[2\bar\beta]$ to be invertible [LS18, Corollary 1.2]). This forces $\bar\beta$ somewhat below $q^{n/(n+m)}$, and $\beta$ even smaller. §5.3, Eq. (84), pp. 47–49

Comparing efficiency and security

The paper says

In Figure 2, LWE gets harder and SIS easier as $\beta$ grows, and they cross near $q^{n/(n+m)}$. The optimal Schnorr-like setting puts $\beta$ and $\bar\beta$ on different sides of the crossing. Okamoto-like needs $\beta > q^{n/(n+m)}$, putting both on the same side. Katz–Wang-like needs $\bar\beta < q^{n/(n+m)}$, again putting both on the same side. Figure 7 sketches the intuition: the Okamoto and Katz–Wang constraints produce less hard Ring-SIS/Ring-LWE instances, which require increasing $n$ and $m$. §5.3, Figure 7, p. 49

Try it

Figure 7, interactive

This is a sketch, like the paper's figure: the lines show direction, not concrete hardness. LWE hardness is read at $\beta$ and SIS hardness at $\bar\beta$; the scheme is only as strong as the lower of the two (our reading). Choose a variant, or drag the markers yourself (Lemma 10 keeps $\bar\beta > \beta$).

RecapSame protocol, three parameter regimes; the unconstrained Schnorr-like one is the most efficient. Back to efficiency: can the prover send less?

Reducing the Proof Size

The paper says

In Figure 5 the verifier can recompute $\mathbf{z}_2 = \mathbf{w} - \mathbf{A}\mathbf{z}_1 + c\mathbf{t}$, so $\mathbf{z}_2$ need not be sent. But this is incompatible with using the protocol efficiently or turning it into a signature with Fiat–Shamir (§5.6). There one sends the short hash $\rho = \mathcal{H}(\mathbf{w})$ instead of $\mathbf{w}$ (the verifier checks $\mathcal{H}(\mathbf{A}\mathbf{z}_1 + \mathbf{z}_2 - c\mathbf{t}) = \rho$), and then $\mathbf{z}_2$ can no longer be recomputed. Not sending $\mathbf{w}$ essentially halves the signature size. So at first glance the prover must send either $\mathbf{w}$ or $\mathbf{z}_2$.

The insight. $\mathbf{z}_2$ is small, so with good probability it does not affect the high-order bits of $\mathbf{w}$. Likewise $\mathbf{y}_2$ does not affect the high bits of $\mathbf{A}\mathbf{y}_1 + \mathbf{y}_2$. So define $\mathbf{w}$ as the high bits of $\mathbf{A}\mathbf{y}_1$, and let the verifier check that the high bits of $\mathbf{A}\mathbf{z}_1 - c\mathbf{t}$ equal $\mathbf{w}$. Then neither $\mathbf{z}_2$ nor $\mathbf{w}$ needs to be sent. The prover still needs $\mathbf{s}_2$ to keep the protocol zero-knowledge. The idea is from [GLP12, BG14]; Figure 8 is due to [BG14].

Notation. As in §2.5.1, $\mathcal S \subset \mathbb{Z}_q$ has size $2^\kappa$ with neighbours $\approx q/2^\kappa$ apart, and $w = \mathrm{HIGH}_\mathcal{S}(w) + \mathrm{LOW}_\mathcal{S}(w)$ with $\mathrm{LOW}_\mathcal{S}(w) \in [q/2^{\kappa+1}]$. $\delta_\mathcal{S}$ is the largest integer such that the sets $s_i + [\delta_\mathcal{S}]$ are disjoint; for equidistant points, $\delta_\mathcal{S} \approx q/2^{\kappa+1}$. For all positive $\gamma < \delta_\mathcal{S}$ and $s \in [\gamma]$:

$$\mathrm{LOW}_\mathcal{S}(w) \in [\delta_\mathcal{S} - \gamma] \implies \mathrm{HIGH}_\mathcal{S}(w) = \mathrm{HIGH}_\mathcal{S}(w + s). \qquad (85)$$

Figure 8 — zero-knowledge proof with a smaller output

  1. Prover: $\mathbf{y} \leftarrow [\gamma + \bar\beta]^m$; send $\mathbf{w} := \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{y})$.
  2. Verifier: $c \leftarrow \mathcal C$.
  3. Prover: $\mathbf{z} := c\mathbf{s}_1 + \mathbf{y}$. If $\mathbf{z} \notin [\bar\beta]^m$ or $\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{y} - c\mathbf{s}_2) \notin [\delta_\mathcal{S} - \gamma]^n$, then $\mathbf{z} := \perp$. Send $\mathbf{z}$.
  4. Verifier: accept iff $\mathbf{z} \in [\bar\beta]^m$ and $\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t}) = \mathbf{w}$.

A ZKPoK of $\bar{\mathbf{s}}_1 \in [2\bar\beta]^m$, $\bar{\mathbf{s}}_2 \in [q/2^\kappa]^n$, $\bar c \in \bar{\mathcal C}$ satisfying (74).

§5.4, Figure 8, Eq. (85), pp. 49–51

Spelled out

Why (85) holds. $w$ is within $\delta_\mathcal{S} - \gamma$ of its nearest point $s_i$. Moving it by at most $\gamma$ keeps it within $\delta_\mathcal{S}$ of $s_i$, inside $s_i + [\delta_\mathcal{S}]$, and that set is disjoint from every other point's neighbourhood. So $s_i$ stays the nearest point. The demo below checks every case exhaustively at toy size.

Try it

HIGH and LOW on the circle — observation (85)

This toy uses $q = 97$ and $\kappa = 2$, so $\mathcal S = \{\lceil i\cdot 97/4 \rfloor\} = \{0, 24, 49, 73\}$. Move $w$ and the shift $s \in [\gamma]$. When $\mathrm{LOW}_\mathcal{S}(w) \in [\delta_\mathcal{S} - \gamma]$, the high part never changes. Illustration numbers, not the paper's.

RecapRound $\mathbf{A}\mathbf{y}$ to its high bits; small perturbations far from a boundary don't change them. Check that this still gives correctness, ZK and PoK.

Correctness

The paper says

If $\mathbf{z} \neq \perp$ we need $\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{y}) = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t})$. Now

$$\mathbf{A}\mathbf{z} - c\mathbf{t} = \mathbf{A}(c\mathbf{s}_1 + \mathbf{y}) - c(\mathbf{A}\mathbf{s}_1 + \mathbf{s}_2) = \mathbf{A}\mathbf{y} - c\mathbf{s}_2. \qquad (86)$$

The prover only continues if $\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{y} - c\mathbf{s}_2) \in [\delta_\mathcal{S} - \gamma]^n$. By (85) this implies $\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{y}) = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{y} - c\mathbf{s}_2)$, so $\mathbf{w} = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t})$. §5.4.1, Eq. (86), p. 51

Spelled out

Apply (85) with $w = \mathbf{A}\mathbf{y} - c\mathbf{s}_2$ and shift $s = c\mathbf{s}_2 \in [\gamma]$: then $w + s = \mathbf{A}\mathbf{y}$.

Zero-Knowledge

The paper says

By Lemma 10, conditioned on $\mathbf{z} \in [\bar\beta]^m$, $\mathbf{z}$ is uniform. The simulator picks $\mathbf{z} \leftarrow [\bar\beta]^m$ and $c \leftarrow \mathcal C$, and checks whether $\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t}) \in [\delta_\mathcal{S} - \gamma]^n$, resampling if not. It then sets $\mathbf{w} := \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t})$ and outputs $(\mathbf{w}, c, \mathbf{z})$. It is crucial that the simulator can perfectly simulate the prover's check

$$\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{y} - c\mathbf{s}_2) \in [\delta_\mathcal{S} - \gamma]^n. \qquad (87)$$

That is why this check, rather than a different and possibly less restrictive one, is performed. The scheme would still be complete if the prover directly checked that the verifier will accept, $\mathbf{w} = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t})$. But the simulator cannot perform that check, because it sets $\mathbf{w}$ only after fixing $\mathbf{z}$ and checking (87), so the scheme would lose its ZK property. Check (87) is needed to ensure correctness and simulatability. §5.4.2, Eq. (87), p. 51

Spelled out

The simulator can run (87) because, by (86), $\mathbf{A}\mathbf{y} - c\mathbf{s}_2 = \mathbf{A}\mathbf{z} - c\mathbf{t}$, which is computable from public data and $\mathbf{z}, c$. Replacing (87) by the direct acceptance check would lose zero-knowledge.

Computing the Probability of ⊥

The paper says

As in Lemma 10, $\Pr_\mathbf{y}[\mathbf{z} \in [\bar\beta]^m] = \bigl(\frac{2\bar\beta+1}{2(\bar\beta+\gamma)+1}\bigr)^{dm} \approx e^{-\gamma dm/\bar\beta}$. For the second check, make the heuristic assumption that $\mathbf{A}\mathbf{y} - c\mathbf{s}_2$ is uniform, so its LOW part is uniform in $[\delta_\mathcal{S}]^n$:

$$\left(\frac{2(\delta_\mathcal{S}-\gamma)+1}{2\delta_\mathcal{S}+1}\right)^{dn} > \left(1 - \frac{\gamma}{\delta_\mathcal{S}}\right)^{dn} \approx e^{-\gamma dn/\delta_\mathcal{S}}, \qquad (88)$$ $$\Pr_\mathbf{y}[\mathbf{z} \neq \perp] \approx e^{-\gamma d(m/\bar\beta + n/\delta_\mathcal{S})}. \qquad (89)$$

Larger $\bar\beta$ and $\delta_\mathcal{S}$ increase the correctness probability, but also the size of the extracted $\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2$. The heuristic is only used to compute the probability; independence of the abort from the secret needs none, because $\mathbf{z}$ is independent of the secret and $\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{y} - c\mathbf{s}_2) = \mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t})$. §5.4.3, Eqs. (88)–(89), pp. 51–52

Proof of Knowledge

The paper says

Rewinding gives $(\mathbf{w}, c, \mathbf{z})$ and $(\mathbf{w}, c', \mathbf{z}')$ with $\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t}) = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z}' - c'\mathbf{t})$. Write each side as HIGH + LOW, with the LOW parts in $[q/2^{\kappa+1}]^n \approx [\delta_\mathcal{S}]^n$, and subtract:

$$\mathbf{A}(\mathbf{z} - \mathbf{z}') - (c - c')\mathbf{t} = \mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t}) - \mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{z}' - c'\mathbf{t}) \in [q/2^\kappa]^n \approx [2\delta_\mathcal{S}]^n. \qquad (90)$$

This is (74), with $\bar{\mathbf{s}}_2$ set to the difference of the two LOW parts. §5.4.4, Eq. (90), p. 52

RecapFigure 8 sends only $\mathbf{z}$ (and $\mathbf{w}$, later replaced by a hash), and extracts $\bar{\mathbf{s}}_2 \in [2\delta_\mathcal{S}]$ instead of $[2\bar\beta]$. Next: shrink the public key.

Reducing the Public Key Size

The paper says

Write $\mathbf{t} = \mathrm{HIGH}_\mathcal{T}(\mathbf{t}) + \mathrm{LOW}_\mathcal{T}(\mathbf{t})$ for a set $\mathcal T \subset \mathbb{Z}_q$ of $2^\ell$ elements about $q/2^\ell$ apart. Since $\mathbf{A}\mathbf{z}_1 \approx c\mathbf{t} \approx c\cdot\mathrm{HIGH}_\mathcal{T}(\mathbf{t})$, the verifier does not need the low bits of $\mathbf{t}$ to verify approximately. So publish only $\mathbf{t}_1 = \mathrm{HIGH}_\mathcal{T}(\mathbf{t})$, which takes $nd\ell$ bits instead of $nd\log q$; here $\mathbf{t} = \mathbf{t}_1 + \mathbf{t}_0$. The techniques are from [DKL+18]. The verifier can only compute $\mathbf{A}\mathbf{z} - c\mathbf{t}_1 = \mathbf{A}\mathbf{z} - c\mathbf{t} + c\mathbf{t}_0$, and would need

$$\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t}) = \mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{z} - c\mathbf{t} + c\mathbf{t}_0). \qquad (91)$$

Forcing $c\mathbf{t}_0$ to be tiny and reusing (85) would be wasteful. We bounded $c\mathbf{s}_2$ by $\gamma$ only because $\mathbf{s}_2$ must stay secret, whereas $\mathbf{t}_0$ need not be secret, only unnecessary for verification. The key observation: if $c\mathbf{t}_0 \in [\delta_\mathcal{S}]^n$, the verifier needs just one extra bit per coefficient. If $v$ lies between $s_i$ and $s_{i+1}$ and $v' \in [\delta_\mathcal{S}]$, the closest point to $v + v'$ can only be $s_i$ or $s_{i+1}$, and the prover tells the verifier which. $\mathrm{HINT}(\mathbf{A}\mathbf{z} - c\mathbf{t}_1, c\mathbf{t}_0) = \mathbf{h} \in \{0,1\}^{dn}$. $\mathrm{USEHINT}(\mathbf{v}, \mathbf{h})$ outputs, for each coefficient of $\mathbf{v}$, the closer neighbouring point if the hint bit is 0 and the farther one if it is 1. For every $\mathbf{v}$ and $\mathbf{h}$,

$$\mathbf{v} - \mathrm{USEHINT}(\mathbf{v}, \mathbf{h}) \in [q/2^\kappa]^n \approx [2\delta_\mathcal{S}]^n. \qquad (92)$$

Usually the hint bit is 0, so $\mathbf{h}$ can be represented by the positions where it is 1. Figure 9 is Figure 8 plus: restart if $c\mathbf{t}_0 \notin [\delta_\mathcal{S}]^n$; send $(\mathbf{z}, \mathbf{h})$; the verifier accepts iff $\mathbf{z} \in [\bar\beta]^m$ and $\mathrm{USEHINT}(\mathbf{A}\mathbf{z} - c\mathbf{t}_1, \mathbf{h}) = \mathbf{w}$. It proves knowledge of $\bar{\mathbf{s}}_1 \in [2\bar\beta]^m$, $\bar{\mathbf{s}}_2 \in [q/2^{\kappa-1}]^n$, $\bar c \in \bar{\mathcal C}$ with

$$\mathbf{A}\bar{\mathbf{s}}_1 + \bar{\mathbf{s}}_2 = \bar c\,\mathbf{t}_1. \qquad (93)$$

Substituting $\mathbf{t}_1 = \mathbf{t} - \mathbf{t}_0$ gives $\mathbf{A}\bar{\mathbf{s}}_1 + (\bar{\mathbf{s}}_2 + \bar c\mathbf{t}_0) = \bar c\mathbf{t}$, i.e. (74) with $\bar{\mathbf{s}}_2$ grown by the largest $\bar c\mathbf{t}_0$. §5.5, Figure 9, Eqs. (91)–(93), pp. 52–54

Spelled out

Let $v = \mathbf{A}\mathbf{z} - c\mathbf{t}_1$ (a coefficient the verifier can compute) and $v' = -c\mathbf{t}_0 \in [\delta_\mathcal{S}]$. Then $v + v' = \mathbf{A}\mathbf{z} - c\mathbf{t}$, whose HIGH part the verifier needs. The demo below enumerates every $(v, v')$ at toy size.

Try it

One hint bit recovers the high part

This uses the same toy $\mathcal S = \{0, 24, 49, 73\} \subset \mathbb{Z}_{97}$. The verifier knows $v$; the prover also knows the offset $v' \in [\delta_\mathcal{S}]$. The true high part of $v + v'$ is one of the two points around $v$, and the hint says which. Illustration numbers.

RecapPublish only $\mathbf{t}_1$; pay with $dn$ hint bits, mostly zeros. Is $\mathbf{t}_0$ secret now?

Correctness and Zero-Knowledge

The paper says

Although the verifier does not need $\mathbf{t}_0$, it should not be considered secret, because the hint $\mathbf{h}$ leaks information about it. Think of it as: the verifier knows all of $\mathbf{t}$ but only uses $\mathbf{t}_1$. ZK follows from Figure 8 (§5.4.2), since the only new output $\mathbf{h}$ can be computed from $\mathbf{z}$ and $\mathbf{t}$. Correctness holds whenever $c\mathbf{t}_0 \in [\delta_\mathcal{S}]^n$. If this sometimes fails, security is unaffected; the prover just restarts more often. Footnote 31: a 1-bit hint in fact works when $c\mathbf{t}_0 \in [2\delta_\mathcal{S} - 1]$. This was observed independently by Jonathan Katz and in [BDL24]; it compresses the public key further at a small cost in signature size, and it came after ML-DSA was standardized. §5.5.1, footnote 31, p. 54

Proof of Knowledge

The paper says

Rewinding gives $\mathrm{USEHINT}(\mathbf{A}\mathbf{z} - c\mathbf{t}_1, \mathbf{h}) = \mathrm{USEHINT}(\mathbf{A}\mathbf{z}' - c'\mathbf{t}_1, \mathbf{h}')$ (Eq. (94)). By (92), each argument is within $[q/2^\kappa]^n$ of this common value, so

$$\mathbf{A}(\mathbf{z} - \mathbf{z}') - (c - c')\mathbf{t}_1 \in [q/2^{\kappa-1}]^n \approx [4\delta_\mathcal{S}]^n, \qquad (95)$$

which is knowledge of $\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2, \bar c$ as in (93). §5.5.2, Eqs. (94)–(95), pp. 54–55

Digital Signatures

The paper says

Figure 10 — the Fiat–Shamir signature scheme (signing a message digest $\mu$)

Sign: (1) $\mathbf{y} \leftarrow [\gamma + \bar\beta]^m$; (2) $c := \mathcal{H}(\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{y}), \mu, \mathbf{A}, \mathbf{t}) \in \mathcal C$; (3) $\mathbf{z} := c\mathbf{s}_1 + \mathbf{y}$; (4) if $\mathbf{z} \notin [\bar\beta]^m$ or $\mathrm{LOW}_\mathcal{S}(\mathbf{A}\mathbf{y} - c\mathbf{s}_2) \notin [\delta_\mathcal{S} - \gamma]^n$, RESTART; (5) if $c\mathbf{t}_0 \notin [\delta_\mathcal{S}]^n$, RESTART; (6) $\mathbf{h} := \mathrm{HINT}(\mathbf{A}\mathbf{z} - c\mathbf{t}_1, c\mathbf{t}_0)$; output $(\mathbf{z}, \mathbf{h})$.

Verify: accept iff $\mathbf{z} \in [\bar\beta]^m$ and $\mathcal{H}(\mathrm{USEHINT}(\mathbf{A}\mathbf{z} - c\mathbf{t}_1, \mathbf{h}), \mu, \mathbf{A}, \mathbf{t}) = c$.

As good practice, the public key is an input to $\mathcal H$. This prevents some malleability attacks, where a signature for one public key allows one to create a signature for a closely related public key.

This is the Fiat–Shamir transform of Figure 9, with secrets chosen uniformly from their domains. Because the protocol is no longer interactive, the signer never sends $\perp$: it keeps restarting until rejection sampling succeeds. That is why ZK was only needed for non-aborting transcripts. Correctness and simulatability follow from Figure 9 and the random-oracle heuristic, and the generic properties of Fiat–Shamir extract from a successful forger the same $\bar{\mathbf{s}}_1, \bar{\mathbf{s}}_2, \bar c$ as in (93). By Lemma 9, that is as hard as Ring-LWE or Ring-SIS. §5.6, Figure 10, p. 55

Note on the paper's text

Figure 10 lists $(\mathbf{z}, \mathbf{h})$ as the output, but verification uses $c$, so the signature also contains $c$. The §5.7 size count agrees: “the signature consists of the vector $\mathbf{z}_1$, the challenge $c$, and the hint vector $\mathbf{h}$”. Both parties also hash “$\mathbf{A}, \mathbf{t}$”, although the verifier only has $\mathbf{t}_1$; read this input as “the public key”.

Spelled out
stepSchnorr signatureFigure 10
mask$y \leftarrow \mathbb{Z}_p$$\mathbf{y} \leftarrow [\gamma+\bar\beta]^m$
challenge$c = \mathcal H(g^y, \mu)$$c = \mathcal H(\mathrm{HIGH}(\mathbf{A}\mathbf{y}), \mu, pk)$
response$z = y + xc$$\mathbf{z} = \mathbf{y} + c\mathbf{s}_1$, restart unless both checks pass
signature$(c, z)$$(c, \mathbf{z}, \mathbf{h})$
verify$c = \mathcal H(g^z h^{-c}, \mu)$$c = \mathcal H(\mathrm{USEHINT}(\mathbf{A}\mathbf{z} - c\mathbf{t}_1, \mathbf{h}), \mu, pk)$

The three lattice-only additions: rejection keeps $\mathbf{z}$ independent of $\mathbf{s}_1$; taking high bits means $\mathbf{s}_2$ never needs to be sent; the hint means the low bits of $\mathbf{t}$ need not be published.

RecapFigure 10 is Schnorr's shape with three lattice-specific additions. Now concrete numbers.

The Signature Scheme CRYSTALS-Dilithium (ML-DSA)

The paper says

A sample instantiation very much resembling [DKL+18], (conservatively) with 192 bits of security (NIST Level 3), over $\mathcal{R}_{q,f}$ with $f = X^{256}+1$ and $q = 2^{23} - 2^{13} + 1$. Since $q \equiv 1 \pmod{512}$, this $q$ allows efficient NTT (§4.6).

Table 4 — parameters
$q$$2^{23} - 2^{13} + 1$
$f(X)$$X^{256}+1$
$\beta$$4$
$(n, m)$$(6, 5)$
$\mathcal C$$c \in [1]$ with $49$ coefficients $\pm1$ and $207$ zeros
$\gamma$$49 \cdot 4 = 196$
$\bar\beta$ (printed as $\beta$)$2^{19} - \gamma - 1$
$\mathcal S$$\{i\cdot(q-1)/16 \mid 0 \le i \le 15\}$
$\delta_\mathcal{S}$$(q-1)/32 - 1$
$\mathcal T$$\{i\cdot 2^{13} \mid 0 \le i \le (q-1)/2^{13}\}$

Every point of $\mathbb{Z}_q$ is at most $(q-1)/32 + 1$ from $\mathcal S$. The coefficients of $\mathbf{t}_0$ lie in $[2^{12}]$, and $c\mathbf{t}_0 \in [\delta_\mathcal{S}]^6$ with high probability. Footnote 32: in fact always, since $\|\mathbf{t}_0\|_\infty \le 2^{12}$ and $\|c\|_1 = 49$ give $\|c\mathbf{t}_0\|_\infty \le 49\cdot 2^{12} < \delta_\mathcal{S}$. From (89), a signing attempt succeeds with probability about $e^{-196\cdot256\cdot(5/2^{19} + 6\cdot32/(q-1))} \approx 0.2$, so about 5 attempts are needed. Signing is noticeably slower than verification, but optimized implementations still run in well under a millisecond on a standard PC. The public key is a 256-bit seed $\rho$ plus $\mathbf{t}_1$ at 10 bits per coefficient, i.e. $6\cdot256\cdot10$ bits: 1952 bytes. The signature is $\mathbf{z}_1$ at 20 bits per coefficient ($256\cdot5\cdot20$ bits), $c$ (about 256 bits) and $\mathbf{h}$ (at most $256\cdot6$ bits): around 3424 bytes. §5.7, Table 4, footnote 32, p. 56

Note on the paper's text

Table 4 labels the row $2^{19} - \gamma - 1$ as $\beta$; the value is $\bar\beta$. The text says “the set $\mathcal S$ can be described with 10 bits”; it means $\mathcal T$, which has $1024$ elements ($\mathcal S$ has 16). It also says the coefficients of $\mathbf{z}_1$ are in $[\beta]$; they are in $[\bar\beta]$, which is why 20 bits are needed.

Try it

Dilithium calculator (Table 4 preset)

Every value below is computed live from Table 4 and the formulas of §5.4.3 and §5.7. Change $(n, m)$ or the number of non-zeros in $c$ to see the trade-offs.

Some optimizations in ML-DSA

The paper says
  • Hash the message once. If $\mu'$ is long, recomputing $\mathcal H(\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{y}), \mu, \mathbf{A}, \mathbf{t})$ after every restart is wasteful. First hash $\mu'$ with SHA-512, together with the public key, into a 512-bit digest $\mu$.
  • Power-of-two masking range. $[\gamma + \bar\beta] = [2^{19} - 1]$ has $2^{20} - 1$ values; sampling instead from $\{-(2^{19}-1), \ldots, 2^{19}-1, 2^{19}\}$ uses exactly 20 random bits.
  • Compact hint. With high probability $\mathbf{h}$ has at most 55 ones. Send their positions (8 bits each, $8\cdot55$ bits) plus the boundaries between the 6 polynomials ($5\cdot6 = 30$ bits): 470 bits instead of 1536. The signature drops to about 3290 bytes. The signer restarts if there are more than 55 ones, which is experimentally very rare.

§5.7, p. 57

Note on the paper's text

The paper says to specify “the positions of the 0's” and a “naive $256\cdot8 = 1536$”-bit string. The positions sent are those of the non-zero hint bits, and $1536 = 256\cdot6$.

Security

The paper says

By §5.5, Lemma 9 and (93), security relies on $\mathcal{R}_{q,f}$-$\mathrm{LWE}_{n,m,\beta}$ (the public key $(\mathbf{A}, \mathbf{t})$ looks uniform) and $\mathcal{R}_{q,f}$-$\mathrm{SIS}_{n,m+1,2\bar\beta}$ (a forger would solve (93) with $\bar{\mathbf{s}}_1 \in [2\bar\beta]$, $\bar{\mathbf{s}}_2 \in [4\delta_\mathcal{S}]$ by (95), both approximately $[2^{20}]$). This corresponds to the middle row of Table 2, where the required $\delta$ is roughly the same for both problems. §5.7, p. 57

Spelled out

Table 2's middle row has LWE with $m = 1280 = 256\cdot5$ ($=dm$), $\beta = 4$, $\delta = 1.003$, and SIS with $n = 1536 = 256\cdot6$ ($=dn$), $\beta = 2^{20}$, $\delta = 1.0032$. The two problems are balanced, which is the optimum §5.2.4 described.

What to remember from §5

  1. Same road map as Schnorr: a Σ-protocol (mask, commit, challenge, respond $\mathbf{z} = \mathbf{y} + c\mathbf{s}$) plus Fiat–Shamir.
  2. Prove a relaxed statement $\mathbf{A}\bar{\mathbf{s}}_1 + \bar{\mathbf{s}}_2 = \bar c\,\mathbf{t}$; by Lemma 9, producing one still means solving Ring-LWE or Ring-SIS.
  3. Rejection sampling (Lemma 10) makes accepted responses uniform on $[\bar\beta]$ whatever the secret, with a secret-independent acceptance probability $\approx e^{-\gamma d(m+n)/\bar\beta}$.
  4. High bits and hints remove $\mathbf{z}_2$ from the signature (§5.4) and the low bits of $\mathbf{t}$ from the public key (§5.5). Check (87) keeps the scheme simulatable.
  5. Dilithium (ML-DSA): $q = 2^{23} - 2^{13} + 1$, $(n, m) = (6, 5)$ over $X^{256}+1$; about 5 signing attempts; a 1952-byte public key; about 3290-byte signatures; security balanced between Ring-LWE and Ring-SIS.

Appendix

Glossary (with the section where each term is first defined)
TermMeaningFirst defined
LWE$_{n,m,q,\beta}$distinguish $(\mathbf{A},\mathbf{A}\mathbf{s}+\mathbf{e})$ with small $\mathbf{s},\mathbf{e}$ from uniform§2.3, Def. 1
LWE$_{n,m,q,\psi}$the same with secrets/errors drawn from a distribution $\psi$§2.3, Def. 2
HIGH / LOWnearest point of a set $\mathcal{S}\subset\mathbb{Z}_q$, and the remainder§2.5.1
modulus switching$\lceil x\rfloor_{q\to p}=\lceil xp/q\rfloor$§2.5.2, Def. 3
LWRLearning with Rounding: $(\mathbf{A},\mathrm{HIGH}_\mathcal{S}(\mathbf{A}\mathbf{s}))$ vs uniform§2.5.3
NIKEnon-interactive key exchange§2.6
lattice, $\mathcal{L}_q^\perp(\mathbf{A})$$\{\mathbf{v}:\mathbf{A}\mathbf{v}\equiv\mathbf{0}\bmod q\}$ (parity-check form)§3.1
determinant, cosets$\det(\Lambda)$; the quotient group $\mathbb{Z}^m/\Lambda$§3.1.1
$\Delta_p(\mathbf{r},\Lambda)$, $\Delta^C_p$$\ell_p$ distance to the lattice; of a coset§3.1.2, Eq. (33)
SIS$_{n,m,q,\beta}$find short $\mathbf{s}_1,\mathbf{s}_2$ with $\mathbf{A}\mathbf{s}_1+\mathbf{s}_2=\mathbf{0}$§3.2, Def. 4
$\delta$quality parameter of lattice reduction (Eq. (34))§3.2
$\mathcal{R}_{q,f}$-LWE / -SISthe same problems over a polynomial ring (Ring / Module-LWE)§4.2, Defs. 5–6
NTRU problemfind $e$ from $(a, as+e)$ with $a=pg_1g_2^{-1}$§4.4.1, Def. 7
NTTNumber Theoretic Transform: FFT over $\mathbb{Z}_q$§4.6
$\psi_\eta$centred binomial distribution§4.7, Def. 8
KEM, CCA-KEM, FOkey encapsulation; the Fujisaki–Okamoto transform§4.8
challenge space $\mathcal{C}$polynomials with exactly $\eta$ coefficients $\pm1$§5.1.1, Eq. (75)
$\Sigma$-protocol, rejection samplingcommit–challenge–respond proof; abort unless the response is in range§5.2
HVZKhonest-verifier zero-knowledge§5.2.1
HINT / USEHINTone bit per coefficient letting the verifier recover $\mathrm{HIGH}_\mathcal{S}$§5.5
Fiat–Shamirchallenge := hash of the first message and the message§5.6
The paper's parameter tables (quick reference)

Values exactly as printed in the paper; the δ values are what an attacker would need (smaller is harder to reach). Tables 1–2 are parameters that resemble Kyber and Dilithium.

Table 1 (§3.4) — LWE, Kyber-like

$m$$\beta$$q$$\delta$
5122$2^{12}$1.0043
7682$2^{12}$1.0029
10242$2^{12}$1.0022

Table 2 (§3.4) — LWE and SIS, Dilithium-like

LWE $m$$\beta$$q$$\delta$SIS $n$$\beta$$q$$\delta$
10242$2^{23}$1.0041024$2^{18}$$2^{23}$1.0041
12804$2^{23}$1.0031536$2^{20}$$2^{23}$1.0032
17922$2^{23}$1.00232048$2^{20}$$2^{23}$1.0025

Table 3 (§4.7) — Kyber

$k$$\eta_1$$\eta_2$$d_u$$d_v$dec. errorpkct
Kyber-512232104$2^{-139}$800 B768 B
Kyber-768322104$2^{-164}$1184 B1088 B
Kyber-1024422115$2^{-174}$1568 B1568 B

Table 4 (§5.7) — Dilithium-like (NIST Level 3)

$q$$2^{23}-2^{13}+1$
$f(X)$$X^{256}+1$
$\beta$4
$(n,m)$$(6,5)$
$\mathcal{C}$$c\in[1]$ with 49 coefficients $\pm1$ and 207 zeros
$\gamma$$49\cdot4=196$
$\bar\beta$ (printed as $\beta$)$2^{19}-\gamma-1$
$\mathcal{S}$$\{i\cdot(q-1)/16 \mid 0\le i\le15\}$
$\delta_\mathcal{S}$$(q-1)/32-1$
$\mathcal{T}$$\{i\cdot2^{13}\mid 0\le i\le(q-1)/2^{13}\}$
References, BibTeX, and code

Citation keys on this page (e.g. [Reg09], [LPR10], [DKL+18]) are the paper's own; the full entries are in the paper's bibliography (pp. 58–65).

BibTeX (built from the paper's own title page):

@misc{lyubashevsky2024basic,
  author = {Vadim Lyubashevsky},
  title  = {Basic Lattice Cryptography: The concepts behind
            Kyber (ML-KEM) and Dilithium (ML-DSA)},
  year   = {2024},
  note   = {IBM Research Europe, Zurich. Last updated June 18, 2025}
}

Code. The paper comes with no code. Every toy computation on this page runs in your browser, in the page's own JavaScript. The larger checks (for example, reproducing Table 3's decryption errors) were also verified independently in Python.