arXiv is now an independent nonprofit! Learn more
License: CC BY 4.0
arXiv:2104.12810v2 [cs.CR] 15 Sep 2021

Classical and Quantum algorithms for generic Syndrome Decoding problems and applications to the Lee metric

André Chailloux Affiliation: Inria de Paris, EPI COSMIQ    Thomas Debris-Alazard Affiliation: Inria Saclay E-mail {andre.chailloux, thomas.debris, simona.etinski}@inria.fr    Simona Etinski Affiliation: Inria de Paris, EPI COSMIQ
Abstract

The security of code-based cryptography usually relies on the hardness of the syndrome decoding (SD) problem for the Hamming weight. The best generic algorithms are all improvements of an old algorithm by Prange, and they are known under the name of Information Set Decoding (ISD) algorithms. This work aims to extend ISD algorithms’ scope by changing the underlying weight function and alphabet size of SD. More precisely, we show how to use Wagner’s algorithm in the ISD framework to solve SD for a wide range of weight functions. We also calculate the asymptotic complexities of ISD algorithms both for the classical and quantum case. We then apply our results to the Lee metric, which currently receives a significant amount of attention. By providing the parameters of SD for which decoding in the Lee weight seems to be the hardest, our study could have several applications for designing code-based cryptosystems and their security analysis, especially against quantum adversaries.

1 Introduction

Code-based cryptography is one of the leading proposals for post-quantum cryptography, and it traditionally relies on the hardness of the syndrome decoding problem. For fixed q,n,k,wq,n,k,w, the problem is defined as follows: starting from a parity check matrix 𝐇𝔽qn×(nk)\mathbf{H}\in\mathbb{F}_{q}^{n\times(n-k)}, and a syndrome 𝐬𝔽qnk\mathbf{s}\in\mathbb{F}_{q}^{n-k}, the goal is to find a vector 𝐞𝔽qn\mathbf{e}\in\mathbb{F}_{q}^{n} such that 𝐇𝐞=𝐬\mathbf{H}\mathbf{e}=\mathbf{s}, and 𝐞\mathbf{e} has the Hamming weight(1)(1) (1) The Hamming weight of a vector 𝐞=(e1,,en)\mathbf{e}=(e_{1},\dots,e_{n}) is |𝐞|H=def|{i:ei0}||\mathbf{e}|_{\textup{H}}\stackrel{{\scriptstyle\text{def}}}{{=}}|\{i:e_{i}\neq 0\}|. ww. This problem has been studied for a long time, and mostly for the alphabet size q=2q=2. Despite many efforts, the best algorithms for solving this problem [Pra62, Ste88, Dum91, Bar97, MMT11, BJMM12, MO15] require an exponential running time, and they are all refinements of the original Prange’s algorithm [Pra62]. As such, they are all commonly known under one name: Information Set Decoding (ISD) algorithms.

It is, however, notoriously difficult to put the syndrome decoding problem into practice. For example, constructing an efficient signature scheme in code-based cryptography often requires utilizing pseudo-random functions, and some other cryptographic assumptions. A generalized version of the problem promises to be harder and to offer a more exploitable structure that leads to creating more efficient constructions. Like DURANDAL [ABG+19], some proposals replace the Hamming weight with the rank metric based weight, which allows designers to use a Schnorr-Lyubashevski type signature. Another proposal, 𝖶𝖠𝖵𝖤\mathsf{WAVE} signature scheme [DST19], utilizes syndrome decoding problem for which q=3q=3, and the Hamming weight is large. This further enables one to construct and exploit a trapdoor one-way preimage sampleable function, which would not be possible for q=2q=2 or q=3q=3 in small weight.

These examples already show the usefulness of going beyond q=2q=2 and the Hamming weight setting. We are, however, still at an early stage of using these variants for cryptographic schemes. Therefore, it is important to study their hardness, especially against quantum computers, since a big appeal of code-based cryptography is post-quantum security.

Our work.

In this paper, we perform a generic analysis of different ISD algorithms. The analysis is applicable to any weight function wt:𝔽qn+wt:\mathbb{F}_{q}^{n}\rightarrow\mathbb{R}_{+} satisfying wt(𝐞)=defi=1nwt(ei)wt(\mathbf{e})\stackrel{{\scriptstyle\text{def}}}{{=}}\sum_{i=1}^{n}wt\textquoteright(e_{i}), for some function wt:𝔽q+wt\textquoteright:\mathbb{F}_{q}\rightarrow\mathbb{R}_{+}, and wt(0)=0.wt\textquoteright(0)=0. However, we primarily focus on the Lee weight analysis, and the comparison between the Lee and Hamming weight. The reason we chose these two weight functions is that the two are commonly encountered in coding theory, and both led to proposals for cryptographic schemes.

Which ISD algorithms do we study here? We analyze algorithms by Prange and Stern/Dumer and the ISD algorithms based on Wagner’s approach to solving a Generalized Birthday problem [Wag02]. Starting from [BCDL19], where classical algorithms for a ternary alphabet and the Hamming weight were analyzed, we broaden the analysis to the higher alphabet sizes, usage of a different weight function, and the study of both classical and quantum algorithms. This is the first time such a generic analysis of quantum ISD algorithms was done since the work of [KT17] that studied only the standard case of q=2q=2 and the Hamming weight.

To perform such a generic analysis, we need a way of computing sphere surface areas in a vector space endowed with an arbitrary metric. More precisely, we aim to calculate the sizes of sets of the form {𝐞𝔽qn:wt(𝐞)=p}\{\mathbf{e}\in\mathbb{F}_{q}^{n}:wt(\mathbf{e})=p\}. To do this, we start with the approach presented in [Ast84], applied to the Lee metric case, and we derive a convex optimization method for calculating the asymptotic sphere surface area independently of the metric. We thus provided a simple approach to analyzing syndrome decoding problems in a vector space endowed with an arbitrary metric and a weight function derived from it.

Our framework can also be used for studying the security of the Restricted Syndrome Decoding problem [BBC+20a]. Nevertheless, it does not work for the rank metric norm where we do not know how to construct ISD algorithms better than Prange’s algorithm(2)(2) (2) There are other algorithms [BBB+20, BBC+20b] based on Gröbner basis that perform better than ISD algorithms for the rank metric..

Notations

Throughout the paper, we use [n]=def{1,,n}[n]\stackrel{{\scriptstyle\text{def}}}{{=}}\{1,\dots,n\} and, given a finite set \mathscr{E}, we denote by |||\mathscr{E}| its size. We consider a weight function wt:𝔽qn+wt:\mathbb{F}_{q}^{n}\rightarrow\mathbb{R}_{+} which satisfies the following:

wt:𝔽q+ : wt(0)=0 and 𝐞=(e1,,en)𝔽qn,wt(𝐞)=iwt(ei).\exists wt^{\prime}:\mathbb{F}_{q}\rightarrow\mathbb{R}_{+}\mbox{ : }wt^{\prime}(0)=0\mbox{ and }\forall\mathbf{e}=(e_{1},\dots,e_{n})\in\mathbb{F}_{q}^{n},{wt}\left(\mathbf{e}\right)=\sum_{i}wt^{\prime}(e_{i}). (1)

This weight function is usually - but not always - obtained as wt(𝐱)=d(𝐱,0)wt(\mathbf{x})=d(\mathbf{x},0) where dd is a distance. We will sometimes use the terminology of distance instead of weight when this is the case. When qq and wtwt are fixed and explicit, we define the surface area of a sphere of weight ww in a vector space of dimension nn as:

Swn=def|{𝐞𝔽qn:wt(𝐞)=w}|.S^{n}_{w}\stackrel{{\scriptstyle\text{def}}}{{=}}\left|\{\mathbf{e}\in\mathbb{F}_{q}^{n}:{wt}\left(\mathbf{e}\right)=w\}\right|.

2 Quantum preliminaries

We refer to [NC00] for a basic introduction to quantum computing. In this paper, we use the canonical gate model where the running time of a quantum algorithm is the number of gates in its corresponding circuit description. We utilize the QRAM model, for which we assume the operation UQRAM:|i|y|b1,,bn|i|y+xi|b1,,bnU_{QRAM}:\ket{i}\ket{y}\ket{b_1,\dots,b_n}\rightarrow\ket{i}\ket{y + x_i}\ket{b_1,\dots,b_n} can be done in time polylog(n)polylog(n) when each bib_{i} is a single bit.

Grover’s algorithm. [Gro96]

For a function f:{0,1}n{0,1}f:\{0,1\}^{n}\rightarrow\{0,1\} that has an efficient classical description, Grover’s algorithm can find xx such f(x)=1f(x)=1 in time O(poly(n)2n/2)O(poly(n)2^{n/2}) if such an xx exists and output ’no solution’ otherwise.

Amplitude amplification. [BH97]

Fix a function f:{0,1}n{0,1}f:\{0,1\}^{n}\rightarrow\{0,1\} that has an efficient classical description. Consider then a quantum algorithm 𝒜\mathscr{A} that outputs xx such that f(x)=1f(x)=1 with probability pp and does not perform intermediate quantum measurements. Using amplitude amplification, one can find xx such that f(x)=1f(x)=1 by making O(1p)O(\frac{1}{\sqrt{p}}) calls to 𝒜\mathscr{A}. Notice that if we start from a classical algorithm 𝒜\mathscr{A}, there are generic ways to run 𝒜\mathscr{A} coherently as a quantum algorithm 𝒜\mathscr{A}^{\prime} that does not have intermediate quantum measurements and behaves exactly like 𝒜\mathscr{A}.

