% \section{Stern-like Proofs}
% \addcontentsline{tof}{section}{\protect\numberline{\thesection} Preuves à la Stern}
% \label{sse:stern}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

On the other hand, Stern's protocol has been originally introduced in the context of code-base cryptography~\cite{Ste96}.
\index{Syndrome Decoding Problem}
Initially, it was introduced for Syndrome Decoding Problem (\SDP): given a matrix $\mathbf P \in \FF_2^{n \times m}$ and a syndrome $\mathbf v \in \FF_2^n$, the goal is to find a binary vector $\mathbf x \in \FF_2^m$ with fixed hamming weight $w$ such that $\mathbf P \cdot \mathbf x = \mathbf v \bmod 2$.

The proof is mainly combinatorial and relies on the fact that applying a permutation on a binary vector leaves its Hamming weight invariant.
% TODO

This problem shows similarities with the $\ISIS$ problem defined in \cref{de:sis} where the constraints on the norm of $\mathbf x$ is a constraint on Hamming weight, and operations are in $\FF_2$ instead of $\Zq$.

After the first works of Kawachi, Tanaka and Xagawa~\cite{KTX08} that extended Stern's proofs to statements $\bmod q$, the work of Ling, Nguyen, Stehlé and Wang~\cite{LNSW13} enables the use of Stern's protocol to prove general $\SIS$ or $\LWE$ statements (meaning the knowledge of a solution to these problems).
These advances in the expressivity of Stern-like protocols has been used to further improve it and therefore enable privacy-based primitives for which no constructions existed in the post-quantum world, such as dynamic group signatures~\cite{LLM+16}, group encryption~\cite{LLM+16a}, electronic cash~\cite{LLNW17}, etc.

In this Section, we describe in a high-level view how Stern's protocol works, and then we detail it.

\subsection{Abstraction of Stern's Protocol}
\addcontentsline{tof}{subsection}{\protect\numberline{\thesubsection} Abstraction du protocole de Stern}

%%%% TODO


Let $K$, $D$, $q$ be positive integers with $D \geq K$ and $q \geq 2$, and let $\mathsf{VALID}$ be a subset of $\mathbb{Z}^D$. Suppose that $\mathcal{S}$ is a finite set such that   every $\phi \in \mathcal{S}$ can be associated with a permutation $\Gamma_\phi$ of $D$ elements  satisfying the following conditions:
\begin{eqnarray}\label{eq:zk-equivalence}
\begin{cases}
\mathbf{w} \in \mathsf{VALID} \hspace*{2.5pt} \Longleftrightarrow \hspace*{2.5pt} \Gamma_\phi(\mathbf{w}) \in \mathsf{VALID}, \\
\text{If } \mathbf{w} \in \mathsf{VALID} \text{ and } \phi \text{ is uniform in } \mathcal{S}, \text{ then }  \Gamma_\phi(\mathbf{w}) \text{ is uniform in } \mathsf{VALID}.~~~~~
\end{cases}
\end{eqnarray}
We aim to construct a statistical \textsf{ZKAoK} for the following abstract relation:
\begin{eqnarray*}
\mathrm{R_{abstract}} = \big\{ \big((\mathbf{M}, \mathbf{v}), \mathbf{w} \big) \in \mathbb{Z}_q^{K \times D} \times \mathbb{Z}_q^D \times \mathsf{VALID}: \mathbf{M}\cdot \mathbf{w} = \mathbf{v} \bmod q.\big\}
\end{eqnarray*}

Note that, Stern's original protocol corresponds to the special case when $\mathsf{VALID} = \{
\mathbf{w} \in \{0,1\}^D: \mathsf{wt}(\mathbf{w}) = k\}$, where $\mathsf{wt}(\cdot)$ denotes the Hamming weight and $k < D$ is a given integer, $\mathcal{S} = \mathcal{S}_D$ is  the set of all permutations of~$D$ elements and $\Gamma_{\phi}(\mathbf{w}) = \phi(\mathbf{w})$.

The conditions in \eqref{eq:zk-equivalence} play a crucial role in proving in \textsf{ZK} that $\mathbf{w} \in \mathsf{VALID}$. To this end, the prover samples a random $\phi \hookleftarrow U(\mathcal{S})$ and lets the verifier check that $\Gamma_\phi(\mathbf{w}) \in \mathsf{VALID}$ without learning any additional information about $\mathbf{w}$ due to the randomness of $\phi$. Furthermore, to prove in a zero-knowledge manner that the linear equation is satisfied, the prover samples a masking vector $\mathbf{r}_w \hookleftarrow U(\mathbb{Z}_q^D)$, and convinces the verifier instead that $\mathbf{M}\cdot (\mathbf{w} + \mathbf{r}_w) = \mathbf{M}\cdot \mathbf{r}_w + \mathbf{v} \bmod q.$


The interaction between prover $\mathcal{P}$ and verifier $\mathcal{V}$ is described in Figure~\ref{Figure:Interactive-Protocol}. The protocol uses a statistically hiding and computationally binding string commitment scheme \textsf{COM} (e.g., the \textsf{SIS}-based scheme from~\cite{KTX08}).


