The Learning With Errors (LWE) problem is one of the most important hardness assumptions lattice-based constructions base their security on. In 2015, Albrecht, Player and Scott presented the software tool LWE-Estimator to estimate the hardness of concrete LWE instances, making the choice of parameters for lattice-based primitives easier and better comparable. To give lower bounds on the hardness, it is assumed that each algorithm has given the corresponding optimal number of samples. However, this is not the case for many cryptographic applications. In this work we first analyze the hardness of LWE instances given a restricted number of samples. For this, we describe LWE solvers from the literature and estimate their runtime considering a limited number of samples. Based on our theoretical results we extend the LWE-Estimator. Furthermore, we evaluate LWE instances proposed for cryptographic schemes and show the impact of restricting the number of available samples.
The Learning With Errors (LWE) problem is used in the construction of many cryptographic lattice-based primitives [20, 30, 31]. It became popular due to its flexibility for instantiating very different cryptographic solutions and its (presumed) hardness against quantum algorithms. Moreover, LWE can be instantiated such that it is provably as hard as worst-case lattice problems .
In general, an instance of LWE is characterized by parameters , , and . To solve an instance of LWE, an algorithm has to recover the secret vector , given access to m LWE samples , where the coefficients of and the are small and chosen according to probability distribution characterized by α (see Definition 2).
To ease the hardness estimation of concrete instances of LWE, the LWE-Estimator [3, 4] was introduced. In particular, the LWE-Estimator is a very useful software tool to choose and compare concrete parameters for lattice-based primitives. To this end, the LWE-Estimator summarizes and combines existing attacks to solve LWE from the literature. The effectiveness of LWE solvers often depend on the number of given LWE samples. To give conservative bounds on the hardness of LWE, the LWE-Estimator assumes that the optimal number of samples is given for each algorithm, i.e., the number of samples for which the algorithm runs in minimal time. However, in cryptographic applications the optimal number of samples is often not available. In such cases the hardness of used LWE instances estimated by the LWE-Estimator might be overly conservative. Hence, also the system parameters of cryptographic primitives based on those hardness assumptions are more conservative than necessary from the viewpoint of state-of-the-art cryptanalysis. A more precise hardness estimation is to take the restricted number of samples given by cryptographic applications into account.
In this work we close this gap. We extend the theoretical analysis and the LWE-Estimator such that the hardness of an LWE instance is computed when only a restricted number of samples is given. As in , our analysis is based on the following algorithms: exhaustive search, the Blum–Kalai–Wassermann (BKW) algorithm, the distinguishing attack, the decoding attack, and the standard embedding approach. In contrast to the existing LWE-Estimator we do not adapt the algorithm proposed by Arora and Ge  due to its high costs and consequential insignificant practical use. Additionally, we also analyze the dual embedding attack. This variant of the standard embedding approach is very suitable for instances with a small number of samples since the embedding lattice is of dimension instead of as in the standard embedding approach. Hence, it is very important for our case with restricted number of samples. As in , we also analyze and implement small secret variants of all considered LWE solvers, where the coefficients of the secret vector are chosen from a pre-defined set of small numbers, with a restricted number of samples given.
Moreover, we evaluate our implementation to show that the hardness of most of the considered algorithms are influenced significantly by limiting the number of available samples. Furthermore, we show how the impact of reducing the number of samples differs depending on the model the hardness is estimated in.
Our implementation is already integrated into the existing LWE-Estimator at https://bitbucket.org/malb/lwe-estimator (from commit-id eb45a74 on). In our implementation, we always use the existing estimations with optimal number of samples, if the given restricted number of samples exceeds the optimal number. If not enough samples are given, we calculate the computational costs using the estimations presented in this work.
Figure 1 shows the categorization by strategies used to solve LWE: One approach reduces LWE to finding a short vector in the dual lattice formed by the given samples, also known as Short Integer Solution (SIS) problem. Another strategy solves LWE by considering it as a Bounded Distance Decoding (BDD) problem. The direct strategy solves for the secret directly. In Figure 1, we dash-frame algorithms that make use of basis reduction methods. The algorithms considered in this work are written in bold.
In Section 2 we introduce notations and definitions required for the subsequent sections. In Section 3 we describe basis reduction and its runtime estimations. In Section 4 we give our analyses of the considered LWE solvers. In Section 5 we describe and evaluate our implementation. In Section 6 we explain how restricting the number of samples impacts the bit-hardness in different models. In Section 7 we summarize our work.
We follow the notation used by Albrecht, Player and Scott . Logarithms are base 2 if not indicated otherwise. We write to indicate the use of the natural logarithm. Column vectors are denoted by lowercase bold letters and matrices by uppercase bold letters. Let be a vector then we denote the i-th component of by . We write for the i-th vector of a list of vectors. Moreover, we denote the concatenation of two vectors and by and is the usual dot product. We denote the euclidean norm of a vector with .
With we denote the discrete Gaussian distribution over with mean zero and standard deviation . For a finite set S, we denote sampling the element s uniformly from S with . Let χ be a distribution over ; then we write if x is sampled according to χ. Moreover, we denote sampling each coordinate of a matrix with distribution χ by with .
For definitions of a lattice L, its rank, its bases, and its determinant we refer to . For a matrix , we define the lattices
The distance between a lattice L and a vector is defined as
Furthermore, the i-th successive minimum of the lattice L is defined as the smallest radius r such that there are i linearly independent vectors of norm at most r in the lattice. Let L be an m-dimensional lattice. Then the Gaussian heuristic is given as
and the Hermite factor of a basis is given as
where is the shortest non-zero vector in the basis. The Hermite factor describes the quality of a basis, which, for example, may be the output of a basis reduction algorithm. We call the root-Hermite factor and the log-root-Hermite factor.
At last we define the fundamental parallelepiped as follows. Let be a set of n vectors . The fundamental parallelepiped of is defined as
In the following we recall the definition of LWE.
Let n and be integers, and . We define by the LWE distribution which outputs , where and .
Let be integers and . Let the coefficients of be sampled according to . Given m samples from for , the learning with errors problem is to find . Given m samples for , the decisional learning with errors problem is to decide whether they are sampled by an oracle or whether they are sampled uniformly random in .
In Regev’s original definition of LWE, the attacker has access to arbitrary many LWE samples, which means that is seen as an oracle that outputs samples at will. If the maximum number of samples available is fixed, we can write them as a fixed set of samples
often written as matrix with . We call sample matrix.
In the original definition, is sampled uniformly at random in . At the loss of n samples, an LWE instance can be constructed where the secret is distributed as the error (see ).
Two characterizations of LWE are considered in this work: (1) the generic characterization by , where the coefficients of secret and error are chosen according to the distribution , and (2) LWE with small secret, i.e., the coefficients of the secret vector are chosen according to a distribution over a small set, e.g., ; the error is again chosen with distribution .
In the following, let be the set the coefficients of are sampled from for LWE instances with small secret. To solve LWE instances with small secret, some algorithms use modulus switching as explained next. Let be a sample of an -LWE instance. If the entries of are small enough, this sample can be transformed into a sample of an -LWE instance, with and
The transformed samples can be constructed such that with
and being the standard deviation of the elements of the secret vector [4, Lemma 2]. With the components of being uniformly distributed, the variance of the elements of the secret vector is determined by
The result is an LWE instance with errors having standard deviation and . For some algorithms, such as the decoding attack or embedding approaches (cf. Section 4.2, 4.3, and 4.4, respectively), modulus switching should be combined with exhaustive search guessing g components of the secret at first. Then, the algorithm runs in dimension . Therefore, all of these algorithms can be adapted to have at most the cost of exhaustive search and potentially have an optimal g somewhere in between zero and n.
The two main hardness assumptions leading to the basic strategies of solving LWE are the Short Integer Solutions (SIS) problem and the Bounded Distance Decoding (BDD) problem. We describe both of them in the following.
The Short Integer Solutions (SIS) problem is defined as follows: Given a matrix consisting of n vectors , find a vector such that with and .
Solving the SIS problem with appropriate parameters solves Decision-LWE. Given m samples written as , which either satisfy or is chosen uniformly at random in , the two cases can be distinguished by finding a short vector in the dual lattice . Then, either results in , if , or is uniformly random over . In the first case, follows a Gaussian distribution over , inherited from the distribution of , and is usually small. Therefore, as long as the Gaussian distribution can be distinguished from uniformly random, Decision-LWE can be solved as long as is short enough.
The BDD problem is defined as follows. Given a lattice L, a target vector , and with , find the lattice vector closest to .
An LWE instance can be seen as an instance of BDD. Let define the lattice . Then the point is contained in the lattice . Since follows the Gaussian distribution, over of all encountered errors are within three standard deviations of the mean. For LWE parameters typically used in cryptographic applications, this is significantly smaller than . Therefore, is the closest lattice point to with very high probability. Hence, finding eliminates . If is invertible the secret can be calculated.
Basis reduction is a very important building block of most of the algorithms to solve LWE considered in this paper. It is applied to a lattice L to find a basis of L such that the basis vectors are short and nearly orthogonal to each other. Essentially, two different approaches to reduce a lattice basis are important in practice: the Lenstra–Lenstra–Lovász (LLL) basis reduction algorithm [24, 29, 14] and the Blockwise Korkine–Zolotarev (BKZ) algorithm with its improvements, called BKZ 2.0 [19, 14]. The runtime estimations of basis reduction used to solve LWE is independent of the number of given LWE samples. Hence, we do not describe the mentioned basis reduction algorithms but only summarize the runtime estimations used in the LWE-Estimator . For a deeper contemplation, we refer to [25, 26, 32, 4].
Following the convention of Albrecht, Player and Scott , we assume that the first non-zero vector of the basis of the reduced lattice is the shortest vector in the basis.
Let L be a lattice with basis . Furthermore, let be the Gram–Schmidt basis with Gram–Schmidt coefficients
Let . Then the runtime of the LLL algorithm is determined by with for all i with . Additionally, an improved variant, called L2, exists, whose runtime is estimated to be , see . Furthermore, a runtime is estimated heuristically, see . The first vector of the output basis is guaranteed to satisfy with .
The BKZ algorithm employs an algorithm to solve several SVP instances of smaller dimension, which can be seen as an SVP oracle. The SVP oracle can be implemented by computing the Voronoi cells of the lattice, by sieving, or by enumeration. During BKZ several BKZ rounds are done. In each BKZ round an SVP oracle is called several times to receive a better basis after each round. The algorithm terminates when the quality of the basis remains unchanged after another BKZ round. The difference between BKZ and BKZ 2.0 are the usage of extreme pruning , early termination, limiting the enumeration radius to the Gaussian Heuristic, and local block pre-processing .
There exist several practical estimations of the runtime of BKZ in the literature. Some of these results are listed in the following. Our firstly mentioned estimation is based on Lindner and Peikert’s  estimation. Originally, Linder and Peikert’s estimates were extrapolated from experimental data computed on a machine that run at 2.3 GHz. Following , we give the corresponding estimates
in clock cycles, called LP model. This result should be used carefully, since applying this estimation implies the existence of a subexponential algorithm for solving LWE . The estimation – shown by Albrecht, Cid, Faugère, Fitzpatrick and Perret  –
called delta-squared model, is non-linear in and it is claimed that this is more suitable for current implementations. As before, the estimates of the delta-square model are given in clock cycles that were converted from Albrecht–Cid–Faugère–Fitzpatrick–Perret’s extrapolation of the runtime of experiments derived on a 2.3GHz machine. Additionally, in the LWE-Estimator a third approach is used. Given an n-dimensional lattice, the running time in clock cycles is estimated to be
where ρ is the number of BKZ rounds and is the time needed to find short enough vectors in lattices of dimension k. Even though, ρ is exponentially upper bounded by at best, in practice the results after rounds yield a basis with
where is the maximum of root-Hermite factors in dimensions , see . However, recent results like progressive BKZ (running BKZ several times consecutively with increasing block sizes) show that even smaller values for ρ can be achieved. Consequently, the more conservative choice is used in the LWE-Estimator. In the latest version of the LWE-Estimator the following runtime estimations to solve SVP of dimension k are used and compared:
The estimation are extrapolations of the runtime estimates presented by Chen and Nguyen . The estimations and are presented in  and , respectively. The latter is a quantumly enhanced sieving algorithm.
Under the Gaussian heuristic and geometric series assumption, the following correspondence between the block size k and can be given:
where is the volume of the unit ball in dimension k. As examples show, this estimation may also be applied when n is finite . As a function of k, the lattice rule of thumb approximates , sometimes simplified to . Albrecht, Player and Scott  show that the simplified lattice rule of thumb is a lower bound to the expected behavior on the interval of usual values for k. The simplified lattice rule of thumb is indeed closer to the expected behavior than the lattice rule of thumb, but it implies an subexponential algorithm for solving LWE. For later reference we write
In this section we describe the algorithms used to estimate the hardness of LWE and analyze them regarding their computational cost. If there exists a small secret variant of an algorithm, the corresponding section is divided into general and small secret variant.
Since the goal of this paper is to investigate how the number of samples m influences the hardness of LWE, we restrict our attention to attacks that are practical for restricted m. This excludes Arora and Ge’s algorithm and BKW, which require at least sub-exponential m. Furthermore, we do not include purely combinatorial attacks like exhaustive search or meet-in-the-middle, since there runtime is not influenced by m.
The distinguishing attack solves decisional LWE via the SIS strategy using basis reduction. For this, the dual lattice is considered. The dimension of the dual lattice is m, the rank is m, and (with high probability) . Basis reduction is applied to find a short vector in . The result is used as short vector in the SIS problem to distinguish the Gaussian from the uniform distribution. By doing so, the decisional LWE problem is solved. Since this attack is in a dual lattice, it is sometimes also called dual attack.
The success probability ϵ is the advantage of distinguishing from uniformly random and can be approximated by standard estimates :
In order to achieve a fixed success probability ϵ, a vector of length
is needed. Let
The logarithm of required to achieve a success probability of ϵ to distinguish from uniformly random is given as
where m is the given number of LWE samples. To estimate the runtime of the distinguishing attack, it is sufficient to determine , since the attack solely depends on basis reduction. Table 1 gives the runtime estimations of the distinguishing attack in the LP and the delta-squared model described in Section 3. Table 2 gives the block size k of BKZ derived in Section 3 following the second approach to estimate the runtime of the distinguishing attack.
|Relation||Block size k in , cf. equation (3.1)|
On the one hand, the runtime of BKZ decreases exponentially with the length of . On the other hand, using a longer vector reduces the success probability. To achieve an overall success probability close to 1, the algorithm has to be run multiple times. The number of repetitions is determined to be via the Chernoff bound . Let be the runtime of a single execution of the algorithm. Then, the best overall runtime is the minimum of over different choices of ϵ. This requires randomization of the attack to achieve independent runs. We assume that an attacker can achieve this without using additional samples, which is conservative from an cryptographic point of view.
The distinguishing attack for small secrets works similar to the general case, but it exploits the smallness of the secret by applying modulus switching at first. To solve a small secret LWE instance with the distinguishing attack, the strategy described in Section 2.3.1 can be applied: First, modulus switching is used and afterwards the algorithm is combined with exhaustive search.
Using the same reasoning as in the standard case, the required for an n, ,p-LWE instance is given by
where p can be estimated by equation (2.1). The rest of the algorithm remains the same as in the standard case. Table 3 gives the run times estimations of in the LP and the delta-squared model described in Section 3. Table 4 gives the block size k of BKZ derived in Section 3 following the second approach to estimate run times of the distinguishing attack with small secret. Combining this algorithm with exhaustive search as described in Section 2.3.1 may improve the runtime.
|Relation||Block size k in , cf. equation (3.1)|
The decoding approach solves LWE via the BDD strategy described in Section 2. The procedure considers the lattice defined by the sample matrix and consists of two steps: the reduction step and the decoding step. In the reduction step, basis reduction is employed on L. In the decoding phase the resulting basis is used to find a close lattice vector and thereby eliminate the error vector .
In the following let the target success probability be the overall success probability of the attack, chosen by the attacker (usually close to 1). In contrast, the success probability refers to the success probability of a single run of the algorithm. The target success probability is achieved by running the algorithm potentially multiple times with a certain success probability for each single run.
To solve BDD, and therefore LWE, the most basic algorithm is Babai’s Nearest Plane algorithm . Given a BDD instance from m samples, the solving algorithm consists of two steps. First, basis reduction on the lattice is used, which results in a new basis for L with root-Hermite factor . The decoding steps is a recursive algorithm that gets as input the partial basis (the complete basis in the first call) and a target vector ( in the first call). In every step, it searches for the coefficient such that is as close as possible to the subspace spanned by . The recursive call is then with the new sub-basis and as target vector.
The result of the algorithm is the lattice point such that . Therefore, the algorithm is able to recover correctly from if and only if lies in the fundamental parallelepiped . The success probability of the Nearest Plane algorithm is the probability of falling into :
Hence, an attacker can adjust his overall runtime according to the trade-off between the quality of the basis reduction and the success probability.
Lindner and Peikert  present a modification of the Nearest Plane algorithm named Nearest Planes. They introduce additional parameters to the decoding step, which describes how many nearest planes the algorithm takes into account on the i-th level of recursion.
The success probability of the Nearest Planes algorithm is the probability of falling into the parallelepiped , given as follows:
To choose values , Lindner and Peikert suggest to maximize while minimizing the overall runtime. As long as the values are powers of 2, this can be shown to be optimal . For a fixed success probability, the optimal values can be found iteratively. In each iteration, the value , for which is currently minimal, is usually increased by one. Then the success probability given by equation (4.1) is calculated again. If the result is at least as large as the chosen success probability, the iteration stops . An attacker can choose the parameters and , which determine the success probability ϵ of the algorithm. Presumably, an attacker tries to minimize the overall runtime
where is the runtime of the basis reduction with chosen target quality , is the runtime of the decoding step with chosen , and ϵ is the success probability achieved by and . To estimate the overall runtime, it is reasonable to assume that the time of the basis reduction and the decoding step are balanced. To give a more precise estimation, one bit has to be subtracted from the number of operations, since the estimation is up to a factor of 2 worse than the optimal runtime.
The runtime of the basis reduction is determined by as described in Section 3. The values cannot be expressed by a formula and therefore, there is also no closed formula for . As a consequence, the runtime of the basis reduction step cannot be explicitly given here. They are found by iteratively varying values for until the running times of the two steps are balanced as described above.
The runtime of the decoding step for Lindner and Peikert’s Nearest Planes algorithm is determined by the number of points that have to be exhausted and the time it takes to process one point:
Since no closed formula is known to calculate the values , they are computed by step-wise increasing like described above until the success probability calculated by equation (4.1) reaches the fixed success probability. In the LWE-Estimator clock cycles is used. Hence, both the runtime and depend on and the fixed success probability.
Since this contemplation only considers a fixed success probability, the best trade-off between success probability and the running time of a single execution described above must be found by repeating the process above with varying values of the fixed success probability.
The decoding approach for small secrets works the same as in the general case, but it exploits the smallness of the secret by applying modulus switching at first and combining this algorithm with exhaustive search afterwards as described in Section 2.3.1.
The standard embedding attack solves LWE via reduction to uSVP. The reduction is done by creating an -dimensional lattice that contains the error vector . Since is very short for typical instantiations of LWE, this results in a uSVP instance. The typical way to solve uSVP is to apply basis reduction.
be the q-ary lattice defined by the matrix as defined in Section 2.2. Moreover, let and , where such that is minimized. Then the lattice can be embedded in the lattice , with
If , the higher-dimensional lattice has a unique shortest vector with length
To determine the success probability and the runtime, we distinguish between two cases: and . The case is mainly of theoretical interest. Practical attacks and the LWE-Estimator use instead, so we focus on this case in the following.
where m is the number of LWE samples. The value τ is experimentally determined to be for a success probability of .
In Table 5, we put all together and state the runtime for the cases from Section 3 of the standard embedding attack in the LP and the delta-squared model. Table 6 gives the block size k of BKZ derived in Section 3 following the second approach to estimate run times of the standard embedding attack.
|Relation||Block size k in , cf. equation (3.1)|
As discussed above, the success probability ϵ of a single run depends on τ and thus does not necessarily yield the desired target success probability . If the success probability is lower than the target success probability, the algorithm has to be repeated ρ times to achieve
Consequently, it has to be considered that ρ executions of this algorithm have to be done, i.e., the runtime has to multiplied by ρ. As before we assume that the samples may be reused in each run.
To solve a small secret LWE instance based on embedding, the strategy described in Section 2.3.1 can be applied: First, modulus switching is used and afterwards the algorithm is combined with exhaustive search. The standard embedding attack on LWE with small secret using modulus switching works the same as standard embedding in the non-small secret case, except that it operates on instances characterized by n, , and p instead of n, α, and q with . It is combined with guessing parts of the secret, which allows for larger and therefore for an easier basis reduction. To be more precise, the requirement for from equation (4.2) changes as follows:
where p can be estimated by equation (2.1). As stated in the description of the standard case, the overall runtime of the algorithm is determined depending on .
In Table 7, we state the runtime of the standard embedding attack in the LP and the delta-squared model. Table 8 gives the block size k of BKZ derived in Section 3 following the second approach to estimate runtime of the standard embedding attack with small secret. The success probability remains the same.
|Relation||Block size k in , cf. equation (3.1)|
Dual embedding is very similar to standard embedding shown in Section 4.3. However, since the embedding is into a different lattice, the dual embedding algorithm runs in dimension instead of , while the number of required samples remains m. Therefore, it is more suitable for instances with a restricted number of LWE samples . In case the optimal number of samples is given (as assumed in the LWE-Estimator by Albrecht, Player and Scott ) this attack is as efficient as the standard embedding attack. Hence, it was not included in the LWE-Estimator so far.
For an LWE instance , let the matrix be defined as
with being the identity matrix. Define
to be the lattice in which uSVP is solved. Considering leads to
and therefore . According to , the length of is small and can be estimated to be
Since this attack is similar to standard embedding, the estimations of the success probability and the running time is the same except for adjustments with respect to the dimension and determinant. Hence, the dual embedding attack is successful if the root-Hermite delta fulfills
while the number of LWE samples is m.
In Table 9, we state the runtime of the dual embedding attack in the LP and the delta-squared model. Table 10 gives the block size k of BKZ derived in Section 3 following the second approach to estimate runtime of the dual embedding attack.
|Relation||Block size k in , cf. equation (3.1)|
Since this algorithm is not mentioned in , we explain the analysis for an unlimited number of samples in the following. The case where the number of samples is not limited, and thus the optimal number of samples can be used, is a special case of the discussion above. To be more precise, to find the optimal number of samples , the parameter m with maximal (according to equation (4.4)) has to be found. This yields the lowest runtime using dual-embedding. The success probability is determined similar to the standard embedding, see Section 4.3.
There are two small secret variant of the dual embedding attack: One is similar to the small secret variant of the standard embedding, the other is better known as the embedding attack by Bai and Galbraith. Both are described in the following.
As before, the strategy described in Section 2.3.1 can be applied: First, modulus switching is used and afterwards the algorithm is combined with exhaustive search. This variant works the same as dual embedding in the non-small secret case, except that it operates on instances characterized by n, , and p instead of n, α, and q with . This allows for larger and therefore for an easier basis reduction. Hence, the following inequality has to be fulfilled by :
where p can be estimated by equation (2.1).
In Table 11, we state the runtime of the dual embedding attack with small secret in the LP and the delta-squared model. Table 12 gives the block size k of BKZ derived in Section 3 following the second approach to estimate runtime of the dual embedding attack with small secret. The success probability remains the same.
|Relation||Block size k in , cf. equation (3.1)|
The embedding attack by Bai and Galbraith  solves LWE with a small secret vector , with each entry in , by embedding. Similar to the dual embedding, Bai and Galbraith’s solves uSVP in the lattice
for the matrix defined as
in order to recover the short vector . Since , the uSVP algorithm has to find an unbalanced solution.
To tackle this, the lattice should be scaled such that it is more balanced, i.e., the first n rows of the lattice basis are multiplied with a factor depending on σ (see ). Hence, the determinant of the lattice is increased by a factor of without significantly increasing the norm the error vector. This increases the needed to successfully execute the attack. The required can be determined similarly as done in the standard embedding in Section 4.3:
where , , and m LWE samples are used.
In Table 13, we state the runtime of the Bai-Galbraith embedding attack in the LP and the delta-squared model. Table 14 gives the block size k of BKZ derived in Section 3 following the second approach to estimate runtime of the Bai-Galbraith embedding attack with small secret.
|Rel.||Block size k in , cf. equation (3.1)|
Similar to the other algorithms for LWE with small secret, the runtime of Bai and Galbraith’s attack can be combined with exhaustive search guessing parts of the secret. However, in contrast to the other algorithms using basis reduction, Bai and Galbraith state that applying modulus switching to their algorithm does not improve the result. The reason for this is, that modulus switching reduces q by a larger factor than it reduces the size of the error.
In this section, we describe our implementation of the results presented in Section 4 as an extension of the LWE-Estimator introduced in [3, 4]. Furthermore, we compare results of our implementation focusing on the behavior when limiting the number of available LWE samples.
Our extension is also written in sage and it is already merged with the original LWE-Estimator (from commit-id eb45a74 on) in March 2017. In the following we used the version of the LWE-Estimator from June 2017 (commit-id: e0638ac) for our experiments.
Except for Arora and Ge’s algorithm based on Gröbner bases, we adapt each algorithm the LWE-Estimator implements to take a fixed number of samples into account if a number of samples is given by the user. If not, each of the implemented algorithms assumes unlimited number of samples (and hence assumes the optimal number of samples is available). Our implementation also extends the algorithms coded-BKW, decisional-BKW, search-BKW, and meet-in-the-middle attacks (for a description of these algorithms see ) although we omitted the theoretical description of these algorithms in Section 4.
Following the notation in , we assign an abbreviation to each algorithm to refer:
|dual||distinguishing attack, Section 4.1,|
|dec||decoding attack, Section 4.2,|
|usvp-primal||standard embedding, Section 4.3,|
|usvp-dual||dual embedding, Section 4.4,|
|usvp-baigal||Bai-Galbraith embedding, Section 4.4.2,|
|usvp||minimum of usvp-primal, usvp-dual, and usvp-baigal,|
|arora-gb||Arora and Ge’s algorithm based on Gröbner bases.|
The shorthand symbol bkw solely refers to coded-BKW and its small secret variant. Decision-BKW and Search-BKW are not assigned an abbreviation and are not used by the main method estimate_lwe, because coded-BKW is the latest and most efficient BKW algorithm. Nevertheless, the other two BKW algorithms can be called separately via the function bkw, which is a convenience method for the functions bkw_search and bkw_decision, and its corresponding small secret variant bkw_small_secret.
In the LWE-Estimator the three different embedding approaches usvp-primal, usvp-dual, and usvp-baigal (in case of LWE with small secret is called) are summarized as the attack usvp and the minimum of the three embedding algorithms is returned. In our experiments we show the different impacts of those algorithms and hence we display the results of the three embedding approaches separately.
Let the LWE instance be defined by n, , and as proposed by Regev . In the following, let and let the number of samples be given by . If instead of α only the Gaussian width parameter (sigma_is_stddev=False) or the standard deviation (sigma_is_stddev=True) is known, α can be calculated by alphaf(sigma, q, sigma_is_stddev).
The main function to call the LWE-Estimator is called estimate_lwe. Listing 1 shows how to call the LWE-Estimator on the given LWE instance (with Gaussian distributed error and secret) including the following attacks: distinguishing attack, decoding, and embedding attacks. The first two lines of Listing 1 define the parameters , and the number of samples m. In the third line the program is called via estimate_lwe. For each algorithm a value rop is returned that gives the hardness of the LWE instance with respect to the corresponding attack.
Basic example of calling the LWE-Estimator of the LWE instance , , , and .
Listing 2 shows the estimations of the LWE instance with , , , and with the secret coefficients chosen uniformly random in .
Example of calling the hardness estimations of the small secret LWE instance , , , , with secret coefficients chosen uniformly random in .
In the following, we give interesting insights earned during the implementation.
One problem arises in the decoding attack dec when very strictly limiting the number of samples. It uses enum_cost to calculate the computational cost of the decoding step. For this, amongst other things, the stretching factors of the parallelepiped are computed iteratively by step-wise increase as described in Section 4.2. In this process, the success probability is used, which is calculated as a product of terms , see equation (4.1). Since the precision is limited, this may lead falsely to a success probability of 0. In this case, the loop never terminates. This problem can be avoided but doing so leads to an unacceptable long runtime. Since this case arises only when very few samples are given, our software throws an error, saying that there are too few samples.
The original LWE-Estimator routine to find the block size k for BKZ, called k_chen, iterates through possible values of k, starting at 40, until the resulting is lower than the targeted . As shown in Listing 3, this iteration uses steps of multiplying k by at most 2. When given a target- close to 1, only a high value k can satisfy the used equation. Hence, it takes a long time to find the suitable k. Therefore, the previous implementation of finding k for BKZ is not suitable in case a limited number of samples is given. Thus, we replace this function in our implementation by finding k using the secant-method as presented in Listing 4.
Iteration to find k in method k_chen of the previous implementation used in the LWE-Estimator.
Implementation of method k_chen to find k using the secant-method.
In the following, we present hardness estimations of LWE with and without taking a restricted number of samples into account. The presented experiments are done for the following LWE instance: , , and .
We show the base-2 logarithm of the estimated hardness of the LWE instance under all implemented attacks (except for Arora and Ge’s algorithm) in Table 15. According to the experiments, the hardness decreases with increasing the number of samples and remains the same after reaching the optimal number of samples. If our software could not find a solution the entry is filled with NaN. This is mostly due to too few samples provided to apply the respective algorithm.
In Table 16, we show the logarithmic hardness and the corresponding optimal number of samples estimated for unlimited number of samples. It should be noted that some algorithms rely on multiple executions, e.g., to amplify a low success probability of a single run to a target success probability. In such a case, the previous implementation of the LWE-Estimator assumed new samples for each run of the algorithm. In our implementation, we assume that samples may be reused in repeated runs of the same algorithm, giving a lower bound on the hardness estimations. Hence, sometimes the optimal number of samples computed by the original LWE-Estimator and the optimal number of samples computed by our method differ a lot in Table 16, e.g., decoding attack. To compensate this and to provide better comparability, we recalculate the optimal number of samples.
|Optimal number of samples|
|Algorithm||Original calculation||Recalculation||Hardness [bit]|
Comparing Table 15 and Table 16 shows that for a number of samples lower than the optimal number of samples, the estimated hardness is either (much) larger than the estimation using optimal number of samples or does not exist. In contrast, for a number of samples greater than or equal to the optimal number of samples, the hardness is exactly the same as in the optimal case, since the implementation falls back on the optimal number of samples when enough samples are given. Without this the hardness would increase again as can be seen for the dual embedding attack in Figure 2. For the results presented in Figure 2 we manually disabled the function to fall back to the optimal number of samples.
In Figure 3 we show the effect of limiting the available number of samples on the considered algorithms. We do not include coded-BKW in this plot, since the number of required samples to apply the attack is very large (about ). The first thing that strikes is that the limitation of the number of samples leads to an clearly notable increase of the logarithmic hardness for all shown algorithms but exhaustive search and BKW. The latter ones are basically not applicable for a limited number of samples. Furthermore, while the algorithms labeled with mitm, sis, dec, and usvp-primal are applicable for roughly the same interval of samples, the dual embedding algorithm (usvp-dual) stands out: the logarithmic hardness of dual-embedding is lower than for the other algorithms for . The reason is that during the dual embedding SVP is solved in a lattice of dimension , when only m samples are given. Moreover, the dual embedding attack is the most efficient attack up to roughly 350 samples. Afterwards, it is as efficient as the standard embedding (usvp-primal).
We tested and compared various proposed parameters of different primitives such as signature schemes [10, 5], encryption schemes [26, 18], and key exchange protocols [6, 13, 12]. In this section we explain our findings using an instantiation of the encryption scheme by Linder and Peikert  as an example. It aims at “medium security” (about 128 bits) and provides samples, where is the message length. For our experiments, we use . The secret follows the error distribution, which means that it is not small. However, we expect a similar behavior for small secret instances.
Except bkw and mitm, all attacks considered use basis reduction as a subroutine. As explained in Section 3, several ways to predict the performance of basis reduction exist. Assuming that sieving scales as predicted to higher dimension leads to the smallest runtime estimates for BKZ on quantum (called ) and classical ( ) computers. However, due to the subexponential memory requirement of sieving, it might be unrealistic that sieving is the most efficient attack (with respect to runtime and memory consumption) and hence enumeration might remain the best SVP solver even for high dimensions. Consequently, we include the runtime estimation of BKZ with enumeration ( ) to our experiments. Finally, we also performed experiments using the prediction by Lindner and Peikert (LP).
Our results are summarized in Table 17. We write “–” if the corresponding algorithm was not applicable for the tested instance of the Linder–Peikert scheme. Since bkw and mitm do not use basis reduction as subroutine, their runtimes are independent of the used BKZ prediction.
For the LWE instance considered, the best attack with arbitrary many samples always remains the best attack after restricting the number of samples. Restricting the samples always leads to an increased runtime for every attack, up to a factor of . Considering only the best attack shows that the hardness increases by about 5 bits. Unsurprisingly, usvp (which consists nearly solely of basis reduction) performs best when we assume that BKZ is fast, but gets outperformed by the decoding attack when we assume larger runtimes for BKZ.
In this work, we present an analysis of the hardness of LWE for the case of a restricted number of samples. For this, we describe the approaches distinguishing attack, decoding, standard embedding, and dual embedding shortly and analyze them with regard to a restricted number of samples. Also, we analyze the small secret variants of the mentioned algorithms under the same restriction of samples.
We adapt the existing software tool LWE-Estimator to take the results of our analysis into account. Moreover, we also adapt the algorithms BKW and meet-in-the-middle that are omitted in the theoretical description. Finally, we present examples, compare hardness estimations with optimal and restricted numbers of samples, and discuss our results.
The usage of a restricted set of samples has its limitations, e.g., if given too few samples, attacks are not applicable as in the case of BKW. On the other hand, it is possible to construct LWE instances from a given set of samples. For example, in  ideas how to generate additional samples (at cost of having higher noise) are presented. An integration in the LWE-Estimator and comparison of those methods would give an interesting insight, since it may lead to improvements of the estimation, especially for the algorithms exhaustive search and BKW.
Funding source: Deutsche Forschungsgemeinschaft
Award Identifier / Grant number: CRC 1119 CROSSING
 M. R. Albrecht, C. Cid, J.-C. Faugère, R. Fitzpatrick and L. Perret, On the complexity of the BKW algorithm on LWE, Des. Codes Cryptogr. 74 (2015), no. 2, 325–354. 10.1007/s10623-013-9864-x Search in Google Scholar
 M. R. Albrecht, R. Fitzpatrick and F. Göpfert, On the efficacy of solving LWE by reduction to unique-SVP, Information Security and Cryptology – ICISC 2013, Lecture Notes in Comput. Sci. 8565, Springer, Berlin (2014), 293–310. Search in Google Scholar
 M. R. Albrecht, F. Göpfert, C. Lefebvre, R. Player and S. Scott, Estimator for the bit security of LWE instances, 2016, https://bitbucket.org/malb/lwe-estimator [Online; accessed 01-June-2017]. Search in Google Scholar
 M. R. Albrecht, R. Player and S. Scott, On the concrete hardness of learning with errors, J. Math. Cryptol. 9 (2015), no. 3, 169–203. Search in Google Scholar
 E. Alkim, N. Bindel, J. Buchmann, O. Dagdelen, E. Eaton, G. Gutoski, J. Krämer and F. Pawlega, Revisiting TESLA in the quantum random oracle model, Post-Quantum Cryptography, Lecture Notes in Comput. Sci. 10346, Springer, Berlin (2017), 143–162. Search in Google Scholar
 E. Alkim, L. Ducas, T. Pöppelmann and P. Schwabe, Post-quantum key exchange – A new hope, Proceedings of the 25th USENIX Security Symposium (Austin 2016), USENIX, Berkeley (2016), 327–343. Search in Google Scholar
 B. Applebaum, D. Cash, C. Peikert and A. Sahai, Fast cryptographic primitives and circular-secure encryption based on hard learning problems, Advances in Cryptology – CRYPTO 2009, Lecture Notes in Comput. Sci. 5677, Springer, Berlin (2009), 595–618. Search in Google Scholar
 S. Arora and R. Ge, New algorithms for learning in presence of errors, Automata, Languages and Programming. Part I, Lecture Notes in Comput. Sci. 6755, Springer, Berlin (2011), 403–415. Search in Google Scholar
 L. Babai, On Lovász’ lattice reduction and the nearest lattice point problem, STACS 85 (Saarbrücken 1985), Lecture Notes in Comput. Sci. 182, Springer, Berlin (1985), 13–20. Search in Google Scholar
 S. Bai and S. D. Galbraith, An improved compression technique for signatures based on learning with errors, Topics in Cryptology – CT-RSA 2014, Lecture Notes in Comput. Sci. 8366, Springer, Berlin (2014), 28–47. Search in Google Scholar
 A. Becker, L. Ducas, N. Gama and T. Laarhoven, New directions in nearest neighbor searching with applications to lattice sieving, Proceedings of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, ACM, New York (2016), 10–24. Search in Google Scholar
 J. Bos, C. Costello, L. Ducas, I. Mironov, M. Naehrig, V. Nikolaenko, A. Raghunathan and D. Stebila, Frodo: Take off the ring! Practical, quantum-secure key exchange from LWE, Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, ACM, New York (2016), 1006–1018. Search in Google Scholar
 J. Bos, C. Costello, M. Naehrig and D. Stebila, Post-quantum key exchange for the TLS protocol from the ring learning with errors problem, IEEE Symposium on Security and Privacy, IEEE Press, Piscataway (2015), 553–570. Search in Google Scholar
 Y. Chen and P. Q. Nguyen, BKZ 2.0: Better lattice security estimates, Advances in Cryptology – ASIACRYPT 2011, Lecture Notes in Comput. Sci. 7073, Springer, Berlin (2011), 1–20. Search in Google Scholar
 H. Chernoff, A measure of asymptotic efficiency for tests of a hypothesis based on the sum of observations, Ann. Math. Statistics 23 (1952), 493–507. 10.1214/aoms/1177729330 Search in Google Scholar
 Ö. Dagdelen, R. El Bansarkhani, F. Göpfert, T. Güneysu, T. Oder, T. Pöppelmann, A. H. Sánchez and P. Schwabe, High-speed signatures from standard lattices, Progress in Cryptology – LATINCRYPT 2014, Lecture Notes in Comput. Sci. 8895, Springer, Berlin (2015), 84–103. Search in Google Scholar
 A. Duc, F. Tramèr and S. Vaudenay, Better algorithms for LWE and LWR, Advances in Cryptology – EUROCRYPT 2015. Part I, Lecture Notes in Comput. Sci. 9056, Springer, Berlin (2015), 173–202. Search in Google Scholar
 N. Gama, P. Q. Nguyen and O. Regev, Lattice enumeration using extreme pruning, Advances in Cryptology – EUROCRYPT 2010, Lecture Notes in Comput. Sci. 6110, Springer, Berlin (2010), 257–278. Search in Google Scholar
 C. Gentry, C. Peikert and V. Vaikuntanathan, Trapdoors for hard lattices and new cryptographic constructions, Proceedings of the Fortieth Annual ACM Symposium on Theory of Computing – STOC’08, ACM, New York (2008), 197–206. Search in Google Scholar
 F. Göpfert, Securely instantiating cryptographic schemes based on the learning with errors assumption, PhD thesis, Darmstadt University of Technology, Darmstadt, 2016. Search in Google Scholar
 G. Hanrot, X. Pujol and D. Stehlé, Algorithms for the shortest and closest lattice vector problems, Coding and Cryptology, Lecture Notes in Comput. Sci. 6639, Springer, Berlin (2011), 159–190. Search in Google Scholar
 T. Laarhoven, M. Mosca and J. van de Pol, Finding shortest lattice vectors faster using quantum search, Des. Codes Cryptogr. 77 (2015), no. 2–3, 375–400. 10.1007/s10623-015-0067-5 Search in Google Scholar
 R. Lindner and C. Peikert, Better key sizes (and attacks) for LWE-based encryption, Topics in Cryptology – CT-RSA 2011, Lecture Notes in Comput. Sci. 6558, Springer, Berlin (2011), 319–339. Search in Google Scholar
 V. Lyubashevsky and D. Micciancio, On bounded distance decoding, unique shortest vectors, and the minimum distance problem, Advances in Cryptology – CRYPTO 2009, Lecture Notes in Comput. Sci. 5677, Springer, Berlin (2009), 577–594. Search in Google Scholar
 D. Micciancio and O. Regev, Lattice-based cryptography, Post-Quantum Cryptography, Springer, Berlin (2009), 147–191. Search in Google Scholar
 P. Q. Nguyên and D. Stehlé, Floating-point LLL revisited, Advances in Cryptology – EUROCRYPT 2005, Lecture Notes in Comput. Sci. 3494, Springer, Berlin (2005), 215–233. Search in Google Scholar
 C. Peikert, Public-key cryptosystems from the worst-case shortest vector problem: extended abstract, Proceedings of the 2009 ACM International Symposium on Theory of Computing – STOC’09, ACM, New York (2009), 333–342. Search in Google Scholar
 O. Regev, On lattices, learning with errors, random linear codes, and cryptography, Proceedings of the 37th Annual ACM Symposium on Theory of Computing – STOC’05, ACM, New York (2005), 84–93. Search in Google Scholar
 C.-P. Schnorr and M. Euchner, Lattice basis reduction: Improved practical algorithms and solving subset sum problems, Math. Program. 66 (1994), no. 2, 181–199. 10.1007/BF01581144 Search in Google Scholar
© 2019 Walter de Gruyter GmbH, Berlin/Boston
This article is distributed under the terms of the Creative Commons Attribution Non-Commercial License, which permits unrestricted non-commercial use, distribution, and reproduction in any medium, provided the original work is properly cited.