3 Syndrome Decoding Problems

When we fix an alphabet size qq and a weight function wtwt, the syndrome decoding problem is defined as follows:

Problem 1

Syndrome Decoding SD(n,kn,w)\textrm{SD}(n,k\leq n,w)

  • Input: A matrix 𝐇𝔽q(nk)×n\mathbf{H}\in\mathbb{F}_{q}^{(n-k)\times n}, a column vector (the syndrome) 𝐬𝔽qnk\mathbf{s}\in\mathbb{F}_{q}^{n-k}.

  • Goal: Find a column vector 𝐞𝔽qn\mathbf{e}\in\mathbb{F}_{q}^{n} s.t. 𝐇𝐞=𝐬\mathbf{H}\mathbf{e}=\mathbf{s} and wt(𝐞)=w{wt}\left(\mathbf{e}\right)=w.

The decision version of this problem, which asks whether there exists a vector 𝐞\mathbf{e} of weight ww such that 𝐇𝐞=𝐬\mathbf{H}\mathbf{e}=\mathbf{s}, is 𝖭𝖯{\mathsf{NP}}-complete for q=2q=2 with the Hamming weight function [BMvT78].

Consider now the input distribution 𝒟\mathscr{D} sampled as follows: pick a random matrix 𝐇𝔽q(nk)×n\mathbf{H}\in\mathbb{F}_{q}^{(n-k)\times n} of rank nkn-k, pick a random 𝐞𝔽qn\mathbf{e}\in\mathbb{F}_{q}^{n} with wt(𝐞)=wwt(\mathbf{e})=w, and output (𝐇,𝐬=𝐇𝐞)(\mathbf{H},\mathbf{s}=\mathbf{H}\mathbf{e}). Notice that the problem always has at least one solution for this distribution and that SD is believed to be hard, even against quantum computers. That is why, in this paper, we study algorithms for SD with this input distribution. We only consider a prime qq to avoid attacks that would use sub-fields of the alphabet field 𝔽q\mathbb{F}_{q}.

Another problem of interest, which we call Checkable Multiple Syndrome Decoding, is the following:

Problem 2

Checkable Multiple Syndrome Decoding CMSD(n,m,w,Y,Z)\textrm{CMSD}(n,m,w,Y,Z)

  • Input: A matrix 𝐇𝔽qm×n\mathbf{H}\in\mathbb{F}_{q}^{m\times n}, a syndrome 𝐬𝔽qm\mathbf{s}\in\mathbb{F}_{q}^{m}.

  • Goal: output the description of a function f:[Y]𝔽qnf:[Y]\rightarrow\mathbb{F}_{q}^{n} such that ff is efficiently computable, and |{𝐞:𝐞Im(f),𝐇𝐞=𝐬 and wt(𝐞)=w}|=Z|\{\mathbf{e}:\mathbf{e}\in\textup{Im}(f),\mathbf{H}\mathbf{e}=\mathbf{s}\text{ and }{wt}\left(\mathbf{e}\right)=w\}|=Z.

This problem is a bit funny looking at first sight, but we are interested in it because, in our framework, it is used as a building block for solving the generic SD problem. It is very similar to asking for ZZ solutions to the syndrome decoding problem. Indeed, from a description ff, one can output ZZ solutions to SD in time YY by enumerating all the f(1),,f(Y)f(1),\dots,f(Y). Reciprocally, if one can find ZZ solutions 𝐞1,,𝐞Z\mathbf{e}_{1},\dots,\mathbf{e}_{Z} to SD(n,m,w)\textrm{SD}(n,m,w) in time TZT\geq Z, then one can solve CMSD(n,m,w,Y,Z)\textrm{CMSD}(n,m,w,Y,Z) by defining f(i)=𝐞if(i)=\mathbf{e}_{i}.

In the quantum setting, we want to have access to the function ff but without paying for a time cost of ZZ for writing down these solutions. That will allow us to search over solutions more efficiently, using Grover’s algorithm, and also justifies the slightly odd definition. Another remark is that while ff should be efficiently computable, it need not have an efficient description. Typically, ff can store some large precomputed databases, but computing f(x)f(x) will only query the database a small number of times.

4 Information Set Decoding Algorithms for any Metric

We present Information Set Decoding algorithms for SD, which consist of a partial Gaussian elimination followed by solving an instance of CMSD. The description here is essentially the one from [BCDL19] with the difference that here we use the CMSD problem.

4.1 Information Set Decoding Framework

