Lattices and Cryptography
Prev: Elliptic Curves and Cryptography Next: Additional Topics in Cryptography
Exercises
Section 7.1. A Congruential Public Key Cryptosystem
7.1
Alice uses the congruential cryptosystem with and private key .
(a) What is Alice’s public key ?
(b) Alice receives the ciphertext from Bob. What is the plaintext?
(c) Bob sends Alice a second message by encrypting the plaintext using the random element . What is the ciphertext that Bob sends to Alice?
Section 7.2. Subset-Sum Problems and Knapsack Cryptosystems
7.2
Use the algorithm described in Proposition 7.5 to solve each of the following subset-sum problems. If the “solution” that you get is not correct, explain what went wrong.
(a) , .
(b) , .
(c) , .
(d) , .
7.3
Alice’s public key for a knapsack cryptosystem is
Eve intercepts the encrypted message . She also breaks into Alice’s computer and steals Alice’s secret multiplier and secret modulus . Use this information to find Alice’s superincreasing private sequence and then decrypt the message.
7.4
Proposition 7.3 gives an algorithm that solves an -dimensional knapsack problem in steps, but it requires storage. Devise an algorithm, similar to Pollard’s rho algorithm (Sect. 5.5), that takes steps, but requires only storage.
Section 7.3. A Brief Review of Vector Spaces
7.5
(a) Let
Each of the sets and is a basis for . Find the change of basis matrix that transforms into .
(b) Let and . Compute the lengths and and the dot product . Compute the angle between and .
7.6
Use the Gram-Schmidt algorithm (Theorem 7.13) to find an orthogonal basis from the given basis.
(a) , , .
(b) , , .
Section 7.4. Lattices: Basic Definitions and Properties
7.7
Let be the lattice generated by . Draw a picture of a fundamental domain for and find its volume.
7.8
Let be an additive subgroup with the property that there is a positive constant such that
Prove that is discrete, and hence is a lattice. In other words, show that in the definition of discrete subgroup, it suffices to check that (7.8) is true for the single vector .
7.9
Prove that a subset of is a lattice if and only if it is a discrete additive subgroup.
7.10
Let be an -by- matrix with entries , and for each pair of indices and , let denote the -by- matrix obtained by deleting the th row of and the th column of . Define a new matrix whose th entry is given by
The matrix is called the adjoint of .
(a) Prove that , where is the -by- identity matrix.
(b) Deduce that if , then
(c) Suppose that has integer entries. Prove that exists and has integer entries if and only if .
(d) For those who know ring theory from Sect. 2.10 or from some other source, suppose that has entries in a ring . Prove that exists and has entries in if and only if is a unit in .
7.11
Recall from Remark 7.16 that the general linear group is the group of -by- matrices with integer coefficients and determinant . Let and be matrices in .
(a) Prove that .
(b) Prove that .
(c) Prove that the -by- identity matrix is in .
(d) Prove that is a group.
(e) Is a commutative group?
7.12
Which of the following matrices are in ? Find the inverses of those matrices that are in .
7.13
Let be the lattice given by the basis
Which of the following sets of vectors are also bases for ? For those that are, express the new basis in terms of the basis , i.e., find the change of basis matrix.
(a) .
(b) .
7.14
Let be a lattice of dimension and let be a basis for . The Gram matrix of is the matrix
(a) Let be the matrix (7.11) described in Proposition 7.20, except that now is an -by- matrix, so it need not be square. Prove that
(b) Prove that
where is the volume of the parallelepiped spanned by any basis for .
(c) Let be the 3-dimensional lattice with basis
Compute the Gram matrix of this basis and use it to compute .
(d) Let be the Gram-Schmidt orthogonalized vectors associated to . Prove that
Section 7.5. The Shortest and Closest Vector Problems
7.15
Let be a lattice and let be a fundamental domain for . This exercise sketches a proof that
(a) Consider the translations of that are entirely contained within , and also those that have nontrivial intersection with . Prove the inclusion of sets
(b) Take volumes in (a) and prove the corresponding upper and lower bounds involving .
(c) Prove that the number of translates that intersect without being entirely contained within is comparatively small compared to the number of translates that are entirely contained within .
(d) Use (b) and (c) to prove (7.63).
7.16
A lattice of dimension has determinant . With no further information, approximately how large would you expect the shortest nonzero vector to be?
Section 7.6. Babai’s Algorithm and Solving CVP with a Good Basis
7.17
Let be the lattice given by the basis and , and let .
(a) Use Babai’s algorithm to find a vector that is close to . Compute the distance .
(b) What is the value of the Hadamard ratio ? Is the basis a good basis?
(c) Show that the vectors and are also a basis for by expressing them as linear combinations of and and checking that the change-of-basis matrix has integer coefficients and determinant .
(d) Use Babai’s algorithm with the basis to find a vector . Compute the distance and compare it to your answer from (a).
(e) Compute the Hadamard ratio using and . Is a good basis?
Section 7.8. The GGH Public Key Cryptosystem
7.18
Alice uses the GGH cryptosystem with private basis
and public basis
(a) Compute the determinant of Alice’s lattice and the Hadamard ratio of the private and public bases.
(b) Bob sends Alice the encrypted message . Use Alice’s private basis to decrypt the message and recover the plaintext. Also determine Bob’s random perturbation .
(c) Try to decrypt Bob’s message using Babai’s algorithm with the public basis . Is the output equal to the plaintext?
7.19
Alice uses the GGH cryptosystem with private basis
and public basis
(a) Compute the determinant of Alice’s lattice and the Hadamard ratio of the private and public bases.
(b) Bob sends Alice the encrypted message . Use Alice’s private basis to decrypt the message and recover the plaintext. Also determine Bob’s random perturbation .
(c) Try to decrypt Bob’s message using Babai’s algorithm with the public basis . Is the output equal to the plaintext?
7.20
Bob uses the GGH cryptosystem to send some messages to Alice.
(a) Suppose that Bob sends the same message twice, using different random elements and . Explain what sort of information Eve can deduce from the ciphertexts and .
(b) For example, suppose that and that random perturbations are chosen with coordinates in the set . This means that there are possibilities for . Suppose further that Eve intercepts two ciphertexts
having the same plaintext. With this information, how many possibilities are there for ?
(c) Suppose that Bob is lazy and uses the same perturbation to send two different messages. Explain what sort of information Eve can deduce from the ciphertexts and .
7.21
The previous exercise shows the danger of using GGH to send a single message twice using different values of .
(a) In order to guard against this danger, suppose that Bob generates by applying a publicly available hash function to , i.e., Bob’s encrypted message is
If Eve guesses that Bob’s message might be , explain why she can check whether her guess is correct.
(b) Explain why the following algorithm eliminates both the problem with repeated messages and the problem described in (a), while still allowing Alice to decrypt Bob’s message. Bob chooses a message and a random string . He then computes
(c) In (b), the advantage of constructing from is that none of the bits of the actual plaintext appear unaltered in . In practice, people replace with more complicated mixing functions having the following two properties: (1) is easily invertible. (2) If even one bit of either or changes, then the value of every bit of changes in an unpredictable manner. Try to construct a mixing function having these properties.
Section 7.9. Convolution Polynomial Rings
7.22
Compute by hand the polynomial convolution product using the given value of .
(a) , , .
(b) , , .
(c) , , .
(d) , , .
7.23
Compute the polynomial convolution product modulo using the given values of and .
(a) , , , .
(b) , , , .
(c) , , , .
(d) , , , .
7.24
Let , where is a prime.
(a) Prove that
(b) Suppose that . Prove that is not invertible in .
7.25
Let and and consider the two polynomials
One of these polynomials has an inverse in and the other does not. Compute the inverse that exists, and explain why the other does not exist.
7.26
For each of the following values of , , and , either find in or show that the inverse does not exist.
(a) , , and .
(b) , , and .
(c) , , and .
7.27
This exercise illustrates how to find inverses in
when is a prime power .
(a) Let be a polynomial, and suppose that we have already found a polynomial such that
for some . Prove that the polynomial
satisfies
(b) Suppose that we know an inverse of modulo . Using (a) repeatedly, how many convolution multiplications does it take to compute the inverse of modulo ?
(c) Use the method in (a) to compute the following inverses modulo , where to ease your task, we have given you the inverse modulo .
(i) , , , .
(ii) , , , .
(iii) , , , .
7.28
Let be a fixed vector.
(a) Suppose that is an -dimensional vector whose coefficients are chosen randomly from the set . Prove that the expected values of and are given by
(b) More generally, suppose that the coefficients of are chosen at random from the set of integers . Compute the expected values of and as in (a).
(c) Suppose now that the coefficients of are real numbers that are chosen uniformly and independently in the interval from to . Prove that
(d) For each of the scenarios described in (a), (b), and (c), prove that
Section 7.10. The NTRU Public Key Cryptosystem
7.29
Alice and Bob agree to communicate using NTRUEncrypt with . Alice’s private key is
Alice receives the ciphertext
from Bob. Decipher the message and find the plaintext.
7.30
Alice and Bob decide to communicate using NTRUEncrypt with parameters . Alice’s public key is
Bob sends Alice the plaintext message using the random element .
(a) What ciphertext does Bob send to Alice?
(b) Alice’s private key is and . Check your answer in (a) by using and to decrypt the message.
7.31
What is the message expansion of NTRUEncrypt in terms of , , and ?
7.32
The guidelines for choosing NTRUEncrypt public parameters require that . Prove that if , then it is very easy for Eve to decrypt the message without knowing the private key. Hint: First do the case that .
7.33
The guidelines for choosing NTRUEncrypt public parameters include the assumption that . Suppose instead that Alice takes , where as always, is an odd prime.
(a) Make a change of variables in the ring , and show that the NTRU lattice takes a simpler form.
(b) Can you find an efficient way to break NTRU in the case that that does involve lattice reduction? This appears to be an open problem.
7.34
Alice uses NTRUEncrypt with to send messages to Bob.
(a) Suppose that Alice uses the same random element to encrypt two different plaintexts and . Explain how Eve can use the two ciphertexts and to determine approximately of the coefficients of . See Exercise 7.38 for a way to exploit this information.
(b) For example, suppose that , so there are possibilities for . Suppose that Eve intercepts two ciphertexts
that were encrypted using the same random element . How many coefficients of can she determine exactly? How many possibilities are there for ?
(c) Formulate a similar attack if Alice uses two different random elements and to encrypt the same plaintext . Hint: Do it first assuming that has an inverse in . The problem is harder without this assumption.
7.35
This exercise describes a variant of NTRUEncrypt that eliminates a step in the decryption algorithm at the cost of requiring slightly larger parameters. Suppose that the NTRUEncrypt private key polynomials and are chosen to satisfy
and that NTRU encryption is changed to
(a) Prove that if is sufficiently large, then the following algorithm correctly decrypts the message:
- Compute and center-lift to an element of .
- Compute . The result is .
Note that this eliminates the necessity to multiply by .
(b) Suppose that we choose , and that we also assume that is ternary. Prove that decryption works provided . Hint: Mimic the proof of Proposition 7.48.
Section 7.11. NTRU as a Lattice Cryptosystem
7.36
This exercise explains how to formulate NTRU message recovery as a closest vector problem. Let be an NTRU public key and let
be a message encrypted using .
(a) Prove that the vector is in .
(b) Prove that the lattice vector in (a) is almost certainly the closest lattice vector to the known vector . Hence solving CVP reveals the plaintext . For simplicity, you may assume that and , as we did in Proposition 7.61.
(c) Show how one can reduce the lattice-to-target distance, without affecting the determinant, by using instead a modified NTRU lattice of the form
7.37
The guidelines for choosing NTRUEncrypt public parameters include the requirement that be prime. To see why, suppose that is even. Explain how Eve can recover the private key by solving a lattice problem in dimension , rather than in dimension . Hint: Use the natural map
7.38
Suppose that Bob and Alice are using NTRUEncrypt to exchange messages and that Eve intercepts a ciphertext for which she already knows part of the plaintext . More precisely, suppose that Eve knows of the coefficients of . Explain how to set up a CVP to find using a lattice of dimension .
Section 7.12. Lattice-Based Digital Signature Schemes
7.39
Samantha uses the GGH digital signature scheme with private and public bases
What is her signature on the document ?
7.40
Samantha uses the GGH digital signature scheme with public basis
She publishes the signature on the document . If the maximum allowed distance from the signature to the document is 60, verify that Samantha’s signature is valid.
7.41
Samantha uses the GGH digital signature scheme with public basis
Use LLL or some other lattice reduction algorithm to find a good basis for Samantha’s lattice, and then use the good basis to help Eve forge a signature on the document . What is the distance from your forged signature lattice vector to the target vector? You should be able to get a distance smaller than 100.
7.42
This exercise gives further details of the NTRUMLS signature scheme. We fix parameters and set
We choose private key polynomials and as follows. For we first choose a polynomial whose coefficients are randomly selected from the set and then let . For we choose a polynomial whose coefficients are randomly selected to lie between and . We further assume that both and are invertible modulo and that is invertible modulo , otherwise we discard them and choose new polynomials.
(a) If and are polynomials whose coefficients lie between and , prove that .
(b) Prove that the following algorithm outputs a pair of polynomials satisfying
0: Input polynomials s_p and t_p with coefficients between -p/2 and p/2.
1: Choose a random polynomial r with coefficients between -A and A.
2: Set s_0 = s_p + pr.
3: Set t_0 = h*s_0 mod q with ||t_0||_infty <= q/2.
4: Set a = g^{-1}*(t_p - t_0) mod p with ||a||_infty <= p/2.
5: Set s = s_0 + a*f and t = t_0 + a*g.(c) Prove that the output from the algorithm in (b) satisfies
(d) Make the simplifying assumption that the output produces polynomials whose coefficients are uniformly and independently distributed between and . Assume further that is not too large, say . Prove that the probability that the algorithm in (b) produces a valid signature is approximately .
Section 7.13. Lattice Reduction Algorithms
7.43
Let and be vectors, and set
Prove that and that is the projection of onto the orthogonal complement of .
7.44
Let and be nonzero vectors in .
(a) What value of minimizes the distance ?
(b) What is the minimum distance in (a)?
(c) If is chosen as in (a), show that is the projection of onto the orthogonal complement of .
(d) If the angle between and is , use your answer in (b) to show that the minimum distance is . Draw a picture illustrating this result.
7.45
Apply Gauss’s lattice reduction algorithm (Proposition 7.66) to solve SVP for the following two dimensional lattices having the indicated basis vectors. How many steps does the algorithm take?
(a) and .
(b) and .
(c) and .
7.46
Let be a vector space, let be a vector subspace of , and let be the orthogonal complement of in .
(a) Prove that is also a vector subspace of .
(b) Prove that every vector can be written as a sum for unique vectors and .
(c) Let and and let . Prove that
7.47
Let be a lattice with basis vectors and .
(a) Is in the lattice?
(b) Find an LLL reduced basis.
(c) Use the reduced basis to find the closest lattice vector to .
7.48
Use the LLL algorithm to reduce the lattice with basis
You should do this exercise by hand, writing out each step.
7.49
Let be the lattice generated by the rows of the matrix
Implement the LLL algorithm (Fig. 7.8) on a computer and use your program to answer the following questions.
(a) Compute and . What is the shortest basis vector?
(b) Apply LLL to . How many swaps are required? What is the value of ? What is the shortest basis vector in the LLL reduced basis? How does it compare with the Gaussian expected shortest length?
(c) Reverse the order of the rows of and apply LLL to the new matrix. How many swaps are required? What is the value of and what is the shortest basis vector?
(d) Apply LLL to the original matrix , but in the Lovasz condition, use instead of . How many swaps are required? What is the value of and what is the shortest basis vector?
7.50
A more efficient way to implement the LLL algorithm is described in Fig. 7.9, with Reduce and Swap subroutines given in Fig. 7.10.
(a) Prove that the algorithm described in Figs. 7.9 and 7.10 returns an LLL reduced basis.
(b) For any given and , let be the -dimensional lattice with basis described by the formulas
Implement the LLL algorithm and use it to LLL reduce for each of the following values of and :
(i) .
(ii) .
(iii) .
(iv) .
In each case, compare the Hadamard ratio of the original basis to the Hadamard ratio of the LLL reduced basis, and compare the length of the shortest vector found by LLL to the Gaussian expected shortest length.
LLL main routine and subroutines:
[1] Input a basis {v_1,...,v_n} for a lattice L.
[2] Set k = 2, kmax = 1, v_1^* = v_1, and B_1 = ||v_1^*||^2.
[3] If k <= kmax go to Step [9].
[4] Set kmax = k and v_k^* = v_k.
[5] Loop j = 1,...,k-1:
[6] Set mu_{k,j} = v_k dot v_j^*/B_j and v_k^* = v_k^* - mu_{k,j}v_j^*.
[7] End loop.
[8] Set B_k = ||v_k^*||^2.
[9] Execute RED(k,k-1).
[10] If B_k < (3/4 - mu_{k,k-1}^2)B_{k-1}, execute SWAP(k), set k=max(2,k-1), and go to [9].
[11] Else execute RED(k,l) for l=k-2,k-3,...,1, then set k=k+1.
[12] If k <= n go to [3].
[13] Return the LLL reduced basis.
RED(k,l):
If |mu_{k,l}| <= 1/2, return.
Set m = round(mu_{k,l}), v_k = v_k - m v_l, and mu_{k,l}=mu_{k,l}-m.
For i=1,...,l-1 set mu_{k,i}=mu_{k,i}-m mu_{l,i}.
SWAP(k):
Exchange v_{k-1} and v_k.
Update the Gram-Schmidt coefficients as in Fig. 7.10.7.51
Let and suppose that we replace the Lovasz condition with the condition
(a) Prove a version of Theorem 7.69 assuming the alternative Lovasz condition (7.64). What quantity, depending on , replaces the 2 that appears in the estimates (7.54)-(7.56)?
(b) Prove a version of Theorem 7.71 assuming the alternative Lovasz condition (7.64). In particular, how does the upper bound for the number of swap steps depend on ? What happens as ?
7.52
Let be an LLL reduced basis for a lattice .
(a) Prove that there are constants such that for all we have
(b) Prove that there is a constant such that for any target vector , Babai’s algorithm (Theorem 7.34) finds a lattice vector satisfying
Thus Babai’s algorithm applied with an LLL reduced basis solves apprCVP to within a factor of . This is Theorem 7.76.
(c) Find explicit values for the constants , , and in (a) and (b).
7.53
Babai’s Closest Plane Algorithm is an alternative rounding method that uses a given basis to solve apprCVP. Implement both of Babai’s algorithms (Theorem 7.34 and Fig. 7.11) and use them to solve apprCVP for each of the following lattices and target vectors. Which one gives the better result?
Closest plane algorithm:
Input a basis v_1,...,v_n of a lattice L and a target vector t.
Compute Gram-Schmidt orthogonalized vectors v_1^*,...,v_n^*.
Set w = t.
Loop i = n,n-1,...,1:
Set w = w - (w dot v_i^*/||v_i^*||^2)v_i.
End loop.
Return the lattice vector t - w.(a) is generated by the rows of the LLL reduced matrix
and the target vector is .
(b) is generated by the rows of the matrix
and the target vector is . Notice that the matrix is not LLL reduced.
(c) Apply LLL reduction to the basis in (b), and then use both of Babai’s methods to solve apprCVP. Do you get better solutions?
7.54
We proved that the LLL algorithm terminates and has polynomial running time under the assumption that ; see Theorem 7.71. Show that this assumption is not necessary by proving that LLL terminates in polynomial time for any lattice . You may assume that your computer can do exact computations in , although in practice one does need to worry about round-off errors. Hint: Use Hermite’s theorem to derive a lower bound, depending on the length of the shortest vector in , for the quantity that appears in the proof of Theorem 7.71.
Section 7.14. Applications of LLL to Cryptanalysis
7.55
You have been spying on George for some time and overhear him receiving a ciphertext that has been encrypted using the congruential cryptosystem described in Sect. 7.1. You also know that George’s public key is and the public modulus is . Use Gaussian lattice reduction to recover George’s private key and the message .
7.56
Let
and let . Use the LLL algorithm to solve the subset-sum problem for and , i.e., find a subset of the elements of whose sum is .
7.57
Alice and Bob communicate using the GGH cryptosystem. Alice’s public key is the lattice generated by the rows of the matrix
Bob sends her the encrypted message
Use LLL to find a reduced basis for Alice’s lattice, and then use Babai’s algorithm to decrypt Bob’s message.
7.58
Alice and Bob communicate using NTRUEncrypt with public parameters . Alice’s public key is
Apply the LLL algorithm to the associated NTRU lattice to find an NTRU private key for . Check your answer by verifying that . Use the private key to decrypt the ciphertext
7.59
(a) Suppose that is a 10 digit integer, and suppose that when is computed, the first 15 digits after the decimal place are 418400286617716. Find the number . Hint: Reformulate it as a lattice problem.
(b) More generally, suppose that you know the first digits after the decimal place of . Explain how to set up a lattice problem to find .
See Exercise 1.49 for a cryptosystem associated to this problem.