Chapter 4Ring-LWE, Module-LWE, and the Number Theoretic Transform

Ring-LWE

August 25, 20265 min readbeginner

Plain Learning With Errors puts the secret in Z_q^n, an ordinary vector with no structure connecting its components.

Plain Learning With Errors puts the secret in Zqn\mathbb{Z}_q^n, an ordinary vector with no structure connecting its components. Ring-LWE puts it in RqR_q instead, so the secret is a polynomial and the components are its coefficients.

That sounds like a change of notation. It is a change of substance, and this note shows exactly what is bought.

01.The definition

Fix the ring Rq=Zq[X]/(Xn+1)R_q = \mathbb{Z}_q[X]/(X^n + 1) from Chapter 1, and an error distribution χ\chi producing polynomials with small coefficients.

A Ring-LWE sample for a secret s∈Rqs \in R_q is a pair

(a,  b=a⋅s+e)  ∈  Rq×Rq,(a,\; b = a \cdot s + e) \;\in\; R_q \times R_q,

where aa is drawn uniformly from RqR_q, the error ee is drawn from χ\chi, and a⋅sa \cdot s is multiplication in RqR_q.

Compare that with the plain LWE sample from Chapter 3. There, aa was a vector, ss was a vector, the product was an inner product, and the result bb was a single number in Zq\mathbb{Z}_q. Here everything is a polynomial and bb is a whole polynomial too.

That last difference is the whole point. A plain sample yields one equation. A ring sample yields nn of them.

One ring sample carries nn plain samples

Work it out on the running parameters q=17q = 17, n=4n = 4.

Let the secret be s(X)=1+2X+3X2+4X3s(X) = 1 + 2X + 3X^2 + 4X^3, so s=(s0,s1,s2,s3)=(1,2,3,4)s = (s_0, s_1, s_2, s_3) = (1,2,3,4). Draw the uniform element a(X)=5+6X+7X2+8X3a(X) = 5 + 6X + 7X^2 + 8X^3 and a small error e(X)=X−X2e(X) = X - X^2, so e=(0,1,−1,0)e = (0, 1, -1, 0).

Multiply aa by ss in R17R_{17}, reducing with X4=−1X^4 = -1 as in Chapter 1. Doing it symbolically, in the unknowns s0s_0 through s3s_3, the four coefficients of the product come out as

(as)0=5s0−8s1−7s2−6s3,(as)1=6s0+5s1−8s2−7s3,(as)2=7s0+6s1+5s2−8s3,(as)3=8s0+7s1+6s2+5s3.\begin{aligned} (as)_0 &= 5 s_0 - 8 s_1 - 7 s_2 - 6 s_3, \\ (as)_1 &= 6 s_0 + 5 s_1 - 8 s_2 - 7 s_3, \\ (as)_2 &= 7 s_0 + 6 s_1 + 5 s_2 - 8 s_3, \\ (as)_3 &= 8 s_0 + 7 s_1 + 6 s_2 + 5 s_3 . \end{aligned}

Substituting the actual secret (1,2,3,4)(1,2,3,4) and reducing modulo 1717 gives as=(12,15,2,9)as = (12, 15, 2, 9), and adding the error gives

b  =  (12,  16,  1,  9).b \;=\; (12,\; 16,\; 1,\; 9) .

Now read those four displayed lines as what they are. Each is a linear equation in the four unknown coefficients of the secret, and each has had a small error added. Four plain-LWE equations, produced from a single pair (a,b)(a, b) of ring elements.

That is the compression, stated precisely. To publish four plain-LWE equations you would have to write down four independent vectors a1,…,a4a_1, \ldots, a_4, sixteen numbers in total. To publish the same four equations here you write down one polynomial aa, which is four numbers.

03.Where the missing numbers went

The sixteen numbers did not vanish. They became implicit.

Collect the coefficients of those four equations into a matrix:

circ⁡−(a)  =  (5−8−7−665−8−7765−88765).\operatorname{circ}_-(a) \;=\; \begin{pmatrix} 5 & -8 & -7 & -6 \\ 6 & 5 & -8 & -7 \\ 7 & 6 & 5 & -8 \\ 8 & 7 & 6 & 5 \end{pmatrix} .

Look at how it is built. Read down the first column: 5,6,7,85, 6, 7, 8, which is aa itself. Each subsequent column is the previous one shifted down by one position, with the entry that falls off the bottom reappearing at the top with its sign flipped.

That sign flip is X4=−1X^4 = -1, showing up as a structural property of the matrix. A matrix built this way is called a negacyclic circulant.

So multiplying by aa in RqR_q is the same as multiplying by this n×nn \times n matrix. The matrix has n2n^2 entries and every one of them is determined by the nn coefficients of aa. Storing aa stores the matrix.

This is where the factor-of-nn key compression from Chapter 3 comes from, and now it is visible rather than asserted.

04.What it costs

Nothing is free, and the price here is an assumption.

In plain LWE the matrix AA is fully random, all n2n^2 entries independent. In Ring-LWE it is a negacyclic circulant, so n2−nn^2 - n of its entries are forced by the other nn. An attacker therefore knows a great deal about the matrix before seeing it, and can look for attacks that exploit that structure.

Ring-LWE is consequently a stronger assumption than plain LWE. Believing it means believing not only that lattice problems are hard, but that they remain hard on this restricted family of structured lattices.

That worry is not theoretical. Attacks exploiting ring structure have been found for some choices of the modulus polynomial, which is a large part of why Xn+1X^n + 1 with nn a power of two is the choice that survived the competition. It is the best-studied case and the one with the fewest exploitable features.

The next note describes the compromise the standards actually adopted, which keeps most of the compression while giving back some of the structure.

FeedbackBook mode
post-quantum-cryptographycryptographymathematics