Fix 𝐇𝔽q(nk)×n\mathbf{H}\in\mathbb{F}_{q}^{(n-k)\times n} of rank (nk)(n-k) and 𝐬𝔽qnk\mathbf{s}\in\mathbb{F}_{q}^{n-k}. Recall that we want to find 𝐞𝔽qn\mathbf{e}\in\mathbb{F}_{q}^{n} such that wt(𝐞)=w{wt}\left(\mathbf{e}\right)=w and 𝐇𝐞=𝐬\mathbf{H}\mathbf{e}=\mathbf{s}. Let us introduce ,p,Y,\ell,p,Y, and ZZ, four parameters of the system that we consider fixed for now. In this framework, an algorithm for solving SD(n,k,w)\textrm{SD}(n,k,w) consists of 44 steps: a permutation step, a partial Gaussian Elimination step, a CMSD step, and a test step.

  1. 1.

    Permutation step. Pick a random permutation π\pi. Let 𝐇π{\mathbf{H}_{\pi}} be the matrix 𝐇\mathbf{H} with the columns permuted according to π\pi. We now want to solve SD(n,k,w)\textrm{SD}(n,k,w) on inputs 𝐇π{\mathbf{H}_{\pi}} and 𝐬\mathbf{s}.

  2. 2.

    Partial Gaussian Elimination step. If the top left square submatrix of 𝐇π{\mathbf{H}_{\pi}} of size nkn-k-\ell is not of full rank, go back to step 11 and choose another random permutation π\pi. That happens with constant probability.(3)(3) (3) For q=2q=2, this happens with probability at least 0.2880.288 and this probability increases as qq increases (see [Coo00], for example). If the submatrix is of full rank, perform Gaussian elimination on the rows of 𝐇π{\mathbf{H}_{\pi}} using the first nkn-k-\ell columns. Let now 𝐒𝔽q(nk)×(nk)\mathbf{S}\in\mathbb{F}_{q}^{(n-k)\times(n-k)} be the invertible matrix corresponding to this operation. There are two matrices then, 𝐇𝔽q(nk)×(k+)\mathbf{H}^{\prime}\in\mathbb{F}_{q}^{(n-k-\ell)\times(k+\ell)} and 𝐇′′𝔽q×(k+)\mathbf{H}^{\prime\prime}\in\mathbb{F}_{q}^{\ell\times(k+\ell)}, such that:

    𝐒𝐇π=(𝟏nk𝐇𝟎𝐇′′).\mathbf{S}{\mathbf{H}_{\pi}}=\begin{pmatrix}\mathbf{1}_{n-k-\ell}&\mathbf{H}^{\prime}\\ \mathbf{0}&\mathbf{H}^{\prime\prime}\end{pmatrix}.

    A vector 𝐞𝔽qn\mathbf{e}\in\mathbb{F}_{q}^{n} can be written as 𝐞=(𝐞𝐞′′)\mathbf{e}=\begin{pmatrix}\mathbf{e}^{\prime}\\ \mathbf{e}^{\prime\prime}\end{pmatrix}, where 𝐞𝔽qnk\mathbf{e}^{\prime}\in\mathbb{F}_{q}^{n-k-\ell} and 𝐞′′𝔽qk+\mathbf{e}^{\prime\prime}\in\mathbb{F}_{q}^{k+\ell}, and one can write 𝐒𝐬=(𝐬𝐬′′){\mathbf{S}}\mathbf{s}=\begin{pmatrix}\mathbf{s}^{\prime}\\ \mathbf{s}^{\prime\prime}\end{pmatrix}, with 𝐬𝔽qnk\mathbf{s}^{\prime}\in\mathbb{F}_{q}^{n-k-\ell} and 𝐬′′𝔽q\mathbf{s}^{\prime\prime}\in\mathbb{F}_{q}^{\ell}.

    𝐇π𝐞=𝐬\displaystyle{\mathbf{H}_{\pi}}{\mathbf{e}}={\mathbf{s}} 𝐒𝐇π𝐞=𝐒𝐬\displaystyle\iff\mathbf{S}\mathbf{H}_{\pi}{\mathbf{e}}=\mathbf{S}{\mathbf{s}}
    (𝟏nk𝐇𝟎𝐇′′)(𝐞𝐞′′)=(𝐬𝐬′′)\displaystyle\iff\begin{pmatrix}\mathbf{1}_{n-k-\ell}&\mathbf{H}^{\prime}\\ \mathbf{0}&\mathbf{H}^{\prime\prime}\end{pmatrix}\begin{pmatrix}{\mathbf{e}^{\prime}}\\ {\mathbf{e}^{\prime\prime}}\end{pmatrix}=\begin{pmatrix}{\mathbf{s}^{\prime}}\\ {\mathbf{s}^{\prime\prime}}\end{pmatrix}
    {𝐞+𝐇𝐞′′=𝐬𝐇′′𝐞′′=𝐬′′\displaystyle\iff\left\{\begin{array}[]{ll}{\mathbf{e}^{\prime}}+\mathbf{H}^{\prime}{\mathbf{e}^{\prime\prime}}={\mathbf{s}^{\prime}}\\ \mathbf{H}^{\prime\prime}{\mathbf{e}^{\prime\prime}}={\mathbf{s}^{\prime\prime}}\end{array}\right. (2)

    To solve the problem, we try to find a solution (𝐞𝐞′′)\begin{pmatrix}\mathbf{e}^{\prime}\\ \mathbf{e}^{\prime\prime}\end{pmatrix} to the above system such that wt(𝐞′′)=p{wt}\left(\mathbf{e}^{\prime\prime}\right)=p and wt(𝐞)=wp{wt}\left(\mathbf{e}^{\prime}\right)=w-p.

  3. 3.

    The CMSD step. Solve CMSD(k+,,p,Y,Z)\textrm{CMSD}(k+\ell,\ell,p,Y,Z) on input (𝐇′′,𝐬′′)(\mathbf{H}^{\prime\prime},\mathbf{s}^{\prime\prime}), and let ff be the output function.

  4. 4.

    The test step. For each i[Y]i\in[Y], let 𝐞i′′=f(i)\mathbf{e}^{\prime\prime}_{i}=f(i) and let 𝐞i=𝐬𝐇𝐞i′′{\mathbf{e}^{\prime}_{i}}={\mathbf{s}^{\prime}}-\mathbf{H}^{\prime}{\mathbf{e}^{\prime\prime}_{i}}. For each ii such that 𝐇′′𝐞′′=𝐬′′\mathbf{H}^{\prime\prime}\mathbf{e}^{\prime\prime}=\mathbf{s}^{\prime\prime}, Equation (2) ensures that 𝐇π(𝐞i𝐞i′′)=𝐬{\mathbf{H}_{\pi}}\begin{pmatrix}\mathbf{e}^{\prime}_{i}\\ \mathbf{e}^{\prime\prime}_{i}\end{pmatrix}={\mathbf{s}}. If wt(𝐞i′′)=p{wt}\left(\mathbf{e}^{\prime\prime}_{i}\right)=p and wt(𝐞i)=wp{wt}\left(\mathbf{e}^{\prime}_{i}\right)=w-p, 𝐞i=(𝐞i𝐞i′′)\mathbf{e}_{i}=\begin{pmatrix}\mathbf{e}^{\prime}_{i}\\ \mathbf{e}^{\prime\prime}_{i}\end{pmatrix} is therefore a solution to SD(n,k,w)\textrm{SD}(n,k,w) on inputs 𝐇π{\mathbf{H}_{\pi}} and 𝐬\mathbf{s}. The solution to SD(n,k,w)\textrm{SD}(n,k,w) can then be turned into a solution of the initial problem by permuting the indices, as detailed in Equation (3) below. If we do not find any solution after checking all i[Y]i\in[Y], we go back to step 11.

At the end of the protocol, we have a vector 𝐞\mathbf{e} such that 𝐇π𝐞=𝐬{\mathbf{H}_{\pi}}\mathbf{e}=\mathbf{s} and wt(𝐞)=w{wt}\left(\mathbf{e}\right)=w. Let 𝐞π1\mathbf{e}_{\pi^{-1}} be the vector 𝐞\mathbf{e} with the permuted coordinates according to π1\pi^{-1}. Hence,

𝐇𝐞π1=𝐇π𝐞=𝐬 and wt(𝐞π1)=wt(𝐞)=w.\mathbf{H}{\mathbf{e}}_{\pi^{-1}}={\mathbf{H}_{\pi}}{\mathbf{e}}={\mathbf{s}}\quad\textrm{ and }\quad{wt}\left(\mathbf{e}_{\pi^{-1}}\right)={wt}\left(\mathbf{e}\right)=w. (3)

Therefore, 𝐞π1\mathbf{e}_{\pi^{-1}} is a solution to the problem.

4.2 Information Set Decoding: Complexity Analysis (Classical and Quantum)

We fix qq and a weight function wtwt. Recall that for any nn and ww, the surface area of a sphere (according to wtwt) of radius ww in 𝔽qn\mathbb{F}_{q}^{n} is defined as:

Swn=|{𝐞𝔽qn:wt(𝐞)=w}|.S^{n}_{w}=|\{\mathbf{e}\in\mathbb{F}_{q}^{n}:{wt}\left(\mathbf{e}\right)=w\}|.

With this definition at hand, we now present the complexity analysis of the algorithm for solving SD(n,k,w)\textrm{SD}(n,k,w) for fixed parameters ,p,Y,Z\ell,p,Y,Z (see section 4.1 for more details).

Lemma 1

Let P1P_{1} be the probability that at step 44, for a fixed ii, wt(𝐞i)=wp{wt}\left(\mathbf{e}^{\prime}_{i}\right)=w-p. We have:

P1=min{1,O(Swpnkmax{1,min{Swnq,qnk}})}.P_{1}=\min\{1,O(\frac{S^{n-k-\ell}_{w-p}}{\max\{1,\min\{S^{n}_{w}q^{-\ell},q^{n-k-\ell}\}\}})\}.

This lemma can be seen as a generalization of Proposition 2 of [BCDL19] (where a max was omitted) for any weight function.

Proof.

Let S={𝐞:wt(𝐞)=w𝐇π𝐞=𝐬}S=\{\mathbf{e}:{wt}\left(\mathbf{e}\right)=w\wedge\mathbf{H}_{\pi}\mathbf{e}=\mathbf{s}\} be the set of solutions to our syndrome decoding problem on input 𝐇π,𝐬\mathbf{H}_{\pi},\mathbf{s}. Let also S2={𝐞=(𝐞𝐞′′):wt(𝐞)=w𝐇′′𝐞′′=𝐬′′}S_{2}=\{\mathbf{e}=\begin{pmatrix}\mathbf{e}^{\prime}\\ \mathbf{e}^{\prime\prime}\end{pmatrix}:{wt}\left(\mathbf{e}\right)=w\wedge\mathbf{H}^{\prime\prime}\mathbf{e}^{\prime\prime}=\mathbf{s}^{\prime\prime}\}, where 𝐇′′\mathbf{H}^{\prime\prime} is the matrix from step 22. By definition, SS2S\subseteq S_{2}, so we have that SS has average size max{1,Swnq(nk)}\max\{1,S^{n}_{w}q^{-(n-k)}\} and S2S_{2} has average size max{Swnq,1}.\max\{S^{n}_{w}q^{-\ell},1\}.

Fix ii and 𝐞i′′=f(i)\mathbf{e}^{\prime\prime}_{i}=f(i) satisfying 𝐇′′𝐞i′′=𝐬′′\mathbf{H}^{\prime\prime}\mathbf{e}^{\prime\prime}_{i}=\mathbf{s}^{\prime\prime} and wt(𝐞i′′)=p{wt}\left(\mathbf{e}^{\prime\prime}_{i}\right)=p. Ti={𝐞i=(𝐞i𝐞i′′):wt(𝐞i)=w}T_{i}=\left\{\mathbf{e}_{i}=\begin{pmatrix}\mathbf{e}^{\prime}_{i}\\ \mathbf{e}^{\prime\prime}_{i}\end{pmatrix}:{wt}\left(\mathbf{e}_{i}\right)=w\right\}. TiT_{i} is of average size SwpnkS^{n-k-\ell}_{w-p}. Step 44 will find a solution if TiST_{i}\cap S\neq\emptyset. Since TiS2T_{i}\subseteq S_{2} and is uniformly distributed in this set, this happens with the following probability:

P1\displaystyle P_{1} =min{1,O(|Ti||S||S2|)}=min{1,O(Swpnkmax{1,Swnq(nk)}max{Swnq,1})}\displaystyle=\min\{1,O(\frac{|T_{i}||S|}{|S_{2}|})\}=\min\{1,O(\frac{S^{n-k-\ell}_{w-p}\cdot\max\{1,S^{n}_{w}q^{-(n-k)}\}}{\max\{S^{n}_{w}q^{-\ell},1\}})\}
=min{1,O(Swpnkmax{1,min{Swnq,qnk}})}.\displaystyle=\min\{1,O(\frac{S^{n-k-\ell}_{w-p}}{\max\{1,\min\{S^{n}_{w}q^{-\ell},q^{n-k-\ell}\}\}})\}.

We now present our generic formula for the running time of the Information Set Decoding algorithm from Section 4.1.

Proposition 1

Fix parameters ,p,Y\ell,p,Y, and ZZ of the information set decoding algorithm. The classical running time of the algorithm, TISDT_{\textup{ISD}}, is given as:

TISD=O(max{1,1P1Z}(poly(n)+TCMSD+poly(n)Y)),T_{\textup{ISD}}=O\left(\max\left\{1,\frac{1}{P_{1}Z}\right\}\cdot\left(\textup{poly}(n)+T_{\textup{CMSD}}+\textup{poly}(n)Y\right)\right),

where P1P_{1} is the probability from the above lemma, and TCMSDT_{\textup{CMSD}} is the running time of step 33, i.e., the time required for solving CMSD(k+,,p,Y,Z)\textup{{CMSD}}(k+\ell,\ell,p,Y,Z).

Proof.

Steps 11 and 22 take time poly(n)\textup{poly}(n), step 33 takes time TCMSDT_{\textup{CMSD}}, and step 44 takes time poly(n)\textup{poly}(n) for each i[Y]i\in[Y], hence the right part of the expression. How many times does the algorithm loop over this process? Step 22 succeeds with constant probability, and step 44 finds a solution with probability 1(1P1)Z1-(1-P_{1})^{Z}, so it loops over the steps O(11(1P1)Z)=O(max{1,1P1Z})O\left(\frac{1}{1-(1-P_{1})^{Z}}\right)=O\left(\max\left\{1,\frac{1}{P_{1}Z}\right\}\right) times, hence the result. ∎

The quantum setting.

Our formulation allows for a simple extension to the quantum setting. We consider the algorithm described earlier with the following two changes: (1)(1) in step 44, the algorithm uses Grover’s search to check whether there is ii such that f(i)f(i) gives us a solution; (2) for each loop, i.e., each time the algorithm starts from step 11, it finds a solution with probability p=Ω(min{1,P1Z})p=\Omega(\min\{1,P_{1}Z\}). This loop can be made coherently with a quantum algorithm 𝒜\mathscr{A} that does not do intermediate measurements and outputs a solution with probability pp. The algorithm then use amplitude amplification to find a solution by repeating the loop O(1p)O(\frac{1}{\sqrt{p}}) times.

Proposition 2

Fix parameters ,p,Y,\ell,p,Y, and ZZ of the information set decoding algorithm. The quantum running time of the algorithm, TISDQT^{Q}_{\textup{ISD}}, is given as:

TISDQ=O(max{1ZP1,1}(poly(n)+TCMSD+poly(n)Y)),T^{Q}_{\textup{ISD}}=O\left(\sqrt{\max\left\{\frac{1}{ZP_{1}},1\right\}}\cdot\left(\textup{poly}(n)+T_{\textup{CMSD}}+\textup{poly}(n)\sqrt{Y}\right)\right),

where P1P_{1} is the probability from Lemma 1, and TCMSDT_{\textup{CMSD}} is the running time of step 33, i.e., of solving CMSD(k+,,p,Y,Z)\textup{{CMSD}}(k+\ell,\ell,p,Y,Z).

Proof.

Again, Steps 11 and 22 take time poly(n)\textup{poly}(n), and step 33 takes time TCMSDT_{\textup{CMSD}}. In step 44, the algorithm runs Grover’s search, so this whole step takes time poly(n)O(Y)\textup{poly}(n)O(\sqrt{Y}). That can be done because the function on input ii determines whether wt(𝐞i)=wp{wt}\left(\mathbf{e}^{\prime}_{i}\right)=w-p runs in polynomial time (since ff runs in polynomial time). As we described above, we repeat the loop O(max{1ZP1,1})O\left(\sqrt{\max\left\{\frac{1}{ZP_{1}},1\right\}}\right) times, which gives the result. ∎

The full ISD algorithm.

To find the best ISD algorithm for solving SD(n,k,w)\textrm{SD}(n,k,w), we minimize the running time of the algorithm presented earlier over parameters p,,Y,p,\ell,Y, and ZZ. In many cases, we do not have full control over YY and ZZ, which are predetermined from other values. For instance, in Wagner’s algorithm, we present next, there is an extra parameter aa (the number of levels) that predetermines YY and ZZ, so we optimize over p,p,\ell, and aa.

5 Solving CMSD

This section presents our analysis of the application of Wagner’s algorithm [Wag02] to solving CMSD(N,m0N,ω0N,Y,Z)\textrm{CMSD}(N,m_{0}N,\omega_{0}N,Y,Z)(4)(4) (4) As Wagner’s algorithm is used for solving Generalized Birthday Problem, it can be easily seen that is well suited for solving CMSD problems, too.. We first present the list merging procedure, which we utilize throughout the section, and then the two versions of our algorithm: the first one that aims to solve the CMSD problem using classical algorithms only, and the second one that utilizes both classical and quantum algorithms.

Notice here the change of the variables’ names when referring to the CMSD problem. It is introduced so that our statements can be made independently of the previous section. Notice also that the asymptotic values of the algorithms’ running times are calculated when NN goes to ++\infty and that when presenting a proof, we ignore all the polynomial and constant terms.

5.1 List Merging

Let us take 33 lists of vectors in 𝔽qn\mathbb{F}_{q}^{n}: L1,L2L_{1},L_{2}, and LL. Take also a set J[n]J\subseteq[n] and a random vector 𝐭𝔽q|J|\mathbf{t}\in\mathbb{F}_{q}^{|J|}. The merging of L1L_{1} and L2L_{2} into LL is done using the following algorithm:

List merging algorithm.
  • Start from an empty list LL, and sort the elements of L1L_{1} according to the lexicographic order on the JJ coordinates.

  • For each vector 𝐲𝔽qn\mathbf{y}\in\mathbb{F}_{q}^{n} from the list L2L_{2}, search for elements 𝐱𝔽qn\mathbf{x}\in\mathbb{F}_{q}^{n} of L1L_{1} that satisfy: 𝐱|J=𝐲|J+𝐭|J\mathbf{x}_{|J}=\mathbf{y}_{|J}+\mathbf{t}_{|J}, where 𝐱|J=def(xj)jJ\mathbf{x}_{|J}\stackrel{{\scriptstyle\text{def}}}{{=}}(x_{j})_{j\in J}, 𝐲|J=def(yj)jJ\mathbf{y}_{|J}\stackrel{{\scriptstyle\text{def}}}{{=}}(y_{j})_{j\in J}, and 𝐭|J=def(tj)jJ\mathbf{t}_{|J}\stackrel{{\scriptstyle\text{def}}}{{=}}(t_{j})_{j\in J}. For each solution found, add 𝐱+𝐲\mathbf{x}+\mathbf{y} in LL and register the references to 𝐱\mathbf{x} and 𝐲\mathbf{y}.

Running time.

Sorting L1L_{1} on JJ coordinates is done in time O(log(|L1|))O(\log(|L_1|)) using dichotomic search. If there are s𝐲s_{\mathbf{y}} solutions for a fixed 𝐲\mathbf{y}, the algorithm takes O(s𝐲log(|L1|))O(s_{\mathbf{y}}\log(|L_1|)) time to find them, and the total size of LL is 𝐲s𝐲\sum_{\mathbf{y}}s_{\mathbf{y}}. Therefore, the algorithm takes time O~(|L1|)\widetilde{O}\left(|L_{1}|\right) for the first step, i.e., to sort L1L_{1}, and it takes O~(max{|L2|,is𝐲})\widetilde{O}\left(\max\{|L_{2}|,\sum_{i}s_{\mathbf{y}}\}\right) for the second step. Overall, the algorithm takes time O~(max{|L1|,|L2|,|L|})\widetilde{O}(\max\{|L_{1}|,|L_{2}|,|L|\}).

Expected number of solutions.

If the elements in L1L_{1} and L2L_{2} are random vectors in 𝔽qn\mathbb{F}_{q}^{n}, there is, on average, |L|=|L1||L2|q|J||L|=\frac{|L_{1}||L_{2}|}{q^{|J|}} elements in the merged list.

List merging operator.

To enable a succinct representation of this procedure in the rest of the text, we define the list merge operator on a set JJ and random vector 𝐭\mathbf{t}, denoted as J𝐭\bowtie_{J}^{\mathbf{t}}:

L=L1J𝐭L2={𝐱+𝐲:𝐱L1,𝐲L2,𝐱|J+𝐲|J=𝐭|J}.L=L_{1}\bowtie_{J}^{\mathbf{t}}L_{2}=\{\mathbf{x}+\mathbf{y}:\mathbf{x}\in L_{1},\mathbf{y}\in L_{2},\mathbf{x}_{|J}+\mathbf{y}_{|J}=\mathbf{t}_{|J}\}.

5.2 First Variant

We present here an approach to solving the CMSD problem, based on Wagner’s algorithm [Wag02], which utilizes classical algorithms only and is closely related to the original Wagner’s algorithm.

We start from relevant definitions. For a number of levels aa, where 2a|n2^{a}|n, and for each i[2a]i\in[2^{a}], we define:

i=def{𝐛𝔽qn:𝐛=(𝟎(i1)n/2a,𝐛i,𝟎(2ai)n/2a) with 𝐛i𝔽qn/2awt(𝐛i)=Nω0/2a},\mathscr{I}_{i}\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{b}\in\mathbb{F}_{q}^{n}:\mathbf{b}=(\mathbf{0}^{(i-1)n/2^{a}},\mathbf{b}_{i},\mathbf{0}^{(2^{a}-i)n/2^{a}})\textrm{ with }\mathbf{b}_{i}\in\mathbb{F}_{q}^{n/2^{a}}\wedge{wt}\left(\mathbf{b}_{i}\right)=N\omega_{0}/2^{a}\},
Lif\displaystyle L^{f}_{i} =def{𝐇𝐛}𝐛i,\displaystyle\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{H}\cdot\mathbf{b}\}_{\mathbf{b}\in\mathscr{I}_{i}},

