Ring-SIS, Ideal lattices, and Ring-LWE

Following the MIT notes here (opens new window).

Some notation first: x\lceil x \rceil means rounding up, x\lfloor x \rfloor means rounding down, x\lfloor x \rceil means the nearest integer,

The problem with hAh_A over Z[x]/(xn1)\mathbb{Z}[x]/(x^n-1), as defined previously, was that the polynomial xn1x^n - 1 is not irreducible.

We might try using xn+1x^n + 1 instead.

The following holds: xn+1x^n + 1 is irreducible over Z\mathbb{Z} if and only if nn is a power of 22. For some intuition, if nn is divisible by an odd positive integer dd, then xn+1x^n + 1 is divisible by xnd+1x^{\frac{n}{d}} + 1.

So, we take Z[x]/(xn+1)\mathbb{Z}[x]/(x^n+1), where nn is some power of 22.

In this case, we have

Rot(ai)=(ai,Xai,Xn1ai)(ai,1ai,n...ai,2ai,2ai,1...ai,3............ai,n1ai,n2...ai,nai,nai,n1...ai,1)Rot(a_i) = (a_i, Xa_i, X^{n-1}a_i) \begin{pmatrix} a_{i,1} & -a_{i, n} & ... & -a_{i,2} \\ a_{i,2} & a_{i, 1} & ... & -a_{i,3} \\ ... & ... & ... & ... \\ a_{i,n-1} & a_{i,n-2} & ... & -a_{i,n} \\ a_{i,n} & a_{i,n-1} & ... & a_{i,1} \end{pmatrix}

and

X=(00...0110...0001...00.........0000...10)X = \begin{pmatrix} 0 & 0 & ... & 0 & -1 \\ 1 & 0 & ... & 0 & 0 \\ 0 & 1 & ... & 0 & 0 \\ ... & ... & ... & 0 & 0 \\ 0 & 0 & ... & 1 & 0 \end{pmatrix}

Note that XX differs in just one entry from last time. Matrices of the form Rot(a)Rot(a), as above, are sometimes called anti-cyclic or negacyclic.

If we have polynomials a=a0+a1x+...+an1xn1a = a_0 + a_1 x + ... + a_{n-1} x^{n-1} and b=b0+b1x+...+bn1xn1b = b_0 + b_1 x + ... + b_{n-1} x^{n-1}, the multiplication aba b can be obtained by a matrix-vector product:

a(x)b(x)=Rot(a)[b0b1...bn1]Ta(x) b(x) = Rot(a) [b_0 b_1 ... b_{n-1}]^T

Let’s consider the multiplication of the following two polynomials:

a=a0+a1x+a2x2a = a_0 + a_1 x + a_2 x^2

b=b0+b1x+b2x2b = b_0 + b_1 x + b_2 x^2

In this case, we have n=3n = 3 (though in reality, we would need nn to be a power of 22), so x3=1.x^3 = -1.

For the sake of brevity (or perhaps out of laziness), let’s focus only on the constant coefficient.

Rot(a)b=(a0a2a1a1a0a2a2a1a0)(b0b1b2)Rot(a) b = \begin{pmatrix} a_0 & -a_2 & -a_1 \\ a_1 & a_0 & -a_2 \\ a_2 & a_1 & a_0 \end{pmatrix} \begin{pmatrix} b_0 \\ b_1 \\ b_2 \end{pmatrix}

=(a0b0a2b1a1b2......)= \begin{pmatrix} a_0 b_0 -a_2 b_1 -a_1 b_2 \\ ... \\ ... \end{pmatrix}

We will see below that we obtain the same result when multiplying a(x)a(x) and b(x)b(x). Again, I am ignoring the non-constant coefficients (represented by three dots).

a(x)b(x)=a0b0+a2b1x3+a1b2x3+...=a0b0a2b1a1b2+...a(x) b(x) = a_0 b_0 + a_2 b_1 x^3 + a_1 b_2 x^3 + ... = a_0 b_0 - a_2 b_1 - a_1 b_2 + ...