\begin{figure}[!htbp]

  \small
  \begin{enumerate}
    \item \textbf{Commitment:} Prover samples $\mathbf{r}_w \leftarrow U(\mathbb{Z}_q^D)$, $\phi \leftarrow  U(\mathcal{S})$ and randomnesses $\rho_1, \rho_2, \rho_3$ for $\mathsf{COM}$.
      Then he sends $\mathrm{CMT}= \big(C_1, C_2, C_3\big)$ to the verifier, where
      \begin{gather*}
        C_1 =  \mathsf{COM}(\phi, \mathbf{M}\cdot \mathbf{r}_w \bmod q; \rho_1), \hspace*{5pt}
        C_2 =  \mathsf{COM}(\Gamma_{\phi}(\mathbf{r}_w); \rho_2), \\
        C_3 =  \mathsf{COM}(\Gamma_{\phi}(\mathbf{w} + \mathbf{r}_w \bmod q); \rho_3).
      \end{gather*}

    \item \textbf{Challenge:} The verifier sends a challenge $Ch \leftarrow U(\{1,2,3\})$ to the prover.
    \item \textbf{Response:} Depending on $Ch$, the prover sends $\mathrm{RSP}$ computed as follows:
      \smallskip
      \begin{itemize}
        \item $Ch = 1$: Let $\mathbf{t}_{w} = \Gamma_{\phi}(\mathbf{w})$, $\mathbf{t}_{r} = \Gamma_{\phi}(\mathbf{r}_w)$, and $\mathrm{RSP} = (\mathbf{t}_w, \mathbf{t}_r, \rho_2, \rho_3)$. \smallskip

        \item $Ch = 2$: Let $\phi_2 = \phi$, $\mathbf{w}_2 = \mathbf{w} + \mathbf{r}_w \bmod q$, and
          $\mathrm{RSP} = (\phi_2, \mathbf{w}_2, \rho_1, \rho_3)$. \smallskip
        \item $Ch = 3$: Let $\phi_3 = \phi$, $\mathbf{w}_3 = \mathbf{r}_w$, and
          $\mathrm{RSP} = (\phi_3, \mathbf{w}_3, \rho_1, \rho_2)$.
      \end{itemize}
  \end{enumerate}
  \textbf{Verification:}  Receiving $\mathrm{RSP}$, the verifier proceeds as follows:
  \smallskip
%\vspace{-0.25cm}
  \begin{itemize}%[leftmargin=0.2cm,itemindent=.2cm,labelwidth=\itemindent,labelsep=0.2cm,align=left]
    \item $Ch = 1$: Check that
      \begin{gather*}
        \mathbf{t}_w \in \mathsf{VALID},\\
        C_2 = \mathsf{COM}(\mathbf{t}_r; \rho_2), \qquad
        {C}_3 = \mathsf{COM}(\mathbf{t}_w + \mathbf{t}_r \bmod q; \rho_3).
      \end{gather*}

    \item $Ch = 2$: Check that 
      \[
        C_1 = \mathsf{COM}(\phi_2, \mathbf{M}\cdot \mathbf{w}_2 - \mathbf{v} \bmod q; \rho_1),\qquad
        {C}_3 = \mathsf{COM}(\Gamma_{\phi_2}(\mathbf{w}_2); \rho_3).
      \]

    \item $Ch = 3$: Check that
      \[
        C_1 =  \mathsf{COM}(\phi_3, \mathbf{M}\cdot \mathbf{w}_3; \rho_1), \qquad
        C_2 =  \mathsf{COM}(\Gamma_{\phi_3}(\mathbf{w}_3); \rho_2).
      \]

  \end{itemize}
  In each case, the verifier outputs $1$ if and only if all the conditions hold.
%\rule{0pt}{3ex}
  \caption{Stern-like \textsf{ZKAoK} for the relation $\mathrm{R_{abstract}}$.}
  \label{Figure:Interactive-Protocol}
\end{figure}
%The properties of the given protocol are summarized in Theorem~\ref{Theorem:zk-protocol}.

\begin{theorem}\label{Theorem:zk-protocol}
The protocol in Figure~\ref{Figure:Interactive-Protocol} is a statistical \emph{\textsf{ZKAoK}} with perfect completeness, soundness error~$2/3$, and communication cost~$\mathcal{O}(D\log q)$. Namely:
\begin{itemize}
\item There exists a polynomial-time simulator that, on input $(\mathbf{M}, \mathbf{v})$, outputs an accepted transcript statistically close to that produced by the real prover.
\item There exists a polynomial-time knowledge extractor that, on input a commitment $\mathrm{CMT}$ and $3$ valid responses $(\mathrm{RSP}_1,\mathrm{RSP}_2,\mathrm{RSP}_3)$ to all $3$ possible values of the challenge $Ch$, outputs $\mathbf{w}' \in \mathsf{VALID}$ such that $\mathbf{M}\cdot \mathbf{w}' = \mathbf{v} \bmod q.$
\end{itemize}
\end{theorem}
The proof of the theorem relies on standard simulation and extraction techniques for Stern-like protocols~\cite{KTX08,LNSW13,LLM+16}.
\vspace{-0.1 cm}


%%%% END TODO