where 𝐇\mathbf{H} is a parity check matrix, defined in Section 4.1.

The sets used for the indexing the lists in the merging procedure (as described in Section 5.1) are chosen so that they form a partition of [n][n], i.e.:

j,j[a],Jj[n],jJj=[n],JjJj=, when jj.\forall j,j^{\prime}\in[a],\quad J_{j}\subseteq[n],\quad\bigcup_{j}J_{j}=[n],\quad J_{j}\cap J_{j^{\prime}}=\emptyset,\text{ when }j\neq j^{\prime}.

The random vectors (again, described in Section 5.1) are chosen such that they satisfy the following constraint:

i[2a],j[a],𝐭ji𝔽qn,i(𝐭ji)|Jj=𝐬|Jj,\forall i\in[2^{a}],\quad\forall j\in[a],\quad\mathbf{t}_{j}^{i}\in\mathbb{F}_{q}^{n},\quad\sum_{i}(\mathbf{t}_{j}^{i})_{|J_{j}}=\mathbf{s}_{|J_{j}},

where 𝐬|Jj\mathbf{s}_{|J_{j}} refers to the syndrome, from Section 4.1, indexed by JjJ_{j}.

List creation and merging.

The algorithm starts by constructing 2a2^{a} lists of the same sizes: LiLifL_{i}\subseteq L^{f}_{i}, for all i[2a]i\in[2^{a}](6)(6) (6) There are previous description where Li=LifL_{i}=L^{f}_{i}, but the inclusion improves the algorithm efficiency.. At each algorithm’s level, the lists are then taken by pairs, {L2i1,L2i}\{L_{2i-1},L_{2i}\}, and merged using the list merging procedure described in the previous subsection. More precisely, at the first level, the pairs are merged on a set J1J_{1} and a random vector 𝐭1i{\mathbf{t}_{1}^{i}} (i.e., J1𝐭1i\bowtie_{J_{1}}^{\mathbf{t}_{1}^{i}} is performed). From the 2a12^{a-1} created lists, at the second level, pairs are taken again and merged similarly using the operator J2𝐭2i\bowtie_{J_{2}}^{\mathbf{t}_{2}^{i}}, for each i[2a2]i\in[2^{a-2}]. The same procedure continues up to the top level, where only 22 lists remain and the list merging is performed using Ja𝐭a1=𝐬|Ja\bowtie_{J_{a}}^{\mathbf{t}_{a}^{1}=\mathbf{s}_{|J_{a}}}. A function ff, required for the CMSD problem, is then constructed using the method described in Section 3.