Now, let’s consider the SIS problem defined by the following matrix:

A=(a0a2a1b0b2b1a1a0a2b1b0b2a2a1a0b2b1b0c0c2c1d0d2d1c1c0c2d1d0d2c2c1c0d2d1d0)A = \begin{pmatrix} a_0 & -a_2 & -a_1 & b_0 & -b_2 & -b_1 \\ a_1 & a_0 & -a_2 & b_1 & b_0 & -b_2 \\ a_2 & a_1 & a_0 & b_2 & b_1 & b_0 \\ c_0 & -c_2 & -c_1 & d_0 & -d_2 & -d_1 \\ c_1 & c_0 & -c_2 & d_1 & d_0 & -d_2 \\ c_2 & c_1 & c_0 & d_2 & d_1 & d_0 \end{pmatrix}

The matrix AZq6×6A \in \mathbb{Z}^{6 \times 6}_q has some structure—the blocks are negacylic matrices. The strange thing is (at least to me) that the SIS problem is not easier due to this structure; it is still difficult to find a short vector ss such that:

As=0modqAs = 0 \; mod \; q

But we can think of AA as follows:

a(x)=a0+a1x+a2x2a(x) = a_0 + a_1 x + a_2 x^2

b(x)=b0+b1x+b2x2b(x) = b_0 + b_1 x + b_2 x^2

c(x)=c0+c1x+c2x2c(x) = c_0 + c_1 x + c_2 x^2

d(x)=d0+d1x+d2x2d(x) = d_0 + d_1 x + d_2 x^2

A=(Rot(a)Rot(b)Rot(c)Rot(d))A = \begin{pmatrix} Rot(a) & Rot(b) \\ Rot(c) & Rot(d) \end{pmatrix}

To store AA, we only need 44 polynomials—specifically, 3 elements from Zq\mathbb{Z}_q for each block (instead of 99 with an unstructured matrix).

But that’s not all; we can also apply a much faster algorithm for the multiplication.

(a0a2a1b0b2b1a1a0a2b1b0b2a2a1a0b2b1b0c0c2c1d0d2d1c1c0c2d1d0d2c2c1c0d2d1d0)(e0e1e2f0f1f2)\begin{pmatrix} a_0 & -a_2 & -a_1 & b_0 & -b_2 & -b_1 \\ a_1 & a_0 & -a_2 & b_1 & b_0 & -b_2 \\ a_2 & a_1 & a_0 & b_2 & b_1 & b_0 \\ c_0 & -c_2 & -c_1 & d_0 & -d_2 & -d_1 \\ c_1 & c_0 & -c_2 & d_1 & d_0 & -d_2 \\ c_2 & c_1 & c_0 & d_2 & d_1 & d_0 \end{pmatrix} \begin{pmatrix} e_0 \\ e_1 \\ e_2 \\ f_0 \\ f_1 \\ f_2 \end{pmatrix}

When we, for example, multiply Rot(a)e(x)Rot(a) e(x), where e(x)=e0+e1x+e2x2e(x) = e_0 + e_1 x + e_2 x^2, we are actually multiplying a(x)e(x)a(x) e(x), and we can use the NTT for this, which means O(nlog(n))O(nlog(n)) operations instead of O(n2).O(n^2).

Hash function

The hash function is again defined:

hA(e)=a1e1+...+alelmodqRh_A(e) = a_1 e_1 + ... + a_l e_l \; mod \; qR

where modqRmod \; qR means reducing the coefficients of the result of the polynomial multiplication modulo qq.

As in the previous case, finding a collision for this hash function is equivalent to solving Ring-SIS, now over this new ring, R=Z[x]/(xn+1)R = \mathbb{Z}[x]/(x^n + 1). It turns out, Ring-SIS is in fact hard over this ring, under a reasonable worst-case complexity assumption.

Ideal lattices

An ideal IRI \subset R is an additive subgroup of a ring RR that is closed under multiplication by any element of the ring.

