In this work, we develop new LSH-based MitM quantum algorithms for ternary LWE, which transform the key recovery problem into a graph search task amenable to quantum walks. We first present QRep-0, the quantum adaptation of Rep-0, to establish the foundational approach. We then introduce QRep-1, which builds upon Rep-1 and achieves a lower complexity through enhanced representation techniques.
4.1. QRep-0: Foundational Instantiation of LSH-Based MitM Quantum Algorithms
The ternary LWE problem aims to recover a ternary secret vector satisfying , with a ternary error vector e. We cast this cryptographic recovery problem as a graph search task solvable by quantum walks, where marked vertices represent valid LWE solutions.
Rep-0 features a level-2 search tree, as illustrated in
Figure 1. The quantum walk operates on a graph constructed as the Cartesian product of four identical Johnson graphs. The construction begins with the four level-2 lists
, each of size
. From these, we define restricted subsets
of size
, where
is a parameter to be optimized. Setting
and
, the graph is formally given by
Each vertex is a 4-tuple . Two vertices u and v are adjacent if and only if, for some index j, the components of u and v differ by exactly one element, while the other three components are identical.
The data structure associated with a vertex in comprises all intermediate lists generated during the execution of Rep-0, which takes the vertex’s 4-tuple as its level-2 input lists. Here, corresponds to the j-th list at level-i, for and .
A vertex is marked if its resultant top-level list contains at least one valid ternary secret s satisfying and . This direct correspondence guarantees that finding any marked vertex solves the original LWE problem.
We begin by explaining the role of the parameter : it governs the trade-off between the setup cost of QRep-0 and the cost of the quantum walk required to reach a marked vertex.
When is large (close to 1), the setup cost dominates the overall complexity. In the extreme case of , all vertices become marked (since ), and QRep-0 reduces to the classical Rep-0 method, no longer relying on quantum walk.
Conversely, when is small (close to 0), the setup cost is minimized, but the fraction of marked vertices becomes negligible. As a result, the cost of amplifying these marked vertices via quantum walk becomes the dominant factor in the overall complexity.
We now analyze the quantum resources—specifically, circuit width and depth—required by QRep-0 as detailed in Algorithm 4.
| Algorithm 4 QRep-0 |
| Input:
An LWE public key , weight w |
| Output:
Secret vector satisfying or ⊥ if no such secret is found. |
|
1: Prepare the initial state (normalization omitted): |
|
2: Repeat times: |
|
(2.1) Apply the phase flip if u is marked: |
| (2.2) Perform the quantum walk for steps. |
| 3: Measure the register |
| 4: If is non-empty, return any ; otherwise, return ⊥.
|
Let
denote the size of level-
i lists in QRep-0, for
. These sizes follow the recurrence relations:
The quantum circuit width, which corresponds to the space complexity, is determined by three registers: the vertex register
encoding a 4-tuple of subsets
, requiring
qubits; the coin register
of similar size; and the data register
, which dominates the space complexity with
qubits. Hence, the overall circuit width (space complexity) is given by
The circuit depth, which corresponds to the time complexity, follows the quantum walk complexity:
where
encompasses the initial state preparation and data structure construction,
captures the cost per quantum walk step including data updates, and
represents the phase oracle for marked vertices.
From Equation (
11), the spectral gap of
is
Since the classical Rep-0 algorithm yields, in expectation, a single element in
, the fraction of marked vertices
corresponds to the probability that all four subsets
contain the necessary elements to reconstruct
s. This fraction is given by
To determine the circuit depth, we analyze the setup cost
and update cost
for the quantum walk in QRep-0. Following the methodology in
Section 6 of [
24], these costs correspond to the classical computational complexity of constructing and updating the hierarchical data structure used in Rep-0.
The setup cost
involves creating the hierarchical lists according to Rep-0. The level-2 lists
(for
) are constructed by randomly sampling
elements from
. The level-1 lists such as
are formed by mergeing
and
via exact matching and LSH. Finally, the level-0 list
is built from the two level-1 lists using LSH. Therefore,
The update cost involves involves inserting or deleting an element from one of the level-2 lists. Without loss of generality, we assume the element to be updated, denoted as x, belongs to . The update of x in can be performed in time .
The insertion or deletion of x subsequently triggers updates in the level-1 list , which is formed by merging and . Specifically, this requires inserting or deleting all elements that are constructed by pairing x with some , where x and y satisfy the matching conditions on k coordinates: approximate matching on coordinates and exact matching on the other coordinates.
To analyze the number of such elements y (and thus the corresponding z) and the time complexity of locating them, we employ the following theorem:
Theorem 2. Given an element and a list L of size with independent and identically distributed elements drawn uniformly from , there exists a classical algorithm that can find a -fraction of satisfying for some set I of size and for some set J of size . The time complexity of this algorithm iswhere the first term corresponds to the expected number of elements y that meet the above conditions. Proof. A detailed derivation of this result is provided in
Appendix A. □
Applying Theorem 2, the time required to update
due to the modification of
x is given by
The number of elements
that need to be updated is
. For each such
z, applying Theorem 2 again, the time required to update the level-0 list
is
. Therefore, the total update time for the level-0 list is
Consequently, the overall update cost is given by
An important observation is that
and
satisfy the relation
. Combining this observation with Equations (
31)–(
33) and
, we obtain the circuit depth (time complexity) of QRep-0:
The parameter is chosen to minimize the overall time complexity by balancing the two dominant terms in the expression: the setup cost and the cost of performing the quantum walk to find a marked vertex .
To achieve this balance, we set the exponents of the two terms equal to each other:
Solving this equation for yields the optimal value .
4.4. Concrete Security Analysis of QRep-1
This subsection presents a comprehensive security analysis of our optimized QRep-1 algorithm, comparing it against previous quantum combinatorial attacks and lattice-based quantum sieving methods.
Table 2 extends our evaluation to include additional ternary-LWE-based schemes from the NTRU-IEEE family, using the same methodology established in
Section 4.2.
All evaluated schemes rely on the hardness of ternary LWE with secret and error vectors restricted to entries. The parameter triple for each scheme specifies the polynomial dimension, modulus, and weight of the secret vector, respectively. The complexity is measured in two forms: represents the base-2 logarithm of the time complexity, while expresses the time complexity relative to the search space size S, providing a normalized measure of efficiency.
Our QRep-1 algorithm achieves a concrete complexity bound of approximately
, substantially improving upon the
bound of vHKM’s quantum combinatorial attack. This represents a significant reduction in the gap between asymptotic predictions and concrete performance. As shown in
Table 2, our method demonstrates dramatic runtime improvements over vHKM, with speedup factors ranging from
for NTRU-Enc-821 to
for NTRU-Prime-761. For signature schemes, we observe speedups of
for BLISS I+II and
for GLP I.
The comparison with quantum sieving reveals a nuanced security landscape. While lattice-based attacks maintain advantages for most parameter sets, our combinatorial approach demonstrates superiority for small-weight parameters. This divergence highlights the importance of considering both attack paradigms in security assessments.
It is crucial to distinguish the resource models between these approaches. Quantum walk-based combinatorial attacks (including both our QRep-1 and vHKM’s) exhibit equivalence between time and quantum space complexity due to the quantum walk framework requiring storage of the entire quantum state. In contrast, quantum sieving employs a hybrid classical-quantum model where only the locality-sensitive filtering step is quantumized, resulting in a two-component resource model with both classical and quantum memory requirements.
Our combinatorial method leverages representation techniques derived from subset-sum or knapsack problems. This approach has strong theoretical foundations: for knapsack-type distributions, it can be rigorously proven that pathological instances constitute an exponentially small fraction, enabling the construction of provable probabilistic algorithms that avoid heuristics [
15]. Experimental validation in prior work [
15] confirms that observed runtimes align closely with theoretical predictions, providing enhanced precision in security estimates compared to lattice reduction heuristics that rely on unproven assumptions like the Geometric Series Assumption.
Our QRep-1 algorithm establishes the new state of the art for quantum combinatorial attacks on ternary LWE, offering both theoretical advances and practical security implications for post-quantum cryptography standardization.