One can check that the final list created by this algorithm contains solutions to the problem. In particular, elements of top level’s list are of the form 𝐇𝐛\mathbf{H}\cdot\mathbf{b}, with wt(𝐛)=Nω0wt(\mathbf{b})=N\omega_{0}. That comes from the property of the weight function we use (see Equation (1)) and the definitions given earlier in this subsection. An example of the algorithm for a=3a=3, i.e., three levels algorithm, is presented below.

Refer to caption
Figure 1: First variant of Wagner’s based algorithm for a=3a=3.
Proposition 3
(7)(7) (7) Notice that YY and ZZ in both propositions are determined by m0,ω0,m_{0},\omega_{0}, and aa and cannot be chosen arbitrarily.

Fix parameters m0,ω0m_{0},\omega_{0}, as well as a number of levels, aa. Let sω0=limn1nlogq(Snω0n)s_{\omega_{0}}=\lim_{n\rightarrow\infty}\frac{1}{n}\log_{q}(S^{n}_{n\omega_{0}}), u=min{sω02a,m0/a}u=\min\{\frac{s_{\omega_{0}}}{2^{a}},m_{0}/a\}, and x=m0(a1)ux=m_{0}-(a-1)u. The first variant of the algorithm on aa levels solves the CMSD(N,m0N,ω0N,Y,Z)\textup{{CMSD}}(N,m_{0}N,\omega_{0}N,Y,Z) problem in time TCMSDT_{\textup{CMSD}}, where

Z=qN(2ux+o(1)),TCMSD=qN(u+o(1)),Y=TCMSD,\displaystyle Z=q^{N(2u-x+o(1))},\ T_{\textup{CMSD}}=q^{N(u+o(1))},\ Y=T_{\textup{CMSD}},

and the o(1)o(1) hides an expression that goes to 00 as NN goes to ++\infty.

Proof.

Let us take all bottom list Li,,L2aL_{i},\dots,L_{2^{a}}, to be random subsets of size qNuq^{N{u}} of Lif,,L2afL_{i}^{f},\dots,L_{2^{a}}^{f}, respecitvely (8)(8) (8) Notice that limn1Nlogq|Lif|=limN1NlogqSNω0/2aN/2a=12asω0,\lim_{n\rightarrow\infty}\frac{1}{N}\log_{q}|L_{i}^{f}|=\lim_{N\rightarrow\infty}\frac{1}{N}\log_{q}S^{N/2^{a}}_{N\omega_{0}/2^{a}}=\frac{1}{2^{a}}s_{\omega_{0}}, so we can choose asymptotically any usω02au\leq\frac{s_{\omega_{0}}}{2^{a}}.. Without loss of generality, we also choose |Jj|=u|J_{j}|=u, for j[2a1]j\in[2^{a-1}], and |Ja|=x|J_{a}|=x. We thus have that Y=qNuY=q^{N{u}}. Furthermore, from the merging algorithm, described earlier in this subsection, we know that all the lists up to the top level are of size qNuq^{Nu}, and the list at the top level is of size qN(2ux)q^{N(2u-x)}. As all the elements in the final list are solutions to the original problem, we expect Z=qN(2ux)Z=q^{N(2u-x)} solutions, on average. All the list mergings take time qNuq^{Nu}, except the last one that takes time qN(2ux)q^{N(2u-x)}, hence TCMSD=max(qNu,qN(2ux))T_{CMSD}=\max(q^{Nu},q^{N(2u-x)}). From the proposition, we know that um0/au\leq m_{0}/a and x=m0(a1)ux=m_{0}-(a-1)u, which implies xm0/aux\geq m_{0}/a\geq u, and thus TCMSD=qNuT_{CMSD}=q^{Nu}. Therefore, we have an algorithm that finds Z=qN(2ux)Z=q^{N(2u-x)} solutions in time TCMSD=qNuT_{CMSD}=q^{Nu}, and for Y=TCMSD=qNuY=T_{CMSD}=q^{Nu}. ∎

5.3 Second Variant

Starting from the original Wagner’s algorithm [Wag02], we derive a quantum version of it and utilize it as part of an algorithm that solves the CMSD problem. Our results are presented in the rest of the section.

We start from relevant definitions. For a number of levels aa, where 2a+1|n2^{a+1}|n and, for each i[2a1]i\in[2^{a}-1], we define:

i=def{𝐛i𝔽qn:𝐛i=(𝟎(i1)n/(2a+1),𝐛i~,𝟎((2a+1)i)n/(2a+1)) with 𝐛i~𝔽qn/(2a+1)wt(𝐛i~)=Nω0/(2a+1)},\mathscr{I}_{i}\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{b}_{i}\in\mathbb{F}_{q}^{n}:\mathbf{b}_{i}=(\mathbf{0}^{(i-1)n/(2^{a}+1)},\widetilde{\mathbf{b}_{i}},\mathbf{0}^{((2^{a}+1)-i)n/(2^{a}+1)})\\ \textrm{ with }\widetilde{\mathbf{b}_{i}}\in\mathbb{F}_{q}^{n/(2^{a}+1)}\wedge{wt}\left(\widetilde{\mathbf{b}_{i}}\right)=N\omega_{0}/(2^{a}+1)\},
Lif\displaystyle L^{f}_{i} =def{𝐇𝐛i}𝐛ii.\displaystyle\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{H}\cdot\mathbf{b}_{i}\}_{\mathbf{b}_{i}\in\mathscr{I}_{i}}.

For i=2ai=2^{a}, we let:

2a=def{𝐛2a𝔽qn:𝐛2a=(𝟎(2a1)n/(2a+1),𝐛2a~) with 𝐛2a~𝔽q2n/(2a+1)wt(𝐛2a~)=2Nω0/(2a+1)},\mathscr{I}_{2^{a}}\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{b}_{2^{a}}\in\mathbb{F}_{q}^{n}:\mathbf{b}_{2^{a}}=(\mathbf{0}^{(2^{a}-1)n/(2^{a}+1)},\widetilde{\mathbf{b}_{2^{a}}})\\ \textrm{ with }\widetilde{\mathbf{b}_{2^{a}}}\in\mathbb{F}_{q}^{2n/(2^{a}+1)}\wedge{wt}\left(\widetilde{\mathbf{b}_{2^{a}}}\right)=2N\omega_{0}/(2^{a}+1)\},
L2af\displaystyle L^{f}_{2^{a}} =def{𝐇𝐛2a}𝐛2a2a,\displaystyle\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{H}\cdot\mathbf{b}_{2^{a}}\}_{\mathbf{b}_{2^{a}}\in\mathscr{I}_{2^{a}}},

In both cases, 𝐇\mathbf{H} is a parity check matrix, which is defined in Section 4.1.

Like in the first variant of the algorithm, the indexing sets, J1,,JaJ_{1},\dots,J_{a}, are chosen so that they form a partition of [n][n]. The random vectors, 𝐭ji𝔽qn\mathbf{t}_{j}^{i}\in\mathbb{F}_{q}^{n}, for all i[2a]i\in[2^{a}] and all j[a]j\in[a], also satisfy the same constraints as in the first variant (for more details, see Section 5.2).

