<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Security on kenji.blog</title><link>http://kenji.blog/en/categories/security/</link><description>Recent content in Security on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>kenjinote</copyright><lastBuildDate>Fri, 11 Sep 2026 21:00:00 +0900</lastBuildDate><atom:link href="http://kenji.blog/en/categories/security/index.xml" rel="self" type="application/rss+xml"/><item><title>Mathematical Intuition of Lattice-based Cryptography</title><link>http://kenji.blog/en/p/lattice-based-cryptography-math-intuition/</link><pubDate>Fri, 11 Sep 2026 21:00:00 +0900</pubDate><guid>http://kenji.blog/en/p/lattice-based-cryptography-math-intuition/</guid><description>&lt;img src="http://kenji.blog/p/lattice-based-cryptography-math-intuition/img/eyecatch.jpg" alt="Featured image of post Mathematical Intuition of Lattice-based Cryptography" />&lt;h1 id="1-introduction-the-dawn-of-post-quantum-cryptography-pqc-and-the-rise-of-lattice-based-cryptography">1. Introduction: The Dawn of Post-Quantum Cryptography (PQC) and the Rise of Lattice-based Cryptography
&lt;/h1>&lt;p>The digital infrastructure of modern society is supported by public-key cryptography technologies such as RSA cryptography and Elliptic Curve Cryptography (ECC). These cryptographic schemes base their security on the mathematical difficulty of problems like the &amp;ldquo;prime factorization problem&amp;rdquo; and the &amp;ldquo;discrete logarithm problem,&amp;rdquo; which are believed to be inefficient (requiring exponential time) to solve with conventional classical computers.&lt;/p>
&lt;p>However, &amp;ldquo;Shor&amp;rsquo;s algorithm,&amp;rdquo; published by Peter Shor in 1994, sent shockwaves through the cryptographic world. This algorithm mathematically proved that once a large-scale quantum computer is realized, it would be able to solve the prime factorization problem and the discrete logarithm problem in polynomial time. This means that the widely used public-key cryptography of today will become completely decipherable in the future.&lt;/p>
&lt;p>To counter such a &amp;ldquo;Quantum Threat,&amp;rdquo; research into new cryptographic schemes that are difficult to break even with quantum computers became an urgent task. This field is called &amp;ldquo;Post-Quantum Cryptography (PQC)&amp;rdquo; or &amp;ldquo;quantum-resistant cryptography.&amp;rdquo;&lt;/p>
&lt;p>There are several strong candidates for PQC. Examples include hash-based cryptography, code-based cryptography, multivariate polynomial cryptography, and isogeny-based cryptography. Among them, &amp;ldquo;Lattice-based cryptography&amp;rdquo; is currently attracting the most attention and is at the center of the PQC standardization process by NIST (National Institute of Standards and Technology). Compared to other methods, lattice-based cryptography has extremely fast encryption and decryption processing speeds, and it has the outstanding feature of an extremely strong security proof in cryptographic theory: a reduction from &amp;ldquo;worst-case complexity&amp;rdquo; to &amp;ldquo;average-case complexity.&amp;rdquo;&lt;/p>
&lt;p>In this article, starting from the mathematical definition of a &amp;ldquo;Lattice,&amp;rdquo; which is the foundation of lattice-based cryptography, we will thoroughly and deeply explain difficult problems on lattices such as SVP (Shortest Vector Problem) and CVP (Closest Vector Problem), and the &amp;ldquo;LWE (Learning With Errors) problem,&amp;rdquo; which can be said to be the heart of modern lattice-based cryptography, using mathematical formulas, geometric intuition, and specific numerical examples.&lt;/p>
&lt;h1 id="2-mathematical-definition-and-geometric-intuition-of-a-lattice">2. Mathematical Definition and Geometric Intuition of a Lattice
&lt;/h1>&lt;h2 id="21-vector-spaces-and-lattices">2.1 Vector Spaces and Lattices
&lt;/h2>&lt;p>In mathematics, a &amp;ldquo;Lattice&amp;rdquo; is a set of discrete points arranged regularly in an $n$-dimensional real vector space $\mathbb{R}^n$. It is similar to a Vector Space learned in linear algebra, but there is a crucial difference. While a vector space is a continuous space represented by a linear combination of basis vectors with &amp;ldquo;real coefficients,&amp;rdquo; a lattice is a discrete space represented by a linear combination of basis vectors with &amp;ldquo;integer coefficients.&amp;rdquo;&lt;/p>
&lt;p>Let&amp;rsquo;s give a strict mathematical definition. Consider $n$ ($n \le m$) linearly independent vectors $\mathbf{b}_1, \mathbf{b}_2, \dots, \mathbf{b}_n$ in an $m$-dimensional real vector space $\mathbb{R}^m$. Let a matrix having these vectors as column vectors be $B = [\mathbf{b}_1, \mathbf{b}_2, \dots, \mathbf{b}_n] \in \mathbb{R}^{m \times n}$. This $B$ is called the &amp;ldquo;Basis&amp;rdquo; of the lattice.&lt;/p>
&lt;p>The lattice $\mathcal{L}(B)$ generated by this basis $B$ is defined as follows:&lt;/p>
$$
\mathcal{L}(B) = \left\{ \sum_{i=1}^{n} x_i \mathbf{b}_i \mathrel{\bigg|} x_i \in \mathbb{Z} \right\} = \{ B \mathbf{x} \mid \mathbf{x} \in \mathbb{Z}^n \}
$$
&lt;p>What is important here is that the coefficients $x_i$ are limited to integers $\mathbb{Z}$, not real numbers $\mathbb{R}$. As a result, rather than a continuous space with infinitely many points, a &amp;ldquo;set of discrete points&amp;rdquo; like equally spaced intersections is formed.&lt;/p>
&lt;h2 id="22-geometric-image">2.2 Geometric Image
&lt;/h2>&lt;p>Let&amp;rsquo;s consider an example of a 2-dimensional plane $\mathbb{R}^2$. When $\mathbf{b}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ and $\mathbf{b}_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ are chosen as basis vectors, the lattice generated by them is the set of all integer coordinates $(x, y) \in \mathbb{Z}^2$ on the coordinate plane. This is the simplest &amp;ldquo;square lattice.&amp;rdquo;&lt;/p>
&lt;p>However, lattices are not always orthogonal. For example, considering the basis $\mathbf{b}_1 = \begin{pmatrix} 2 \\ 1 \end{pmatrix}$ and $\mathbf{b}_2 = \begin{pmatrix} 1 \\ 3 \end{pmatrix}$, the generated points become like the intersections of an obliquely skewed mesh.&lt;/p>
&lt;h2 id="23-non-uniqueness-of-the-basis-and-unimodular-transformations">2.3 Non-uniqueness of the Basis and Unimodular Transformations
&lt;/h2>&lt;p>There is an important property related to the foundation of the security of lattice-based cryptography. That is, &amp;ldquo;there are infinitely many bases that generate the same lattice.&amp;rdquo;&lt;/p>
&lt;p>For example, the $\mathbb{Z}^2$ lattice generated by the previous basis $\mathbf{b}_1 = (1, 0)^T, \mathbf{b}_2 = (0, 1)^T$ can be generated as exactly the same lattice $\mathbb{Z}^2$ using the basis $\mathbf{b}'_1 = (1, 1)^T, \mathbf{b}'_2 = (2, 3)^T$.&lt;/p>
&lt;p>The necessary and sufficient condition for a basis $B$ and another basis $B'$ to generate the same lattice is that there exists a matrix with integer components $U \in \mathbb{Z}^{n \times n}$ whose determinant is $\det(U) = \pm 1$, and it can be expressed as:
&lt;/p>
$$ B' = B U $$
&lt;p>
Such a matrix $U$ is called a &amp;ldquo;Unimodular matrix.&amp;rdquo;&lt;/p>
&lt;p>The basic idea in its application to cryptography is to use a &amp;ldquo;good basis&amp;rdquo; (a basis that is close to orthogonal and consists of short vectors) as a secret key, and a &amp;ldquo;bad basis&amp;rdquo; (a basis that is extremely skewed relative to each other and consists of very long vectors) as a public key. It becomes very difficult to calculate a good basis from a bad basis as the dimension increases. This is the basic intuition behind lattice-based cryptography.&lt;/p>
&lt;h1 id="3-computationally-hard-problems-in-lattices">3. Computationally Hard Problems in Lattices
&lt;/h1>&lt;p>The security of lattice-based cryptography depends on the difficulty of solving specific mathematical problems on lattices. Here, we introduce the two most fundamental and famous problems.&lt;/p>
&lt;h2 id="31-shortest-vector-problem-svp">3.1 Shortest Vector Problem (SVP)
&lt;/h2>&lt;p>SVP is the most classical and famous problem in lattice theory.&lt;/p>
&lt;p>&lt;strong>Definition (SVP):&lt;/strong>
Given an arbitrary lattice basis $B$, find the vector $\mathbf{v}$ with the minimum Euclidean norm (length) among the non-zero vectors belonging to that lattice $\mathcal{L}(B)$.&lt;/p>
&lt;p>Expressed mathematically, it is the problem of finding $\mathbf{v}$ such that $\min_{\mathbf{v} \in \mathcal{L}(B) \setminus \{\mathbf{0}\}} \| \mathbf{v} \|$. This minimum length is written as $\lambda_1(\mathcal{L})$ and is called the &amp;ldquo;first successive minimum&amp;rdquo; of the lattice.&lt;/p>
&lt;p>In lower dimensions such as 2D or 3D, you can draw a figure and visually find the shortest vector. Alternatively, it can be efficiently solved using algorithms like Gauss&amp;rsquo;s lattice reduction algorithm. However, when the dimension $n$ becomes a high dimension such as hundreds to thousands, it is known that strictly solving SVP is NP-hard.&lt;/p>
&lt;p>In actual cryptography, instead of the strict shortest vector, an approximate SVP ($\gamma$-SVP) is used, which finds an &amp;ldquo;approximately short vector.&amp;rdquo; When the approximation factor $\gamma$ is of polynomial size, this problem is still considered very difficult.&lt;/p>
&lt;h2 id="32-closest-vector-problem-cvp">3.2 Closest Vector Problem (CVP)
&lt;/h2>&lt;p>CVP is also an extremely important problem in lattice-based cryptography.&lt;/p>
&lt;p>&lt;strong>Definition (CVP):&lt;/strong>
Given an arbitrary lattice basis $B$ and an arbitrary target vector $\mathbf{t} \in \mathbb{R}^m$ in space (which is not necessarily a lattice point), find the lattice point $\mathbf{v} \in \mathcal{L}(B)$ that is closest to $\mathbf{t}$ among the lattice points.&lt;/p>
&lt;p>Expressed mathematically, it is the problem of searching for a lattice point $\mathbf{v}$ such that $\min_{\mathbf{v} \in \mathcal{L}(B)} \| \mathbf{v} - \mathbf{t} \|$.&lt;/p>
&lt;p>Like SVP, CVP is also NP-hard in high dimensions. From the perspective of application to cryptography, the LWE problem described later is closely related to a special variant of this CVP (Bounded Distance Decoding: BDD).&lt;/p>
&lt;h2 id="33-why-are-they-unsolvable-in-high-dimensions-limits-of-lll-and-bkz">3.3 Why Are They Unsolvable in High Dimensions? (Limits of LLL and BKZ)
&lt;/h2>&lt;p>A famous algorithm for solving high-dimensional lattice problems is the LLL algorithm (Lenstra-Lenstra-Lovász algorithm). The LLL algorithm operates in polynomial time and can reduce a lattice basis to a &amp;ldquo;good basis&amp;rdquo; to some extent. However, since the shortest vector found by the LLL algorithm has an exponential approximation factor ($2^{\mathcal{O}(n)}$) relative to the length of the true shortest vector, it is not enough to break the security of the cryptography.&lt;/p>
&lt;p>By using a more powerful basis reduction algorithm such as the BKZ (Block Korkine-Zolotarev) algorithm, which is an improvement over LLL, a shorter vector can be found, but its computational complexity increases exponentially with respect to the block size. In lattice-based cryptography, secure parameters (such as the size of the dimension $n$) are determined by estimating the execution time of this BKZ algorithm. In current PQC standard parameters, values of dimension $n$ from 500 to over 1000 are chosen, and it is said that it would take more than the age of the universe to decrypt even if supercomputers or future quantum computers were used.&lt;/p>
&lt;h1 id="4-mathematical-formulation-of-the-lwe-learning-with-errors-problem">4. Mathematical Formulation of the LWE (Learning With Errors) Problem
&lt;/h1>&lt;p>Most of modern lattice-based cryptography is based on the &amp;ldquo;LWE (Learning With Errors) problem&amp;rdquo; proposed by Oded Regev in 2005. The beauty of the LWE problem lies in the simplicity of its formulation and the fact that it has a powerful mathematical proof of &amp;ldquo;reduction from worst-case to average-case complexity.&amp;rdquo;&lt;/p>
&lt;h2 id="41-systems-of-linear-equations-without-noise">4.1 Systems of Linear Equations Without Noise
&lt;/h2>&lt;p>To understand the LWE problem, let&amp;rsquo;s first consider a simple system of linear equations without noise.
Suppose there is an unknown secret vector $\mathbf{s} \in \mathbb{Z}_q^n$ (each component is an integer from $0$ to $q-1$). Here, $q$ is assumed to be a prime number.&lt;/p>
&lt;p>Choose random coefficient vectors $\mathbf{a}_1, \mathbf{a}_2, \dots \in \mathbb{Z}_q^n$, and calculate their inner product with the secret vector $\mathbf{s}$ modulo $q$.
$b_1 = \langle \mathbf{a}_1, \mathbf{s} \rangle \pmod q$
$b_2 = \langle \mathbf{a}_2, \mathbf{s} \rangle \pmod q$
$\vdots$&lt;/p>
&lt;p>Given a sufficient number (at least $n$) of pairs $(\mathbf{a}_i, b_i)$, we can easily recover the secret vector $\mathbf{s}$ by using &amp;ldquo;Gaussian elimination&amp;rdquo; in linear algebra. This is a problem that can be easily solved in polynomial time.&lt;/p>
&lt;h2 id="42-definition-of-the-lwe-problem-adding-noise">4.2 Definition of the LWE Problem: Adding Noise
&lt;/h2>&lt;p>So, what happens if we add a slight &amp;ldquo;noise (error)&amp;rdquo; to this problem?
This is the essence of the LWE problem.&lt;/p>
&lt;p>For an unknown secret vector $\mathbf{s} \in \mathbb{Z}_q^n$, we add a small error $e_i \in \mathbb{Z}_q$ to the result of each equation.
$b_i = \langle \mathbf{a}_i, \mathbf{s} \rangle + e_i \pmod q$&lt;/p>
&lt;p>Here, $e_i$ is a small integer value with a mean of 0 and a relatively small standard deviation (for example, chosen from a discrete Gaussian distribution, like a normal distribution).
The given information is a list of pairs of a random vector $\mathbf{a}_i$ and $b_i$ calculated by adding an error to it.
$( \mathbf{a}_1, b_1 ), ( \mathbf{a}_2, b_2 ), \dots, ( \mathbf{a}_m, b_m )$&lt;/p>
&lt;p>This becomes very neat when expressed as a matrix.
Using a random matrix $A \in \mathbb{Z}_q^{m \times n}$, a secret vector $\mathbf{s} \in \mathbb{Z}_q^n$, and an error vector $\mathbf{e} \in \mathbb{Z}_q^m$, it can be written as:
&lt;/p>
$$ \mathbf{b} = A \mathbf{s} + \mathbf{e} \pmod q $$
&lt;p>
Only $A$ and $\mathbf{b}$ are given. The problem of finding $\mathbf{s}$ from this is the &amp;ldquo;Search LWE problem.&amp;rdquo;&lt;/p>
&lt;p>Because the error $e_i$ is included, if one tries to use Gaussian elimination, the errors amplify exponentially during the process of adding and subtracting equations, making it impossible to reach the correct answer. At first glance, it looks like a simple system of linear equations, but just by adding this small noise, the difficulty of the problem jumps to an NP-hard level.&lt;/p>
&lt;h2 id="43-decision-lwe-problem">4.3 Decision LWE Problem
&lt;/h2>&lt;p>What is frequently used in cryptographic theory proofs is the &amp;ldquo;Decision LWE problem,&amp;rdquo; a variation of the Search LWE problem.&lt;/p>
&lt;p>The Decision LWE problem is the problem of determining which of the following two distributions a given list of samples came from:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>LWE Distribution&lt;/strong>: Intentionally calculated $(A, \mathbf{b} = A\mathbf{s} + \mathbf{e} \pmod q)$&lt;/li>
&lt;li>&lt;strong>Uniform Random Distribution&lt;/strong>: $(A, \mathbf{u})$ consisting of a completely randomly chosen matrix $A$ and vector $\mathbf{u}$&lt;/li>
&lt;/ol>
&lt;p>Surprisingly, if the parameters of the LWE problem are chosen appropriately, the pairs obtained from the LWE distribution become &amp;ldquo;Computationally Indistinguishable&amp;rdquo; from pairs of completely random data. This property provides the foundation for LWE-based cryptography to generate &amp;ldquo;ciphertexts indistinguishable from random numbers.&amp;rdquo;&lt;/p>
&lt;h2 id="44-reduction-from-worst-case-to-average-case-complexity-regevs-theorem">4.4 Reduction from Worst-Case to Average-Case Complexity (Regev&amp;rsquo;s Theorem)
&lt;/h2>&lt;p>Oded Regev&amp;rsquo;s greatest achievement is mathematically linking the difficulty of this LWE problem to the difficulty of the aforementioned lattice problems (SVP and CVP).&lt;/p>
&lt;p>Using a quantum reduction, he proved that &amp;ldquo;if there is a polynomial-time algorithm that can solve the LWE problem on average (for randomly chosen $A$ and $\mathbf{e}$), then there is a polynomial-time quantum algorithm that can solve the Gap-SVP for the worst case (the most difficult case) of any lattice.&amp;rdquo; (Later, a classical reduction was also demonstrated by Peikert et al.)&lt;/p>
&lt;p>This is a dream-like property in cryptographic theory. This is because it dispels the concern that &amp;ldquo;the cipher might be broken because we happened to choose a weak key (a part of the average case),&amp;rdquo; and gives a strong guarantee that &amp;ldquo;if average-case LWE can be solved, all hard problems on lattices can be solved (therefore LWE is absolutely hard).&amp;rdquo;&lt;/p>
&lt;div class="mermaid">graph TD
A["Worst-case Lattice Problems (Gap-SVP, SIVP)"] -->|Quantum/Classical Reduction| B["Average-case LWE Problem"]
B -->|Cryptographic Construction| C["LWE-based Cryptosystems (PKE, KEM, FHE)"]
style A fill:#ffcccc,stroke:#ff0000,stroke-width:2px,color:#000
style B fill:#ccffcc,stroke:#00aa00,stroke-width:2px,color:#000
style C fill:#ccccff,stroke:#0000ff,stroke-width:2px,color:#000&lt;/div>
&lt;h1 id="5-construction-of-a-public-key-cryptosystem-regevs-cryptosystem-using-lwe">5. Construction of a Public-Key Cryptosystem (Regev&amp;rsquo;s Cryptosystem) using LWE
&lt;/h1>&lt;p>Now that we understand the difficulty of the LWE problem, let&amp;rsquo;s look at the basic public-key cryptosystem proposed by Oded Regev to see how it is used for encryption and decryption. Here, we will explain the most basic mechanism for encrypting a 1-bit message $M \in \{0, 1\}$.&lt;/p>
&lt;h2 id="51-key-generation">5.1 Key Generation
&lt;/h2>&lt;ol>
&lt;li>Determine the system parameters: the modulus prime number $q$, the dimension $n$, and the number of equations $m$ ($m > n \log q$).&lt;/li>
&lt;li>As a secret key, choose a vector $\mathbf{s} \in \mathbb{Z}_q^n$ at random.&lt;/li>
&lt;li>Generate a random matrix $A \in \mathbb{Z}_q^{m \times n}$.&lt;/li>
&lt;li>Choose a small error vector $\mathbf{e} \in \mathbb{Z}_q^m$ from an error distribution such as a discrete Gaussian distribution.&lt;/li>
&lt;li>Calculate the vector $\mathbf{b} = A \mathbf{s} + \mathbf{e} \pmod q$.&lt;/li>
&lt;li>The Public Key will be $(A, \mathbf{b})$.&lt;/li>
&lt;li>The Secret Key will be $\mathbf{s}$.&lt;/li>
&lt;/ol>
&lt;p>The public key is exactly an &amp;ldquo;instance of the LWE problem.&amp;rdquo; Finding the secret key $\mathbf{s}$ from the public key $(A, \mathbf{b})$ is equivalent to solving the Search LWE problem, thereby ensuring security.&lt;/p>
&lt;h2 id="52-encryption">5.2 Encryption
&lt;/h2>&lt;p>Alice encrypts a 1-bit message $M \in \{0, 1\}$ using Bob&amp;rsquo;s public key $(A, \mathbf{b})$.&lt;/p>
&lt;ol>
&lt;li>Choose a random binary vector (components are 0 or 1) $\mathbf{r} \in \{0, 1\}^m$.&lt;/li>
&lt;li>As the first half of the ciphertext, compute the vector $\mathbf{u} = A^T \mathbf{r} \pmod q$. ($A^T$ is the transpose of $A$. That is, we are adding up the rows of $A$ where the component of $\mathbf{r}$ is 1).&lt;/li>
&lt;li>As the second half of the ciphertext, compute the scalar $v = \mathbf{b}^T \mathbf{r} + M \cdot \lfloor \frac{q}{2} \rfloor \pmod q$.
(If the message $M$ is 0, add nothing; if $1$, add exactly half the value of $q$, $\lfloor \frac{q}{2} \rfloor$).&lt;/li>
&lt;li>The Ciphertext will be $(\mathbf{u}, v)$.&lt;/li>
&lt;/ol>
&lt;p>The intuitive meaning of encryption is to take the &amp;ldquo;sum of a random subset&amp;rdquo; for the public key matrix $A$ and vector $\mathbf{b}$. Due to the difficulty of the Decision LWE problem, this ciphertext $(\mathbf{u}, v)$ appears indistinguishable from a completely random vector and uniform random number (Semantic Security).&lt;/p>
&lt;div class="mermaid">flowchart LR
M["Message M in {0,1}"] --> Enc
PK["Public Key (A, b)"] --> Enc
r["Random binary vector r"] --> Enc
subgraph Enc ["Encryption Process"]
direction TB
u_calc["u = A^T * r mod q"]
v_calc["v = b^T * r + M * floor(q/2) mod q"]
end
Enc --> CT["Ciphertext (u, v)"]&lt;/div>
&lt;h2 id="53-decryption">5.3 Decryption
&lt;/h2>&lt;p>Bob decrypts the ciphertext $(\mathbf{u}, v)$ using the secret key $\mathbf{s}$.&lt;/p>
&lt;ol>
&lt;li>Compute the following value: $D = v - \mathbf{s}^T \mathbf{u} \pmod q$&lt;/li>
&lt;li>If the computed result is closer to $0$, output $M=0$; if it is closer to $\lfloor \frac{q}{2} \rfloor$, output $M=1$.&lt;/li>
&lt;/ol>
&lt;p>Let&amp;rsquo;s expand this mathematically to see why this can decrypt the message.
Recall that $\mathbf{b} = A \mathbf{s} + \mathbf{e}$.&lt;/p>
$$
\begin{aligned}
v - \mathbf{s}^T \mathbf{u} &amp;= (\mathbf{b}^T \mathbf{r} + M \cdot \lfloor \frac{q}{2} \rfloor) - \mathbf{s}^T (A^T \mathbf{r}) \\
&amp;= ((A \mathbf{s} + \mathbf{e})^T \mathbf{r} + M \cdot \lfloor \frac{q}{2} \rfloor) - \mathbf{s}^T A^T \mathbf{r} \\
&amp;= (\mathbf{s}^T A^T \mathbf{r} + \mathbf{e}^T \mathbf{r} + M \cdot \lfloor \frac{q}{2} \rfloor) - \mathbf{s}^T A^T \mathbf{r} \\
&amp;= \mathbf{e}^T \mathbf{r} + M \cdot \lfloor \frac{q}{2} \rfloor \pmod q
\end{aligned}
$$
&lt;p>Here, $\mathbf{s}^T A^T \mathbf{r}$ perfectly cancelled out from the equation!
What remains is $\mathbf{e}^T \mathbf{r} + M \cdot \lfloor \frac{q}{2} \rfloor$.&lt;/p>
&lt;p>$\mathbf{e}$ is a noise vector with very small components, and $\mathbf{r}$ is a binary vector whose components are 0 or 1. Therefore, their inner product $\mathbf{e}^T \mathbf{r}$ also remains a relatively small value (if parameters are chosen properly).&lt;/p>
&lt;ul>
&lt;li>If $M=0$, the result is $\mathbf{e}^T \mathbf{r}$, which is a small value close to $0$.&lt;/li>
&lt;li>If $M=1$, the result is $\mathbf{e}^T \mathbf{r} + \lfloor \frac{q}{2} \rfloor$, which will be located around half the value of $q$, $\lfloor \frac{q}{2} \rfloor$.&lt;/li>
&lt;/ul>
&lt;p>If the parameters are designed so that the absolute value of the error $\mathbf{e}^T \mathbf{r}$ stays under $\frac{q}{4}$, Bob can accurately determine (decrypt) the message $M$ just by seeing whether the computed result is closer to $0$ or $\lfloor \frac{q}{2} \rfloor$. This is the beautiful mechanism by which LWE-based cryptography functions.&lt;/p>
&lt;div class="mermaid">flowchart LR
CT["Ciphertext (u, v)"] --> Dec
SK["Secret Key s"] --> Dec
subgraph Dec ["Decryption Process"]
direction TB
calc["Compute D = v - s^T * u mod q"]
check["Check if D is closer to 0 or q/2"]
end
calc --> check
Dec --> M_out["Recovered Message M"]&lt;/div>
&lt;h1 id="6-toy-example-of-lwe-cryptography-using-specific-numerical-values">6. Toy Example of LWE Cryptography Using Specific Numerical Values
&lt;/h1>&lt;p>Since simply listing formulas might make it hard to get a real sense of it, let&amp;rsquo;s actually set very small numerical parameters and follow the calculations from encryption to decryption.
(* In actual cryptographic systems, values of $n$ of 500 or more and $q$ of several thousands or more are used to ensure security)&lt;/p>
&lt;p>&lt;strong>[Parameter Settings]&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Modulus $q = 17$ (A prime number. Therefore, values take the range from $0$ to $16$)&lt;/li>
&lt;li>Dimension $n = 2$&lt;/li>
&lt;li>Number of equations $m = 4$&lt;/li>
&lt;li>Suppose we want to encrypt the message $M = 1$.&lt;/li>
&lt;li>Message shift amount: $\lfloor \frac{q}{2} \rfloor = \lfloor \frac{17}{2} \rfloor = 8$&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>[1. Key Generation Phase]&lt;/strong>
Bob randomly chooses the secret key $\mathbf{s}$, matrix $A$, and error vector $\mathbf{e}$.
&lt;/p>
$$ \mathbf{s} = \begin{pmatrix} 3 \\ 4 \end{pmatrix} \in \mathbb{Z}_{17}^2 $$
$$ A = \begin{pmatrix} 2 &amp; 15 \\ 1 &amp; 8 \\ 14 &amp; 5 \\ 9 &amp; 10 \end{pmatrix} \in \mathbb{Z}_{17}^{4 \times 2} $$
$$ \mathbf{e} = \begin{pmatrix} 1 \\ -1 \\ 0 \\ 2 \end{pmatrix} \equiv \begin{pmatrix} 1 \\ 16 \\ 0 \\ 2 \end{pmatrix} \pmod{17} $$
&lt;p>Next, calculate the public key $\mathbf{b}$.
&lt;/p>
$$ A \mathbf{s} = \begin{pmatrix} 2 &amp; 15 \\ 1 &amp; 8 \\ 14 &amp; 5 \\ 9 &amp; 10 \end{pmatrix} \begin{pmatrix} 3 \\ 4 \end{pmatrix} = \begin{pmatrix} 2\times 3 + 15\times 4 \\ 1\times 3 + 8\times 4 \\ 14\times 3 + 5\times 4 \\ 9\times 3 + 10\times 4 \end{pmatrix} = \begin{pmatrix} 6 + 60 \\ 3 + 32 \\ 42 + 20 \\ 27 + 40 \end{pmatrix} = \begin{pmatrix} 66 \\ 35 \\ 62 \\ 67 \end{pmatrix} $$
&lt;p>
Calculate this modulo 17. (e.g., $66 = 17 \times 3 + 15$)
&lt;/p>
$$ A \mathbf{s} \pmod{17} = \begin{pmatrix} 15 \\ 1 \\ 11 \\ 16 \end{pmatrix} $$
&lt;p>
Add the error vector $\mathbf{e}$.
&lt;/p>
$$ \mathbf{b} = A \mathbf{s} + \mathbf{e} = \begin{pmatrix} 15 \\ 1 \\ 11 \\ 16 \end{pmatrix} + \begin{pmatrix} 1 \\ 16 \\ 0 \\ 2 \end{pmatrix} = \begin{pmatrix} 16 \\ 17 \\ 11 \\ 18 \end{pmatrix} \equiv \begin{pmatrix} 16 \\ 0 \\ 11 \\ 1 \end{pmatrix} \pmod{17} $$
&lt;p>The public key is $A$ and $\mathbf{b} = (16, 0, 11, 1)^T$.&lt;/p>
&lt;p>&lt;strong>[2. Encryption Phase]&lt;/strong>
Alice encrypts the message $M = 1$.
Choose a random vector $\mathbf{r}$. Here, let $\mathbf{r} = (1, 0, 1, 0)^T$.&lt;/p>
&lt;p>Calculate $\mathbf{u}$.
&lt;/p>
$$ \mathbf{u} = A^T \mathbf{r} = \begin{pmatrix} 2 &amp; 1 &amp; 14 &amp; 9 \\ 15 &amp; 8 &amp; 5 &amp; 10 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 2 \times 1 + 14 \times 1 \\ 15 \times 1 + 5 \times 1 \end{pmatrix} = \begin{pmatrix} 16 \\ 20 \end{pmatrix} \equiv \begin{pmatrix} 16 \\ 3 \end{pmatrix} \pmod{17} $$
&lt;p>Calculate $v$.
&lt;/p>
$$ \mathbf{b}^T \mathbf{r} = (16, 0, 11, 1) \begin{pmatrix} 1 \\ 0 \\ 1 \\ 0 \end{pmatrix} = 16 \times 1 + 11 \times 1 = 27 \equiv 10 \pmod{17} $$
&lt;p>
Add the value $\lfloor 17/2 \rfloor = 8$ corresponding to the message $M=1$.
&lt;/p>
$$ v = \mathbf{b}^T \mathbf{r} + M \cdot 8 = 10 + 1 \times 8 = 18 \equiv 1 \pmod{17} $$
&lt;p>Alice sends the ciphertext $(\mathbf{u}, v) = \left( \begin{pmatrix} 16 \\ 3 \end{pmatrix}, 1 \right)$ to Bob.&lt;/p>
&lt;p>&lt;strong>[3. Decryption Phase]&lt;/strong>
Bob, upon receiving the ciphertext, decrypts it using the secret key $\mathbf{s} = (3, 4)^T$.
Calculate the decryption formula: $D = v - \mathbf{s}^T \mathbf{u} \pmod{17}$.&lt;/p>
$$ \mathbf{s}^T \mathbf{u} = (3, 4) \begin{pmatrix} 16 \\ 3 \end{pmatrix} = 3 \times 16 + 4 \times 3 = 48 + 12 = 60 \equiv 9 \pmod{17} $$
$$ D = v - \mathbf{s}^T \mathbf{u} = 1 - 9 = -8 \pmod{17} $$
&lt;p>Here, in the modulo 17 world, $-8$ is equal to $9$ ($-8 + 17 = 9$).
Determine whether the obtained value $D = 9$ is closer to $0$ or $8$ ($\lfloor 17/2 \rfloor$).
Since $9$ is clearly closer to $8$ than to $0$, Bob correctly restored $M = 1$!&lt;/p>
&lt;p>Why did it become $9$? Let&amp;rsquo;s recall the previous proof.
The error part is $\mathbf{e}^T \mathbf{r} = (1, -1, 0, 2) (1, 0, 1, 0)^T = 1 \times 1 + 0 \times 1 = 1$.
Therefore, the calculation result is $\mathbf{e}^T \mathbf{r} + M \cdot 8 = 1 + 8 = 9$, confirming that the theoretically expected value was calculated.&lt;/p>
&lt;h1 id="7-evolution-towards-practical-application-ring-lwe-and-module-lwe">7. Evolution Towards Practical Application: Ring-LWE and Module-LWE
&lt;/h1>&lt;p>The Standard LWE problem explained so far has an extremely strong security proof, but it has a fatal flaw in practical use. That is, &amp;ldquo;the size of the keys becomes huge&amp;rdquo; and &amp;ldquo;the computational cost is high.&amp;rdquo;&lt;/p>
&lt;p>In Standard LWE, the public key includes a huge matrix $A \in \mathbb{Z}_q^{m \times n}$. When the parameter $n$ goes up to hundreds or thousands, the size of this matrix reaches several megabytes, making it too heavy to transmit and receive every time over Internet communication protocols (such as TLS). Also, multiplying a matrix and a vector requires a computational complexity of $\mathcal{O}(n^2)$.&lt;/p>
&lt;p>To solve this problem, &amp;ldquo;Ring-LWE (RLWE)&amp;rdquo; and &amp;ldquo;Module-LWE (MLWE)&amp;rdquo; were introduced, incorporating an algebraic structure called polynomial rings into the lattice.&lt;/p>
&lt;h2 id="71-intuition-of-ring-lwe">7.1 Intuition of Ring-LWE
&lt;/h2>&lt;p>In Ring-LWE, vectors and matrices are replaced with elements (polynomials) over a polynomial ring $\mathcal{R}_q = \mathbb{Z}_q[X]/(X^n + 1)$. (Here, $n$ is chosen as a power of 2).&lt;/p>
&lt;p>Whereas the public key of Standard LWE was a matrix $A$, Ring-LWE uses a single polynomial $a(x)$. The secret key $s(x)$ and the error $e(x)$ also become polynomials.
The equation looks like this:
&lt;/p>
$$ b(x) = a(x) \cdot s(x) + e(x) \pmod q $$
&lt;p>Since this is polynomial multiplication, by using the &amp;ldquo;Number Theoretic Transform (NTT),&amp;rdquo; which is similar to the Fast Fourier Transform (FFT), the computational complexity can be dramatically reduced to $\mathcal{O}(n \log n)$. Furthermore, because the size of the public key shrinks from a matrix to a single polynomial, the data size is reduced to $\mathcal{O}(n)$. This brings an overwhelming advantage in communication bandwidth.&lt;/p>
&lt;p>Mathematically speaking, Ring-LWE reduces to a problem on a lattice with a special symmetry called an &amp;ldquo;Ideal Lattice&amp;rdquo; rather than a general lattice.&lt;/p>
&lt;h2 id="72-module-lwe-and-nist-standardization-kyber--ml-kem">7.2 Module-LWE and NIST Standardization (Kyber / ML-KEM)
&lt;/h2>&lt;p>While Ring-LWE is efficient, there was some concern that the special algebraic structure of ideal lattices might become a clue for future attacks. Therefore, &amp;ldquo;Module-LWE (MLWE)&amp;rdquo; was created to take the &amp;ldquo;best of both worlds&amp;rdquo;: the conservative security of Standard LWE and the efficiency of Ring-LWE.&lt;/p>
&lt;p>Module-LWE considers small matrices and vectors whose elements are polynomials. In other words, it handles modules over a ring.
Currently, &amp;ldquo;CRYSTALS-Kyber&amp;rdquo; (standardized name: ML-KEM), which NIST selected as the standard for PQC key encapsulation mechanisms (KEM), is built precisely on the difficulty of this Module-LWE problem.&lt;/p>
&lt;h1 id="8-why-is-it-secure-against-quantum-computers">8. Why is it Secure Against Quantum Computers?
&lt;/h1>&lt;p>Finally, let&amp;rsquo;s touch upon the core issue: &amp;ldquo;Why is lattice-based cryptography considered unbreakable even when using quantum computers?&amp;rdquo;&lt;/p>
&lt;p>Shor&amp;rsquo;s algorithm, which allows quantum computers to break RSA cryptography and Elliptic Curve Cryptography, is essentially an algorithm that solves the &amp;ldquo;Hidden Subgroup Problem (HSP).&amp;rdquo; The mathematical structure (finite abelian groups) behind RSA and ECC has periodicity, and by using a specific operation of quantum algorithms called the Quantum Fourier Transform (QFT), this period (hidden subgroup) can be extracted all at once.&lt;/p>
&lt;p>However, lattice problems are fundamentally different. Although lattices also have periodicity, what is required in SVP and CVP is a geometric, non-linear property such as &amp;ldquo;shortest distance&amp;rdquo; or &amp;ldquo;removal of noise.&amp;rdquo; Even if a &amp;ldquo;Quantum Fourier Transform over an abelian group&amp;rdquo; like Shor&amp;rsquo;s algorithm is applied directly, useful information that would be the answer to the lattice problem cannot be efficiently extracted. To date, no quantum algorithm that can solve SVP or LWE in polynomial time has been discovered, and it is widely believed that even with the parallel computing power of quantum computers, the only effective means is near-brute-force search (about the level of square root speedup by Grover&amp;rsquo;s algorithm).&lt;/p>
&lt;h1 id="9-conclusion">9. Conclusion
&lt;/h1>&lt;p>In this article, we explained the mathematical intuition of lattice-based cryptography in detail, starting from the geometric definition of a lattice, to the formulation of the LWE problem, and the construction of a public-key cryptosystem.&lt;/p>
&lt;ol>
&lt;li>A &lt;strong>Lattice&lt;/strong> is a discrete space represented by integer-coefficient linear combinations of basis vectors, and finding a &amp;ldquo;good basis&amp;rdquo; close to orthogonal (SVP) becomes difficult in high dimensions.&lt;/li>
&lt;li>The &lt;strong>LWE (Learning With Errors) problem&lt;/strong> is the problem of solving a system of linear equations with noise, and since it is tied to the difficulty of worst-case problems on lattices, it provides a powerful security foundation.&lt;/li>
&lt;li>By using the LWE problem, encryption and decryption (&lt;strong>Regev&amp;rsquo;s Cryptosystem&lt;/strong>) are realized through an ingenious mechanism of intentionally adding and removing noise.&lt;/li>
&lt;li>In real-world protocols, &lt;strong>Ring-LWE&lt;/strong> and &lt;strong>Module-LWE&lt;/strong> using polynomial rings are adopted to improve communication efficiency and computation speed, serving as the foundation for the NIST-standard &lt;strong>ML-KEM&lt;/strong>.&lt;/li>
&lt;/ol>
&lt;p>As the unprecedented computational paradigm shift of quantum computers approaches, it is quite romantic that &amp;ldquo;lattice-based cryptography,&amp;rdquo; born from the depths of classical linear algebra and number theory, will bear the foundation of future internet security. The math that forms the foundation of lattice-based cryptography is by no means too esoteric, and anyone with a basic knowledge of linear algebra and probability can fully understand its beautiful structure. We hope this article has helped you understand lattice-based cryptography, the core of PQC.&lt;/p></description></item><item><title>How Zero-Knowledge Proofs (ZKP) Work and Their Latest Applications in Web3 and Security</title><link>http://kenji.blog/en/p/zero-knowledge-proofs-zkp-web3-security/</link><pubDate>Fri, 11 Sep 2026 19:00:00 +0900</pubDate><guid>http://kenji.blog/en/p/zero-knowledge-proofs-zkp-web3-security/</guid><description>&lt;img src="http://kenji.blog/p/zero-knowledge-proofs-zkp-web3-security/img/eyecatch.jpg" alt="Featured image of post How Zero-Knowledge Proofs (ZKP) Work and Their Latest Applications in Web3 and Security" />&lt;h2 id="introduction">Introduction
&lt;/h2>&lt;p>In modern digital society, data privacy and scalability have become two of the most critical challenges. As the risks of personal information leaks and unauthorized use increase, there is a strong demand for technology that allows you to &amp;ldquo;prove that you have certain information without revealing the information itself to the other party.&amp;rdquo; This is realized by &lt;strong>Zero-Knowledge Proofs (ZKP)&lt;/strong>.&lt;/p>
&lt;p>Zero-Knowledge Proofs is a concept in cryptography first proposed in the 1980s by Shafi Goldwasser, Silvio Micali, and Charles Rackoff, but for a long time, it remained primarily a theoretical research topic. However, with the rise of blockchain technology and Web3, the situation completely changed. ZKP has suddenly been thrust into the spotlight as the &amp;ldquo;magic wand&amp;rdquo; that simultaneously solves the scalability problems (limits of processing capacity) and privacy problems (the fact that all transactions are public) faced by public blockchains like Ethereum.&lt;/p>
&lt;p>In this article, we will provide a highly detailed and technically deep explanation, ranging from the basic concepts of Zero-Knowledge Proofs to the profound mathematical and cryptographic mechanisms of the currently mainstream &lt;strong>zk-SNARKs&lt;/strong> and &lt;strong>zk-STARKs&lt;/strong>, and finally to the latest application examples in Web3 and security, such as ZK-Rollups and Decentralized Identity (DID).&lt;/p>
&lt;hr>
&lt;h2 id="what-is-a-zero-knowledge-proof-zkp">What is a Zero-Knowledge Proof (ZKP)?
&lt;/h2>&lt;p>A Zero-Knowledge Proof (ZKP) refers to a protocol in which a prover can prove to a verifier that a certain proposition is true, &amp;ldquo;without transmitting any information other than the fact that the proposition is true.&amp;rdquo;&lt;/p>
&lt;h3 id="the-3-requirements-for-zkp">The 3 Requirements for ZKP
&lt;/h3>&lt;p>To be established as a ZKP, the following three properties must be strictly satisfied:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Completeness&lt;/strong>
If the proposition is true, and both the prover and the verifier follow the protocol correctly, the verifier must accept the proof with an overwhelming probability.&lt;/li>
&lt;li>&lt;strong>Soundness&lt;/strong>
If the proposition is false, no matter how computationally powerful and malicious the prover is, it is impossible (except for a negligibly small probability) to deceive the verifier into accepting the proof.&lt;/li>
&lt;li>&lt;strong>Zero-Knowledge&lt;/strong>
If the proposition is true, the verifier cannot obtain any information from the proof process other than the fact that &amp;ldquo;the proposition is true.&amp;rdquo; From the verifier&amp;rsquo;s perspective, this is proven by the mathematical definition that it is possible to simulate the proof process (a simulator exists).&lt;/li>
&lt;/ol>
&lt;h3 id="interactive-and-non-interactive-proofs">Interactive and Non-Interactive Proofs
&lt;/h3>&lt;p>There are two types of ZKPs: &lt;strong>Interactive Proofs&lt;/strong>, where the prover and verifier communicate multiple times, and &lt;strong>Non-Interactive Proofs&lt;/strong>, where the prover sends the proof data only once.&lt;/p>
&lt;h4 id="interactive-zkp">Interactive ZKP
&lt;/h4>&lt;p>Early ZKPs were designed as interactive protocols. The famous &amp;ldquo;Ali Baba&amp;rsquo;s Cave&amp;rdquo; allegory falls under this category. The general flow of the protocol is as follows:&lt;/p>
&lt;div class="mermaid">sequenceDiagram
participant Prover as "Prover"
participant Verifier as "Verifier"
Note over Prover, Verifier: "Basic Flow of the Interactive Proof Protocol"
Prover->>Verifier: "1. Send Commitment"
Verifier->>Prover: "2. Send Random Challenge"
Prover->>Verifier: "3. Calculate and Send Response"
Note over Verifier: "Verify the Response"
Verifier-->>Prover: "4. Accept / Reject"
Note over Prover, Verifier: "* Repeat this dozens of times to increase certainty"&lt;/div>
&lt;p>This method is powerful, but the verifier must be online, making it inconvenient to apply to asynchronous distributed systems like blockchains. In a blockchain, anyone must be able to verify past proofs at any time.&lt;/p>
&lt;h4 id="fiat-shamir-heuristic-and-non-interactivity">Fiat-Shamir Heuristic and Non-Interactivity
&lt;/h4>&lt;p>A breakthrough technique for converting interactive proofs into Non-Interactive Zero-Knowledge Proofs (NIZK) is the &lt;strong>Fiat-Shamir Heuristic&lt;/strong>.&lt;/p>
&lt;p>Instead of the &amp;ldquo;random challenge&amp;rdquo; sent by the verifier, the prover self-generates a &amp;ldquo;pseudo-random challenge&amp;rdquo; using their own commitment and the hash value of public information. Assuming that a cryptographic hash function (such as SHA-256 or Keccak) functions as a random oracle, the prover cannot predict or manipulate the challenge in advance, allowing the proof to be completed with a single message transmission while maintaining the same level of security as an interactive proof.&lt;/p>
&lt;hr>
&lt;h2 id="technical-details-of-zk-snarks">Technical Details of zk-SNARKs
&lt;/h2>&lt;p>Currently, the most widely used ZKP is &lt;strong>zk-SNARKs&lt;/strong> (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge). As the name suggests, it is an Argument of Knowledge that has zero-knowledge properties (zk), features very small proof sizes and fast verification (Succinct), and is Non-Interactive.&lt;/p>
&lt;p>The foundation of zk-SNARKs is advanced algebraic geometry and cryptography. It converts the execution and computation of programs into the verification of specific polynomial equations.&lt;/p>
&lt;h3 id="1-conversion-to-arithmetic-circuits-and-r1cs-rank-1-constraint-system">1. Conversion to Arithmetic Circuits and R1CS (Rank-1 Constraint System)
&lt;/h3>&lt;p>First, any computation you want to prove (such as an algorithm or smart contract logic) is converted into an &lt;strong>Arithmetic Circuit&lt;/strong> consisting of addition and multiplication gates.&lt;/p>
&lt;p>Next, this arithmetic circuit is converted into a set of matrix equations called &lt;strong>R1CS (Rank-1 Constraint System)&lt;/strong>. R1CS is the problem of finding matrices $A, B, C$ that satisfy the following constraint for a variable vector $x$:&lt;/p>
$$ (A \cdot x) \circ (B \cdot x) = C \cdot x $$
&lt;p>Here, $\circ$ represents the Hadamard product (element-wise product). This constraint ensures that all logic gates (especially multiplication gates) in the circuit are calculated correctly.&lt;/p>
&lt;h3 id="2-conversion-to-qap-quadratic-arithmetic-program">2. Conversion to QAP (Quadratic Arithmetic Program)
&lt;/h3>&lt;p>Since there are countless R1CS matrix constraints, verifying them individually is highly inefficient. Therefore, Lagrange interpolation is used to compress these constraints into a single polynomial equation. This is the &lt;strong>QAP (Quadratic Arithmetic Program)&lt;/strong>.&lt;/p>
&lt;p>Through the conversion to QAP, the problem to be proven is reduced to the question: &amp;ldquo;Is a specific polynomial $P(x)$ divisible by another known polynomial $Z(x)$?&amp;rdquo;&lt;/p>
$$ P(x) = L(x) \cdot R(x) - O(x) $$
&lt;p>Here, $L(x), R(x), O(x)$ are combinations of polynomials corresponding to each row of matrices $A, B, C$, respectively. If the prover knows the correct solution (Witness), the value becomes 0 at each root (evaluation point) of $P(x)$, so $P(x)$ will have the target polynomial $Z(x)$ as a factor. In other words, there exists a polynomial $H(x)$ such that the following equation holds:&lt;/p>
$$ P(x) = H(x) \cdot Z(x) $$
&lt;p>The verifier only needs to check whether this equation $P(s) = H(s) \cdot Z(s)$ holds at a certain random secret point $s$ to instantly verify that the entire computation was performed correctly. This is the secret of its &amp;ldquo;Succinctness.&amp;rdquo;&lt;/p>
&lt;h3 id="3-elliptic-curve-cryptography-and-bilinear-pairings">3. Elliptic Curve Cryptography and Bilinear Pairings
&lt;/h3>&lt;p>However, if the verifier knows the secret point $s$, it would be possible for the prover to fabricate a fake polynomial to satisfy the equation (a collapse of soundness). Therefore, it is necessary to perform computations while keeping $s$ encrypted (using homomorphic encryption) so that no one knows it.&lt;/p>
&lt;p>This is achieved using &lt;strong>Bilinear Pairings&lt;/strong> on elliptic curves.
A pairing $e$ is a special function that can calculate a value equivalent to the encryption of the product of two encrypted values.&lt;/p>
$$ e(g_1^a, g_2^b) = e(g_1, g_2)^{ab} $$
&lt;p>Even without knowing $s$ itself, the prover calculates the encrypted values of the polynomials $P(s)$ and $H(s)$ using encrypted values of powers of $s$ (this is called the CRS: Common Reference String). The verifier uses the pairing function to verify whether the relationship $P(s) = H(s) \cdot Z(s)$ holds while the values remain encrypted.&lt;/p>
&lt;h3 id="4-trusted-setup">4. Trusted Setup
&lt;/h3>&lt;p>The biggest weakness of zk-SNARKs (especially early ones like Groth16) is that they require a process to generate the secret point $s$, known as a &lt;strong>Trusted Setup&lt;/strong>. If the creator of $s$ retains the value without destroying it, they can generate arbitrary fake proofs (the Toxic Waste problem).&lt;/p>
&lt;p>To prevent this, a ritual called a &amp;ldquo;Ceremony&amp;rdquo; is conducted using Multi-Party Computation (MPC). Numerous participants cooperate to provide randomness, and as long as at least one participant honestly destroys their random value, the security of the entire system is maintained. However, research to eliminate this dependency has been ongoing for many years.&lt;/p>
&lt;hr>
&lt;h2 id="technical-details-of-zk-starks">Technical Details of zk-STARKs
&lt;/h2>&lt;p>&lt;strong>zk-STARKs&lt;/strong> (Zero-Knowledge Scalable Transparent Argument of Knowledge) emerged as an answer to the reliance on trusted setups and the risk of elliptic curve cryptography being decrypted by quantum computers.&lt;/p>
&lt;p>Developed by Eli Ben-Sasson and others, STARKs feature no need for a trusted setup, living up to the name &amp;ldquo;Transparent,&amp;rdquo; and maintain efficient proof sizes and verification times even as the amount of computation increases, living up to the name &amp;ldquo;Scalable.&amp;rdquo;&lt;/p>
&lt;h3 id="1-polynomial-commitments-and-the-fri-protocol">1. Polynomial Commitments and the FRI Protocol
&lt;/h3>&lt;p>zk-STARKs base their security entirely on &lt;strong>hash functions&lt;/strong>, rather than elliptic curve cryptography. Therefore, they have the properties of Post-Quantum Cryptography.&lt;/p>
&lt;p>Computation verification is performed by utilizing the properties of one-dimensional or multi-dimensional polynomials after being converted into a format called AIR (Algebraic Intermediate Representation). The core of STARKs lies in the &lt;strong>FRI (Fast Reed-Solomon Interactive Oracle Proof of Proximity)&lt;/strong> protocol.&lt;/p>
&lt;p>The FRI protocol is a technique for verifying &amp;ldquo;whether a certain function is sufficiently close to a polynomial of a specific degree (Proximity).&amp;rdquo; The prover commits the polynomial&amp;rsquo;s values as leaves of a Merkle Tree (Polynomial Commitment).&lt;/p>
&lt;div class="mermaid">graph TD
Root["Merkle Root (Commitment)"] --> Node0["Node 0"]
Root --> Node1["Node 1"]
Node0 --> Leaf0["P(x_0)"]
Node0 --> Leaf1["P(x_1)"]
Node1 --> Leaf2["P(x_2)"]
Node1 --> Leaf3["P(x_3)"]&lt;/div>
&lt;p>The verifier requests the disclosure of several random points and uses Merkle proofs to confirm that they are included in the commitment. By repeating this recursively, it guarantees with overwhelming probability that the original polynomial actually has a low degree.&lt;/p>
&lt;h3 id="comparison-of-zk-snarks-and-zk-starks">Comparison of zk-SNARKs and zk-STARKs
&lt;/h3>&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Feature&lt;/th>
&lt;th style="text-align:left">zk-SNARKs&lt;/th>
&lt;th style="text-align:left">zk-STARKs&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>Cryptographic Assumptions&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Elliptic curves, Pairings&lt;/td>
&lt;td style="text-align:left">Collision-resistant hash functions&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>Trusted Setup&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Required (Universal for Plonk, etc.)&lt;/td>
&lt;td style="text-align:left">Not required (Transparent)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>Quantum Resistance&lt;/strong>&lt;/td>
&lt;td style="text-align:left">No&lt;/td>
&lt;td style="text-align:left">Yes&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>Proof Size&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Very small (~200 Bytes)&lt;/td>
&lt;td style="text-align:left">Somewhat large (Tens of KB)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>Proof Generation Computational Cost&lt;/strong>&lt;/td>
&lt;td style="text-align:left">High&lt;/td>
&lt;td style="text-align:left">Relatively lower than SNARKs&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>Verification Cost (Gas Fee)&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Very low (Constant)&lt;/td>
&lt;td style="text-align:left">Low (Increases logarithmically)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>In recent years, SNARKs that &amp;ldquo;do not require a trusted setup, or only require it once&amp;rdquo; like Plonk and Halo2 have appeared, and the boundary between SNARKs and STARKs is gradually blurring, but the fundamental difference in mathematical approaches remains important.&lt;/p>
&lt;hr>
&lt;h2 id="latest-applications-of-zero-knowledge-proofs-in-web3-and-security">Latest Applications of Zero-Knowledge Proofs in Web3 and Security
&lt;/h2>&lt;p>Having transitioned from theory to practice, ZKPs are now sparking a revolution at the forefront of Web3 and cybersecurity.&lt;/p>
&lt;h3 id="1-ultimate-scaling-of-ethereum-with-zk-rollups">1. Ultimate Scaling of Ethereum with ZK-Rollups
&lt;/h3>&lt;p>L1 (Layer 1) blockchains like Ethereum have significant constraints on scalability (the trilemma) due to their emphasis on decentralization and security. The definitive L2 (Layer 2) solution to solve this is &lt;strong>ZK-Rollups&lt;/strong>.&lt;/p>
&lt;p>In a ZK-Rollup, thousands of transactions are executed and processed off-chain (L2), generating a &amp;ldquo;single ZKP (Validity Proof)&amp;rdquo; indicating that they were all executed correctly. The smart contract on the L1 chain only needs to verify this proof.&lt;/p>
&lt;div class="mermaid">flowchart LR
Users["Users (Tx Submission)"] --> Sequencer["Sequencer (Tx Collection &amp; Execution)"]
Sequencer --> Prover["Prover (ZKP Generation)"]
Sequencer --> L1Contract["L1 Smart Contract (Tx Data Publication)"]
Prover --> L1Contract["ZKP (Proof) Submission"]
L1Contract --> Verify["Verification &amp; State Update"]&lt;/div>
&lt;p>The biggest advantage of ZK-Rollups is that, unlike Optimistic Rollups (such as Arbitrum and Optimism), they do not require a challenge period (typically 7 days) for Fraud Proofs. Because correctness is cryptographically guaranteed, fund withdrawals to L1 (Finality) are completed the moment the proof is verified. Currently, projects like zkSync, Starknet, Scroll, and Polygon zkEVM are engaged in fierce development competition, and the realization of &lt;strong>zkEVMs&lt;/strong>, which are compatible with the EVM (Ethereum Virtual Machine), is driving rapid ecosystem growth.&lt;/p>
&lt;h3 id="2-privacy-preserving-identity-zkp-for-identity">2. Privacy-Preserving Identity (ZKP for Identity)
&lt;/h3>&lt;p>The nature of personal authentication in the digital world will also be fundamentally changed by ZKPs.
For example, in response to the question, &amp;ldquo;Are you 18 or older?&amp;rdquo;, conventional systems required presenting a driver&amp;rsquo;s license or passport, handing over unnecessary personal information like name and address to the other party.&lt;/p>
&lt;p>By using ZKPs, based on a digital certificate (Verifiable Credential) issued by a public institution, it becomes possible to &lt;strong>mathematically prove only the fact&lt;/strong> that &amp;ldquo;calculated from my date of birth, I am 18 or older on the current date.&amp;rdquo; The verifier only needs to verify the certificate&amp;rsquo;s signature and the ZKP, without knowing the user&amp;rsquo;s date of birth or identity.&lt;/p>
&lt;p>Projects for Proof of Personhood like Worldcoin also incorporate a mechanism to prove only that one is a &amp;ldquo;unique human&amp;rdquo; using ZKPs, rather than storing and sharing iris data directly.&lt;/p>
&lt;h3 id="3-confidential-smart-contracts-and-enterprise-use">3. Confidential Smart Contracts and Enterprise Use
&lt;/h3>&lt;p>The property of public blockchains that &amp;ldquo;all data is public&amp;rdquo; has been a major barrier for companies handling confidential transactions and supply chain information on the blockchain.&lt;/p>
&lt;p>By using ZKP technology (such as privacy-focused networks like Aleo and Aztec), the input values, output values of transactions, and even the smart contract logic executed can be kept encrypted, while only the validity of state updates is etched onto the public chain. This makes it possible to prevent front-running (MEV) in DeFi (Decentralized Finance) and to build confidential consortium networks among enterprises, all while enjoying the high security of public chains.&lt;/p>
&lt;hr>
&lt;h2 id="future-challenges-and-prospects-for-zkp">Future Challenges and Prospects for ZKP
&lt;/h2>&lt;p>While ZKPs are undoubtedly a next-generation foundational technology, several challenges remain.&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Proof Generation Computational Costs and Hardware Acceleration&lt;/strong>
Generating a ZKP requires massive polynomial operations, FFT (Fast Fourier Transform), and MSM (Multi-Scalar Multiplication). Currently, research into dedicated hardware (FPGAs and ASICs) to accelerate this proof generation, known as &lt;strong>ZKP Mining&lt;/strong> (Prover Networks), is rapidly advancing.&lt;/li>
&lt;li>&lt;strong>Standardization and Improvement of Developer Experience (DX)&lt;/strong>
Dedicated languages for writing ZKP circuits, such as Circom, Cairo, Noir, and Leo, are proliferating. A standard unifying these and the maturation of compilers that automatically generate ZKP circuits from existing languages like Rust and C++ will be key to general software engineers adopting ZKPs.&lt;/li>
&lt;/ol>
&lt;h2 id="conclusion">Conclusion
&lt;/h2>&lt;p>Zero-Knowledge Proofs (ZKP) have evolved from merely a &amp;ldquo;technology to enhance cryptocurrency anonymity&amp;rdquo; to a &amp;ldquo;general-purpose technology redefining trust across the internet.&amp;rdquo; Small proofs calculated deep within mathematics and cryptography will infinitely scale blockchain capabilities and act as a strong shield protecting our privacy.&lt;/p>
&lt;p>Towards true mass adoption of Web3 and the construction of a secure and private next-generation internet, Zero-Knowledge Proofs will continue to function as the most crucial piece. We must keep a close eye on the future evolution of ZKP technology.&lt;/p>
&lt;hr>
&lt;p>&lt;em>References and Related Links&lt;/em>&lt;/p>
&lt;ul>
&lt;li>Groth, J. (2016). &amp;ldquo;On the Size of Pairing-based Non-interactive Arguments&amp;rdquo;&lt;/li>
&lt;li>Ben-Sasson, E., et al. (2018). &amp;ldquo;Scalable, transparent, and post-quantum secure computational integrity&amp;rdquo;&lt;/li>
&lt;li>Vitalik Buterin&amp;rsquo;s blog on zk-SNARKs and zk-STARKs&lt;/li>
&lt;/ul></description></item><item><title>What is Fully Homomorphic Encryption (FHE)? Explaining the Keystone of Next-Generation Security</title><link>http://kenji.blog/en/p/fully-homomorphic-encryption-fhe-explained/</link><pubDate>Fri, 11 Sep 2026 11:00:00 +0900</pubDate><guid>http://kenji.blog/en/p/fully-homomorphic-encryption-fhe-explained/</guid><description>&lt;img src="http://kenji.blog/p/fully-homomorphic-encryption-fhe-explained/img/eyecatch.jpg" alt="Featured image of post What is Fully Homomorphic Encryption (FHE)? Explaining the Keystone of Next-Generation Security" />&lt;p>As cloud computing and AI technologies become established as societal infrastructure, the tradeoff between &amp;ldquo;data privacy&amp;rdquo; and &amp;ldquo;data utilization&amp;rdquo; has become one of the most critical challenges. While there is a growing demand to have AI analyze highly sensitive data—such as medical records, financial information, and personal biometric data—on the cloud, many companies hesitate to send data externally due to security concerns.&lt;/p>
&lt;p>Traditional encryption technologies (like AES and RSA) excel at protecting data stored in storage (Data at Rest) and data flowing over networks (Data in Transit). However, &lt;strong>when performing processing (computations) such as searching or machine learning on the server side (Data in Use), the ciphertext must first be decrypted back into plaintext&lt;/strong>. If the server is hacked at this decrypted moment, or if a malicious internal administrator peeks at the data, it directly leads to information leakage.&lt;/p>
&lt;p>The dream technology that overcomes this fundamental weakness of &amp;ldquo;decryption during processing&amp;rdquo; is &lt;strong>Fully Homomorphic Encryption (FHE)&lt;/strong>. By using FHE, it becomes possible to perform computational processing while keeping the data encrypted, without ever decrypting it, and returning only the resulting ciphertext to the client.&lt;/p>
&lt;p>In this article, we will thoroughly and deeply explain FHE, the keystone of next-generation security, covering everything from its concept and history, the groundbreaking breakthrough by Craig Gentry, mathematical foundations (such as Ring-LWE), its biggest challenge &amp;ldquo;noise&amp;rdquo; and its solution (bootstrapping), up to the latest implementation libraries.&lt;/p>
&lt;hr>
&lt;h2 id="1-what-is-homomorphic-encryption-basic-concepts">1. What is Homomorphic Encryption? Basic Concepts
&lt;/h2>&lt;p>&amp;ldquo;Homomorphic&amp;rdquo; is an algebraic term referring to the property where mappings can be made between sets with a certain structure while preserving the structure of the operations. &amp;ldquo;Homomorphism&amp;rdquo; in cryptography is the property where &lt;strong>operations in the plaintext space correspond to operations in the ciphertext space&lt;/strong>.&lt;/p>
&lt;p>Expressed in simple formulas, let $m_1$ and $m_2$ be plaintexts, $E(\cdot)$ be the encryption function, and $D(\cdot)$ be the decryption function. If we let $\circ$ be an operation on the plaintext (such as addition or multiplication) and $\diamond$ be an operation on the ciphertext, the following relationship holds:&lt;/p>
$$ D(E(m_1) \diamond E(m_2)) = m_1 \circ m_2 $$
&lt;p>In other words, if you decrypt the result of applying some operation $\diamond$ to the ciphertexts $E(m_1)$ and $E(m_2)$, it matches the result of operating $\circ$ on the original plaintexts.&lt;/p>
&lt;h3 id="data-flow-in-cloud-computing">Data Flow in Cloud Computing
&lt;/h3>&lt;p>The architecture of cloud processing using FHE is completely different from traditional ones. The following diagram shows the flow of secure data processing utilizing FHE.&lt;/p>
&lt;div class="mermaid">graph TD
A["Client (Holds secret key)"] -->|1. Encrypt plaintext x: E(x)| B["Cloud Server (Encrypted data only)"]
B -->|2. Apply function f to ciphertext: E(f(x))| B
B -->|3. Ciphertext of calculation result E(y)| A
A -->|4. Decrypt with secret key: y = f(x)| A
style A fill:#d4edda,stroke:#28a745
style B fill:#f8d7da,stroke:#dc3545&lt;/div>
&lt;p>The server receives the encrypted data $E(x)$, but since it does not have the secret key, it can never know the contents of the data. However, by utilizing the properties of FHE, it can apply a function $f$ (for example, an inference model for machine learning) to the ciphertext and generate $E(f(x))$. The client receives this and decrypts it with their own secret key to obtain the desired result $y = f(x)$.&lt;/p>
&lt;hr>
&lt;h2 id="2-history-of-homomorphic-encryption-evolution-phe-she-fhe">2. History of Homomorphic Encryption Evolution: PHE, SHE, FHE
&lt;/h2>&lt;p>Homomorphic encryption did not reach its current &amp;ldquo;fully&amp;rdquo; form all at once. It is broadly classified into three stages depending on the types and number of operations it can achieve.&lt;/p>
&lt;h3 id="partially-homomorphic-encryption-phe">Partially Homomorphic Encryption (PHE)
&lt;/h3>&lt;p>PHE is an encryption scheme that can perform &lt;strong>only one of either&lt;/strong> addition or multiplication indefinitely. In fact, ciphers with this property have existed for a long time.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>RSA Encryption (Homomorphism for multiplication)&lt;/strong>
RSA encryption unintentionally possessed a multiplicative homomorphic property. Given plaintexts $m_1, m_2$ and a public key $(e, N)$:
$$ E(m_1) = m_1^e \pmod N $$
$$ E(m_2) = m_2^e \pmod N $$
Multiplying these gives:
$$ E(m_1) \times E(m_2) = (m_1 \cdot m_2)^e \pmod N = E(m_1 \times m_2) $$
Thus, the multiplication of ciphertexts corresponds to the multiplication of plaintexts.&lt;/li>
&lt;li>&lt;strong>Paillier Encryption (Homomorphism for addition)&lt;/strong>
The Paillier cryptosystem, invented in 1999, has an additive homomorphic property. It has been put to practical use in applications like electronic voting (aggregating encrypted votes and decrypting only the final result).&lt;/li>
&lt;/ul>
&lt;h3 id="somewhat-homomorphic-encryption-she">Somewhat Homomorphic Encryption (SHE)
&lt;/h3>&lt;p>This scheme can execute &lt;strong>both&lt;/strong> addition and multiplication, but there is a &lt;strong>limit to the number of operations (circuit depth)&lt;/strong> that can be performed. Due to the accumulation of &amp;ldquo;noise,&amp;rdquo; which will be discussed later, decryption becomes impossible after a certain number of multiplications. The BGN (Boneh-Goh-Nissim) cryptosystem of 2005 falls under this category, but it had limitations in performing practical, complex computations (like deep learning).&lt;/p>
&lt;h3 id="fully-homomorphic-encryption-fhe">Fully Homomorphic Encryption (FHE)
&lt;/h3>&lt;p>This is an encryption scheme that can execute both addition and multiplication an &lt;strong>unlimited number of times&lt;/strong>. Similar to Turing completeness in information theory, if addition (equivalent to XOR) and multiplication (equivalent to AND) can be combined infinitely, it means that in principle, any computable function or algorithm can be executed while remaining encrypted.&lt;/p>
&lt;p>FHE was long called the &amp;ldquo;holy grail of cryptography&amp;rdquo; and was even said to be impossible to realize. However, in 2009, &lt;strong>Craig Gentry&lt;/strong>, who was a doctoral student at Stanford University at the time, proposed the first FHE scheme using Ideal Lattices, sending shockwaves through the world.&lt;/p>
&lt;hr>
&lt;h2 id="3-mathematical-foundations-of-fhe-the-lwe-problem-and-ring-lwe">3. Mathematical Foundations of FHE: The LWE Problem and Ring-LWE
&lt;/h2>&lt;p>Many of the current mainstream FHE schemes are based on the &lt;strong>LWE (Learning With Errors) problem&lt;/strong>, a mathematical hard problem in &amp;ldquo;Lattice-based Cryptography,&amp;rdquo; which is also known as Post-Quantum Cryptography.&lt;/p>
&lt;h3 id="intuitive-understanding-of-the-lwe-problem">Intuitive Understanding of the LWE Problem
&lt;/h3>&lt;p>Solving a system of linear equations is easy if you use methods like Gaussian elimination.&lt;/p>
$$ \begin{cases} 3s_1 + 4s_2 + 2s_3 \equiv 12 \pmod{17} \\ 1s_1 + 9s_2 + 5s_3 \equiv 8 \pmod{17} \\ \vdots \end{cases} $$
&lt;p>However, what happens if we add a very small &amp;ldquo;random error (noise)&amp;rdquo; $e$ to the results of these equations?&lt;/p>
$$ \begin{cases} 3s_1 + 4s_2 + 2s_3 + e_1 \equiv 13 \pmod{17} \\ 1s_1 + 9s_2 + 5s_3 + e_2 \equiv 7 \pmod{17} \\ \vdots \end{cases} $$
&lt;p>With just the addition of this error $e$, the problem of finding the secret variable vector $\vec{s}$ transforms into an NP-hard problem that is difficult to decipher even using current supercomputers or quantum computers. This is the LWE problem.&lt;/p>
&lt;h3 id="ring-lwe-problem-rlwe">Ring-LWE Problem (RLWE)
&lt;/h3>&lt;p>The standard LWE problem involves matrix operations, which means the key size is extremely large (sometimes in gigabytes) and computational efficiency is poor. To solve this, the &lt;strong>Ring-LWE (RLWE) problem&lt;/strong>, which uses operations over polynomial rings, was introduced.&lt;/p>
&lt;p>In RLWE, elements belong to the polynomial ring $R_q = \mathbb{Z}_q[x] / (x^N + 1)$ (where $N$ is a power of 2, and $q$ is the modulus prime).
Let the secret key be a polynomial $s(x)$, and with a random polynomial $a(x)$ and a small noise polynomial $e(x)$, the public key becomes the following pair:&lt;/p>
$$ (a(x), b(x)) \quad \text{where} \quad b(x) = -a(x) \cdot s(x) + e(x) \pmod q $$
&lt;p>During encryption, the plaintext $m(x)$ is encoded using the properties of this polynomial to generate the ciphertext.&lt;/p>
&lt;hr>
&lt;h2 id="4-the-biggest-barrier-noise-and-gentrys-bootstrapping">4. The Biggest Barrier &amp;ldquo;Noise&amp;rdquo; and Gentry&amp;rsquo;s Bootstrapping
&lt;/h2>&lt;p>The most important concept in understanding FHE is &lt;strong>&amp;ldquo;noise management.&amp;rdquo;&lt;/strong>&lt;/p>
&lt;p>In LWE/RLWE-based cryptography, small &amp;ldquo;noise (errors)&amp;rdquo; are intentionally included to ensure security.
The process of decrypting a ciphertext $c$ of a plaintext $m$ can be roughly represented by the following formula:&lt;/p>
$$ D(c) = (c \cdot s) \pmod q = m + \text{noise} $$
&lt;p>During decryption, this &lt;code>noise&lt;/code> is removed through rounding processes or similar to obtain the correct plaintext $m$. However, when homomorphic operations (especially multiplication) are performed between ciphertexts, this noise is dramatically amplified.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Homomorphic Addition&lt;/strong>: Noise increases additively ($e_1 + e_2$). This is a relatively gradual increase.&lt;/li>
&lt;li>&lt;strong>Mathematical Representation of Homomorphism by Homomorphic Addition&lt;/strong>:
$$ E(m_1) \oplus E(m_2) = E(m_1 + m_2) $$&lt;/li>
&lt;li>&lt;strong>Homomorphic Multiplication&lt;/strong>: Noise explodes multiplicatively (because it includes terms like $e_1 \times e_2$). After just a few multiplications, the noise exceeds the threshold $q/2$, preventing correct rounding and causing decryption to fail.&lt;/li>
&lt;li>&lt;strong>Mathematical Representation of Homomorphism by Homomorphic Multiplication&lt;/strong>:
$$ E(m_1) \otimes E(m_2) = E(m_1 \times m_2) $$&lt;/li>
&lt;/ul>
&lt;p>This is the reason why FHE could not be realized for a long time and remained at the level of SHE (with a limited number of operations).&lt;/p>
&lt;h3 id="the-magic-of-bootstrapping">The Magic of Bootstrapping
&lt;/h3>&lt;p>Craig Gentry&amp;rsquo;s genius contribution was inventing a noise reduction technique called &lt;strong>&amp;ldquo;bootstrapping.&amp;rdquo;&lt;/strong> This was a paradigm shift in cryptography.&lt;/p>
&lt;p>Intuitively, it is the operation of &amp;ldquo;&amp;lsquo;decrypting&amp;rsquo; the ciphertext to clean it while it remains encrypted, and putting it into a new ciphertext before it becomes too noisy and breaks.&amp;rdquo;&lt;/p>
&lt;ol>
&lt;li>Suppose we have a highly noisy ciphertext $C_{noisy}$.&lt;/li>
&lt;li>The client provides the server in advance with the secret key $sk$ &amp;ldquo;encrypted with the public key,&amp;rdquo; $E_{pk}(sk)$ (this is called the bootstrapping key).&lt;/li>
&lt;li>The server runs a &lt;strong>Decryption Circuit&lt;/strong> homomorphically on $C_{noisy}$.&lt;/li>
&lt;li>Specifically, it performs a &amp;ldquo;decryption within the encrypted space&amp;rdquo; on $E_{pk}(C_{noisy})$ using $E_{pk}(sk)$.&lt;/li>
&lt;li>Since this decryption circuit itself is a homomorphic operation, it generates new noise, but the noise of the newly output ciphertext $C_{fresh}$ is reset to a fixed &amp;ldquo;constant level.&amp;rdquo;&lt;/li>
&lt;/ol>
&lt;div class="mermaid">graph LR
A["High noise ciphertext C_noisy"] --> B["Homomorphic decryption circuit (Eval_Dec)"]
C["Encrypted secret key E(sk)"] --> B
B --> D["Low noise ciphertext C_fresh"]
style B fill:#ffeeba,stroke:#ffc107&lt;/div>
&lt;p>By executing this bootstrapping periodically during computation, it theoretically became possible to compute circuits of infinite depth (achieving FHE). However, Gentry&amp;rsquo;s early scheme was desperately expensive computationally, with a single bootstrapping operation taking anywhere from tens of minutes to hours.&lt;/p>
&lt;hr>
&lt;h2 id="5-generations-of-fhe-and-the-evolution-of-major-schemes">5. Generations of FHE and the Evolution of Major Schemes
&lt;/h2>&lt;p>In the race toward practical FHE, cryptographers around the world have competed to improve the algorithms. Currently, FHE is mainly classified into four generations or families.&lt;/p>
&lt;h3 id="2nd-generation-exact-integer-arithmetic-bgv-bfv">2nd Generation: Exact Integer Arithmetic (BGV, BFV)
&lt;/h3>&lt;p>The &lt;strong>BGV (Brakerski-Gentry-Vaikuntanathan)&lt;/strong> and &lt;strong>BFV (Brakerski/Fan-Vercauteren)&lt;/strong> schemes appeared between 2011 and 2012. These are based on RLWE and are suitable for integer modular arithmetic (exact calculations).
They support batching techniques like SIMD (Single Instruction, Multiple Data), characterized by the ability to pack thousands of data slots into a single large polynomial ciphertext and compute them in parallel all at once.&lt;/p>
&lt;h3 id="3rd-generation-accelerated-bootstrapping-gsw-fhew-tfhe">3rd Generation: Accelerated Bootstrapping (GSW, FHEW, TFHE)
&lt;/h3>&lt;p>The &lt;strong>GSW (Gentry-Sahai-Waters)&lt;/strong> scheme of 2013 made the structure of FHE simpler. This was developed further into &lt;strong>TFHE (Fast Fully Homomorphic Encryption over the Torus)&lt;/strong>, one of the mainstream schemes today.
The hallmark of TFHE is its extremely fast bootstrapping (on the order of milliseconds). It excels at gate-level operations (logic circuits like AND, XOR), and since the ciphertext size is relatively small, it is suited for fast evaluation of arbitrary logic circuits.&lt;/p>
&lt;h3 id="4th-generation-specialization-for-approximate-calculation-and-machine-learning-ckks">4th Generation: Specialization for Approximate Calculation and Machine Learning (CKKS)
&lt;/h3>&lt;p>The &lt;strong>CKKS (Cheon-Kim-Kim-Song)&lt;/strong> scheme proposed by Cheon et al. in 2017 can be called the definitive technology for privacy protection in current AI and machine learning.
While previous FHEs insisted on &amp;ldquo;exact integer calculations,&amp;rdquo; CKKS supports &lt;strong>&amp;ldquo;approximate calculations of floating-point numbers&amp;rdquo;&lt;/strong> while remaining encrypted. It demonstrates overwhelming performance in real number calculations where small errors are tolerable, such as the training and inference of neural networks.&lt;/p>
&lt;p>The table below summarizes how to choose a scheme by purpose.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Scheme Name&lt;/th>
&lt;th style="text-align:left">Preferred Data Type&lt;/th>
&lt;th style="text-align:left">Recommended Use Cases&lt;/th>
&lt;th style="text-align:left">Features&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>BFV / BGV&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Integer&lt;/td>
&lt;td style="text-align:left">Exact statistical calculations, financial data aggregation, DB queries&lt;/td>
&lt;td style="text-align:left">High throughput via SIMD batching&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>CKKS&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Real/Complex&lt;/td>
&lt;td style="text-align:left">Machine learning (DNN, logistic regression), signal processing&lt;/td>
&lt;td style="text-align:left">Acceleration via approximate calculation, rescaling&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">&lt;strong>TFHE&lt;/strong>&lt;/td>
&lt;td style="text-align:left">Boolean&lt;/td>
&lt;td style="text-align:left">Arbitrary logic circuits, string search, evaluation of non-linear functions&lt;/td>
&lt;td style="text-align:left">Ultra-fast bootstrapping (millisecond range)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;hr>
&lt;h2 id="6-practice-fhe-libraries-and-conceptual-code">6. Practice: FHE Libraries and Conceptual Code
&lt;/h2>&lt;p>Today, many open-source libraries are provided that allow you to use FHE without deep cryptographic knowledge.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Microsoft SEAL (Simple Encrypted Arithmetic Library)&lt;/strong>: A C++ library supporting BFV, BGV, and CKKS. One of the industry standards. Its Python binding, &lt;strong>TenSEAL&lt;/strong>, is popular among AI engineers.&lt;/li>
&lt;li>&lt;strong>Zama (Concrete)&lt;/strong>: A framework based on TFHE. You can write in Rust/Python, and it provides functionality (Concrete ML) to compile existing PyTorch models and run them on FHE.&lt;/li>
&lt;li>&lt;strong>OpenFHE&lt;/strong>: The successor to PALISADE, a comprehensive C++ library supporting all major schemes.&lt;/li>
&lt;/ul>
&lt;h3 id="example-of-fhe-programming-using-python-tenseal">Example of FHE Programming using Python (TenSEAL)
&lt;/h3>&lt;p>Here, we show a conceptual Python code example using the CKKS scheme to add and multiply real number vectors while they remain encrypted.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;span class="lnt">17
&lt;/span>&lt;span class="lnt">18
&lt;/span>&lt;span class="lnt">19
&lt;/span>&lt;span class="lnt">20
&lt;/span>&lt;span class="lnt">21
&lt;/span>&lt;span class="lnt">22
&lt;/span>&lt;span class="lnt">23
&lt;/span>&lt;span class="lnt">24
&lt;/span>&lt;span class="lnt">25
&lt;/span>&lt;span class="lnt">26
&lt;/span>&lt;span class="lnt">27
&lt;/span>&lt;span class="lnt">28
&lt;/span>&lt;span class="lnt">29
&lt;/span>&lt;span class="lnt">30
&lt;/span>&lt;span class="lnt">31
&lt;/span>&lt;span class="lnt">32
&lt;/span>&lt;span class="lnt">33
&lt;/span>&lt;span class="lnt">34
&lt;/span>&lt;span class="lnt">35
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">tenseal&lt;/span> &lt;span class="k">as&lt;/span> &lt;span class="nn">ts&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 1. Context setup (including key generation)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Use CKKS scheme, set polynomial degree to 8192&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">context&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">ts&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">context&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">ts&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">SCHEME_TYPE&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">CKKS&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">poly_modulus_degree&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">8192&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">coeff_mod_bit_sizes&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">60&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">40&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">40&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mi">60&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">context&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">generate_galois_keys&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">context&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">global_scale&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="mi">2&lt;/span>&lt;span class="o">**&lt;/span>&lt;span class="mi">40&lt;/span> &lt;span class="c1"># Scaling factor for real numbers&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 2. Client side: Data encryption&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">vector1&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mf">1.5&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">2.5&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">3.5&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">vector2&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="mf">2.0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">3.0&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="mf">4.0&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Convert plaintext vectors to ciphertexts (should be executed on the client side)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">enc_v1&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">ts&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">ckks_vector&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">context&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">vector1&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">enc_v2&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">ts&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">ckks_vector&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">context&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">vector2&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 3. Server side: Computations while encrypted (Protection of Data in Use)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># The server does not know the plaintexts but can perform addition and multiplication&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">enc_add&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">enc_v1&lt;/span> &lt;span class="o">+&lt;/span> &lt;span class="n">enc_v2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">enc_mul&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">enc_v1&lt;/span> &lt;span class="o">*&lt;/span> &lt;span class="n">enc_v2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 4. Client side: Decryption of results&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Only the client with the secret key can view the results&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">res_add&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">enc_add&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">decrypt&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">res_mul&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">enc_mul&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">decrypt&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Decrypted addition result: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">res_add&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Example output: [3.5000001, 5.5000001, 7.5000002] (Includes minute errors due to approximate calculation)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Decrypted multiplication result: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">res_mul&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Example output: [3.0000002, 7.5000005, 14.0000003]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>As you can see from the code above, you can intuitively describe computations between ciphertexts by overloading normal Python operators, such as &lt;code>enc_v1 + enc_v2&lt;/code>. On the server side, vector operations are completed without knowing the contents of the vectors.&lt;/p>
&lt;hr>
&lt;h2 id="7-fhe-challenges-performance-and-hardware-acceleration">7. FHE Challenges: Performance and Hardware Acceleration
&lt;/h2>&lt;p>While FHE provides theoretically perfect security, its biggest challenge for practical use is &lt;strong>&amp;ldquo;performance overhead.&amp;rdquo;&lt;/strong>&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Computational Overhead&lt;/strong>: Compared to computing in plaintext, computing in ciphertext is thousands to tens of thousands of times slower on a CPU. Polynomial multiplications and bootstrapping require massive amounts of FFT (Fast Fourier Transform) or NTT (Number Theoretic Transform) calculations.&lt;/li>
&lt;li>&lt;strong>Ciphertext Expansion&lt;/strong>: A few bytes of plaintext can expand to several megabytes when encrypted. This puts severe pressure on memory bandwidth and network bandwidth.&lt;/li>
&lt;/ol>
&lt;h3 id="approaches-to-hardware-solutions">Approaches to Hardware Solutions
&lt;/h3>&lt;p>To overcome this overhead, the development of dedicated FHE hardware accelerators (ASIC, FPGA, GPU support) is progressing worldwide.&lt;/p>
&lt;ul>
&lt;li>&lt;strong>GPU Acceleration&lt;/strong>: Efforts are underway to parallelize NTT operations and bootstrapping using powerful GPUs from NVIDIA and others, with reports of speeds tens of times faster than software implementations (e.g., 100x.ai, Zama&amp;rsquo;s TFHE-rs CUDA backend).&lt;/li>
&lt;li>&lt;strong>DARPA DPRIVE Project&lt;/strong>: The US Defense Advanced Research Projects Agency (DARPA) is promoting the &amp;ldquo;DPRIVE (Data Protection in Virtual Environments)&amp;rdquo; project to develop dedicated hardware to bring the computational speed of FHE to parity with plaintext processing (within a 10x overhead). Intel, Microsoft, and Intellectual Ventures are participating.&lt;/li>
&lt;li>&lt;strong>Emergence of FPUs (FHE Processing Units)&lt;/strong>: Startups like Cornami and Optalysys are embarking on the development of FHE-specific chips using optical computing and specialized silicon architectures.&lt;/li>
&lt;/ul>
&lt;p>In the near future, an era may come where &amp;ldquo;FPUs&amp;rdquo; become a standard feature in server and cloud infrastructure, just like NPUs (Neural Processing Units) in AI.&lt;/p>
&lt;hr>
&lt;h2 id="8-expected-use-cases">8. Expected Use Cases
&lt;/h2>&lt;p>Now that FHE is approaching practical speeds, disruptive innovations are expected in areas such as:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Privacy Protection in Medical and Genomic Analysis&lt;/strong>:
By having a cloud AI learn from patients&amp;rsquo; medical records and DNA data held by multiple hospitals while keeping it encrypted with FHE, highly accurate cancer diagnostic models and new drug development can be performed without violating privacy laws (like HIPAA or GDPR).&lt;/li>
&lt;li>&lt;strong>Fraud Detection and Anti-Money Laundering (AML) for Financial Institutions&lt;/strong>:
Competing banks can cross-analyze data in an encrypted state to detect massive illegal money transfer networks, without revealing customer account information or transaction histories to each other.&lt;/li>
&lt;li>&lt;strong>Secure AI Inference APIs (MaaS: Model as a Service)&lt;/strong>:
Users encrypt their voice, facial images, and prompts before sending them to AI services (like LLMs such as ChatGPT). The AI provider generates the answer without ever knowing the user&amp;rsquo;s input and returns it as a ciphertext. This completely dispels the concern of &amp;ldquo;AI learning or peeking at personal information.&amp;rdquo;&lt;/li>
&lt;/ol>
&lt;hr>
&lt;h2 id="9-conclusion-the-future-of-cryptography-is-unseen-computation">9. Conclusion: The Future of Cryptography is &amp;ldquo;Unseen Computation&amp;rdquo;
&lt;/h2>&lt;p>Just as the invention of public key cryptography (RSA) in the 1970s enabled secure communication on the Internet (such as HTTPS), Craig Gentry&amp;rsquo;s invention of FHE is one of the most important milestones in the history of cryptography.&lt;/p>
&lt;p>Today, Fully Homomorphic Encryption (FHE) has leapt from the theories of laboratories into the stage where Microsoft, IBM, Intel, Google, and many startups are fiercely competing toward practical application. While challenges regarding computational cost and data size still exist, thanks to the refinement of algorithms and the evolution of hardware accelerators, performance improvements continue at a pace exceeding Moore&amp;rsquo;s Law.&lt;/p>
&lt;p>In a few years, &amp;ldquo;computing data while keeping it encrypted&amp;rdquo; will not be something special, but will likely become the standard data protection best practice in cloud services. FHE is the keystone of next-generation security, realizing the &lt;strong>ultimate combination of privacy and data utilization&lt;/strong> in a data-driven society.&lt;/p></description></item></channel></rss>