We can view II as a lattice by embedding RR in Zn\mathbb{Z}^n via the trivial embedding that maps xix^i to the unit vector eie_i.

So, II can be viewed as a lattice in Zn\mathbb{Z}^n that is invariant under the linear transformation XX. This means IZnI \subset \mathbb{Z}^n is a lattice such that (y1,...,yn)TI(y_1, ..., y_n)^T \in I if and only if (yn,y1,...,yn1)TI(-y_n, y_1, ..., y_{n-1})^T \in I.

Let’s now take a look at successive minima:

Definition: Let LL be a lattice of rank nn. The successive minima of LL are λ1\lambda_1,...,λn\lambda_n such that, for 1in1 \leq i \leq n, λi\lambda_i is minimal such that there exist ii linearly independent vectors v1v_1,...,viLv_i \in L with vjλi||v_j|| \leq \lambda_i for 1ji1 \leq j \leq i.

The embedding of II into Zn\mathbb{Z}^n allows us to consider the geometry of an ideal II. We can define the l2l_2 norm. Non-zero lattice elements yIy \in I can be divided into groups of nn linearly independent vectors y,xy,x2y,...,xn1yy, xy, x^2 y, ..., x^{n-1}y, all with the same length, xiy=xjy||x^i y|| = ||x^j y||. Thus, it also holds: λ1(I)=λn(I)\lambda_1(I) = \lambda_n(I).

Definition: For a ring RR (with an associated norm ||\cdot||) and approximation factor γ1\gamma \geq 1, γ\gamma-IdealSVP over RR is the approximate search problem defined as follows. The input is (a basis for) an ideal lattice II over RR. The goal is to output a non-zero element yIy \in I with yγλ1(I)||y|| \leq \gamma \lambda_1(I)||.

Peikert and Rosen, and independently Lyubashevsky and Micciancio, proved the following result:

Theorem: For nn any power of 22, integer l1l \geq 1, and integer modulus q2n2lq \geq 2n^2 l, γ\gamma-Ideal SVP over R=Z[x]/(xn+1)R = \mathbb{Z}[x]/(x^n+1) can be efficiently reduced to Ring-SIS over RR, where γ=lpoly(n)\gamma = l \cdot poly(n).

Ring-LWE

We continue taking notes from an MIT lecture (opens new window).

Theorem: For integers l,q2l, q \geq 2, for nn power of 22, and an error distribution χ\chi over short elements in RR, the (average-case, search) Ring-LWE problem is defined as follows. The input is a1,..,anRqa_1,..,a_n \in R_q sampled independently and uniformly at random together with b1,...,bnRqb_1,...,b_n \in R_q, where bi:=ais+eimodqRb_i := a_i s + e_i \; mod \; qR for sRqs \in R_q, and eiχe_i \sim \chi. The goal is to output ss.

Let’s take a look at the example of public key encryption based on Ring-LWE.

The secret key is a short secret sχs \sim \chi (short usually means it’s from R{1,0,1})R_{\{-1, 0, 1\}}). The public key is (a^,y)(\hat{a}, y), where a^Rq\hat{a} \in R_q is chosen uniformly at random, and y:=a^s+emod;qRy := \hat{a} s + e \; mod ; qR, where eχe \sim \chi.

To encrypt mRqm \in R_q, compute

(a,b)=(a^r+xmodq,yr+x+q/2mmodq)(a, b) = (\hat{a} r + x \; mod \; q, yr + x' + \lfloor q/2 \rceil m \; mod \; q)

for r,x,xχr, x, x' \sim \chi.

To decrypt (a,b)(a, b), compute basmodqR=q/2m+er+xxsmodqb - a s \; mod \; qR = \lfloor q/2 \rceil m + er + x' - xs \; mod \; q. Round each coefficient to either q/2q/2 or 00, whichever is closest, and interpret 00 as 00 and q/2q/2 as 11.

Note that in LWE-encryption, only one bit is encrypted at a time.