In this variant, all the bottom lists, L1,,L2a1L_{1},\dots,L_{2^{a}-1}, are of the same sizes, except the rightmost one, L2aL_{2^{a}}, which is quadratically larger than the others. We thus change our definitions of LifL^{f}_{i} accordingly (see definitions above). In contrast to the first variant, the algorithm does not create the rightmost list. It computes and sorts the other lists in lexicographical order on the indices of corresponding JjJ_{j}, for all j[a]j\in[a] and, instead of creating the last list, it evaluates a function that describes the list, and then finds a corresponding element (if one exists) in the top list using an efficient (quantum) routine. For the rest of the lists, the algorithm use the same merging method as in the first variant (see Section 5.2). An example of the algorithm on three levels is presented below.

Let us now construct the function ff as it is required for the CMSD problem. First, let 𝐲2a1,,𝐲2aY\mathbf{y}^{1}_{2^{a}},\dots,\mathbf{y}^{Y}_{2^{a}} be the elements of L2aL_{2^{a}}, i.e., the elements of the bottom right list. For a fixed kk, we aim to find 𝐲1,,𝐲2a1\mathbf{y}^{\prime}_{1},\dots,\mathbf{y}^{\prime}_{2^{a}-1} that satisfy the following: for i[2a1]\forall i\in[2^{a}-1], 𝐲iLi\mathbf{y}^{\prime}_{i}\in L_{i} and i𝐲i+𝐲2ak=𝐬\sum_{i}\mathbf{y}^{\prime}_{i}+\mathbf{y}^{k}_{2^{a}}=\mathbf{s}. If they exist, for each ii, we find the associated 𝐛i\mathbf{b}_{i} (from the definition of i\mathscr{I}_{i} above) such that 𝐇𝐛i=𝐲i\mathbf{H}\mathbf{b}_{i}=\mathbf{y}^{\prime}_{i} and 𝐇𝐛2a=𝐲2ak\mathbf{H}\mathbf{b}_{2^{a}}=\mathbf{y}^{k}_{2^{a}}. If there are several such combinations, we take the first one according to the lexicographical order. Finally, let us take 𝐞k=i𝐛i\mathbf{e}_{k}=\sum_{i}\mathbf{b}_{i}, so that we have 𝐇𝐞k=𝐬\mathbf{H}\mathbf{e}_{k}=\mathbf{s}. We then define ff as follows:

