<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Arnav Panjla on Medium]]></title>
        <description><![CDATA[Stories by Arnav Panjla on Medium]]></description>
        <link>https://medium.com/@arnavpanjla?source=rss-b3e8c9d81a82------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*z18d1-cOtVjzT1UaEBLPYA.png</url>
            <title>Stories by Arnav Panjla on Medium</title>
            <link>https://medium.com/@arnavpanjla?source=rss-b3e8c9d81a82------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 06:19:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arnavpanjla/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Prover vs Verifier: Exploring the World of Interactive Proofs in Cryptography]]></title>
            <link>https://medium.com/@arnavpanjla/prover-vs-verifier-exploring-the-world-of-interactive-proofs-in-cryptography-83ad30be07da?source=rss-b3e8c9d81a82------2</link>
            <guid isPermaLink="false">https://medium.com/p/83ad30be07da</guid>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[interactive-proof]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[zero-knowledge-proofs]]></category>
            <dc:creator><![CDATA[Arnav Panjla]]></dc:creator>
            <pubDate>Fri, 17 Jan 2025 05:56:17 GMT</pubDate>
            <atom:updated>2025-01-17T06:13:21.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3vlgExCyDK8EbH3aiyBag.png" /></figure><p>Interactive proofs are a cornerstone of modern cryptography, enabling a Prover to convince a Verifier of a statement’s truth <strong>without revealing unnecessary details</strong>. From the <strong>Graph Non-Isomorphism</strong> problem to the <strong>Sumcheck</strong> and <strong>GKR protocols</strong>, these frameworks showcase the power of algebra in verifying computations. With the <strong>Fiat-Shamir transformation</strong> addressing key challenges, interactive proofs bridge complexity and trust in groundbreaking ways. This blog dives deep into these concepts, unraveling the cryptographic interplay between complexity, efficiency, and trust.</p><p>Introduced in the 1980s, IPs and arguments represented a major conceptual expansion of what constitutes “<strong>proof</strong>” that a statement is true. Traditionally, a proof is a static object that can be easily checked step-by-step for correctness because each individual step of the proof should be trivial to verify. In contrast, IPs allow for interaction between the prover and verifier and a tiny but <strong>nonzero probability that an invalid proof passes</strong> verification.</p><blockquote><strong>Interactive Proof</strong> is a type of proof system where a verifier and a prover engage in an interaction to establish the truth of a statement. The prover is assumed to be powerful, but the verifier has limited computational power.</blockquote><p>To understand what an interactive proof is, consider the following scenario. Imagine a company (the verifier) that hires a remote AI service provider (the prover) to analyze sensitive customer data. The company uploads all of its data to the cloud while keeping only a compact “encrypted summary” of the data locally (ensuring the cloud provider never sees the full dataset). Later, the company asks the AI service to perform a specific analysis or computation, say running an algorithm <strong>f</strong> on the customer data.</p><p>The AI service performs the analysis and returns the computed result to the company. However, instead of simply trusting the service’s claimed output, the company can <strong>use an interactive proof system (IP) to ensure the result is accurate</strong>. Through this protocol, the company can obtain a formal guarantee that the computation was performed correctly <strong>without needing to access the cloud’s internal workings</strong> or the full dataset.</p><blockquote><strong>Transferability</strong> distinguishes interactive proofs (IPs) from static proofs. In static proofs, once Alice (the prover) provides Bob (the verifier) with a proof, Bob can share it with Carol (a third party) to convince her of the statement’s truth. However, IPs are not inherently transferable. While Bob can send Carol a transcript of his interaction with Alice, Carol will only trust the proof if she also trusts Bob. This is because the soundness of an IP relies on <strong>Alice not knowing Bob’s next challenge </strong>during the interaction — something a transcript alone cannot guarantee.</blockquote><h3>Key Concepts in Interactive Proofs</h3><ul><li><strong>Soundness: </strong>Ensures that a cheating prover can not convince the verifier of a false statement.<br>While there are more nuanced definitions, such as “computational soundness”, “statistical soundness” and “information-theoretic soundness”, this explanation is sufficient as a starting point.</li><li><strong>Completeness:</strong> This guarantees that if the proof is honest and the statement is true, the verifier accepts the proof with high probability.</li><li><strong>Zero-knowledge:</strong> Zero-knowledge means the verifier learns nothing beyond the statement being true. The prover doesn’t reveal how they know it’s true; they just say it is.</li><li><strong>Succinct: </strong>It refers to the property of a proof or a protocol being <strong>short</strong> and <strong>efficient</strong> while still <strong>maintaining its validity</strong> and <strong>correctness</strong>. Specifically, in interactive proofs, a succinct proof allows one party (usually the prover) to convince another party (the verifier) of a statement with significantly less communication or computational overhead.</li><li><strong>Knowledge Soundness: </strong>Knowledge soundness ensures that if the prover convinces the verifier of the statement, then the prover must have had the knowledge required to generate the proof.</li></ul><h3><strong>How Interactive Proofs Work</strong></h3><p>We can imagine a scenario where a prover <strong>P</strong> tries to convince a verifier <strong>V</strong> that a particular statement <strong>x</strong> is true. <strong>P</strong> aims to prove that x ∈ L, where L is some fixed language. For efficiency, we require <strong>V</strong> to run in <strong>polynomial time with respect to |x|</strong>, ensuring that any proof provided is efficiently verifiable.</p><p>In this framework, a traditional mathematical proof can be modeled by having <strong>P</strong> send a proof <strong>π</strong> to <strong>V</strong>. The verifier <strong>V</strong> then deterministically checks whether <strong>π</strong> is a valid proof of <strong>x </strong>and outputs <strong>V(x,π)</strong>, where 1 denotes acceptance and 0 denotes rejection. Since V operates in polynomial time, we can also assume that the length of <strong>π is polynomial</strong>.</p><p>The traditional notion of a proof is captured by the following requirements:</p><ul><li>If x ∈ L, there exists a proof π such that V(x,π)=1 (completeness).</li><li>If x ∉ L, no matter what proof π the prover sends, V(x,π)=0 (soundness).</li></ul><p>A language <strong>L ∈ IP</strong> if there exist a pair of interactive algorithms <strong>(P, V) </strong>:</p><ul><li><strong>Completeness:</strong> If <strong>x ∈ L</strong>, the probability that (P,V) accepts is 1:</li></ul><p><strong>Pr⁡ [⟨P,V⟩(x) = 1] = 1</strong></p><ul><li><strong>Soundness:</strong> If <strong>x ∉ L</strong>, then for any prover P∗, even a cheating one, the probability that (P*, V) accepts is at most 1/2:</li></ul><p><strong>Pr ⁡[⟨P*,V⟩(x) = 1] ≤ 1/2</strong></p><p>Here, <strong>P</strong> is the honest prover, while<strong> P*</strong> is an arbitrary (potentially unbounded) prover. The pair<strong>(P, V)</strong> satisfying these conditions constitutes a proof system for L.</p><h3>A Surprising Example: Graph Non-Isomorphism, GNI</h3><p>Graph Non-Isomorphism (GNI) provides an intriguing example of how interaction can expand the power of proof systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YIgCySkpdYDR8kAv" /><figcaption>Photo by <a href="https://unsplash.com/@alinnnaaaa?utm_source=medium&amp;utm_medium=referral">Alina Grubnyak</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Key Concept:</h4><p>Given two n-vertex graphs <strong>G0</strong>​ and<strong> G1​,</strong> we define <strong>G0∼G1 if G0 is isomorphic to G1</strong>​. Graph isomorphism involves determining whether <strong>G0​</strong> can be transformed into<strong> G1</strong>​ by relabeling vertices. Graph non-isomorphism is the complement problem: determining that <strong>G0≁G1</strong>.</p><p>To encode isomorphism, for a graph G and a permutation π on n elements, <strong>π(G)</strong> represents the graph obtained by relabeling G’s vertices using <strong>π</strong>. A graph <strong>G0</strong>​ is isomorphic to <strong>G1​</strong> if a permutation <strong>π</strong> such that <strong>G0 = π(G1)</strong> exists.</p><h4>The Interactive Protocol for GNI:</h4><ol><li><strong>Verifier’s Step:</strong></li></ol><ul><li>The verifier<strong> V</strong> picks a random bit <strong>b ∈ {0,1}</strong>.</li><li>It also selects a random permutation <strong>π</strong> on n elements.</li><li>The verifier then computes <strong>G′ = π(Gb)</strong> and sends G′ to the prover P.</li></ul><p><strong>2. Prover’s Step: </strong>The prover determines whether G′ is isomorphic to G0​ or G1.</p><ul><li>If <strong>G′ ∼ G0​</strong>, the prover replies 0.</li><li>If <strong>G′ ∼ G1</strong>​, the prover replies 1.</li></ul><p><strong>3. Verifier’s Check: </strong>The verifier accepts if and only if the prover’s response matches b.</p><h4>Completeness and Soundness:</h4><ul><li><strong>Completeness ( G0 ≁ G1 ): </strong>If <strong>G0≁G1</strong>, then G′ can only be isomorphic to either G0​ or G1​, not both. A correct prover will always respond correctly, matching b exactly. Therefore, Pr⁡[ ⟨P,V⟩(x) = 1 ] = 1.</li><li><strong>Soundness (G0∼G1​): </strong>If G0∼G1​, the graphs are indistinguishable after random permutation. A random permutation of G0 is distributed identically to a random permutation of G1. The verifier’s bit b is perfectly hidden from the prover, even if the prover is computationally unbounded. Thus, even a cheating prover can only guess b with a probability of 1/2: Pr⁡[ ⟨P∗,V⟩(x) = 1 ] ≤ 1/2</li></ul><h4>Why GNI in IP is Surprising?</h4><p>While traditional proofs struggle with non-isomorphism because verifying G0≁G1 involves reasoning about all possible permutations, this interactive protocol leverages randomness and interaction to achieve efficient verification. It highlights <strong>how interaction can handle problems beyond the reach of static-proof systems</strong>, showing that IP includes problems <strong>outside NP.</strong></p><h3>Interactive Proof Complexity Class</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*s1f_udhVg9Zlx6v-N0mWlQ.png" /><figcaption>Complexity Classes</figcaption></figure><blockquote>A complexity class is a set of decision problems that can be solved by an algorithm with a certain amount of resources. A decision problem is a problem where the answer is either yes or no.</blockquote><blockquote>The two most commonly used resources in complexity theory are time and space.</blockquote><ul><li><strong>EXPSAPCE</strong> : Contains all decision problems that can be solved in exponential space.</li><li><strong>EXPTIME </strong>: Contains all decision problems that can be solved in exponential time.</li><li><strong>PSPACE</strong> : Contains all decision problems that can be solved using polynomial space on a deterministic Turing machine.</li><li><strong>NPSPACE :</strong> represents the class of decision problems that can be solved by a nondeterministic machine using polynomial space.</li><li><strong>P </strong>: Means that the running time of the algorithm is bounded by a polynomial function of the size of the input.</li><li><strong>BPP</strong> : Bounded-Error Probabilistic Polynomial Time represents the class of decision problems that can be solved by a probabilistic Turing machine in polynomial time with bounded error probability.</li></ul><p><strong>IP = PSPACE</strong> shows that interactive proof systems, even with their probabilistic nature and interaction between the prover and verifier, do not require more computational resources than polynomial-space algorithms.</p><h3>The Power of Randomness: Freivalds’ Algorithm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PyhSzgvF0jmkbpQa" /><figcaption>Photo by <a href="https://unsplash.com/@alpridephoto?utm_source=medium&amp;utm_medium=referral">Андрей Сизов</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Suppose we are given two n×n matrices <strong>A </strong>and <strong>B</strong> over the finite field Fp, where p &gt; n² is a prime number. The goal is to compute the product matrix <strong>C=A⋅B</strong>. The fastest known algorithm for multiplying matrices asymptotically runs in <strong>O(n^{2.37286})</strong> time, but this algorithm is complicated and impractical for large matrices.</p><blockquote>Instead of focusing on how to multiply matrices quickly, the question at hand is whether we can efficiently verify that two matrices were multiplied.</blockquote><h4>The Verification Problem</h4><p>Let’s consider the case where we are given a matrix C, and we need to check if <strong>C = A⋅B</strong>. Freivalds’ algorithm provides a simple randomized method to verify this in<strong> O(n²)</strong> time, which is close to the time required to simply read the matrices <strong>A</strong>,<strong> B</strong>, and <strong>C</strong>.</p><h4>Freivalds’ Algorithm</h4><p>The algorithm works as follows:</p><ol><li><strong>Randomized Vector Selection: </strong>Choose a random vector <strong>r ∈ Fp</strong>, and construct the vector x=(1, r, r2, …, rn−1), where the entries of <strong>x are powers of r.</strong></li><li><strong>Matrix-Vector Multiplication: </strong>Compute <strong>y = Cx</strong>, and then compute <strong>z=A⋅Bx</strong></li><li><strong>Comparison: </strong>Output <strong>YES</strong> if y=z; otherwise, output <strong>NO</strong>.</li></ol><h4>Time Complexity</h4><p>The time complexity of this algorithm can be analyzed as follows:</p><ul><li>Generating the vector O(n) multiplications.</li><li>Matrix-vector multiplication for y = C and z = A⋅B takes O(n²)time each.</li></ul><p>Thus, the total runtime of the algorithm is <strong>O(n²)</strong></p><h4>Completeness:</h4><ul><li>If C = D, then for any choice of the random vector r, Cx = Dx holds. Therefore, the algorithm will output <strong>YES</strong> for every possible r.</li></ul><h4>Soundness:</h4><ul><li>If C ≠ DC , then at <strong>least one entry </strong>Ci,j ≠ Di,j for some row i exists. Let Ci and Di​ denote the i-th rows of C and D, respectively. Since Cx computes the Reed-Solomon fingerprint of Ci and A⋅B⋅x computes the fingerprint of Di , the probability that Ci ≠ Di is at least 1−(n−1)/p​ due to the properties of Reed-Solomon codes. Thus, if C≠D, the algorithm outputs <strong>NO</strong> with a probability of at least 1−(n−1)/p .</li></ul><p>Freivalds’ algorithm offers a fast and efficient way to verify matrix multiplication in O(n²) time, significantly faster than directly computing the matrix product. This randomized approach is especially useful in contexts where<strong> verification is more important than the actual computation</strong> of the matrix product itself.</p><h3>Sum-Check Protocol</h3><p>The Sumcheck Protocol is a <strong>fundamental interactive proof </strong>technique to verify claims about sums of multivariate polynomials over finite fields. It plays a key role in numerous cryptographic protocols, particularly in proving statements about the correctness of computations and in constructing <strong>zk-SNARKs and zk-STARKs</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e4uLRt5GgpkIdkCk" /><figcaption>Photo by <a href="https://unsplash.com/@helenatheactress?utm_source=medium&amp;utm_medium=referral">Kati Hoehl</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Suppose we have a multivariate polynomial <strong>f( x1, x2, …,xk ) </strong>defined over a finite field F, and we want to verify the following claim interactively:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*bETBcOhmltr94B2yiJR2eQ.png" /></figure><p>Here,<strong> S</strong> is the sum of <strong>f</strong> evaluated at all points in the Boolean hypercube. The prover <strong>P knows f</strong> and the value of <strong>S</strong>, while the verifier <strong>V</strong> wants to <strong>check P’s claim</strong> efficiently without evaluating f on all 2^{k} points.</p><h4>Protocol Description</h4><ol><li><strong>Initialization: </strong>At the start, the prover P sends a claimed value<strong> C1</strong>, which is supposed to equal the sum H given by :</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*xLtXoCeJl1gjKKbrYpXOJw.png" /></figure><p><strong>2. First Round:</strong></p><ul><li>P sends a univariate polynomial <strong>g1(X1)</strong> claimed to represent::</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*-T4Xz4h6j1LAf_sieMuKdA.png" /></figure><ul><li>V verifies two conditions :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*LujOqdm4GIGmddOQ4o-Wzg.png" /></figure><p>If any condition fails, V rejects it.</p><p><strong>3. Subsequent Rounds (j-th round for 1 &lt; j &lt; v1 ):</strong></p><ul><li><strong>V</strong> chooses a random <strong>rj ∈ Fr_j</strong> and sends it to P.</li><li><strong>P</strong> responds with a univariate polynomial<strong> gj(Xj)</strong>, claimed to represent:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*S2qQkkh-RNVH_HOuV9vEzA.png" /></figure><ul><li><strong>V</strong> verifies:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*mLzOQdH2vc4cQEC6AwyaBw.png" /></figure><p>If any condition fails, V rejects it.</p><p><strong>4. Final Round (v-th round): </strong>P sends <strong>gv(Xv),</strong> claimed to be :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*dwIJN2lawUFx-jTl1vPjRg.png" /></figure><ul><li><strong>V</strong> verifies:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*Vvy3TfHH-2K7uJD4WQvZqQ.png" /></figure><p><strong>5. Final Verification:</strong></p><ul><li><strong>V </strong>chooses a random<strong> rv ∈ Fr_v</strong> and evaluates<strong> g( r1, r2, …, rv)</strong>with a<strong> single oracle query </strong>to g.</li><li><strong>V </strong>checks:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*5B4wnvTtgUm9vw0TKd-u-A.png" /></figure><p>If any condition fails, V rejects it. Otherwise, V accepts.</p><blockquote>An “<strong>oracle query”</strong> can be thought of as a way to access information from a “black box” that can instantly provide answers to specific questions or computations. Intuitively, it’s like asking an expert for help when you need to know something without figuring it out yourself.</blockquote><h4>Key Properties</h4><ul><li><strong>Soundness:</strong><br>If <strong>P </strong>is dishonest, any incorrect claim about <strong>H</strong> will eventually be caught with high probability due to the random choices of <strong>r1,…, rv​</strong></li><li><strong>Completeness:</strong><br>If <strong>P</strong> is honest and the claim is correct, <strong>V</strong> will pass all checks and accept.</li><li><strong>Efficiency:</strong><br>The protocol reduces an exponential sum to a sequence of univariate polynomial evaluations, making it more efficient than direct computation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*Hj_rwP3NGi3gK99xwz30PQ.png" /><figcaption>Sum-Check Example</figcaption></figure><h3>Polynomial and algebraic tools</h3><h4>Schwartz-Zippel Lemma</h4><p>For an m-variate polynomial <strong>g</strong>, the degree of a term of <strong>g</strong> is the sum of the exponents of the variables in the term. The total degree of <strong>g </strong>is the maximum of the degree of any term of <strong>g.</strong></p><p>Let <strong>F </strong>be any field, and let <strong>g: Fm→F</strong> be a nonzero m-variate polynomial of total degree at most <strong>d</strong>. Then, on any finite set S ⊆ F,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*dSBPXoVLC8fjETLSFUjTZQ.png" /></figure><p>Here, <strong>x ← Sm</strong> denotes an x drawn uniformly at random from the product set <strong>Sm,</strong> and <strong>|S| </strong>denotes the size of <strong>S.</strong> In other words, if x is chosen uniformly randomly from Sm, then the probability that <strong>g(x) = 0</strong> is at most <strong>d/ |S|.</strong></p><blockquote>An easy implication of the Schwartz-Zippel lemma is that for any two distinct m-variate polynomials p and q of total degree at most d over F, <strong>p(x) = q(x)</strong> for at most a <strong>d / |F| fraction of inputs</strong>.</blockquote><h4>Low-degree Extension</h4><p>A <strong>low-degree extension</strong> is a method to extend a discrete function defined on a finite set to a polynomial of a specified low total degree over a larger domain.</p><p><strong>Definition</strong>: Suppose <strong>f: Sm → F</strong> is a function defined over a finite grid Sm, where S ⊆ F, S and F are fields. A low-degree extension <strong>f*​ is a polynomial f*: Fm → F</strong> of total degree at most d in each variable such that<strong> f*(x) = f(x) for all x ∈ S.</strong></p><ul><li>Enables interpolation of f over a larger domain.</li><li>Allows probabilistic checks of properties of f using fewer points.</li><li>Useful in sum-check protocols, Reed-Solomon coding, and error-correcting codes.</li></ul><h4>Multilinear Extension</h4><p>A <strong>multilinear extension</strong> is a specific type of low-degree extension where the polynomial has a degree at most 1 in each variable (i.e., it is linear in every variable).</p><p>Given a function <strong>f:{0,1}m → F</strong> defined over the Boolean hypercube {0, 1}^m, its multilinear extension <strong>f*:Fm→F</strong> is a polynomial such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*IhxRr-5jAHy38mWZYo0AZA.png" /></figure><p><strong>Construction</strong>: Multilinear extensions are computed using the <strong>Lagrange basis</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*d7aK26kuhQbEmVCnrzlCcQ.png" /></figure><ul><li>Efficient interpolation over {0, 1}^m.</li><li>Ensures consistency of f when evaluated at Boolean points xi ∈ {0,1}</li><li>Useful in cryptography (e.g., polynomial commitments, interactive proofs).</li></ul><h3>Polynomial commitments: A brief overview</h3><p><strong>Polynomial commitments</strong> are cryptographic primitives that allow a prover to commit to a polynomial f(x) in a way that:</p><ul><li>The commitment is <strong>succinct</strong>.</li><li>The prover can later <strong>open</strong> the commitment at any point x, providing proof that the value f(x) is correct.</li><li>The verifier can efficiently check the proof without needing access to the full polynomial.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*iFBvftzlP46e-1kcH_LZvA.png" /><figcaption>types of polynomial commitments</figcaption></figure><blockquote><strong>Polynomial commitments</strong> are like sealing a secret recipe in an envelope: you lock away the entire recipe (the polynomial) and can later prove specific details about it (like the amount of sugar) without revealing the whole thing. This allows you to “commit” to a secret while maintaining privacy, and then provide a small proof that shows you know something specific about it, without others seeing the full content. It’s a way to prove you know something while keeping the underlying information hidden, and it’s commonly used in cryptographic systems like zero-knowledge proofs.</blockquote><h3>Application of sum-check protocol: Counting triangles in graphs</h3><ul><li>Given a <strong>graph</strong> G=(V, E) consists of vertices V and edges E.</li><li>The <strong>adjacency matrix</strong> A represents the graph, where:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*OnzbSaWoX-0G0aYpcp_oqA.png" /></figure><ul><li>The <strong>goal</strong> is to count the number of <strong>triangles</strong> in the graph. A triangle is defined as three vertices I, j, k such that all edges (i,j),(j,k),(i,k) exist in the graph.</li></ul><p>This issue is clearly not linked to polynomials or multilinear extensions. We need to establish a connection between the triangle count and a low-degree polynomial g, enabling us to utilize the sum-check protocol to compute the result effectively!</p><h4>Solution Using Multilinear Extensions</h4><ol><li><strong>Adjacency Matrix as a Function</strong></li></ol><ul><li>Instead of treating A as a matrix, interpret it as a function <strong>fA​: fA(x,y):{0,1}log⁡n×{0,1}log⁡n→{0,1}.</strong></li><li>The binary representations x and y correspond to vertex indices i and j, respectively.<strong> fA(x,y)=Ai,j</strong>.</li></ul><p><strong>2. Triangle Counts as a Sum</strong></p><ul><li>The number of triangles Δ in the graph is given by:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*mKGMs8mzEVIIXvlgr_FvXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*7HL37lRXxhvPYilr70GLBA.png" /></figure><p><strong>3. Working in a Finite Field</strong></p><ul><li>Convert A to entries in a finite field F of size p ≥ 6n³ (large enough to avoid overflow and ensure correctness).</li><li>Perform all calculations in F, ensuring soundness for protocols like sum-check.</li></ul><p><strong>4. Define the Polynomial g</strong></p><ul><li>Use the <strong>multilinear extension</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*VBd_yQndcHTzxh2j42Cohw.png" /></figure><p><strong>5. Sum-Check Protocol</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*IynqVa6pjhL73d1ZFPVpdA.png" /></figure><p>Apply the <strong>sum-check protocol</strong> to compute this sum efficiently within an interactive proof.</p><h3>GKR protocol : A brief overview</h3><p>The <strong>GKR Protocol</strong> (<strong>Goldwasser-Kalai-Rothblum Protocol</strong>) is an interactive proof system that enables a prover to convince a verifier of the correctness of a computation with <strong>logarithmic communication and verification complexity</strong>, making it highly efficient.</p><p>The <strong>prover’s complexity is linear</strong> in the size of the circuit.</p><p>The <strong>verifier’s complexity is logarithmic</strong> in the size of the circuit.</p><p>The verifier challenges the prover to prove this claim step by step, starting from the output layer and working backward through the circuit.</p><p>For example:</p><ul><li><strong>Layer 1</strong>: Inputs are</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/277/1*FSh5nTJ6tqHSSMYrDHwBxw.png" /></figure><ul><li><strong>Layer 2:</strong> Outputs from Layer 1 are multiplied:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*Dkh6-CgeAifG9sOSnVfNjQ.png" /></figure><ul><li><strong>Layer 3: </strong>Outputs from Layer 2 are added</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*NaI9lh1QbhWMbHEohLUd1g.png" /></figure><p>This circuit computes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*Bn7EAf6DvfPEhacNEhftiw.png" /></figure><blockquote>The GKR protocol leverages the <strong>Sum-Check Protocol</strong> to verify the correctness of computations at each layer of the circuit efficiently.</blockquote><blockquote>Think of it as a <strong>layer-by-layer audit</strong> of a circuit’s computation.</blockquote><blockquote><strong>Sum-Check Protocol </strong>acts as the <strong>auditor’s tool</strong>, verifying the correctness of each layer by checking polynomial consistency.</blockquote><h3>Simple Circuit with GKR and Sum-Check</h3><p>Consider a small circuit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*eH4nrgrsbdhX8IB4Uzr99A.png" /></figure><h4>Verification Using GKR:</h4><p><strong>Layer 2 (Addition Layer)</strong>:</p><ul><li>Polynomial:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*rBXqHysVujbteaajkJ1IRQ.png" /></figure><ul><li>Sum-Check: Verify</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*k1g7oyvP1JHEOh6bScPq_w.png" /></figure><p><strong>Layer 1 (Multiplication Layer)</strong>:</p><ul><li>Polynomials for each gate:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*Gr0MsYVkmCVdcURjvGnEdQ.png" /></figure><ul><li>Sum-Check: Verify:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*Kwv5Vgg9d8GnQ3d3AGKUFg.png" /></figure><h4>Recursive Reduction:</h4><ul><li>Each sum-check reduces the verification problem to evaluating simpler subclaims on random values.</li><li>At the end, the verifier needs to evaluate the polynomial on a few points to confirm correctness.</li></ul><h3>Challenges and Limitations of IP Systems</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zq_ijf6quq4jykCYZrujTA.jpeg" /></figure><h4>Computational Constraints</h4><ul><li><strong>Verifier Restrictions</strong>: The verifier has bounded computational power</li><li><strong>Prover Trustworthiness</strong>: The prover is assumed to have unlimited computational resources but cannot be fully trusted</li><li><strong>Probabilistic Nature</strong>: Proofs are probabilistic, with only an exponentially small (non-zero) chance of verification.</li></ul><h4>Key Challenges</h4><ol><li><strong>Communication Overhead</strong>: Requires multiple interaction rounds between the prover and verifier</li><li><strong>Randomness Dependency</strong>: Most interactive proof systems critically depend on the verifier’s ability to make random choices.</li></ol><h4>Fundamental Restrictions</h4><ul><li>Cannot guarantee absolute proof in the strict mathematical sense</li><li>Verification is probabilistic</li><li>Dependent on random coin flips and communication rounds</li></ul><h3>Fiat-Shamir Transformation: Converting IP to non-interactive proofs</h3><p>Before looking at the working of Fiat-Shamir lets think of some naive ways to make the protocol non-interactive.</p><ul><li>A simple way to make the protocol non-interactive is to <strong>ask the prover to randomly draw the verifier’s messages</strong> from the uniform distribution, independent of all prior messages. This does not function because the <strong>prover is untrusted and can not be forced to draw the verifier’s challenges from the right distribution.</strong></li><li>A second solution is to have <strong>Q</strong> use the random oracle to decide the verifier’s message <strong>ri</strong> in round <strong>i</strong> of I. It will ensure each task is evenly dispersed. A simple implementation of this approach would select ri in <strong>Q</strong> by evaluating the random oracle at input <strong>i</strong>. This approach is likewise flawed. While this assures uniform distribution of verifier messages <strong>ri,</strong> it does not guarantee independence from prover messages <strong>g1,…, gi</strong> from rounds 1, 2,…, i of I. Specifically, the prover in Q can learn all verifier messages r1, r2,… in advance by asking the random oracle at predefined points and choose messages in I based on these values.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZcJsVP9kGgaic9J1" /><figcaption>Photo by <a href="https://unsplash.com/@bkaraivanov?utm_source=medium&amp;utm_medium=referral">Bozhin Karaivanov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Comprehensive explanation of Fiat-Shamir</h4><p>The Fiat-Shamir transformation replaces each of the verifier’s messages from the interactive protocol <strong>I</strong> with a value derived from the <strong>random oracle</strong> in the following manner:</p><p>In Q, the verifier’s message in round i of I is determined by interrogating the random oracle, where the query point is the list of messages sent by the prover in rounds 1,…, i. As in the previous naive attempt, this eliminates the necessity for the verifier to transmit any information to the prover. Rather, the <strong>prover can send a single message that contains the transcript of the entire protocol</strong>, which includes a list of all messages exchanged by the prover in the interactive protocol. <br>A technique known as <strong>hash chaining</strong> is frequently employed to implement the Fiat-Shamir transformation in many-round interactive protocols. This implies that, rather than selecting the round-i verifier challenge ri in the interactive protocol to be the hash (or random oracle evaluation) of all preceding prover messages g1,…, gi, one instead selects ri to be a hash of only (x, i, ri−1, gi).</p><p>By maintaining the inputs at which the hash function is evaluated to be brief, this minimises the cost of hashing in actuality. In the random oracle mode, this variant of Fiat-Shamir can also be demonstrated to be secure.</p><blockquote>To ensure the security of the Fiat-Shamir transformation in scenarios where an adversary has the ability to select the<strong> input x</strong> to the IP or argument, it is imperative that <strong>x be appended to the list that is hashed in each round.</strong></blockquote><blockquote><strong>Adaptive soundness</strong> is the term used to describe this property of soundness against adversaries that have the ability to select x.</blockquote><h3>References-</h3><ul><li>Justin Thaler — <a href="https://people.cs.georgetown.edu/jthaler/ProofsArgsAndZK.pdf">ProofsArgsAndZK</a></li><li>Brilliant.org— <a href="https://brilliant.org/wiki/complexity-theory/">Complexity Theory, Brilliant</a></li><li>Jonathan Katz — <a href="https://www.cs.umd.edu/~jkatz/complexity/f11/">CMSC 652 Complexity Theory</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83ad30be07da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Digital Signatures: The Cornerstone of Modern Cryptography]]></title>
            <link>https://medium.com/@arnavpanjla/demystifying-digital-signatures-the-cornerstone-of-modern-cryptography-8928010690a2?source=rss-b3e8c9d81a82------2</link>
            <guid isPermaLink="false">https://medium.com/p/8928010690a2</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[bls-signature]]></category>
            <category><![CDATA[rsa]]></category>
            <category><![CDATA[elliptic-curve]]></category>
            <category><![CDATA[digital-signatures]]></category>
            <dc:creator><![CDATA[Arnav Panjla]]></dc:creator>
            <pubDate>Sun, 05 Jan 2025 17:19:31 GMT</pubDate>
            <atom:updated>2025-01-05T17:19:31.549Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMhtysx1NTZRzwI6A1n0UQ.png" /><figcaption>Digital Signatures</figcaption></figure><p>In today’s linked digital world, protecting data authenticity and integrity has never been more important. Cryptographic processes are essential for sustaining confidence in a digital ecosystem, from safeguarding online transactions to validating user identities. Among these mechanisms, digital signatures are an essential component of modern cryptography. They provide a means of verifying the validity of digital messages or documents, confirming that they have not been altered and come from a legitimate source.</p><p>We’ll journey through the workings of popular schemes like RSA, ECDSA, and BLS signatures, uncover the role of authenticated encryption, and examine how encryption and signatures (signcryption) can be combined to enhance security. Along the way, we’ll touch on advanced topics, implementation details, and emerging trends shaping the future of cryptography.</p><h3>Definition of a digital signature</h3><p>A signature scheme<strong> S*</strong> = (<strong>G</strong>, <strong>S</strong>, <strong>V</strong> ) is a triple of efficient algorithms G, S, and V, where</p><ul><li><strong>G</strong> is called a key generation algorithm</li><li><strong>S</strong> is called a signing algorithm</li><li><strong>V</strong> is called a verification algorithm</li></ul><p><strong>G</strong> is a probabilistic algorithm that takes no input. It outputs a pair <strong>(pk, sk)</strong>.</p><p><strong>S</strong> is a probabilistic algorithm that is invoked as <strong>E(sk, m) → σ</strong>, where sk is a secret key (as output by G) and m is a message. The algorithm outputs a signature σ.</p><p><strong>V</strong> is a deterministic algorithm invoked as <strong>V (pk, m, σ)</strong>. It outputs either accept or reject. We require that a signature generated by <strong>S</strong> is always accepted by <strong>V </strong>. That is, for all <strong>(pk, sk)</strong> output by <strong>G</strong> and all messages m, we have,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*vtnZvtn66JhXsKzUFLYzWA.png" /></figure><h4>Secure signatures</h4><p>We allow the adversary to perform a chosen message attack, where they can request the signature of any message they select. However, the adversary should still be unable to create an existential forgery, even with this capability. Specifically, the attacker cannot generate a legitimate message-signature pair <strong>(m, σ)</strong> for a new message <strong>m</strong>.</p><blockquote>Here “new” refers to a message for which the adversary has not previously requested a signature.</blockquote><h4>Attack Game: Secure Signature</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*M5N7kHg0eg5c2Ft71wV-qA.png" /><figcaption>Signature Attack game (source: Principls of modern cryptography)</figcaption></figure><p>For a given signature scheme <strong>S* = (G, S, V)</strong> defined over <strong>(M, Σ) </strong>and a given adversary<strong> ‘A’</strong>, the attack game runs as follows:</p><ul><li>The challenger runs <strong>(pk,sk) ← KeyGen()</strong> and sends <strong>pk</strong> to ‘<strong>A’</strong></li><li><strong>‘A’</strong> queries the challenger several times. For i=1,2,… the i-th signing query is a message mi ∈ M. The challenger computes <strong>σi ← S(sk, mi)</strong> and then gives <strong>σi​ </strong>to ‘<strong>A’</strong>.</li><li>Eventually, A outputs a candidate forgery pair <strong>(m,σ) ∈ M × Σ</strong></li></ul><p>We say that the adversary wins the game if the following two conditions hold:</p><ul><li><strong>V( pk, m, σ )</strong> == accept , and</li><li><strong>m</strong> is new, i.e. <strong>m </strong>∉<strong> { m1, m2,… }</strong></li></ul><p>We define <strong>A</strong>’s advantage with respect to S, denoted by <strong>SIGadv[A, S]</strong> as the probability that ‘<strong>A’</strong> wins the game.</p><p>We say that a signature scheme S is secure if<strong> </strong>the quantity<strong> SIGadv[ A, S ]</strong> is negligible for all efficient adversaries ‘<strong>A’</strong></p><h3>RSA Digital Signatures</h3><p>In 1977, the <strong>Rivest–Shamir–Adleman</strong> (RSA) cryptosystem introduced public-key encryption, revolutionizing cryptography. Traditional symmetric-key encryption uses the same secret key to encrypt and decrypt messages. RSA was a breakthrough because of its magic, and 40 years later, it is still the standard for public-key encryption and internet security. RSA is primarily arithmetic.</p><p><strong>Trapdoor permutations</strong>, mathematical objects that transform a number x to a number y in the same range, make determining y from x straightforward using the public key. Calculating x from y is nearly impossible without the private key or trapdoor.</p><blockquote>The “trapdoor” refers to a hidden mathematical structure that makes it easy to decrypt messages if you know the private key, but hard for an attacker to do so without that knowledge.</blockquote><h4><strong>Basic RSA:</strong></h4><p>Involves generating a key pair (public and private keys) based on large prime numbers and modular arithmetic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*XUAMl7qisPfw48NZETIe5g.png" /></figure><p>Assuming that factoring is indeed hard and that finding e-th roots is about as hard, RSA’s security level depends on -</p><ul><li>the size of n</li><li>the choice of p and q</li><li>how the trapdoor permutation is used.</li></ul><blockquote>To be safe, n should at least be 2048 bits long (a security level of about 90 bits, requiring a computational effort of about 2⁹⁰ operations), but preferably 4096 bits long (a security level of approximately 128 bits).</blockquote><p>A digital signature is employed to prevent forgeries, while encryption ensures confidentiality. The most prominent illustration of this distinction is that it is permissible for a signature scheme to disclose information regarding the signed message, as it is not classified as confidential. Nevertheless, a signature scheme can process messages of arbitrary sizes by utilizing their hash values as a proxy, and it can be both deterministic and secure.</p><h4>Violating the RSA Signature: <em>Blinding attack</em></h4><p>Say you want a third party’s signature on some incriminating message you know they would never knowingly sign.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*3JvVlMMRt2t8JjorFnJtVw.png" /><figcaption>binding attack</figcaption></figure><p>As you can see, this is practical and powerful.</p><h4><strong>PKCS1 v2.1: </strong>Probabilistic Signature Scheme (PSS)</h4><p>PSS is a <strong>probabilistic</strong> (randomized) signature scheme, meaning that even if you sign the same message multiple times, you will get a different signature each time due to the inclusion of random data in the padding process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VTYFtAsZxN0-GWYI0epdw.png" /><figcaption>Signing a message, M, with PSS standard, where (n,d) is private key. Source: Serious Cryptography</figcaption></figure><p>The PSS signing process works as follows —</p><ul><li>Pick an r-byte random string R using the PRNG( PseudoRandom Number Generator).</li><li>Form an encoded message M′ = 0000000000000000 || <strong>Hash1</strong>(M) || R, long of h + r + 8 bytes (with eight zero bytes at the beginning).</li><li>Compute the h-byte string H = <strong>Hash1</strong>(M′).</li><li>Set L = 00 … 00 || 01 || R, or a sequence of 00 bytes followed by a 01 byte and then R, with a number of 00 bytes such that L is long of m — h — 1 bytes (the byte width m of the modulus minus the hash length h minus 1).</li><li>Set L = L ⊕ Hash2(H), thus replacing the previous value of L with a new value.</li><li>Convert the m-byte string P = L || H || BC to a number, x, lower than n. Here, the byte BC is a fixed value appended after H.</li><li>Given the value of x just obtained, compute the RSA, x^{d} mod n to obtain the signature.</li></ul><p>To verify a signature given a message, M, you compute Hash1(M) and use the public exponent e to retrieve L and H and then M′ from the signature, checking the padding’s correctness at each step.</p><blockquote>In practice, the random string R (called a salt in the RSA-PSS standard) is usually as long as the hash value. For example, if you use n = 2048 bits and SHA-256 as the hash, the value L is long of m — h — 1 = 256–32–1 = 223 bytes, and the random string R would typically be 32 bytes.</blockquote><h4>RSA: Ways to Speed UpComputation</h4><p><strong>1. Fast Exponentiation (Exponentiation by Squaring): </strong>RSA relies heavily on modular exponentiation. <strong>Fast exponentiation</strong>, or <strong>exponentiation by squaring</strong>, speeds up this process by reducing the number of multiplications. Instead of calculating m^e directly, exponentiation by squaring breaks the exponent e into smaller powers. This reduces the number of operations from <strong>O(e)</strong> to<strong> O(log⁡ e)</strong>, making it much faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*ufMrKxGOTsIw0InPOGV0Ig.png" /></figure><p><strong>2. Chinese Remainder Theorem (CRT):</strong></p><p>The Chinese Remainder Theorem (CRT) optimizes RSA decryption and signing by breaking the large modulus N = p × q (where p and q are prime numbers) into two smaller moduli: p and q.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*XbhIUOs27GQKsBHhzoVXUQ.png" /></figure><h3>ECDSA Digital Signatures</h3><p>ECDSA (Elliptic Curve Digital Signature Algorithm) is a modern and widely adopted signature scheme based on the mathematics of elliptic curves. It provides equivalent security to RSA but with much smaller key sizes, making it highly efficient in resource-constrained environments.</p><p>Here is a quick recap on the <a href="https://medium.com/@arnavpanjla/elliptic-curve-cryptography-d19a94229dfc">workings of ECDSA</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*m5LzUvfGF4dawGzwyrnkjA.png" /><figcaption>working of ECDSA</figcaption></figure><h4>Deterministic ECDSA</h4><p>Deterministic ECDSA addresses vulnerabilities in traditional ECDSA by removing randomness in signature generation. This approach:</p><ul><li>Eliminates risks associated with weak random number generators</li><li>Ensures consistent signature generation</li><li>Improves overall cryptographic security</li></ul><h4>EdDSA (Edwards-curve Digital Signature Algorithm)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*BZY2VesESsc3kF5AeIhNQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*8k6k0YU1F0cvInG0muZcfg.png" /></figure><p>EdDSA used the Ed25519 curve instead of the elliptic curve for signature generation and verification.</p><p><strong>Key Features</strong></p><ul><li>Complete formulas (e.g. addition law): the formula works for all points in the curve.</li><li>Hash collision resistance.</li><li>128-bit security level.</li><li>Small 32-byte keys and 64-byte signatures.</li><li>Deterministic signature generation</li><li>Resistant to side-channel attacks</li></ul><h3>BLS Signatures</h3><p>BLS (<strong>Boneh-Lynn-Shacham</strong>) digital signatures are a cryptographic signature scheme that uses <strong>bilinear pairings</strong> on elliptic curve groups to create compact and secure digital signatures. <br>The BLS signature scheme uses the following key concepts:</p><ul><li>Bilinear Pairing</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*W0Q8qw2UMtKShNZfkswOyg.png" /></figure><ul><li>Hash function (H)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*GvNW-lAW_LV19JTS6WHvQQ.png" /></figure><p>BLS signature scheme is defined as follows —</p><ul><li><strong>KeyGeneration</strong> — Choose a random α and set h such that</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*4Z_D1VcfPPReE_Xtgkl0mA.png" /></figure><p>2.<strong> Sign(sk,n) — </strong>The signature is a single group element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*kUxrsjpV7Cck8hmB_4X5Ng.png" /></figure><p>3. <strong>Verify( pk, m, σ) </strong>— To verify a signature σ for a message m with the public key pk = (h) :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*P_1Lbtla8uPIYkbQqaHZuA.png" /></figure><h4>BLS comparison with ECDSA</h4><p>Considering BLS signatures with curve BLS12–381, targeting 126 bits of security.</p><ul><li>For 128-bit security, ECDSA takes 37 and 79 microseconds to sign and verify a signature on a typical laptop. In comparison, for a similar level of security, BLS takes 370 and 2700 microseconds to sign and verify a signature.</li><li>(considering curve BLS12–381) In terms of sizes, ECDSA uses 32 bytes for public keys and 64 bytes for signatures, while BLS uses 96 bytes for public keys and 48 bytes for signatures. Alternatively, BLS can also be instantiated with 48 bytes of public keys and 96 bytes of signatures.</li><li>BLS also allows for signature aggregation. In other words, a single signature is sufficient to authenticate multiple messages and public keys</li></ul><h3>BLS multi-signature construction</h3><p>As in BLS, the scheme needs a bilinear pairing and the Hash function. We will also need a second hash function H1 :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*PRkbBh529sbvF2mOX2VjmQ.png" /></figure><p>BLS multi-signature scheme works as follows:</p><p>1.<strong>KeyGeneration</strong> — Choose a random α and set h such that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*4Z_D1VcfPPReE_Xtgkl0mA.png" /></figure><p><strong>2. Sign(sk,n) — </strong>The signature is a single group element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*kUxrsjpV7Cck8hmB_4X5Ng.png" /></figure><p><strong>3.</strong> <strong>Aggregate </strong>((pk1,σ1), (pk2,σ2) …….. (pki,σi))</p><p>Given multiple signatures, compute the aggregate as follows:</p><ul><li>Compute</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*-2u5FZzPoO4okgXsnOvi5Q.png" /></figure><ul><li>Output the multi-signature:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*lg3PDkcXsEjNGkWA0iPgZg.png" /></figure><p><strong>4. Verify </strong>((pk1…….. pki, m, σ))</p><p>To verify a multi-signature σ on message m:</p><ul><li>Compute</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*-LT6DWAvvXrVGKzfPgUUJg.png" /></figure><ul><li>Compute the aggregate public key:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*sr62TZEPxybeJnn4XSdDug.png" /></figure><ul><li>Assert</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*exX80YbgrjdlyQkUEgQciA.png" /></figure><p>Verification always requires two pairings independent of n.</p><blockquote>Notice that the aggregate public key ‘<strong>apk</strong>’ can be calculated before the message ’<strong>m</strong>’ is known. In particular, confirming the multi-signature ‘<strong>σ</strong>’ is equivalent to proving that ‘<strong>σ</strong>’ is a normal BLS signature on ‘<strong>m</strong>’ with respect to the aggregated public key ‘<strong>apk</strong>’. After generating ‘<strong>apk</strong>’, the verifier does not require the underlying public keys ‘<strong>pk1,…,pkn</strong>’. This approach is known as <strong>public key aggregation</strong>.</blockquote><h4>Batch Verification</h4><p>A batch of b multi-signatures can be validated faster than one at a time. Consider the following triples (m_i, σ_i, a_pk_i) for i = 1,…, b. The aggregated public key a_pk_i is used to verify the multi-signature σ_i on m_i.</p><p>A batch of b multi-signatures can be verified as a batch faster than one at a time. Consider the following triples (m_i, σ_i, a_pk_i) for i = 1, ..., b, where a_pk_i is the aggregated public key used to verify the multi-signature σ_i on m_i.</p><p>If all the messages m_1, ..., m_b are distinct, then we can use signature aggregation to verify all these triples as a batch:</p><p>Compute an aggregate signature</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*8PDYEFnruo2Y6qwUihhajw.png" /></figure><p>Accept all b multi-signature tuples as valid if:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*B9tU4Xhan51hYLblezZ4ww.png" /></figure><p>This method confirms the b multi-signatures takes only b + 1 pairings rather than 2b pairings to check them individually.</p><blockquote>If some messages are repeated, batch verification can be done by first choosing random ρ_1, ..., ρ_b ← R{1, ..., 2^64}, computing σ = σ_ρ_1^1 ⋯ σ_ρ_b^b ∈ G_1, and checking that:</blockquote><blockquote>e(g_1, σ) == e(a_pk_ρ_1^1, H_0(m_1)) ⋯ e(a_pk_ρ_b^b, H_0(m_b))</blockquote><h3>Signcryption: Combining signatures and encryption</h3><p>A signcryption scheme enables a sender, Alice, to transmit an encrypted message to a recipient, Bob, in a manner that is only readable by Bob. Bob is thus convinced that the message originated from Alice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kf1JhXVtjK81Odtw4iOrHQ.jpeg" /></figure><p>In messaging systems that offer end-to-end security, signcryption schemes are essential; however, Alice may transmit the message while Bob is unavailable. Alice cannot establish a shared session key with Bob due to Bob’s inactive status.</p><ul><li><strong>Functionality</strong>: It provides both confidentiality and authenticity, much like authenticated encryption, but in a <strong>non-interactive</strong> setting where a shared secret key is not available</li><li><strong>Key pairs</strong>: Signcryption involves both the sender’s<strong> (skS, pkS)</strong> and recipient’s <strong>(skR, pkR)</strong> key pairs, and their respective identities <strong>(idS, idR)</strong></li><li><strong>Algorithms</strong>: A signcryption scheme includes three algorithms: key generation (<strong>G</strong>), encryption (<strong>E</strong>), and decryption (<strong>D</strong>).</li><li><strong>Security:</strong> Secure signcryption means that an adversary without the secret keys cannot break semantic security for the ciphertexts and cannot make Bob accept a ciphertext not generated by Alice.</li></ul><h4>Mathematical definition of signcryption</h4><p>A signcryption scheme <strong>SC = (G, E, D)</strong> is a triple of efficient algorithms, <strong>G</strong>, <strong>E</strong>, and <strong>D</strong>, where:</p><ul><li><strong>G(Key generation algorithm)</strong> is a probabilistic algorithm that takes no input. It outputs a pair <strong>(pk, sk)</strong> where <strong>sk</strong> is called a secret key and<strong> pk</strong> is called a public key.</li><li><strong>E(Encryption algorithm)</strong> is a probabilistic algorithm that is invoked as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*KDBdjc4xGO6v_Wt-ECc62A.png" /></figure><p>where skS and idS are the secret key and identity of the sender, pkR and idR are the public key and identity of the recipient, and m is a message. The algorithm outputs a ciphertext c.</p><ul><li><strong>D(Decryption algorithm)</strong> is a deterministic algorithm invoked as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*ZbSQn0Uv4uTm0VgCWDUVug.png" /></figure><p>It outputs either a message m or a special symbol, “reject.”</p><ul><li>We require that a ciphertext generated by E is always accepted by D. That is, for all possible outputs<strong> (pkS, skS)</strong> and <strong>(pkR, skR)</strong> of G, all identities <strong>idS</strong>, <strong>idR</strong>, and all messages <strong>m</strong>, we have:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*iAUiJ354hwBMfJqGtYjGNQ.png" /></figure><p>As usual, we say that messages lie in a finite message space M, ciphertexts lie in some finite ciphertext space C, and identities lie in some finite identity space I. We say that <strong>SC = (G, E, D)</strong> is defined over <strong>(M, C, I).</strong></p><blockquote>The public-key analogue of authenticated encryption for symmetric cyphers is signcryption. Authenticated encryption is intended to achieve the same confidentiality and authenticity objectives as signcryption, provided that the sender and recipient have already established a shared private key. Signcryption is designed for “non-interactive environments” that lack a shared private key.</blockquote><h4>Ways to create signcryption</h4><ul><li><strong>Encrypt-then-sign</strong>: First, the message is encrypted using the recipient’s public encryption key, and then the resulting ciphertext is signed using the sender’s secret signing key.</li><li><strong>Sign-then-encrypt:</strong> First, the message is signed using the sender’s secret signing key, and then the message-signature pair is encrypted using the recipient’s public encryption key.</li></ul><h4>Signcryption construction based on Die-Hellman key exchange</h4><p>The signcryption scheme we describe can be built from <strong>any non-interactive</strong> key exchange (RSA, ECDH, etc. ), but we present it concretely using Diffie-Hellman key exchange here.</p><p>The protocol uses a group <strong>G</strong> of prime order <strong>q</strong> with generator <strong>g </strong>∈<strong> G</strong>. This variant is said to be non-interactive because once every party publishes its contribution to the protocol — g^α for some random <strong>α</strong> ∈ <strong>Zq</strong> — no more interaction is needed to establish a shared key between any pair of parties.</p><p>The scheme mainly has 3 ingredients :</p><ul><li>a symmetric cipher <strong>E</strong> = (<strong>Es</strong>, <strong>Ds</strong>) defined over ( <strong>K</strong>, <strong>M</strong>, <strong>C</strong>)</li><li>a group G of prime order q with generator <strong>g</strong> ∈ <strong>G</strong></li><li>a hash function, <strong>H</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*Vnul9WlsiKcgcxW8_PcRhg.png" /></figure><p>Given these ingredients, the system SCDH is defined over (<strong>M</strong>, <strong>C</strong>, <strong>I</strong>) and works as follows:</p><p><strong>1. </strong>The <strong>key generation</strong> algorithm G runs as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*RNGEgAmkivSauBulTggaMw.png" /></figure><p>The public key is <strong>pk </strong>:= <strong>h</strong>, and the secret key is <strong>sk </strong>:= <strong>α</strong>. We use <strong>hX</strong> to denote the public key associated with identity <strong>idX</strong> and use <strong>αX</strong> to denote the associated secret key.</p><p><strong>2. Encryption</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*lXvJ-TUhVL-oJjxq7SUY8w.png" /></figure><p>works by first deriving the Die-Hellman secret between users S and R, namely</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*I5R9FWwBF1gw3oKrGQayKA.png" /></figure><p>, and then encrypting the message m using the symmetric cipher with a key derived from hSR. More precisely, encryption works as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*ljba87-BSh8pSj6LueEQKA.png" /></figure><p><strong>3. Decryption</strong> works as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*V-VI1BMyVOxBU1n2AiWYUg.png" /></figure><h3>RSA vs ECDSA vs BLS digital signature</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*7D5x6mcHRnV7PcPidv-5GA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*I5rpM4HvkxpUPkvF-M2eQQ.png" /></figure><h4>Computational Efficiency Comparison</h4><p>For 128-bit security:</p><ul><li>ECDSA: 37/79 microseconds (sign/verify)</li><li>BLS: 370/2700 microseconds (sign/verify)</li></ul><p>Demonstrates trade-offs between aggregation capabilities and computational speed.</p><h3>References →</h3><ul><li><em>Dan Boneh and Victor Shoup, </em>Principles of modern cryptography</li><li><em>Jena-Philippe Aumasson</em>, Serious cryptography</li><li>moon-math</li><li><a href="https://bibliotecadigital.ipb.pt/bitstream/10198/24067/1/Nakai_Eduardo.pdf">Evaluation and Implementation of the Ed25519 Digital Signature Algorithm in Rust</a></li><li><a href="https://crypto.stanford.edu/~dabo/pubs/papers/BLSmultisig.html">BLS Multi-Signatures With Public-Key Aggregation</a></li><li><a href="https://www.ietf.org/archive/id/draft-irtf-cfrg-bls-signature-05.html">BLS Signatures</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8928010690a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Symmetric Encryption]]></title>
            <link>https://medium.com/@arnavpanjla/symmetric-encryption-6c0d0b42266c?source=rss-b3e8c9d81a82------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c0d0b42266c</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[encryption]]></category>
            <dc:creator><![CDATA[Arnav Panjla]]></dc:creator>
            <pubDate>Tue, 24 Dec 2024 20:29:21 GMT</pubDate>
            <atom:updated>2024-12-27T07:17:23.709Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t-izy1rS45S9JeHs_LyihQ.png" /></figure><p>Welcome to the world of Symmetric Encryption — a powerful and efficient cornerstone of digital security. 🔐 With techniques like key generation and cryptographic algorithms, symmetric encryption ensures data stays secure with speed and simplicity. It&#39;s the backbone of modern encryption, from protecting communications to safeguarding sensitive information. Explore how this essential encryption method both fortifies and faces the future of digital security.</p><p>Symmetric encryption is a cryptographic method where the <strong>same key is used for data encryption and decryption</strong>. It plays a critical role in securing communication by ensuring confidentiality and efficiency, especially in systems where high-speed data processing is essential.</p><h3>A Brief Overview</h3><p>This blog delves into foundational concepts like key generation, one-time padding (<strong>OTP</strong>), and <strong>Shannon’s perfect secrecy</strong>, explores practical implementations such as stream and block ciphers, <strong>DES</strong>, and <strong>AES</strong>, and highlights various <strong>network attacks</strong>, including <strong>vulnerabilities in RC4 and DES</strong>. Finally, we will discuss some sophisticated attacks such as <strong>algorithmic attacks</strong>, <strong>side-channel attacks</strong>, <strong>fault injection,</strong> and <strong>Quantum exhaustive searches</strong>. By the end, you’ll understand the strengths of symmetric encryption and <strong>how attackers exploit its weaknesses</strong>, making this a must-read for enthusiasts of <strong>cryptography and cybersecurity</strong>.</p><h3>Measuring security</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2uKXm5xgb0FV3epKaAqYg.png" /></figure><ol><li><strong>Informational security ( Security in “theory”)</strong><br> Informational security doesn’t measure how hard it is to break a cipher. Whether it is breakable at all. A Cipher is <strong>informationally secure if it cannot be broken given infinite computational time and resources</strong>. Even if a successful attack on a cipher would take trillions of years, such a cipher is informationally insecure.</li></ol><p><strong>2. Computational security(Security in “practice”)</strong><br> Computational security views a cipher as secure if it <strong>cannot be broken within a reasonable amount of time and with reasonable resources such as memory, hardware, budget, and energy</strong>.<br> Computational security is expressed in terms of two values -</p><ul><li><strong>t</strong>, the minimum limit on the number of operations needed to carry out to compromise the security</li><li><strong>e</strong>, the limit on the probability of success</li></ul><p><strong>For a <em>(t,e) secure</em> cipher, No attacker with fewer than t operation will succeed with probability less than e.</strong></p><blockquote>We can conclude that a cipher with a key of n bits is “at best” (t,t/2^{n}) secure, no matter how strong the CipherCipher, a brute force will always succeed. Therefore, the key must be long enough to <strong>make brute force attack impractical</strong>.</blockquote><p>Another much better way of <strong>measuring security is in bits</strong>.<br> We avoid the (t, ε) notation by assuming a success probability of ε close to 1 or some other practical value. We then express security in bits, where <strong>“n-bit security” means that about 2^n operations are needed to compromise some particular security notion</strong>.</p><p><em>Remember, key size doesn’t always equal the size of the key.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*PZr97SfAs-pjmnPfr5ZhKQ.png" /></figure><p>Should we then say that the second CipherCipher is stronger than the first? In principle, yes, but <strong>we rarely see such a hundred-fold performance difference between commonly used ciphers</strong>.</p><h3>Attack Patterns</h3><p><strong>1. Parallelism</strong> — Parallelism attack patterns generally refer to strategies where an attacker attempts to exploit the ability to <strong>process multiple parts of the ciphertext simultaneously to speed up the decryption or breaking of the encryption scheme</strong>.</p><p><strong>2. Memory</strong> — Concerning the way space is used, it’s essential to consider how many memory lookups are required as part of an attack, the speed of memory accesses (<em>which may differ between reads and writes</em>), the size of the data accessed, the access pattern (<em>contiguous or random memory addresses</em>), and how data is structured in memory.</p><p><strong>3. Precomputations</strong> — Precomputation operations need to be performed only once and can be reused over subsequent executions of the attack. When performing this attack, the attacker performs one massive computation that <strong>produces large lookup tables</strong> that are then stored and reused to perform the attack.</p><p><strong>4. Number of targets</strong> — The greater the number of targets, the greater the attack surface, and the more attackers can learn about the keys they’re after.</p><h3>Generating Keys</h3><p>If you plan to encrypt something, you must generate temporary “session keys” (like the ones generated when browsing an HTTPS site) or long-term public keys. Cryptographic keys may be generated in one of three ways:</p><ul><li><strong>Randomly</strong>, using a pseudorandom number generator (PRNG)</li><li><strong>From a password</strong>, using a key derivation function (KDF)</li><li>Through a <strong>key agreement protocol</strong>, which is a series of message exchanges between two or more parties that ends with the establishment of a shared key</li></ul><h3>Perfect Encryption: The One-Time Pad</h3><p>Now that you know basic terminologies and techniques, let’s dive into one of the most fascinating aspects of cryptography: the One-Time Pad (OTP) and its connection to perfect secrecy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4kRKldRXjj-oyfsso54eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*4ghZcxz6on7xzlLPWo2WWQ.png" /></figure><p>In an OTP system:</p><ul><li>A key (pad) is generated that is as long as the message to be encrypted.</li><li>The key is used only once and then discarded securely.</li><li>Each character of the plaintext is <strong>XOR</strong>ed with the corresponding character of the key to produce the ciphertext.</li><li>encryption and decryption are both done in the same manner.</li></ul><p><strong>Practical Challenges of OTP</strong></p><ul><li>Key Length Requirement</li><li>Secure Key Distribution</li><li>One-Time Use Restriction</li></ul><h3>Shannon’s Perfect Secrecy</h3><p>Shannon defined perfect secrecy as a property of encryption where the ciphertext provides no information about the plaintext. <strong>The probability distribution of the plaintext given the ciphertext c should be the same as that of the plaintext without the ciphertext</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*jq9Kr1j2zIFxklcKqjEz4A.png" /></figure><h3>Stream Ciphers</h3><p>Stream ciphers <strong>generate pseudorandom bits from the key and encrypt the plaintext by XORing it with the pseudorandom bits</strong> in the same fashion as the one-time pad.</p><h4>General working of stream ciphers</h4><p>Stream ciphers take two values: a <strong>key</strong> and a <strong>nonce</strong>.</p><blockquote>The key should be secret, but the nonce doesn’t have to be secret; rather, it should be unique for each key.</blockquote><p>Stream ciphers produce a pseudorandom stream of bits called the keystream. The keystream is XORed to a plaintext to encrypt it and then XORed again to the ciphertext to decrypt it.</p><h3>Feedback Shift Register (FSR)</h3><p>A feedback shift register (FSR) is a sequential circuit that <strong>generates pseudo-random sequences</strong>. It operates as follows -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*ZqmGPTvpc8Ie-lShNdglCg.png" /></figure><ol><li><strong>Linear Feedback Shift Register (LFSR)</strong><br> In linear feedback shift register <strong>LFSR</strong>, f(R0) is a linear function of the bits in the register. Typically, this function involves XORing specific bits of the register, defined by a feedback polynomial.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*1nsbOy6eoTXqaYxuT4zexw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hiKyRJivjobY6cO1B6C99A.png" /><figcaption>LFSR</figcaption></figure><blockquote>Note that if the feedback poynomial is <em>Primitive</em> (ie, it can’t be factorised further) then it will achieve the maximum period , which is 2^{n} — 1.</blockquote><p><strong>2. Filtered LFSR</strong></p><p>To mitigate the insecurity of LFSRs, you can hide their linearity by passing their output bits through a nonlinear function before returning them to produce a <strong>filtered LFSR.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*bphg7Dxr-dUaS1kSUwydlQ.png" /><figcaption>Filtered LFSR</figcaption></figure><p>The function <strong>g must be a non-linear function, <br></strong>For example , <strong>g</strong> can be L1 L2 + L3 (1 + XX² + X³, in polynomial notation)<br><strong>Filtered LFSR</strong>s are stronger than plain <strong>LFSRs</strong> because of their nonlinear function.</p><p><strong>3. Non-Linear FSR (NFSR)</strong></p><p>Adding a stronger layer to a flawed algorithm won’t secure the entire system. The root cause of the problem must be addressed directly.<br>In <strong>NFSRs</strong>, instead of a linear feedback function, we use a non-linear feedback function. Therefore, we are using not just <strong>XOR</strong>s but bitwise <strong>AND</strong> and <strong>OR</strong> as well.</p><p>The only downside is that no “efficient way ” of computing its period exists. We need to run close to 2^{n} operation, To determine whether its period is large enough.</p><blockquote>By combining LFSRs and NFSRs, you can get both a guaranteed maximal period and cryptographic strength, so you do not have to worry about short periods when using an NFSR. That is exactly how Grain-128a works.</blockquote><h3>Grain-128a</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*2YpuFsAJ_P-q5uPz8LRX_w.png" /><figcaption>Grain-128 Mechanism</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*-pMQEtREyq_YFX_uOCFfLw.png" /></figure><p><strong>Working: </strong>Grain-128a uses a <strong>128-bit key</strong> and a <strong>96-bit nonce</strong>. The key is copied into the 128-bit NFSR, and the nonce is placed into the first 96 bits of the LFSR, with the remaining <strong>32 bits set to ones and a zero at the end</strong>. The system is initialized by <strong>updating it 256 times before generating the first keystream bit</strong>. During this process, the bit produced by the h function isn’t output but is instead fed into the LFSR, ensuring the LFSR’s state depends on both the key and the nonce.</p><h3>A5/1</h3><p>A5/1 was used to encrypt voice communications in the <strong>2G mobile</strong> standard. However, attacks emerged in the early 2000s, and eventually, A5/1 was compromised. The cipher relies on three LFSRs and employs a seemingly <strong>clever technique</strong> that, upon closer inspection, <strong>proves to be insecure</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*CY_TqoSj5wt4R1CuRNtv7A.png" /><figcaption>A5/1 Mechanism</figcaption></figure><p>Instead of updating all three LFSRs on every clock cycle, the designers of A5/1 introduced a <strong>clocking rule</strong> that works as follows:</p><ol><li>It checks the values of the 9th bit of LFSR 1, the 11th bit of LFSR 2, and the 11th bit of LFSR 3, called the ‘clocking bits’. These bits will either all be the same (either 1 or 0), or exactly two of them will be the same.</li><li>The registers whose clocking bits match the majority value (0 or 1) are clocked. As a result, two or three LFSRs are updated at each cycle.</li></ol><blockquote>Suppose the current state of the three LFSRs is as follows:</blockquote><blockquote><strong>LFSR 1</strong>: The9th bit is 1.</blockquote><blockquote><strong>LFSR 2</strong>: The 11th bit is 0.</blockquote><blockquote><strong>LFSR 3</strong>: The 11th bit is 1.</blockquote><blockquote>The clocking bits are [101]. According to the majority rule. <strong>LFSR 1 and LFSR 3</strong> are clocked (updated), while <strong>LFSR 2</strong> is not updated.</blockquote><h3>Attack on A5\1</h3><ul><li><strong>TMTO attack</strong> — The <strong>Time-Memory Trade-Off (TMTO)</strong> attack on the <strong>A5/1</strong> stream cipher reduces the cost of a brute-force attack by using a precomputed lookup table. The attack involves creating a table with <strong>2⁶⁴ entries</strong>, but the memory required is enormous (about 256 exabytes). To optimize this, TMTO attacks reduce the table size, trading memory for increased computation during the attack.</li></ul><blockquote>In 2010, researchers demonstrated the feasibility of this attack by generating <strong>two terabytes</strong> of tables in two months using <strong>GPUs</strong>, allowing them to decrypt A5/1-encrypted calls almost in real-time (2–3 hrs). This vulnerability led to A5/1 being replaced in the <strong>3G/4G</strong> standards due to its insecurity.</blockquote><ul><li><strong>Guess and Determine attack</strong> — The <strong>guess-and-determine attack</strong> on A5/1 works by brute-forcing the initial states of <strong>LFSRs 1 and 2</strong> and the <strong>clocking bits of LFSR 3</strong> during the first 11 clock cycles. The attacker guesses certain secret values and, based on these guesses, reconstructs the rest of the LFSR 3 state using equations.</li></ul><blockquote>The attack involves iterating through <strong>2¹⁹</strong> possible values for LFSR 1, <strong>2²²</strong> for LFSR 2, and <strong>2¹¹</strong> for LFSR 3’s clocking bits. This results in a worst-case scenario of <strong>2⁵² operations (in practice, its 2⁵⁴ operation)</strong>, which is approximately <strong>2¹⁰ (about 1000 times) faster</strong> than a brute-force search over 64-bit keys (<strong>2⁶⁴</strong>).</blockquote><h3>RC4</h3><p>The RC4 (<em>software-based</em>) cipher is a widely known stream cipher used for secure communication, and it is notable for its simplicity and speed. It was historically applied in various protocols like <strong>SSL/TLS</strong>,<strong> (802.11b)WEP, </strong>and <strong>WPA</strong>, though its usage has decreased due to <strong>vulnerabilities</strong>.</p><p>At the heart of the RC4 cipher is a PRG called the<strong> RC4 PRG</strong>.</p><ul><li><strong>Key scheduling algorithm </strong>— RC4 initializes a state array, <strong>S,</strong> of 256 bytes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*AAUMq3LmkMTwgBLo6yTE1Q.png" /></figure><ul><li><strong>PseudoRandom Generation (PRG)</strong> — RC4 generates a keystream by continuously modifying <strong>S</strong> and using its values to produce pseudo-random bytes one at a time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*SP8i6a1YH341IgaCeZpIow.png" /></figure><h3>Vulnerabilities in RC4</h3><ul><li><strong>Bias in RC4 output</strong> — Mantin and Shamir [70] showed that even assuming perfect initialization, the output of RC4 is biased. The bias is not very noticeable but sufficient enough to attack the cipher.</li></ul><blockquote>(Mantin-Shamir). Suppose the array S is set to random permutation of 0 …n-1 and that i, j are set to 0. Then the probability that the second byte of the output of RC4 is equal to 0 is 2/n.</blockquote><ul><li><strong>Bias in RC4 stream generation </strong>— The following Lemman shows that the probability of getting (0,0) or (0,1) is greater by a factor of (1/256³) than what it is supposed to be.</li></ul><blockquote>(Fluhrer-McGrew). Suppose RC4 is initialized with a random state T in ST RC4. Let (z1, z2) be the first two bytes output by RC4 when started in state T. Then</blockquote><blockquote>i ≠ n — 1 ⇒ Pr[(z1, z2) = (0, 0)] ≈ (1/n²) · (1 + (1/n))</blockquote><blockquote>i ≠ 0, 1 ⇒ Pr[(z1, z2) = (0, 1)] ≈ (1/n²) · (1 + (1/n))</blockquote><p>Proof of both the lemma can be seen <a href="https://crypto.stanford.edu/~dabo/cryptobook/draft_0_3.pdf">here</a>.</p><h3>Block Ciphers</h3><p>Block ciphers <strong>divide plaintext into fixed-sized blocks</strong> (e.g., 64 or 128 bits) and encrypt each block using a symmetric key. The process involves several rounds of mathematical transformations, such as substitution, permutation, and key mixing, to convert plaintext into ciphertext.<br>Block ciphers <strong>provide robust security</strong> for structured data, while stream ciphers are lightweight and better for real-time applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*cMDamt7aXCKHSqkjULvsdg.png" /><figcaption>Difference between block and stream cipher</figcaption></figure><h3>Substitution — Permutation Networks (SPN)</h3><p>In the design of a block cipher, confusion, and diffusion take the form of substitution and permutation operations, which are combined within substitution–permutation networks (SPNs).</p><blockquote>In cryptography, “confusion” means that the input changes in complicated ways, and “diffusion” means that these changes affect all bits of the input in the same way.<br>“Diffusion” is about breadth, while “confusion” is about depth.</blockquote><ul><li><strong>Substituion</strong> — The plaintext undergoes substitution <strong>via S-boxes</strong>. Each S-box maps input bits to output bits, adding non-linearity to resist linear cryptanalysis. S-boxes must be carefully chosen to be cryptographically strong: they should be as nonlinear as possible and have no statistical bias.</li><li><strong>Permutation</strong> —The output bits are switched around to <strong>spread the input’s effect across the block more evenly</strong>, enhancing diffusion. To mix up the bits, some ciphers use simple linear algebra and <strong>matrix multiplications</strong> instead of moving the bits around.</li></ul><h3>Feistel Network</h3><p>The Feistel network is a symmetric structure widely used in block cipher design. It <strong>divides the plaintext into two halves</strong> and processes them through multiple rounds of encryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*rO6A8KXaHPDxI_RfFkQXig.png" /><figcaption>Feistel Network</figcaption></figure><p><em>Each </em><strong><em>F</em></strong><em> takes a different round key Ki; </em><strong><em>F</em></strong><em> can either be a pseudorandom permutation </em><strong><em>PRP</em></strong><em> or a pseudorandom function </em><strong><em>PRF</em></strong><em>. </em>What matters is <strong>F</strong> should be cryptographically secure.</p><h3>DES</h3><p>The DES is a 16-round Feistel Network that operates on 64-bit (by dividing into 32-bit each) input. Each round uses a function F, which takes 32-bit input along with 48-bit key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*VnfJDBxfcWtGAiFWshjFJQ.png" /><figcaption>Source: Principles of Modern Cryptography</figcaption></figure><ul><li>The function <strong>E</strong> replicates and rearranges a 32-bit input to make it 48-bit.</li><li>The <strong>mixing permutation</strong>, also known as the function <strong>P</strong>, reorganized the bits of the input to convert a 32-bit input to a 32-bit output.</li><li>The central components of the DES algorithm are the S-boxes, which are functions S1,…,S8. For each S-box Si, a lookup table maps a 6-bit input to a 4-bit output (<em>No output bit of an S-box should be close to a linear function of the input bits</em>).</li></ul><p>The <strong>DES key expansion function</strong> accepts a <strong>56-bit key k</strong> as input and generates <strong>16 keys</strong> k1,…,k16, each of which is <strong>48 bits</strong> in length. Each key ki comprises 48 bits selected from the 56-bit key, with each ki utilizing a distinct subset of bits from k.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*58-ayL5kqt17T4V8JAuZVA.png" /><figcaption>Complete DES Circuit (Source: Principles of Modern Cryptography)</figcaption></figure><blockquote>The 16-iteration DES round cypher, as well as initial and final permutations termed IP and FP, comprise the <strong>complete DES algorithm</strong>. IP and FP simply rearrange the 64 incoming bits. IP is inverse of FP.</blockquote><h3>Exhaustive Search Attack on DES</h3><blockquote>The attacker is provided with a small number of plaintext blocks x1,…,xn ∈ X and their corresponding ciphertexts y1,…,yn obtained using a block cipher key k ∈ K . The goal of the attacker is to determine the key k by testing all possible keys k ∈ K until they find one that correctly maps the given plaintext blocks to the provided ciphertext blocks.</blockquote><blockquote>For block ciphers like DES and AES-128, having just three plaintext/ciphertext pairs is sufficient to ensure that, with high probability, there exists a unique 56-bit key.</blockquote><p>The DES challenges were created by RSA data security to prove comprehensive search on DES is possible. Simple rules: RSA data security posted three DES input/output pairs on a pre-announced date.</p><ul><li>The Deschall project solved DES in 96 days. The researchers used a distributed Internet search utilizing 78,000 volunteers’ idle CPU cycles.</li><li>The Electronic Frontier Foundation (EFF) engaged Paul Kocher to create a DES comprehensive key search machine,<strong> Deepcrack</strong>. Around 1,900 specialized DES chips were in six cabinets on this computer. Each chip tackled a different region of the key space simultaneously. In 56 hours, DeepCrack solved the DES challenge.</li><li>The COPACOBANA team built a cluster of 120 off-the-shelf FPGA boards, searching the 56-bit DES key space in just 12.8 days.</li></ul><blockquote>A 56-bit key is insufficient. Today, the minimum safe key size is 128 bits</blockquote><h3>The 3Ε construction: Triple-DES</h3><p>In the face of sophisticated assaults, the DES cipher has demonstrated <strong>remarkable resilience</strong>. The most practical assault on DES is a brute force exhaustive search over the entire key space, despite the extensive analysis in place for many years.</p><p>Unfortunately, the 56-bit key space is insufficient.</p><p>A natural question is whether we can strengthen the cipher against exhaustive searches without changing its structure. The simplest technique is to iterate the cipher with different keys repeatedly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*Nq_BnsWhrASRzSXJ6M31nA.png" /></figure><p>For DES, the 3E block cipher, called Triple-DES, uses keys whose length is 3x56 = 168 bits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*2Vnme3-z-IpPhaFMIBLa3A.png" /><figcaption>NIST version of Triple-DES</figcaption></figure><p><strong>Some limitations of Triple-DES</strong></p><ul><li>Slow Encryption and Decryption</li><li>Effective key length Vulnerability (<em>Effective security is only 112-bit due to the Meet-in-the-Middle attack.)</em></li><li>Energy consumptions</li></ul><h3>The Advanced Encryption Standard (AES )</h3><blockquote>AES (Rijndael) was one of 15 candidates in the AES competition, held by NIST from 1997 to 2000 to specify “an unclassified, publicly disclosed encryption algorithm capable of protecting sensitive government information well into the next century,” as stated in the 1997 Federal Register announcement.</blockquote><p>AES processes blocks of 128 bits using a secret key of 128, 192, or 256 bits, with the 128-bit key being the most common.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*4p8iXnpg3kg3GCBhEHflIA.png" /><figcaption>Internal state of AES (4 x 4 array of 16 bytes)</figcaption></figure><p>In order to transform its state, AES uses an SPN(Substitution — Permutation Networks) structure with</p><ul><li>10 rounds for 128-bit keys (most common)</li><li>12 rounds for 192-bit keys</li><li>14 rounds for 256-bit keys</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*t-t1Pz0Oc2wke3uNYb4Bvg.png" /><figcaption>Structure of AES-128 (Source: Principles of modern cryptography)</figcaption></figure><ul><li><strong>SubBytes</strong>: Replace each byte (s0 , s1 , … , s15 ) with another byte according to an S-box. In this example, the S-box is a lookup table of 256 elements.</li><li><strong>ShiftRows</strong>: Shifts the ith row of i positions, for i ranging from 0 to 3).</li><li><strong>MixColumns</strong>: Applies the same linear transformation to each of the four columns of the state (that is, each group of cells with the same.</li></ul><blockquote>In an SPN, the S represents substitution and the P represents permutation. The permutation layer is a combination of ShiftRows and MixColumns, while the substitution layer is SubBytes.</blockquote><h3>How secure is AES?</h3><p>Fundamentally, AES is secure because all output bits depend on all input bits in some complex, pseudorandom way.</p><p>However, AES is not guaranteed to be immune to all probable attacks. For starters, we do not know all conceivable attacks, and we do not always know how to demonstrate that a cipher is secure against a specific assault. The only method to truly develop trust in AES’s security is to crowdsource assaults, in which a large number of knowledgeable individuals attempt to break AES and hopefully fail.</p><blockquote>Implementing and deploying crypto requires a million considerations, but AES is not one of them.</blockquote><blockquote>Block cyphers face a greater threat from their “ways of operation” than their basic algorithms. A strong cypher, such as AES, cannot protect against wrong mode selection or misuse of the correct mode.</blockquote><p>Some key elements in AES’s security:</p><ul><li><strong>SubBytes</strong>: This operation introduces nonlinearity, which strengthens the cipher. Without it, AES would essentially become a large system of linear equations solvable by basic algebra.</li><li><strong>ShiftRows</strong>: Without this operation, changes in one column wouldn’t affect the others, making it possible to break AES by creating four 32-element codebooks, one for each column. (<em>In a secure block cipher, altering one input bit should affect all output bits.</em>)</li><li><strong>MixColumns</strong>: It is necessary because a change in one byte would not affect any other bytes in the state. An attacker accessing the chosen plaintext could easily recover any ciphertext by keeping 16 lookup tables, each with 256 bytes and the encrypted value of every possible byte.</li></ul><h3>Sophisticated Attacks on Block Ciphers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1WeLXrTYPSn9oJE3pCx5g.png" /></figure><h3>Algorithmic Attack</h3><p>Algorithmic Attacks involve deducing the inner workings of a specific block cipher, which could lead to key compromise by observing pairs of plaintext and ciphertext. Attacking the design of block ciphers is a vast field with many sophisticated techniques which include:</p><ul><li><strong>Linear cryptanalysis</strong> (A <em>known-plaintext attack that uses linear approximations of the cipher’s operations</em>)</li><li><strong>Differential cryptanalysis</strong> (F<em>ocuses on the effect of input differences on output differences.</em>)</li><li><strong>Biclique Cryptanalysis</strong> (G<em>eneralisation of Meet-in-the-Middle Attack</em>)</li><li><strong>Slide attacks</strong> (<em>Exploits similarities between encryption rounds in ciphers using repeated round functions)</em></li><li><strong>Boomerang attacks</strong> (<em>Advanced differential attack that uses two linked differential characteristics</em>)</li></ul><h3>Side-channel Attacks</h3><p>Side-channel attacks do not target the cryptosystem as a mathematical construct. Instead, they take advantage of information that is unintentionally leaked through its physical implementation.</p><p>For an attacker who watches a cryptosystem process a secret key. The attacker can learn more than the system’s input/output behavior. Two prime examples are:</p><ul><li><strong>Timing side channel:</strong> Encrypting a plaintext block may take longer, depending on the secret key. Measuring the encryption time can reveal some information about the key to the attacker.</li><li><strong>Power side channel: </strong>The secret key may also affect hardware power consumption during encryption. An attacker could obtain key information by monitoring the device’s power consumption.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*0o5dvQ_2gJjsYz4zCAQOEw.png" /><figcaption>AES Differential Power Analysis (source: Principles of Modern Cryptography)</figcaption></figure><blockquote>Many additional side channels have been employed to compromise implementations, including <strong>electromagnetic radiation </strong>that emanates from a device during encryption, <strong>heat</strong> that emanates from a device during encryption, and even <strong>sound</strong>.</blockquote><h3>Fault-injection Attack</h3><p>These attacks are designed to intentionally introduce defects into the hardware during the operation of the cryptosystem. An adversary has the ability to obtain information about the secret key by exploiting the malformed output.</p><blockquote>It is possible to introduce defects into the target hardware by overclocking it, heating it with a laser, or direct electromagnetic interference at the target chip.</blockquote><p>One safeguard against fault injection assaults is to consistently verify the computation’s outcome. The computed ciphertext is discarded, and an error is generated by the hardware if the check fails. Regrettably, this results in a twofold decrease in efficacy and is seldom implemented in practice.</p><h3>Quantum Exhaustive Search Attacks</h3><p>Theoretically, it is possible to construct computers that utilize quantum laws to resolve issues in a significantly shorter amount of time than a classical computer.</p><p>Consider a block cipher (E,D) with key space K. On a classical computer, exhaustive search takes time proportional to |K|. A quantum computer would take time proportional to <strong>sqrt{|K|}.</strong></p><blockquote>For block ciphers like AES-128 this means that quantum exhaustive search will only require about sqrt(2¹²⁸)= <strong>2⁶⁴ steps</strong>.</blockquote><h3>References</h3><ol><li>Jean-Philippe Aumasson, <a href="https://www.kea.nu/files/textbooks/humblesec/seriouscrytography.pdf"><em>Serious Cryptography</em></a>.</li><li>Dan Boneh and Victor Shoup, <a href="https://crypto.stanford.edu/~dabo/cryptobook/draft_0_3.pdf"><em>Principals of modern cryptography</em></a>.</li><li>LambdaClass, <a href="https://github.com/lambdaclass/sparkling_water_bootcamp?tab=readme-ov-file"><em>sparkling_water_bootcamp</em></a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c0d0b42266c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elliptic curve cryptography]]></title>
            <link>https://medium.com/@arnavpanjla/elliptic-curve-cryptography-d19a94229dfc?source=rss-b3e8c9d81a82------2</link>
            <guid isPermaLink="false">https://medium.com/p/d19a94229dfc</guid>
            <category><![CDATA[elliptic-curve]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <dc:creator><![CDATA[Arnav Panjla]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 17:05:02 GMT</pubDate>
            <atom:updated>2024-12-16T17:05:02.488Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey, curve connoisseurs! 🌀✨<br> Welcome to the world of <strong>Elliptic Curve Cryptography (ECC)</strong> — a sleek, powerful, and efficient pillar of modern cryptography. 🚀 Unlike traditional methods like RSA, ECC delivers top-tier security with much smaller key sizes, unlocking faster computations and reducing storage needs. This makes it the go-to choice for securing everything from blockchain and IoT to mobile devices.</p><p>In this blog, we’ll unravel the magic behind ECC, explore its real-world applications, and show you why it’s reshaping secure communication. Ready to ride the curve of innovation? Let’s dive in! 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*r8rfdGWPifQuvj1hLeVMew.png" /></figure><p>Cryptography is pivotal in ensuring that sensitive information remains protected from prying eyes. From securing online transactions to safeguarding personal messages, cryptography forms the backbone of digital security.</p><p>One of the most fascinating advancements in this field is Elliptic Curve Cryptography (ECC). Unlike traditional cryptographic methods like RSA, ECC achieves high levels of security with much smaller key sizes. This knowledge empowers you to understand and utilize a new level of security for these everyday tools.</p><p>ECC leverages the unique properties of elliptic curves, a special type of mathematical structure, to create cryptographic keys. The introduction of elliptic curve cryptography (ECC) in <strong>1985 </strong>revolutionized how we do public-key cryptography. With a 256-bit key, ECC is more powerful and efficient than alternatives like RSA and classical Diffie-Hellman. Despite its complexity, this efficiency makes <strong>ECC a superior choice</strong> in the field of cryptography.</p><p>This blog explores the fundamentals of ECC, its advantages over traditional methods, real-world applications, and the reasons it has become a cornerstone of modern cryptographic systems.</p><h3>What are elliptic curves?</h3><p>An elliptic curve is a set of points in 2D space that satisfies a specific equation. In simpler terms, it’s a collection of points that meet a particular mathematical condition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*WEl-Pes5Luc3ue1lkaYRYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uxt2JJ03_WDHO11q_wvFvw.png" /></figure><p><em>Mathematically</em>, an Elliptic curve is defined as :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*bYhqvc4y0Uy7JrII6J4_9g.png" /></figure><p>Instead of picturing elliptic curves as a graph plot, it’s more accurate to <strong>consider them a collection of points</strong>. A point is part of this set only if it satisfies the elliptic curve equation.<br> The first image corresponds to real numbers, and the next image with points corresponds to an elliptical curve in a finite field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qardVCB83Aw3lDHn6nXvoQ.png" /></figure><p>It is called the “Curve” because if defined over a characteristic zero field, such as a field of real number R, then a set of all points that satisfy (x,y) R | y³ = x² + ax + b , looks like a curve. It should be stressed that visualizing elliptic curves over the finite fields as curves should not be done as we focus more on <strong>computational properties</strong> than geometric ones.</p><p>The equation 4a³+27b² != 0 means that the curve is <strong>non-singular</strong>, which implies that the curve has <strong>no self-intersects</strong>.<br>The following example demonstrates what happens when 4a³ + 27b² = 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRvnP4hgcpkJ6SUKJZSmXA.png" /></figure><h3>Some common terms</h3><p>( <strong>P</strong> is a point on curve, addition(+) and multiplication are defined later)<br><strong>1. Point at infinity Θ </strong>— There exists a unique point called the “point at infinity” (<strong>Θ</strong>), the equivalent of zero in point arithmetic; it’s always the case that <strong>P </strong>+ <strong>Θ </strong>=<strong> P</strong>.<br><strong>2.</strong> <strong>Order of curve —</strong> There exists a number n, called the order of curve, such that <strong>nP = Θ</strong> for any <strong>P</strong>, and of course, <strong>(n+1)P = P, (9n + 2)P = 2P</strong>, and so on.<br><strong>3. Generator —</strong> There also exists a point <strong>G</strong>, which is understood to, in some sense, represent the number “1”. Any point in the elliptic curve can be described as <strong>kG</strong> where <strong>k </strong>is an integer. Theoretically, any point on a curve (<strong>except Θ</strong> ) can be <strong>G</strong>; all that matters is that<strong> G should be standardized</strong>.</p><h3>Adding two points in EC</h3><p>In Elliptic Curve, adding two points P(x1,y1) and Q(x2,y2) involves finding a third point R(x3,y3).</p><ul><li><strong>When P ≠ Q — </strong>Draw a line through P and Q. This line <strong>intersects</strong> the elliptic curve at a third point, <strong>−R</strong>. The final result R is the <strong>reflection</strong> of <strong>−R</strong> across the x-axis.</li><li><strong>When P = Q — </strong>Use the tangent at P as the line. This is called <strong>point doubling</strong>.</li><li><strong>When Q = −P — </strong>The line is vertical, and the result is the <strong>point at infinity</strong> Θ, the identity element.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*WdO5yZFE4K1wkxCm_RXvFw.png" /></figure><h3>Scalar Multiplication</h3><p>Scalar multiplication computes kP (repeatedly adding P to itself k times). It’s efficiently performed using the <strong>double-and-add</strong> method. For binary k:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*3OoU2fAS6iBAx3apbCM-KA.png" /></figure><h3>The Elliptic Curve Discrete Log problem, ECDLP</h3><h3>What is the Discrete Log Problem: DLP?</h3><p>The Discrete Logarithm Problem involves <strong>finding an integer y</strong> such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*aU31uuUo-rsjK6v8o_ywhA.png" /></figure><p>Where:</p><ul><li>g is the <strong>base</strong> (a generator of the group),</li><li>x is a known group element,</li><li>p is a prime number, and</li><li>y is the <strong>unknown integer</strong> (the “logarithm”).</li></ul><p>The DLP is <strong>computationally challenging for carefully chosen groups</strong>, forming the basis for cryptographic systems like Diffie-Hellman and ECC.</p><ul><li>Solving DLP is about as <strong>hard as factoring large integers</strong>. Techniques like Pollard’s rho or index calculus have similarities to integer factoring algorithms.</li><li>Groups with n-bit primes offer security <strong>comparable to factoring n-bit integers</strong>.</li></ul><h3>DLP in Elliptic curves</h3><p>Cryptography with elliptic curves has a similar problem, the problem of <strong>finding the number k</strong> such that given a point Q, an EC, and a Generator G,<br> Q=kG<br> This is the formidable Elliptic Curve Discrete Logarithm Problem or ECDLP, a complex puzzle that underpins the security of elliptic curve cryptography.<br> (Instead of numbers, the elliptic curve’s problem operates on points and multiplication instead of exponentiation)</p><p><strong>When p is n-bits long, the security level is approximately n/2 bits</strong>. For instance, an elliptic curve defined over numbers modulo p with p being 256-bits provides around 128-bit security. This efficiency is evident when compared to achieving the same security level with DLP or RSA, which would require key sizes in the several thousand bits range.</p><p>One approach to solving the <strong>Elliptic Curve Discrete Logarithm Problem (ECDLP)</strong> is to find a collision between two outputs,</p><p>c_{1} <strong>P</strong> + d_{1} <strong>Q</strong> and c_{2} <strong>P</strong> + d_{2}<strong>Q</strong>. Here:</p><ul><li><strong>P</strong> and <strong>Q</strong> are points on the elliptic curve, where <strong>Q = kP</strong> for some unknown <strong>k</strong>,</li><li>c_{1}, d_{1}, c_{2}, and d_{2} are numbers required to deduce k.</li></ul><p>Similar to hash functions, a collision occurs when two different inputs produce the same output. In the context of ECDLP, this is a significant event, as it means finding points that can lead to a solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*uJrS64CnlG4co0yDEmUY1Q.png" /></figure><p><em>k</em> can be derived from the equation above, solving the ECDLP. However, this is computationally infeasible in practice for well-chosen curves.<br> Elliptic curves used in cryptography are defined over numbers with at least 256 bits. Finding a collision <strong>requires up to 2¹²⁸ operations</strong>, which is computationally <strong>impractical</strong>.</p><h3>Elliptical curve bilinear pairing</h3><p>A bilinear pairing is a map<strong> </strong>ê<strong>: G1 × G1 → GT</strong> (G1 is a group)that satisfies the following:</p><ul><li><strong>Bilinearity</strong>: For any R, S, T ∈ G1:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*mCBoTvbY3BzXnz1ETgq2jg.png" /></figure><ul><li><strong>Non-degeneracy</strong>: There exists P ∈ G1 such that <strong>ê(P,P) ≠ 1</strong>. This ensures the pairing is non-trivial and useful for cryptographic operations.</li><li><strong>Efficient Computability</strong>: The pairing map<strong> ê</strong> can be computed efficiently.</li></ul><h3>Properties of Bilinear Pairings</h3><ul><li><strong>ê(S,∞) = 1 and ê(∞,S) = 1 </strong>(neutral elements).</li><li><strong>ê(S,−T) = ê(−S,T) = ê(S,T)^{-1} </strong>(inversion symmetry).</li><li><strong>ê(aS,bT) = ê(S,T)^{ab}</strong> for integers a,b (scalar multiplication).</li><li><strong>ê(S,T) = ê(T,S)</strong> (symmetry in arguments).</li><li><strong>If ê(S,R) = 1 for all R ∈ G1, then S = ∞ </strong>(ensures injectivity).</li></ul><h3>Reducing DLP in G1 to DLP in GT</h3><p>If <strong>Q = xP</strong> is a discrete logarithm problem (DLP) in G1, we can compute:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*yGq2Ob646-_Gkg1vUrEO1w.png" /></figure><p>Thus, solving the DLP in G1 is equivalent to solving it in GT,</p><p>with <strong>g = ê(P, P) </strong>and <strong>h = ê(P, Q).</strong></p><h3>Bilinear Diffie-Hellman Problem (BDHP)</h3><p>The BDHP is defined as follows:</p><ul><li>Given <strong>P, aP, bP, cP ∈ G1,</strong> compute <strong>ê(P, P)^{abc}</strong>.</li><li><strong>The hardness of BDHP</strong>: If the Discrete Logarithm Problem (DLP) in G1 and GT is hard, then BDHP is assumed to be equally hard.</li></ul><h3>Decisional Diffie-Hellman Problem (DDHP)</h3><p>The Decisional Diffie-Hellman problem in G1 can be efficiently solved. The DDHP is to decide whether a given quadruple (P, aP, bP, cP) if elements in G1 is a valid Diffie-Hellman quadruple, i.e, whether —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*QOKWMK31Tj8Vcxd8_aYFwA.png" /></figure><h3>Diffie–Hellman Key Agreement over Elliptic Curves</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KuVEQXfNQfJYMHjE6-zRqQ.png" /></figure><p>The elliptic curve version of the Diffie–Hellman (DH) key agreement protocol operates similarly to the classical DH protocol but with elliptic curve notations. Here’s how it works:</p><h3>Classical Diffie–Hellman (DH)</h3><ol><li><strong>Setup:</strong></li></ol><ul><li>A fixed number <strong>g</strong> is agreed upon.</li><li>Alice selects a secret random number a, and computes A = g^{a}, and sends A to Bob.</li><li>Bob selects a secret random number b, and computes B = g^{b}, and sends B to Alice.</li></ul><p><strong>2. Shared Secret:</strong></p><ul><li>Both compute the shared secret:<br><strong> g^{ab} = A^{b} = B^{a}</strong></li></ul><h3>Elliptic Curve Diffie–Hellman (ECDH)</h3><ol><li><strong>Setup:</strong></li></ol><ul><li>A fixed point G on an elliptic curve is agreed upon.</li><li>Alice selects a secret random number d_{a}, computes P_{a} = d_{a} G (scalar multiplication), and sends P_{a} to Bob.</li><li>Bob selects a secret random number d_{b}, computes P_{b} = d_{b} G, and sends P_{b} to Alice.</li></ul><p><strong>2. Shared Secret:</strong></p><ul><li>Both compute the same shared secret point:<br> d_{a} P_{b} = d_{b} P_{a} = d_{a} d_{b} G</li></ul><h3>Security Basis</h3><ul><li>ECDH relies on the hardness of the Elliptic Curve Discrete Logarithm Problem (ECDLP), just as classical DH relies on the Discrete Logarithm Problem (DLP).</li><li>Protocols, like authenticated DH and Menezes–Qu–Vanstone (MQV), are secure when adapted to elliptic curves, as they rely on the ECDLP assumption. This adaptability instills confidence in the applicability of ECDH.</li></ul><p>ECDH provides the same functionality as classical DH but uses elliptic curve mathematics. It ensures security through the formidable challenge of solving ECDLP, making it a reassuringly strong candidate for modern cryptographic protocols.</p><h3>Signing with Elliptic Curves</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*m5LzUvfGF4dawGzwyrnkjA.png" /></figure><p>ECDSA (<em>Elliptic Curve Digital signature algorithm</em>) is the standard algorithm used for signing with ECC. This algorithm has <strong>replaced RSA and classical DSA</strong> in many applications. It is the only signature algorithm used in Bitcoin and is also used in <strong>SSH and TLS</strong>.<br> The signer generates a signature using his private key, and the verifier uses the signer’s public key to check the signature’s correctness.</p><h3>ECDSA Signature generation</h3><p>The signer follows the following steps.</p><ol><li><strong>Hash the Message</strong><br> Use a cryptographic hash function (e.g., SHA-256 or BLAKE2) to hash the message. The hash value, h, is a number between 0 and n−1, where n is the order of the elliptic curve.</li><li><strong>Generate a Random Number</strong><br> Choose a random number k such that 1 ≤ k ≤ n−1.</li><li><strong>Compute the Elliptic Curve Point</strong><br> Calculate<strong> kG</strong>, where G is the generator point on the curve. This produces a point with coordinates (x,y).</li><li><strong>Calculate the Signature Components</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*qGFwxCXxjHqCSYhhwDWuYQ.png" /></figure><p><strong>5. The Signature</strong><br> The signature is the pair (r,s).</p><h3>ECDSA Signature verification</h3><p>The ECDSA verification algorithm uses the signer’s public key to check the validity of a signature (r,s) for a given message hash h. The steps are:</p><ol><li><strong>Compute the Inverse of s</strong></li></ol><ul><li>Calculate w = s^{-1} mod n, where s is part of the signature.</li><li>Since s = h+rd / k during signing, w represents k / h+rd.</li></ul><p><strong>2. Calculate u and v</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*B1Bi5SXd44Gm6lO-r3EmZw.png" /></figure><p><strong>3. Compute the Point Q</strong></p><ul><li>Use u and v to calculate:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*gL8dVtZ0nUcOCMiCVf8x-g.png" /></figure><ul><li>Here, G is the generator point, and P is the signer’s public key (P = dG).</li></ul><p>4. <strong>Verify the Signature</strong></p><ul><li>The signature is valid if the x-coordinate of<strong> Q </strong>matches the value <strong>r</strong> from the signature.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*vZ8KOgpDux6Rb6SrjVyReA.png" /></figure><h3>Rust example for ECDSA</h3><pre>//Date: 2021-09-26<br><br>//This code demonstrates how to generate a public key from a secret key, sign a message using the secret key, and verify the signature using the public key.<br>//The code uses the secp256k1 crate for elliptic curve cryptography and the sha2 crate for computing SHA-256 hashes.<br><br>/* <br>To run this code, add the following dependencies to your Cargo. toml file:<br>[dependencies]<br>secp256k1 = &quot;0.30.0&quot;<br>sha2 = &quot;0.10.6&quot;<br>hex = &quot;0.4&quot;<br>*/<br><br><br>use secp256k1::{Secp256k1, Message, SecretKey, PublicKey};<br>use sha2::{Sha256, Digest};<br><br>// Computes a SHA-256 hash of the input data.<br>fn compute_hash(data: &amp;[u8]) -&gt; [u8; 32] {<br>    let mut hasher = Sha256::new();<br>    hasher.update(data);<br>    let result = hasher.finalize();<br>    let mut hash = [0u8; 32];<br>    hash.copy_from_slice(&amp;result);<br>    hash<br>}<br><br>fn main() {<br>    let secp = Secp256k1::new();<br><br>    let secret_key = SecretKey::from_slice(&amp;[0xcd; 32]).expect(&quot;32 bytes, within curve order&quot;);<br><br>    let public_key = PublicKey::from_secret_key(&amp;secp, &amp;secret_key);<br>    println!(&quot;Public key is : {:?}&quot;, public_key);<br><br>    let hash_msg = compute_hash(b&quot;I am batman&quot;);<br>    println!(&quot;The message SHA256 hash is : {:?}&quot;, hash_msg.iter().map(|b| format!(&quot;{:02x}&quot;, b)).collect::&lt;String&gt;());<br>    let message = Message::from_digest(hash_msg);<br>    <br>    <br>    let sig = secp.sign_ecdsa(&amp;message, &amp;secret_key);<br>    println!(&quot;Signature is : {:?}&quot;, sig);<br><br>    assert!(secp.verify_ecdsa(&amp;message, &amp;sig, &amp;public_key).is_ok());<br>    println!(&quot;Signature is valid!&quot;);<br>}</pre><h3>ECDSA vs RSA</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*aboTMARubcR3nWGwIx8zfw.png" /></figure><p>RSA is limited to encryption and signatures, while ECC offers a broader range of functionalities as a family of algorithms. It can be used for encryption, generating signatures, performing key agreements, and offering advanced cryptographic functionalities. This practicality of ECC makes it a relevant choice for many cryptographic needs.</p><p>ECC provides efficient signing and shorter signatures, whereas RSA excels in verification with a small public key.</p><p>While <strong>RSA verification</strong> is generally faster than <strong>ECC signature generation</strong> due to its use of a small public key e, ECC offers two key advantages over RSA: shorter signatures and faster signing.</p><ul><li>ECC provides efficiency in signing and shorter signatures.</li><li>RSA excels in verification with a small public key.</li></ul><p>ECC operates with smaller numbers, resulting in signatures that are hundreds of bits long rather than thousands, which is advantageous for the storage and transmission of multiple signatures. Furthermore, ECDSA signing is significantly faster than RSA signing, and their verification speeds are comparable, as ECC achieves similar security levels with smaller numbers. This speed advantage of ECDSA should make you feel the algorithm’s efficiency.</p><p>The key takeaway is to favor ECDSA over RSA unless signature verification speed is crucial and signing speed is less critical. This is ideal for scenarios like <strong>“sign-once, verify-many</strong>, “such as when a Windows executable is signed once but needs verification by numerous systems during execution.</p><h3>Elliptic Curve Integrated Encryption Scheme (ECIES)</h3><p>Elliptic curves are used more for digital signatures. Due to the limitations in the size of the plaintext, it’s less popular to use elliptic curves than it is to use RSA at the same level of security. However, elliptic curve encryption can be achieved using the <strong>Elliptic Curve Integrated Encryption Scheme (ECIES)</strong>, which combines asymmetric and symmetric encryption techniques. Here’s how it works:</p><ol><li><strong>Key Generation</strong></li></ol><ul><li>A random number d is chosen, and the ephemeral public key is computed as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*8VYkE4KkUtDECXPPlZUj4A.png" /></figure><ul><li>Here, G is a fixed base point on the curve.</li><li>The pair ( d, Q ) is an ephemeral key used only for this encryption process.</li></ul><p><strong>2. Compute Shared Secret</strong></p><ul><li>Using the recipient’s public key P, compute the Elliptic Curve Diffie–Hellman (ECDH) shared secret:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*cHtA9JHUiRnlZFNExDdTBg.png" /></figure><p><strong>3. Key Derivation</strong></p><ul><li>Apply a <strong>Key Derivation Function (KDF)</strong> to S to produce a symmetric encryption key K:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*cHtA9JHUiRnlZFNExDdTBg.png" /></figure><p><strong>4. Encrypt Message</strong></p><ul><li>Use K with a symmetric authenticated encryption cipher (e.g., AES-GCM) to encrypt the plaintext message M, producing:</li><li>Ciphertext <strong>C</strong>.</li><li>Authentication tag <strong>T</strong> (to ensure integrity).</li></ul><p><strong>5. Generate Ciphertext</strong></p><ul><li>The final ECIES ciphertext includes:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*lkjm2xLXw7PkSHphRDY2OA.png" /></figure><h3>Decryption Process</h3><ol><li><strong>Compute Shared Secret</strong></li></ol><ul><li>The recipient uses their private key dR and the ephemeral public key Q to compute the shared secret:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*rp4SRPz3RzYeyP6VByeqXA.png" /></figure><p><strong>2. Derive Symmetric Key</strong></p><ul><li>Use the same <strong>KDF</strong> to derive the symmetric key <strong>K</strong> from <strong>S</strong>.</li></ul><p><strong>3. Decrypt and Verify</strong></p><ul><li>Decrypt <strong>C</strong> using <strong>K</strong> and verify the authentication tag <strong>T</strong> to ensure the integrity of the message.</li></ul><h3>Security Basis</h3><p>ECIES relies on the hardness of the <strong>Elliptic Curve Discrete Logarithm Problem (ECDLP)</strong>, making it secure for modern encryption. The hybrid nature of ECIES allows it to leverage elliptic curves for key exchange while using efficient symmetric encryption for the actual message.</p><h3>Advantages and Limitations</h3><ol><li><strong>Advantages:</strong></li></ol><ul><li>High security with smaller key sizes due to elliptic curves.</li><li>Strong integrity through authentication tags.<br> (<em>Authentication tags are cryptographic values used to verify message integrity and authenticity, ensuring data has not been altered and confirming the sender’s identity. For example, In ECDSA, the signature acts as an authentication tag for a message.</em>)</li></ul><p><strong>2. Limitations:</strong></p><ul><li>Restricted plaintext size (about 100 bits), making it less suitable for large data encryption than RSA.</li><li>It is more commonly used for secure key exchange rather than direct message encryption.</li></ul><p>ECIES is often preferred in scenarios requiring efficient encryption with high security and small data sizes.</p><p>Let’s demonstrate how the <strong>Elliptic Curve Integrated Encryption Scheme (ECIES)</strong> works using an example. Assume Alice wants to send an encrypted message to Bob.</p><h3>Example Scenario: Alice encrypts a message “HELLO” for Bob.</h3><h4>Setup:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*B2Y7g02fyaXyRPUsBBOdsg.png" /></figure><h4>Encryption by Alice:</h4><ol><li><strong>Generate Ephemeral Key Pair</strong>:</li></ol><ul><li>Alice picks a random ephemeral private key <strong>d_{a}=45</strong></li><li>Computes the ephemeral public key <strong>Q = d_{a} G</strong></li></ul><p><strong>2. Compute Shared Secret</strong>:</p><ul><li>Shared secret : <strong>S = d_{a} P_{b} = d_{a} (d_{b} G ) = ( d_{a} d_{b} ) G</strong></li></ul><p><strong>3. Key Derivation</strong>:</p><ul><li>Apply a Key Derivation Function (KDF) to S to derive a symmetric key K:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*bJ5-GC6wMeDKmDt86NOdxg.png" /></figure><p><strong>4. Encrypt Message</strong>:</p><ul><li>Convert “HELLO” into bytes (e.g., ASCII) and encrypt using K with AES-GCM:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*h6prseqzqpwvptMCVSxRkA.png" /></figure><p><strong>5. Create Ciphertext</strong>:</p><ul><li>Final ciphertext sent to Bob:<strong> ( Q, C, T )</strong></li></ul><h4>Decryption by Bob:</h4><ol><li><strong>Compute Shared Secret</strong>: Bob receives Q and computes</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*3AyH68bJSjwq1uZLjzbTTA.png" /></figure><p><strong>2. Derive Symmetric Key</strong>: Bob applies the same KDF to Sx to obtain K:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*KXurcsVRUeRFGkNoyVP2Lg.png" /></figure><p><strong>3. Decrypt Message</strong>:</p><ul><li>Using K, Bob decrypts C with AES-GCM to recover M.</li><li>Verifies the authenticity of M using T.</li></ul><p><strong>4. Result</strong>: Bob decrypts and verifies <strong>M = ”HELLO”</strong></p><h4>Key Observations:</h4><ul><li>The shared secret S is derived independently by Alice and Bob but is identical because of elliptic curve scalar multiplication properties.</li><li>The encryption and decryption process ensures confidentiality (via AES encryption) and integrity (via the authentication tag T).</li></ul><h3>Applications of Elliptic curves</h3><h3>Bitcoin</h3><p>Bitcoin transactions rely on elliptic curve cryptography (ECC), specifically the <strong>secp256k1 curve</strong>, to secure digital signatures that authenticate and transfer ownership of Bitcoin. A blockchain serves as the public ledger, linking blocks through SHA-256 hashes.</p><p>The <strong>secp256k1</strong> curve is defined by the equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*Xg3KloUsmTr4tBdECUgRnQ.png" /></figure><p>Each Bitcoin address is derived from a user’s public key using a two-step hashing process: the public key is hashed with <strong>SHA-256</strong>, and the result is further hashed with <strong>RIPEMD-160</strong>, yielding a <strong>HASH160</strong> value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*dKTXbV4UjbkF1T16KrZ1ZA.png" /></figure><p>This value is then encoded into a human-friendly Bitcoin address using the formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*nye-1_Zh-6LASOHuAGQYqw.png" /></figure><h3>Secure Shell (SSH)</h3><p>Elliptic Curve Cryptography (ECC) is integrated into the SSH protocol in three critical areas.</p><ul><li>It is employed in session key negotiation via the ephemeral ECDH key exchange. In this process, the client and server each generate a temporary key pair for the duration of the session, as specified in <a href="https://datatracker.ietf.org/doc/html/rfc5656">RFC 5656</a>, adhering to SEC1 standards.</li><li>ECC is used for <strong>server authentication</strong>, where the server sends its host key — often an ECDSA public key — to the client during the key exchange, allowing the client to verify the key fingerprint against a stored value. In contrast, the server signs a transcript of the exchange to authenticate itself.</li><li>Lastly, <strong>clients can use ECDSA public keys to authenticate themselves</strong>. This integration ensures strong security and low computational overhead, making ECC an ideal choice for modern SSH implementations.</li></ul><h3>References</h3><ol><li>Buterin, Vitalik. <a href="https://medium.com/@VitalikButerin/exploring-elliptic-curve-pairings-c73c1864e627"><em>Exploring Elliptic Curve Pairings</em></a> (2017)</li><li>MoonMath Manual</li><li>Jean-Philippe Aumasson, <em>Serious Cryptography</em>.</li><li><em>Joppe W. Bos, J. Alex Halderman, Nadia Heninger, Jonathan Moore, Michael Naehrig, and Eric Wustrow</em>. <a href="https://eprint.iacr.org/2013/734/"><em>Elliptic Curve Cryptography in Practice</em></a></li><li>Menezes, Alfred. <a href="https://www.math.uwaterloo.ca/~ajmeneze/publications/pairings.pdf"><em>Applications of Pairing-Based Cryptography</em></a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d19a94229dfc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fully Homomorphic Encryption (FHE)]]></title>
            <link>https://medium.com/@arnavpanjla/fully-homomorphic-encryption-fhe-45c6d4eb705d?source=rss-b3e8c9d81a82------2</link>
            <guid isPermaLink="false">https://medium.com/p/45c6d4eb705d</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Arnav Panjla]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 18:52:52 GMT</pubDate>
            <atom:updated>2024-12-09T18:52:52.744Z</atom:updated>
            <content:encoded><![CDATA[<p>Encryption transforms plaintext into ciphertext to protect it from unauthorised access. This ensures that only those with the decryption key can access the data. Encrypting data before transmission over the internet ensures it remains private even when traversing public channels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*amhLe52Sl6r4orP2TvT5SQ.png" /></figure><p>Some applications require complex computations on encrypted data. Fully Homomorphic Encryption (FHE) makes this possible by enabling computations on encrypted data <strong>without ever decrypting it</strong>. The data remains secure throughout the process, as only the user can decrypt the final results. FHE also ensures the encrypted data is <strong>immune to memory-based attacks</strong>, as decryption is mathematically infeasible for unauthorised parties.</p><p>One typical example is an “electronic voting machine” in the cloud. In this scenario, voters can encrypt their ballots, and a central entity can aggregate all the encrypted votes to compute the final result, which would then be published. The problem with traditional authenticated encryption is that the central authority would need to decrypt the ballots to perform the aggregation, thereby exposing the individual votes. Fully homomorphic encryption will allow us to compute a function over the ciphertexts without decrypting them and to obtain an encryption of the function’s output directly, which in this case is the total votes.</p><p>Generally, the function f to evaluate is public, so the processing steps to convert an encryption of x into an encryption of f(x) are in public knowledge, which can easily be carried out in the cloud without involving any secret. This openness and transparency make sure that anyone can verify the process.</p><p>Therefore, FHE (Fully Homomorphic Encryption) is <strong>robust against side-channel attacks</strong> and other forms of corruption from the cloud host. Consider a scenario where someone needs to outsource a computation, but the data is susceptible. They would likely be hesitant to use a cloud VM if there’s a possibility that someone else has root access to the machine. Similarly, they might be reluctant to run it in a secure enclave like SGX, knowing that the cloud’s CPU and memory are continuously monitored for metrics like load, power, and temperature—potentially allowing some information to be inferred from these observations. However, the assurance of FHE lies in its ability to guarantee that <strong>extracting any single bit of information requires solving a post-quantum mathematical problem</strong>, making it secure against any measurements or observations we could make.</p><p>FHE provides confidentiality; an <strong>attacker cannot read any information without the secret key</strong>. However, thanks to the universal malleability of FHE, it is possible for an attacker to change any bit in the final output, which makes it invalid. This idea of universal malleability implies that an attacker could change any operation done on the cryptotext, possibly producing inaccurate results. While this may sound concerning, in FHE, such attacks correspond to dishonest or incorrect executions of homomorphic operations. By including redundancy or replication in the computation, these problems can be lessened.</p><h3>Key components of FHE</h3><p>FHE is often described as using a public key system. These keys contribute to creating a safe and private environment that permits data processing without disclosing the underlying plaintext to unauthorised parties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*g50UxjpeAZSHR6uGHC0F_w.png" /><figcaption>Key components of FHE</figcaption></figure><ol><li><strong>Decryption Key</strong>: Also called the <strong>master key</strong> of the system. It is used to decrypt the ciphertext back into original plaintex. As each FHE operation is performed without the need to decrypt, the decryption key is typically <strong>generated locally</strong> (data sender’s side) and never transmitted.</li><li><strong>Encryption Key</strong>: This key allows data encryption in FHE systems. In settings where public encryption is enabled, data providers can encrypt data before sending it to a computing unit. Remember, having an encryption key does not imply that you can perform successful decryption.</li><li><strong>Evaluation Key</strong>: This key is given to any computing unit responsible for evaluating a function on cryptotexts. It is safe to be shared or published, similar to a public key. It enables evaluators to apply operations on encrypted data without increasing noise excessively, thereby supporting secure, complex data processing.</li></ol><h3>Various FHE scenarios</h3><h3>Outsourcing mode</h3><p>Outsourcing mode, historically the first published use case for Fully Homomorphic Encryption (FHE), is designed to ensure that cloud computing is privacy-preserving, similar to a secure enclave. It achieves this through cryptographic security rather than hardware-based security. In this scenario, Alice is the owner of private data but has limited computing resources, while Bob, a cloud instance, represents a significant increase in computational power. Alice’s private data remains inaccessible to Bob. She can outsource the computation by encrypting her inputs, allowing Bob to homomorphically evaluate the desired (public) function and return the encrypted result to her.</p><p>Due to current hardware limitations, outsourcing computations in this manner is still relatively slow and yet to be practical for all use cases. Typically, there is a significant overhead: running time may increase by 1 million, and memory usage can increase by 1,000 for non-linear operations such as polynomial evaluations or complex mathematical functions.</p><p>Although it is possible for Bob to produce inaccurate results from the computation, this can be identified by:</p><ul><li>Independent verification of the computation by a reputable third party.</li><li>The computation will be publicly rerun to verify its accuracy.</li></ul><h3>Client Server Model</h3><p>The client-server model significantly improves the two-party computation paradigm by allowing the computational unit to offer a secure computation service to numerous clients. Implemented with FHE, this model is particularly advantageous in situations that involve a private model prediction service, a machine learning service with private inputs, and a private model. In this setup, the server maintains the private model, and each client submits their data to request a prediction. As a result, each client receives an encrypted prediction that can only be decrypted with their secret key. In this setup, the server maintains the private model while each client submits their data and requests a prediction. As a result, each client receives an encrypted prediction that can only be decrypted using their unique secret key.</p><p>Although the two-party computation method offers numerous advantages, a few potential downsides must be addressed.</p><ul><li>The client’s outcome may inadvertently reveal information about the server’s model. Therefore, the server needs to add more security measures to prevent leaks and ensure the system stays safe.</li><li>Homomorphic computation is not publicly verifiable. As a result, the server must be either trusted or incentivised to comply with the protocol.</li></ul><h3>Homomorphism in a Nutshell</h3><p>A homomorphism, a mathematical concept, may sound complex, but it’s quite simple. It’s a <strong>relationship between two mathematical structures where an operation performed on one element corresponds consistently to an operation performed on the image of that element in another structure</strong>.</p><p>In other words, it’s a <strong>‘mapping’</strong> or <strong>‘translation’</strong> that preserves how things interact within the structure.</p><p><em>Mathematically speaking</em>,<br> Consider two algebraic structures (A, ⊞) and (B, ⊕), where elements of field A and field B are denoted as a and b, respectively. A homomorphism exists if there is a function Γ such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*9ZQ82qxUmRcMvbHbZuF3rg.png" /></figure><p>This property allows operations on encrypted data to mirror operations on the original data without needing to decrypt the data itself.</p><p><em>Following is a rather trivial example of homomorphism in rust :</em></p><pre>fn encrypt(value: i32, base: i32, modulus: i32) -&gt; i32 {<br>    // Exponential encryption<br>    pow_mod(base, value, modulus)<br>}<br><br>fn decrypt(encrypted_value: i32, base: i32, modulus: i32, expected_sum: i32) -&gt; i32 {<br>    // Finding the discrete logarithm<br>    for i in 0..modulus {<br>        if pow_mod(base, i, modulus) == encrypted_value {<br>            return i;<br>        }<br>    }<br>    expected_sum<br>}<br><br>fn pow_mod(mut base: i32, mut exp: i32, modulus: i32) -&gt; i32 {<br>    let mut result = 1;<br>    base %= modulus;<br>    while exp &gt; 0 {<br>        if exp &amp; 1 == 1 {<br>            result = (result * base) % modulus;<br>        }<br>        base = (base * base) % modulus;<br>        exp &gt;&gt;= 1;<br>    }<br>    result<br>}<br><br>fn main() {<br>    // Dummy plaintext values<br>    let plaintext1 = 3;<br>    let plaintext2 = 5;<br>    println!(&quot;Plaintext 1: {}&quot;, plaintext1);<br>    println!(&quot;Plaintext 2: {}&quot;, plaintext2);<br>    <br>    // Public key (base for exponentiation)<br>    let public_key = 2;<br>    println!(&quot;Public Key (base of exponent): {}&quot;, public_key);<br>    <br>    // Modulus for additional security<br>    let modulus = 11;<br>    println!(&quot;Modulus: {}&quot;, modulus);<br>    <br>    // Encrypting values by raising to power of public key<br>    let encrypted1 = encrypt(plaintext1, public_key, modulus);<br>    println!(&quot;Encrypted 1: {}&quot;, encrypted1);<br>    let encrypted2 = encrypt(plaintext2, public_key, modulus);<br>    println!(&quot;Encrypted 2: {}&quot;, encrypted2);<br>    <br>    // Homomorphic addition using multiplication of encrypted values<br>    let encrypted_sum = (encrypted1 * encrypted2) % modulus;<br>    println!(&quot;Encrypted Sum: {}&quot;, encrypted_sum);<br>    // Decrypting the result<br>    let decrypted_sum = decrypt(encrypted_sum, public_key, modulus, plaintext1 + plaintext2);<br>    println!(&quot;Decrypted Sum: {}&quot;, decrypted_sum);<br>    <br>}</pre><h3>Other types of Homomorphic Encryption</h3><p>Before exploring FHE schemes in depth, the following are additional homomorphic encryption types.</p><ol><li><strong>Partially homomorphic encryption</strong><br> It permits only a limited number of operations on encrypted data, including addition and multiplication.<br> Partially homomorphic encryption is a crucial tool in scenarios where only one type of operation is needed, such as tallying votes. This type of encryption is commonly used in voting systems and other applications where only one kind of operation is performed on the encrypted data.</li><li><strong>Somewhat homomorphic encryption</strong><br> It allows multiplication and addition, but only a limited number of times.<br> They are specially used where the depth of computation is already known, such as evaluating polynomials and specific machine learning algorithms like linear regression and logistic regression.</li><li><strong>Fully homomorphic encryption</strong><br> It allows both addition and multiplication an unlimited number of times. This comes with higher complexity and is computationally expensive, which may be ideal for scenarios that require extensive data processing, such as cloud computing and data analysis. Despite its higher complexity and computational expense, its ability to handle addition and multiplication unlimited times makes it a valuable tool in these contexts.</li></ol><h3>Understanding LWE and RLWE: A Mathematical Overview with Rust Implementation</h3><h3>Learning With Errors (LWE)</h3><p><strong>Learning With Errors (LWE)</strong> is a central problem in modern cryptography, especially in constructing secure encryption schemes, including <strong>Fully Homomorphic Encryption (FHE)</strong>. The basic idea behind LWE is to encrypt data by performing operations on <strong>noisy dot products</strong>. This “noise” ensures that solving the system of equations (i.e., decrypting the message) is difficult unless you have access to the secret key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hpVVCl4A6Mv5v_0igpSKBw.png" /></figure><p>The security of LWE is based on the <strong>hardness of learning the secret key ( s )</strong> given many such noisy dot products. The noise term ( e ) makes it computationally infeasible to deduce the exact value of ( s ) or ( m ), providing the cryptographic guarantee of privacy.</p><h3>Encryption Process in LWE</h3><p>In LWE encryption, the process involves the following steps:</p><ol><li><strong>Secret Key Generation</strong>: The secret key ( s ) is a random binary vector of fixed length ( n ).</li><li><strong>Message Representation</strong>: The message ( m ), typically a small integer, is embedded into a larger integer by shifting it to the most significant bits.</li><li><strong>Encryption of the Message</strong>: Random integers ( a ) are sampled, and their dot product with the secret key ( s ) is computed. The message ( m ) is then added to this product, along with random noise ( e ). This results in a noisy encryption of the message.</li></ol><p>Mathematically, the encryption process for a message ( m ) can be described as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5nBq8hYAhinCy9GTyndoFA.png" /></figure><p>the enctypted value is both the random samples choosen and as well as noise marked result, i.e</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*guOEkGOzNwl0QzgLR4JJYQ.png" /></figure><p>Here’s a rust code piece :</p><pre>fn encrypt&lt;&#39;a&gt;(s: &amp;[u8], a:  &amp;&#39;a [u8], m: &amp;[u8], e: u32 ) -&gt; Vec&lt;(u32, &amp;&#39;a [u8])&gt; {<br>    let dot_prod = dot_product(s, a);<br>    let m_shifted = (m.iter().fold(0u32, |acc, &amp;bit| (acc &lt;&lt; 1) | bit as u32)) &lt;&lt; 28;<br>    let enc:u32 = dot_prod + m_shifted + e;<br>    let rand_key :&amp;[u8] = a;<br>    let result: Vec&lt;(u32, &amp;[u8])&gt; = vec![(enc, rand_key)];<br>    result<br>}</pre><p>In the Rust code:</p><ul><li>The encrypt function computes the dot product of ( a ) and ( s ), adds the message (for example - shifted by 28 bits), and then adds random noise ( e ).</li><li>The resulting obfuscated product is appended to the vector ( a ) to form the ciphertext.</li></ul><h3>Decryption Process in LWE</h3><p>The decryption process involves reversing the encryption procedure:</p><ol><li><strong>Compute the Dot Product</strong>: Compute the dot product of the random vector ( a ) and the secret key ( s ) to retrieve the part of the ciphertext corresponding to the original message.</li><li><strong>Remove the Noise</strong>: The noise term ( e ) needs to be subtracted to retrieve the message. Since the message is embedded in the most significant bits of the ciphertext, rounding the result to the nearest multiple of ( 2²⁸ ) removes the noise.</li></ol><p>Mathematically, decryption can be expressed as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9VFdXfP9pzlZnBiTWYnxeg.png" /></figure><p>Where the rounding removes the noise, and the message ( m ) is retrieved.</p><p>Here’s the rust code snipet for decryption :</p><pre>fn decrypt(enc_msg: Vec&lt;(u32,&amp;[u8])&gt; , s: &amp;[u8]) -&gt; Vec&lt;u8&gt; {<br>    let (enc_val, a) = &amp;enc_msg[0];<br>    let dot_prod = dot_product(&amp;s, &amp;a);<br>    let d: u32 = round_to_nearest_2_power_28(enc_val - dot_prod);<br>    let e: u32 = d / (1u32 &lt;&lt; 28);<br>    let result: Vec&lt;u8&gt; = decimal_to_4bit_binary(e);<br>    result<br>}</pre><p>In this code:</p><ul><li>The decrypt function computes the dot product of the secret key ( s ) and the random vector ( a ), then subtracts this from the last element of the ciphertext.</li><li>The round_to_power_of_2 function rounds the result to remove the noise, restoring the original message.</li></ul><p>Here’s the Rust code for <strong>overall process</strong>:</p><pre>fn dot_product(s: &amp;[u8], a: &amp;[u8]) -&gt; u32 {<br>    s.iter()<br>     .zip(a.iter())<br>     .map(|(s_bit, a_bit)| (*s_bit &amp; *a_bit) as u32)<br>     .fold(0, |acc, bit| acc + bit)<br>}<br><br>fn round_to_nearest_2_power_28(c: u32) -&gt; u32 {<br>    let divisor = 1u32 &lt;&lt; 28;<br>    ((c + divisor / 2) / divisor) * divisor<br>}<br><br>fn decimal_to_4bit_binary(decimal: u32) -&gt; Vec&lt;u8&gt; {<br>    let lowest_4_bits = decimal &amp; 0b1111;<br>    (0..4)<br>        .map(|i| ((lowest_4_bits &gt;&gt; (3 - i)) &amp; 1) as u8)<br>        .collect()<br>}<br><br>fn encrypt&lt;&#39;a&gt;(s: &amp;[u8], a:  &amp;&#39;a [u8], m: &amp;[u8], e: u32 ) -&gt; Vec&lt;(u32, &amp;&#39;a [u8])&gt; {<br>    let dot_prod = dot_product(s, a);<br>    let m_shifted = (m.iter().fold(0u32, |acc, &amp;bit| (acc &lt;&lt; 1) | bit as u32)) &lt;&lt; 28;<br>    let enc:u32 = dot_prod + m_shifted + e;<br>    let rand_key :&amp;[u8] = a;<br>    let result: Vec&lt;(u32, &amp;[u8])&gt; = vec![(enc, rand_key)];<br>    result<br>}<br><br>fn decrypt(enc_msg: Vec&lt;(u32,&amp;[u8])&gt; , s: &amp;[u8]) -&gt; Vec&lt;u8&gt; {<br>    let (enc_val, a) = &amp;enc_msg[0];<br>    let dot_prod = dot_product(&amp;s, &amp;a);<br>    let d: u32 = round_to_nearest_2_power_28(enc_val - dot_prod);<br>    let e: u32 = d / (1u32 &lt;&lt; 28);<br>    let result: Vec&lt;u8&gt; = decimal_to_4bit_binary(e);<br>    result<br>}<br><br>fn main() {<br>    <br>    // 4 bit message vector<br>    let m: Vec&lt;u8&gt; = vec![1, 0, 1, 0];<br>    // 32 bit secret key<br>    let s: Vec&lt;u8&gt; = vec![1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,1,1];<br>    // 32 bit random vector<br>    let a: Vec&lt;u8&gt; = vec![1,1,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0,0,1];<br>    //noise value<br>    let e: u32 = 57;<br><br>    // Ensure vectors are of desired length<br>    assert_eq!(s.len(), 32, &quot;s must be 32 bits&quot;);<br>    assert_eq!(a.len(), 32, &quot;a must be 32 bits&quot;);<br>    assert_eq!(m.len(), 4, &quot;m must be 4 bits&quot;);<br><br>    // print initial values<br>    println!(&quot;secret key: {:?}&quot;, s);<br>    println!(&quot;random no.: {:?}&quot;, a);<br>    println!(&quot;4 bit msg: {:?}&quot;, m);<br><br>    // ENCRYPTION ------&gt; <br>    println!(&quot;---------------------------------Encrypting--------------------------------------&quot;);<br>    let enc_msg = encrypt(&amp;s, &amp;a, &amp;m, e);<br>    let enc_val = enc_msg[0].0;<br>    println!(&quot;encrypted msg  : {:?}&quot;, enc_msg);<br>    println!(&quot;random vector  : {:?}&quot;, a);<br>    println!(&quot;&lt;s,a&gt; + m + e  : {:?}&quot;, enc_val);<br>    <br>    // DECRYPTION ------&gt;<br>    println!(&quot;---------------------------------Decrypting--------------------------------------&quot;);<br>    let dec_msg : Vec&lt;u8&gt; = decrypt(enc_msg, &amp;s);<br>    println!(&quot;decrypted msg : {:?}&quot;,dec_msg);<br><br>}</pre><h3>Security of LWE: Mathematical Guarantee</h3><p>The security of LWE is based on the hardness of the following problem: Given many noisy linear equations of the form -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNIaI-rmWDYSc9VD8HkiZw.png" /></figure><p>It is computationally infeasible to recover the secret key ( s ) or the message ( m ). The noise added during encryption ensures that the system cannot be solved easily.</p><p>In other words, even if an adversary has access to a set of ciphertexts corresponding to different messages, it is infeasible to recover the secret key ( s ) or learn anything about the message ( m ) without knowing the secret key. The cryptographic guarantee can be seen as a machine-learning problem -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15oMfzVx9m3lse5jpwy3og.png" /></figure><p>Where ( a ) is a random vector, ( s ) is the secret key, and ( m ) is the message. The learner’s task is to solve for ( s ) or ( m ), but the <strong>added noise</strong> ( e ) ensures that this problem is <strong>computationally hard</strong>. Without the perturbance, this problem is equivalent to solving a linear system and would be easy. With the perturbance, nobody knows how to solve it in polynomial time.</p><h3>Ring-Learning With Errors (RLWE)</h3><p><strong>Ring-Learning With Errors (RLWE)</strong> is a variant of LWE that operates in the ring of polynomials modulo a polynomial of degree ( n ). RLWE is often used in more advanced encryption schemes, as it provides both efficient and secure methods for operations on encrypted data. The key difference between LWE and RLWE is that the dot products and noise are performed in polynomial rings rather than over vectors.</p><p>The RLWE problem is often formulated as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJq0rRZ3eAEfIKIUB1M6BA.png" /></figure><p>Where ( a ) and ( s ) are now polynomials, and the problem remains hard to solve due to the noise term ( e ).</p><p>In practice, encryption is performed by <strong>computing noisy dot products and adding random noise</strong>, while decryption involves reversing the process and <strong>rounding to remove the noise</strong>. The security of LWE ensures that the key or message cannot be recovered even if a large number of ciphertexts are entered, making LWE a strong building block of modern cryptography.</p><h3>Advantages of RLWE over LWE</h3><p><strong>RLWE has several advantages over LWE</strong>, especially in the context of cryptography. These results are mostly caused by <strong>formulas expressed in polynomial rings</strong> (e.g., using ring formulas instead of vectors), which allows for more computational effort and easier cryptographic design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DV9TCiM3t6wk72ln_E7GEg.png" /></figure><h3>Maintaining the Validity of Calculations in Homomorphic Encryption</h3><p>Homomorphic encryption (FHE) guarantees the legitimacy of the computed function, with trust and incentives being essential in collaborative scenarios.</p><p>As an example, when two legal subjects are in different jurisdictions and are simultaneously performing statistical calculations, there are rules like the GDPR that permit the publication of overall statistics without having the individual data made available in a centralised body. In these instances, FHE facilitates secure computation, and all parties have a vested interest in ethically adhering to the protocol.</p><p>In non-collaborative contexts, the significance of redundancy is central to the verification of the computation’s legitimacy. The simplest way to achieve this is by adding<strong> redundancy</strong>. For example, homomorphic computations can be <strong>made public and deterministic </strong>in outsourcing scenarios. Suppose two or more independent entities produce the same encrypted result. In that case, this guarantees that the computation is correct and the result can be safely decrypted. Introducing more redundancy increases confidence in the outcome, though it comes with a <strong>trade-off regarding computational efficiency</strong>.</p><h3>BFV: A Practical FHE Scheme Based on RLWE</h3><p>The <strong>Brakerski/Fan-Vercauteren (BFV)</strong> scheme is a fully homomorphic encryption (FHE) type that plays a crucial role in enabling encrypted computations on integers. It is based on RLWE problem and provides both addition and multiplication operations on ciphertexts.</p><p>The BFV algorithm helps to perform arithmetic operations on intergers while maintaning a good level of accuracy. This approach is specially useful in places such as data security and accounting, where even small errors are unacceptable.</p><h3>Key Features of BFV</h3><ul><li>Ring Learning with Errors (RLWE)</li><li>Noise Growth Management.</li><li>Relinearization and Modulus Switching</li></ul><h3>How does BFV manages growth ?</h3><p>BFV manages noise growth through:</p><ul><li><strong>Relinearization</strong>: After multiplication, the resulting ciphertext is of a higher degree. Relinearization transforms it back to a lower degree, reducing noise.</li><li><strong>Modulus Switching</strong>: This technique scales down the ciphertext modulus to control noise without affecting decryption accuracy.</li></ul><h3>Bootstrapping</h3><p>To enable <strong>continuous homomorphic operations</strong>, BFV supports bootstrapping. This process refreshes the ciphertext, reducing noise to allow further computations without compromising decryption accuracy.</p><h3>Applications of BFV</h3><p>In case of <strong>medical data</strong>, where condidentiality is of utmost importance, BFV’s techniques such as <strong>relineralisation</strong> , <strong>analog-to-digital migration</strong>, and <strong>bootstraping</strong> ensure robust cryptographic computaions without compromising on security.</p><h3>BGV: A Practical FHE Scheme Without Bootstrapping</h3><p>The <strong>BGV</strong> (Brakerski-Gentry-Vaikuntanathan) scheme significantly advances Fully Homomorphic Encryption (FHE) by introducing leveled homomorphic encryption <strong>without the need for Gentry’s bootstrapping</strong>. Based on the Learning With Errors (<strong>LWE</strong>) and Ring Learning With Errors (<strong>RLWE</strong>) problems, BGV can provide code encryption, which is helpful for applications that need to handle data security.</p><h3>Key Features of BGV</h3><ul><li>Leveled homomorphic encryption</li><li>Noise Management</li><li>Relinearization</li></ul><h3>Modulus Switching and Noise Reduction</h3><ul><li><strong>Modulus Switching</strong>: By switching to smaller moduli after each operation, BGV manages noise growth more effectively. This step helps maintain encryption integrity, allowing more computations without noise wrapping around the modulus.</li><li><strong>Leveled Approach</strong>: Instead of indefinite homomorphic operations, BGV sets a fixed circuit depth. This leveled structure is more efficient, particularly for applications requiring a finite number of operations on encrypted data.</li></ul><h3>Applications of BGV</h3><p>BGV’s leveled approach is suited for computations on encrypted data that require exact results but don’t need indefinite homomorphic depth.<br> Its Key applications include:</p><ul><li>Financial Computations</li><li>Privacy-Preserving Analytics</li><li>Healthcare</li></ul><p>BGV represents a practical FHE approach that balances efficiency and noise management without bootstrapping. With libraries like <strong>concrete</strong>, implementing BGV in Rust is accessible, making it feasible for real-world applications where privacy and efficiency are paramount.</p><h3>References</h3><ol><li>Buterin, Vitalik. “<a href="https://vitalik.eth.limo/general/2020/07/20/homomorphic.html">Homomorphic Encryption and Its Applications</a>” (2020).</li><li>RareSkills. “<a href="https://www.rareskills.io/post/homomorphisms">Introduction to Homomorphisms</a>”.</li><li>Kun, Jeremy. “<a href="https://www.jeremykun.com/2024/05/04/fhe-overview/">A High-Level Technical Overview of FHE</a>” (2024).</li><li>“Fully Homomorphic Encryption: Introduction and Use Cases.” <a href="https://cryptographycaffe.sandboxaq.com/posts/fhe-01/">Cryptography Caffe</a>.</li><li>Gentry, Craig. “<a href="https://eprint.iacr.org/2012/144">Fully Homomorphic Encryption Scheme</a>” (2012).</li><li>Brakerski, Zvika, and Craig Gentry. “<a href="https://eprint.iacr.org/2011/277">Fully Homomorphic Encryption from Ring-LWE</a>” (2011).</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45c6d4eb705d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>