f(k)={𝐞k, if such a vector exists, 𝟎, otherwise. f(k)=\left\{\begin{array}[]{l}\mathbf{e}_{k}\textrm{, if such a vector exists, }\\ \mathbf{0}\textrm{, otherwise. }\end{array}\right.

The function ff then can be described as follows. On an input kk, ff takes 𝐲2ak\mathbf{y}^{k}_{2^{a}}, from the list L2aL_{2^{a}}, and checks if it can be summed with 𝐲2ai\mathbf{y}^{\prime}_{2^{a}-i} from the left neighbouring list, L2aiL_{2^{a}-i}, so that they appear in the solution sum. Again, if we have several such combinations, we take any one of them, for example, the first one in lexicographical order. The function repeats that at each level until it fails (in which case it outputs 𝟎\mathbf{0}), or it arrives to the top list, where it outputs the corresponding 𝐞k\mathbf{e}_{k}.

Proposition 4

(7) Fix parameters m0,ω0m_{0},\omega_{0}, as well as a number of levels, aa. Let sω0=limn1nlogq(Snω0n)s_{\omega_{0}}=\lim_{n\rightarrow\infty}\frac{1}{n}\log_{q}(S^{n}_{n\omega_{0}}), u=min{sω02a+1,m0/a}u^{\prime}=\min\{\frac{s_{\omega_{0}}}{2^{a}+1},m_{0}/a\}, and x=m0(a1)ux=m_{0}-(a-1)u. The second variant of the algorithm on aa levels solves the CMSD(N,m0N,ω0N,Y,Z)\textup{{CMSD}}(N,m_{0}N,\omega_{0}N,Y,Z) problem in time TCMSDT_{\textup{CMSD}}, where

Z=qN(3ux+o(1)),TCMSD=qN(u+o(1)),Y=qN(2u+o(1)),\displaystyle Z=q^{N(3u^{\prime}-x+o(1))},\ T_{\textup{CMSD}}=q^{N(u^{\prime}+o(1))},\ Y=q^{N(2u^{\prime}+o(1))},

and the o(1)o(1) hides an expression that goes to 00 as NN goes to ++\infty.

Proof.

We choose lists L1,,L2a1L_{1},\dots,L_{2^{a}-1} to be random subsets of size qNuq^{Nu^{\prime}} of L1f,,L2a1fL_{1}^{f},\dots,L_{2^{a}-1}^{f}, respectively. We also choose L2aL_{2^{a}} so that is a random subset of L2afL_{2^{a}}^{f} and that it is of size qN2uq^{N2u^{\prime}}. Without loss of generality, we choose JjJ_{j} such that |Jj|=u|J_{j}|=u^{\prime}, for all j[2a1]j\in[2^{a-1}], and |Ja|=x|J_{a}|=x. We then have that Y=q2NuY=q^{2Nu^{\prime}}. After the list merging at each level up to the top one, the new lists are of expected size qNuq^{Nu^{\prime}}, except the rightmost one, at each level, that is of expected size qN2uq^{N2u^{\prime}}. At the top level, there is one list of the expected size qNuq^{Nu^{\prime}} and one of the expected size qN2uq^{N2u^{\prime}}. Since |Ja|=x|J_{a}|=x, the expected size of the top list, that is the expected number of solutions to be find by the algorithm, is Z=qN(3ux)Z=q^{N(3u^{\prime}-x)}. The time for which the algorithm finds ZZ solutions is calculated as follows. Constructing and sorting the lists to compute ff take time qN(u+o(1))q^{N(u^{\prime}+o(1))} (omitting the constant multiplicative term 2a2^{a}), but computing ff afterwards take polynomial time, so we finally have TCMSD=qN(u+o(1))T_{CMSD}=q^{N(u^{\prime}+o(1))}. The number of kk such that f(k)f(k) outputs a good solution is actually the size of LtopL^{top}, i.e., qN(3ux)q^{N(3u^{\prime}-x)} and, since f:[Y]𝔽qnf:[Y]\rightarrow\mathbb{F}_{q}^{n}, this proves our proposition. ∎

Refer to caption
Figure 2: Second variant of Wagner’s based algorithm for a=3a=3.
Final remarks.

Our ISD algorithm aims to solve an instance of CMSD(k+,,p,Y,Z)\textrm{CMSD}(k+\ell,\ell,p,Y,Z). That means we can use the above propositions to calculate the asymptotic running time of the algorithm described in section 4.1. We first define N=k+,m0=k+,N=k+\ell,m_{0}=\frac{\ell}{k+\ell}, and ω0=pk+,\omega_{0}=\frac{p}{k+\ell}, and then do the following: we plug Proposition 3 into Proposition 1, for the classical case, and plug Proposition 4 into Proposition 2, for the quantum case. We then optimize parameters of our ISD algorithm over k,k,\ell, and aa by minimizing the algorithm’s running. From the values of k,k,\ell, and aa, we finally extract YY and ZZ and obtain the asymptotic running time of the algorithm in both the classical and quantum case.

6 Computing Surface Area of a Sphere

We here rely primarily on the combinatorial approach presented in [Ast84]. Some of the other methods are shown in more recent papers as, for example, [GS91], [BB19], [WKH+21]. We decided to use the approach from [Ast84] as it enables us to derive a generic method for calculating the asymptotic value of the sphere surface area independently of the weight function and the alphabet size.

Proposition 5

Fix a parameter qq, and a weight function wtwt^{\prime} satisfying Equation 1. Let the set CC be defined as follows:

C=def{𝐜=(c1,,cq):i[q],ci,i=1qci=n,i=1qciwt(i)=w},C\stackrel{{\scriptstyle\text{def}}}{{=}}\{\mathbf{c}=(c_{1},\cdots,c_{q}):i\in[q],c_{i}\in\mathbb{N},\sum_{i=1}^{q}c_{i}=n,\sum_{i=1}^{q}c_{i}wt^{\prime}(i)=w\},

where w,wnmaxi{1,,q}wt(i).w\in\mathbb{N},\quad w\leq n\mathop{\max}\limits_{i\in\{1,\cdots,q\}}wt^{\prime}(i). The sphere surface area, and its corresponding asymptotic value when nn gows to ++\infty, are given by the following expressions:

Swn=𝐜C(n𝐜).S_{w}^{n}=\sum_{\mathbf{c}\in C}\binom{n}{\mathbf{c}}. (4)
sω=limn+maxcC(i=1qcinlogqcin).s_{\omega}=\mathop{\lim}\limits_{n\to+\infty}\max_{\textbf{c}\in C}\bigg(\sum_{i=1}^{q}-\frac{c_{i}}{n}\log_{q}{\frac{c_{i}}{n}}\bigg). (5)
Proof.

Let us first take a multiset of size nn where elements are taken from [q][q], and each element is repeated cic_{i} times, for each i[q]i\in[q]. The number of permutations of such a multiset is given by the multinomial coefficient, defined as (nc1,,cq)=defn!c1!cq!.{n\choose{c_{1},\dots,c_{q}}}\stackrel{{\scriptstyle\text{def}}}{{=}}\frac{n!}{c_{1}!\dotsc_{c_{q}}!}. This number corresponds to the number of vectors consisting of c1c_{1} ones, c2c_{2} twos, …, cqc_{q} values of qq. By the definition of the set CC, and the sphere surface area, we thus have Swn=𝐜C(n𝐜).S_{w}^{n}=\sum_{\mathbf{c}\in C}\binom{n}{\mathbf{c}}.

Given the classical combinatorial result for the number of multinomial coefficients for a fixed nn and qq, the size of a set CC, and thus the number of the elements in the sum, is upper bounded by (n+q1q1)\binom{n+q-1}{q-1}. The upper and lower bounds of SwnS_{w}^{n} are then given by max𝐜C(n𝐜)Swn(n+q1q1)max𝐜C(n𝐜).\mathop{\max}\limits_{\mathbf{c}\in C}\binom{n}{\mathbf{c}}\leq S_{w}^{n}\leq\binom{n+q-1}{q-1}\mathop{\max}\limits_{\mathbf{c}\in C}\binom{n}{\mathbf{c}}.

Following the same line of reasoning as in [Ast84], i.e., by taking logqlog_{q} of each part of the equation above, multiplying them by 1n\frac{1}{n}, where n+{n\to+\infty}, and using Stirling’s approximation we finally obtain: sω=limn+maxcC(i=1qcinlogqcin).s_{\omega}=\mathop{\lim}\limits_{n\to+\infty}\max_{\textbf{c}\in C}\bigg(\sum_{i=1}^{q}-\frac{c_{i}}{n}\log_{q}{\frac{c_{i}}{n}}\bigg).

This proposition can be observed as a generalization of the combinatorial approach presented in [Ast84] for any weight function and arbitrary alphabet size. Using the same reasoning, we calculate the asymptotic value of the sphere surface area, sωs_{\omega}, by reducing the Expression 5 to the following convex optimization problem:

Problem 3

Let 𝝀=(λ1,,λq)\boldsymbol{\lambda}=(\lambda_{1},...,\lambda_{q}), and λi+\lambda_{i}\in\mathbb{R}_{+} for each i[q]i\in[q].

  • Maximize: i=1qλilogqλi\quad-\sum_{i=1}^{q}\lambda_{i}\log_{q}{\lambda_{i}},

  • Subject to: i=1qλi=1,i=1qλiwt(i)=ω\quad\sum_{i=1}^{q}\lambda_{i}=1,\quad\sum_{i=1}^{q}\lambda_{i}wt^{\prime}(i)=\omega.

It can be easily verified that when replacing the optimization variable λi\lambda_{i} with ci/nc_{i}/n from (5)(5), the optimization problem remains convex. If we denote by 𝝀~=(λ~1,,λ~q)\tilde{\boldsymbol{\lambda}}=(\tilde{\lambda}_{1},...,\tilde{\lambda}_{q}) the solution of Problem 3, the asymptotic value of the sphere surface area is calculated as sω=i=1qλ~ilogqλ~i.s_{\omega}=-\sum_{i=1}^{q}\tilde{\lambda}_{i}\log_{q}{\tilde{\lambda}_{i}}. Notice here that we do not compute only the surface areas but also the typical weight pattern of words of Lee weight ww, i.e. the 𝐜C\mathbf{c}\in C that maximizes the quantity in Equation 5. This is necessary if we want to use this problem in Stern’s signature scheme.

It can be shown that Problem 3 belongs to the subclass of the convex optimization problems, namely the class of conic optimization problems [BV14]. As such, it is susceptible to solving via MOSEK solver [ApS21], so we utilize MOSEK as a primary computational tool. Nevertheless, to be solved via MOSEK, Problem 3 needs to be transformed so that it aligns with the standard form of conic optimization problems, as presented in the following problem:

Problem 4

Let λ=def(λ1,,λq)+q\mathbf{\lambda}\stackrel{{\scriptstyle\text{def}}}{{=}}(\lambda_{1},...,\lambda_{q})\in\mathbb{R}_{+}^{q} and τ=def(τ1,,τq)+q\mathbf{\tau}\stackrel{{\scriptstyle\text{def}}}{{=}}(\tau_{1},...,\tau_{q})\in\mathbb{R}_{+}^{q}.

  • Maximize: i=1qτi\quad\sum_{i=1}^{q}\tau_{i},

  • Subject to: i=1qλi=1,i=1qλiwt(i)=ω,(1,λ,τ)Kexp\quad\sum_{i=1}^{q}\lambda_{i}=1,\quad\sum_{i=1}^{q}\lambda_{i}\;wt^{\prime}(i)=\omega,\quad(1,\mathbf{\lambda},\mathbf{\tau})\in K_{exp}.

where the constraint (1,λ,τ)Kexp(1,\mathbf{\lambda},\mathbf{\tau})\in K_{exp} means that τiλilogqλi\tau_{i}\leq-\lambda_{i}\log_{q}\lambda_{i}, for each i[q]i\in[q].(11)(11) (11) The notation KexpK_{exp} comes from the MOSEK optimizer[ApS21] and represents the exponential convex cone. It can be easily verified that Problem 3 and Problem 4 are equivalent, hence finding a solution of either of the two yields the asymptotic value of the sphere surface area.

7 Results

We use our framework to compare SD with the Hamming and Lee weight. For q=2q=2 and q=3q=3, the weight functions are the same by their definitions. For q>3q>3, however, our numerical results show that the asymptotic complexities of the problem differ in these two cases and that the problem is indeed harder in the Lee weight case. We present here the comparison of the complexities of our classical ISD algorithm in the Lee and Hamming weight setting and in the parameter range that is interesting from the perspective of the hardest instances of the SD problem. It can be easily verified that the complexity of the hardest instances of the Lee SD problem is indeed higher than that of the hardest Hamming instances.

Figure 3: Comparison of the Hamming and Lee SD problem: for a fixed qq and RR, the exponents α\alpha s.t. Time=2αnTime=2^{\alpha n} are given as a function of ω\omega^{*}, where ω=ω\omega^{*}=\omega in the Hamming weight case, and ω=ωq/2\omega^{*}=\omega\lfloor q/2\rfloor in the Lee weight case.

In the rest of the analysis, we focus on the SD problem in Lee weight. The following plot illustrates some of the numerical results we obtain.

Figure 4: Hardness of the Lee SD problem: The exponents α\alpha of the binary asymptotic complexity, Time=2αnTime=2^{\alpha n}, of four ISD algorithms in Lee weight setting.

We observe that for any fixed qq and RR, the asymptotic complexity of our algorithms, as a function of ω\omega^{*}, has 22 local maxima: at some values ω[0,x)\omega^{*}_{-}\in[0,{x}) and ω+(x,q2]\omega^{*}_{+}\in({x},\lfloor\frac{q}{2}\rfloor], with x=q214qx=\frac{q^{2}-1}{4q}(12)(12) (12) This value corresponds to the average Lee weight of a vector chosen uniformly at random.. Moreover, these local maxima always satisfy:

ω\displaystyle\omega^{*}_{-} =ω[0,x) st. sω=(1R).\displaystyle=\omega\in[0,x)\textrm{ st. }{s}_{\omega}=(1-R).
ω+\displaystyle\omega^{*}_{+} ={ω(x,q2] st. sω=(1R) if such an ω exists footnotemark:   q2 otherwise.\displaystyle=\left\{\begin{tabular}[]{l}$\omega\in(x,\lfloor\frac{q}{2}\rfloor]\textrm{ st. }{s}_{\omega}=(1-R)\textrm{ if such an }\omega\textrm{ exists }$\\ $\lfloor\frac{q}{2}\rfloor\textrm{ otherwise.}$\end{tabular}\right.

This characterization of the local maxima is particularly useful when aiming to obtain the hardest instances of a problem. Namely, for a fixed qq, it allows us to find the RR that yields the hardest problem and then to check only the 22 corresponding weights, ω\omega_{-} and ω+\omega_{+}, to obtain the hardest instance. That makes our calculations more efficient, which becomes increasingly important as qq increases and the convex optimization part of the calculations becomes costly due to the number of constraints in Problem 3.

It is also important to notice here that many previous papers only consider the case ω\omega^{*}_{-} and miss out on very interesting parameter ranges where, for the lower values of qq, the problem is typically the hardest. Nevertheless, we also observe that as qq increases, the plots become symmetric between small weight and large weight. Therefore, we can expect that for relatively high values of qq the difference between the small and large weights would become negligible. However, we cannot verify this claim due to the high computational cost of such verification.

The properties we observe here hold for all ISD algorithms we consider, in both classical and quantum settings. However, it is worth noticing that while these seem to be a generic property of ISD algorithms, there might be other algorithms for which these properties do not hold.

Parameters for which the problem is the hardest.

To find the hardest instances of the problem, for a given qq, we rely on the observation about the local maxima, ω\omega^{*}_{-} and ω+\omega^{*}_{+}, and we optimize over RR to obtain the hardest instance. For the sake of simplicity, in Table 1, we present only the results of the analysis of the classical and quantum Wagner’s based ISD algorithms and remark that the other two ISD algorithms exhibit similar behaviour.

q Classical Wagner ISD complexity Quantum Wagner ISD complexity
RR ω/q/2\omega/\lfloor q/2\rfloor α\alpha α^\hat{\alpha} RR ω/q/2\omega/\lfloor q/2\rfloor α\alpha α^\hat{\alpha}
3 0.370 1.000 0.269 0.170 0.369 1.000 0.148 0.093
5 0.572 1.000 0.357 0.154 0.569 1.000 0.206 0.089
13 0.480 0.957 0.522 0.141 0.501 0.962 0.283 0.076
43 0.454 0.954 0.794 0.146 0.472 0.959 0.429 0.079
163 0.442 0.967 1.117 0.152 0.464 0.971 0.607 0.083
331 0.438 0.974 1.291 0.154 0.464 0.978 0.703 0.084
Table 1: Hardest instances of Lee SD problem: the asymptotic complexity exponents, α\alpha and α^\hat{\alpha}, correspond to the binary asymptotic complexity, Time=2αnTime=2^{\alpha n}, and qq-ary asymptotic complexity, Time=qα^nTime=q^{\hat{\alpha}n}, respectively.

It can be readily verified that the complexity of a problem, expressed as 2n(α+o(1))2^{n(\alpha+o(1))}, becomes higher as qq increases. That is expected since the inputs’ size also increases, and we do not get this extra difficulty for free. If, for example, we want to use this problem in Stern’s signature scheme, where the signature size essentially scales with the size of qq-ary vectors of size nn or nkn-k, this increase of the input size becomes relevant. Therefore, we propose the scaling where the complexity is of the form qn(α^+o(1))q^{n(\hat{\alpha}+o(1))} instead of 2n(α+o(1))2^{n(\alpha+o(1))}, and we refer to them as qq-ary asymptotic complexity and binary asymptotic complexity, respectively. Observing qq-ary complexity, the problem now is the hardest for q=3q=3. Intricately, qq-ary complexity diminishes and then increases again at some point as qq increases. Hence, it would be interesting to calculate the asymptotic qq-ary complexity when both qq and nn grows beyond bounds. We can also observe that while for q=3q=3 and q=5q=5 the optimal values were for ω=1\omega^{*}=1, this property does not hold for larger qq. Nevertheless, it remains in the range close to 11 (typically, in the range (0.95,1](0.95,1]). We can see, as well, that the hardest instances of the problem occur at the mid-range code rates and, typically, in the range (0.35,0.6)(0.35,0.6).

8 Conclusion

This paper analyzes different ISD algorithms, both in the classical and quantum regimes, for solving SD problems with varying sizes of alphabet and different weight functions. In the numerical part of the paper, we focused on analyzing the Hamming and Lee weight cases as representative examples of weight functions.

Our results show that, for a fixed alphabet size q>3q>3, the complexity of the hardest instances of SD problem is higher in the Lee than in the Hamming weight, as well as that the hardest instances occur at high weights. That is true both in the classical and quantum setting. We also show that the problem remains exponentially hard for conveniently chosen parameters both in the classical and quantum setting for the class of the algorithms we consider. Finally, for a fixed alphabet size, we offer a rough estimate of the parameters’ ranges for which the SD problem in Lee weight is typically the hardest.

These results have several implications for designers that want classical and quantum security estimates for their code-based schemes using different weight functions as, for example, for WAVE or other recently proposed schemes[BBC+20a]. For the quantum setting, our algorithms have almost a quadratic improvement over the classical setting, so it is important to update the parameters if we want to achieve quantum security.

Acknowledgments.

The authors want to thank Nicolas Sendrier and Anthony Leverrier for helpful discussions. S.E. has received funding from the European Union’s Horizon 2020 research and innovation program under the Marie Skłodowska-Curie grant agreement No 754362.

[Uncaptioned image]

References

  • [ApS21] MOSEK ApS. MOSEK Fusion API for C++. Version Release 9.2.38., 2021.
  • [Ast84] Jaakko Astola. On the asymptotic behaviour of lee-codes. Discret. Appl. Math., 8(1):13–23, 1984.
  • [Bar97] Alexander Barg. Complexity issues in coding theory. Electronic Colloquium on Computational Complexity, October 1997.
  • [BB19] S. Bhattacharya and A. Banerjee. A method to find the volume of a sphere in the lee metric, and its applications. In 2019 IEEE International Symposium on Information Theory (ISIT), pages 872–876, 2019.
  • [BBB+20] Magali Bardet, Pierre Briaud, Maxime Bros, Philippe Gaborit, Vincent Neiger, Olivier Ruatta, and Jean-Pierre Tillich. An algebraic attack on rank metric code-based cryptosystems. In Advances in Cryptology - EUROCRYPT 2020, volume 12107, pages 64–93. Springer, 2020.
  • [BBC+20a] Marco Baldi, Massimo Battaglioni, Franco Chiaraluce, Anna-Lena Horlemann-Trautmann, Edoardo Persichetti, Paolo Santini, and Violetta Weger. A new path to code-based signatures via identification schemes with restricted errors. CoRR, 2020.
  • [BBC+20b] Magali Bardet, Maxime Bros, Daniel Cabarcas, Philippe Gaborit, Ray A. Perlner, Daniel Smith-Tone, Jean-Pierre Tillich, and Javier A. Verbel. Improvements of algebraic attacks for solving the rank decoding and minrank problems. In Advances in Cryptology - ASIACRYPT 2020, volume 12491, pages 507–536. Springer, 2020.
  • [BCDL19] Rémi Bricout, André Chailloux, Thomas Debris-Alazard, and Matthieu Lequesne. Ternary syndrome decoding with large weights. SAC 2019, 2019.
  • [BH97] Gilles Brassard and Peter Høyer. An exact quantum polynomial-time algorithm for simon’s problem. In Fifth Israel Symposium on Theory of Computing and Systems, ISTCS 1997, Ramat-Gan, Israel, June 17-19, 1997, Proceedings, pages 12–23. IEEE Computer Society, 1997.
  • [BJMM12] Anja Becker, Antoine Joux, Alexander May, and Alexander Meurer. Decoding random binary linear codes in 2n/202^{n/20}: How 1+1=01+1=0 improves information set decoding. In Advances in Cryptology - EUROCRYPT 2012, LNCS. Springer, 2012.
  • [BMvT78] Elwyn Berlekamp, Robert McEliece, and Henk van Tilborg. On the inherent intractability of certain coding problems. IEEE Trans. Inform. Theory, 24(3):384–386, May 1978.
  • [BV14] Stephen P. Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University Press, 2014.
  • [Coo00] Colin Cooper. On the distribution of rank of a random matrix over a finite field. Random Struct. Algorithms, 17:197–212, 10 2000.
  • [DST19] Thomas Debris-Alazard, Nicolas Sendrier, and Jean-Pierre Tillich. Wave: A new family of trapdoor one-way preimage sampleable functions based on codes. In Advances in Cryptology - ASIACRYPT 2019, LNCS, Kobe, Japan, December 2019. Springer.
  • [Dum91] Ilya Dumer. On minimum distance decoding of linear codes. In Proc. 5th Joint Soviet-Swedish Int. Workshop Inform. Theory, pages 50–52, Moscow, 1991.
  • [Gro96] Lov K. Grover. A fast quantum mechanical algorithm for database search. In Gary L. Miller, editor, Proceedings of the Twenty-Eighth Annual ACM Symposium on the Theory of Computing, Philadelphia, Pennsylvania, USA, May 22-24, 1996, pages 212–219. ACM, 1996.
  • [GS91] Danièle Gardy and Patrick Solé. Saddle point techniques in asymptotic coding theory. In Algebraic Coding, First French-Soviet Workshop,, volume 573, pages 75–81. Springer, 1991.
  • [KT17] Ghazal Kachigar and Jean-Pierre Tillich. Quantum information set decoding algorithms. In Post-Quantum Cryptography 2017, volume 10346 of LNCS, Utrecht, The Netherlands, June 2017. Springer.
  • [MMT11] Alexander May, Alexander Meurer, and Enrico Thomae. Decoding random linear codes in O(20.054n)O(2^{0.054n}). In Advances in Cryptology - ASIACRYPT 2011, volume 7073 of LNCS, pages 107–124. Springer, 2011.
  • [MO15] Alexander May and Ilya Ozerov. On computing nearest neighbors with applications to decoding of binary linear codes. In E. Oswald and M. Fischlin, editors, Advances in Cryptology - EUROCRYPT 2015, volume 9056 of LNCS, pages 203–228. Springer, 2015.
  • [NC00] Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press, 2000.
  • [Pra62] Eugene Prange. The use of information sets in decoding cyclic codes. IRE Transactions on Information Theory, 8(5):5–9, 1962.
  • [Ste88] Jacques Stern. A method for finding codewords of small weight. In G. D. Cohen and J. Wolfmann, editors, Coding Theory and Applications, volume 388 of LNCS, pages 106–113. Springer, 1988.
  • [Wag02] David A. Wagner. A generalized birthday problem. In Moti Yung, editor, Advances in Cryptology - CRYPTO 2002, volume 2442 of Lecture Notes in Computer Science, pages 288–303. Springer, 2002.
  • [WKH+21] Violetta Weger, Karan Khathuria, Anna-Lena Horlemann, Massimo Battaglioni, Paolo Santini, and Edoardo Persichetti. On the hardness of the lee syndrome decoding problem. 2021. arXiv quant-ph 2002.12785.