Linear Time Encodable Binary Code Achieving GV Bound with Linear Time Encodable Dual Achieving GV Bound
Abstract
We initiate the study of what we term βfast good codesβ with βfast good duals.β Specifically, we consider the task of constructing a binary linear code such that both it and its dual are asymptotically good (in fact, have rate-distance tradeoff approaching the GV bound), and are encodable in time. While we believe such codes should find applications more broadly, as motivation we describe how such codes can be used the secure computation task of encrypted matrix-vector product, as studied by Behhamouda et al (CCS 2025).
Our main contribution is a construction of such a fast good code with fast good dual. Our construction is inspired by the repeat multiple accumulate (RMA) codes of Divsalar, Jin and McEliece (Allerton, 1998). To create the rate 1/2 code, after repeating each message coordinate, we perform accumulation steps β where first a uniform coordinate permutation is applied, and afterwards the prefix-sum modulo 2 is applied β which are alternated with discrete derivative steps β where again a uniform coordinate permutation is applied, and afterwards the previous two coordinates are summed modulo 2. Importantly, these two operations are inverse of each other. In particular, the dual of the code is very similar, with the accumulation and discrete derivative steps reversed.
Our analysis is inspired by a prior analysis of RMA codes due to Ravazzi and Fagnani (IEEE Trans. Info. Theory, 2009). The main idea is to bound the input-output weight-enumerator function: the expected number of messages of a given weight that are encoded into a codeword of a given weight. We face new challenges in controlling the behaviour of the discrete derivative matrix (which can significantly drop the weight of a vector), which we overcome by careful case analysis.
Keywords and phrases:
Binary error-correcting codes, dual codes, fast encoding, repeat-multiple-accumulate codesFunding:
Nicolas Resch: Research supported by an NWO (Dutch Research Council) grant with number C.2324.0590. This work was done in part while visiting the Simons Institute for the Theory of Computing, supported by DOE grant #DE-SC0024124.Copyright and License:
2012 ACM Subject Classification:
Theory of computation Error-correcting codesAcknowledgements:
The authors would like to thank Yuval Ishai, for patient discussions concerning potential cryptographic applications of our codes; Geoffroy Couteau, for sharing the construction of the codes that we analyze; Divya Ravi, for kindly reading over the cryptographic sections and suggesting relevant citations; the anonymous reviewers for helpful comments; and Henri Pfister for suggesting overlooked citations on RMA codes.Editor:
Shubhangi SarafSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl β Leibniz-Zentrum fΓΌr Informatik
1 Introduction
The theory of error-correcting codes is largely concerned with constructing linear subspaces of finite vector spaces satisfying interesting combinatorial properties. In this work, we focus on the most popular setting of binary codes, i.e., subspaces . A first desirable property of a code is that the codewords (i.e., elements of ) are well-spread. To quantify this, one typically uses the minimum distance , defined as the minimum fraction of coordinates one needs to change in order to transform one codeword into another one. In other words, , where denotes the (relative) Hamming distance. In fact, for linear codes, it suffices to look at the minimum distance of a nonzero codeword from , i.e., , where is the (relative) Hamming weight.
On the other hand, one would like the linear code to be fairly large. This is typically quantified by the codeβs rate, defined as where . The well-known Gilbert-Varshmov (GV) bound states that such binary linear codes of rate and distance exist whenever , where denotes the binary entropy function, which has a continuous inverse . For binary codes, the GV bound remains the best known achievable tradeoff between rate and distance. We will be looking for codes that get close to the GV bound, as in the following definition.
Definition 1 (GV Bound).
Fix and . We define , and say a code of rate is -close to the GV bound if .
Beyond hoping for large rate and large distance, one can make other demands on a code. For example, one could hope for encoding to be very fast. That is, recalling that for every linear code one can define a generator matrix for which , one could hope that the time it takes to compute from is as small as possible, ideally .111We quantify encoding time in a circuit model, where all fan-in 2 gates are available. For additional details on this point, see SectionΒ 2.
Additionally, especially in the context of cryptography the dual code of a binary linear code is also often crucial (being connected to, e.g., the secrecy threshold in secret-sharing schemes). Recall that the dual of a code is defined as , where for we have , the standard inner-product modulo 2. Recall that if then , so if has rate then has rate . We thus find it most natural to consider codes of rate , so that and are of the same rate (and could potentially achieve the same distance).
In this work, we consider the task of constructing binary linear codes of rate meeting the following list of desiderata:
-
Firstly, we would like to approach the GV bound .
-
We would like the dual distance to also approach the GV bound .
-
Lastly, we would like both and to be encodable in time (which, up to constants, is clearly optimal).
To coin a term, we call such a code a fast good code with fast good dual.
1.1 Our results
In this work, we prove that such a fast good code with fast good dual indeed exists.
Theorem 2.
For all large enough (even) and all , there exists a binary code of rate such that:
-
and both have distance at least ;
-
and are both encodable in time.
As we discuss later, the encoding time is in fact practically fast. For example, with there is a boolean circuit with binary gates implementing the encoding map with size . Unfortunately we do not now how to bound more precisely the encoding time of and in terms of . However, empirically the constant in front of is very small; see Table 1 and the surrounding discussion. We additionally note that Boolean circuits of size and depth can implement the encoding map, should low depth be desired.
While we will provide a much broader overview of our proof technique later, we now briefly outline the idea. Firstly, we emphasize that our construction is randomized. Both and will be sampled in such a way that they are reminiscent of repeat multiple accumulate () codes. Essentially, codes are defined by multiple rounds, where in each round a coordinate permutation is applied, followed by an accumulation step, which is just the prefix-sum modulo 2. In particular, these rounds can be implemented very quickly (just xorβs). The idea is to consider random codes, where the coordinate permutations are chosen uniformly at random, and demonstrate they are likely to have very good distance.
Fortunately for us, a sequence of works [22, 23, 2, 18, 24, 6] have shown these codes achieve good distance. The basic idea of these works is, given two weights and , to analyze the expected number of message vectors of weight that are mapped to a codeword of weight . Using some coding-theoretic jargon, this is called the input-output weight-enumerator function, or IOWEF for short. Concretely, for a fixed generator matrix we define
Then, if denotes a random generator matrix (sampled according to some given distribution), the IOWEF will be . The pleasant feature of this code ensemble is that its IOWEF has a fairly simple expression. To show a code achieves minimum distance with probability for some , by Markovβs inequality it suffices to show that the sum of the IOWEF over all with is .
Now, it is not difficult to see that an code has constant weight dual codewords (assuming the number of rounds is constant, as we always do). Hence, they are unsuitable for our target. Nonetheless, we note that the inverse of the accumulation step is quite simple: namely, one just takes the xor of the previous two coordinates. We view this operation as a discrete derivative. While this operation is not very helpful in terms of achieving good distance (it can at most double the weight of a vector, and in the worst case can drop it all the way down to ), as it corresponds to doing an accumulation step in the dual, it increases the dual distance! Thus, we can hope for both distance and dual distance to be large. A main challenge is to argue that these discrete derivative rounds are unlikely to harm the minimum distance.
Thus, our task is to bound the IOWEF of codes where accumulation rounds are interleaved with discrete derivative rounds. As in prior works [18, 24, 6], roughly speaking we break the analysis into the case where are small or large. The first case is handled largely by combinatorial reasoning concerning binomial coefficients; the latter case is handled by looking at the exponent of the IOWEF, i.e., looking at of the IOWEF and bounding it via analytic means: this function is often called the spectral shape function. In some sense, we manage to bound the spectral shape functions of our code ensembles by that of an code, allowing us to obtain the same distance guarantees. This is the sense in which we manage to show the discrete derivative rounds donβt harm minimum distance. In particular, we can get distance -close to the GV bound, where the closeness to the GV bound is determined by the number of βroundsβ of our encoding maps.
We believe that the existence of such a code is interesting, and likely to find further applications in coding theory, cryptography, or theoretical computer science more broadly. As a small proof of concept, we show their utility for the task of computing encrypted matrix-vector product (EMVP), as studied by Benhamouda et al [4]. The task is as follows. In an initial offline phase, a client sends an encryption of a matrix to a server, while keeping a (short) secret key. In the online phase, the client may send encryptions of query vectors ; based on these encryptions, the server computes a value , which the client can use to determine the matrix-vector product . Importantly, the server learns nothing about the matrix or the query vectors . As Benhamouda et al [4] discuss, this is an important subroutine for efficient secure computation tasks in a number of domains, including encrypted fuzzy search and secure ML. Additionally, note that the special case of each being a unit vector (i.e., having a single entry) is equivalent to (single-server) private information retrieval (PIR). While we provide more details later of this application in Section 4, the fast encoding time for the and we construct yield improved running times for the protocol of Benhamouda et al [4].
Again, we emphasize that this is just a small proof-of-concept for our codes. We consider the main contribution of this work to be the code construction itself, along with the (fairly involved) analysis. Nonetheless, we flesh out this application further in Section 4.
1.2 Related work
To the best of our knowledge, ours is the first work to construct βfast good codesβ with βfast good duals.β However, our codes are heavily inspired by so-called repeat-multiple-accumulate (RMA) codes. These codes were initially introduced as containing only a single round of permuting and accumulating by Divsalar, Jin and McEliece [11], and then extended to contain multiple rounds by Pfister and Siegel in an 1999 conference paper [22]. A series of works [23, 18, 24, 6] (that we build upon) have managed to show that such codes can have minimum distance approaching the GV bound222There are some minor caveats concerning the speed at which one approaches the GV bound which we discuss later, but for practical purposes such codes achieve essentially this rate/distance tradeoff. along with linear-time encoding. We will introduce these codes more formally later (Section 2.1) and discuss in detail how we build upon the analyses of these works. We remark that the codes in these works are, like ours, non-explicit.
Regarding the task of constructing explicit linear-time encodable binary codes that are asymptotically good (namely, rate and minimum distance are positive constants), Spielman [27] provided a construction based on expander codes; these codes can also be decoded in linear time. Many works have built off this construction, allowing for more and more sophisticated decoding guarantees; however, this is somewhat tangential from our main focus. Note that the proven rate/distance tradeoff of Spielmanβs code is quite far from the GV bound. Guruswami and Indyk [13] are the first to construct linear-time encodable codes achieving the GV bound, but only over sufficiently large fields (and in fact, they work in the regime where the distance can be , i.e., roughly the Singleton bound).
A work in the same vein as ours is by Druk and Ishai [12]; therein, the authors give a (randomized, non-explicit) construction of a code meeting the GV bound which is linear-time encodable, and additionally outline some cryptographic applications of these codes. Finally, we mention a work by Rudra and Wootters [25] which, among other results, demonstrates the existence of linear-time encodable binary codes of rate that are list-decodable up to radius , where we recall that a code is called -list-decodable if from every vector there are at most codewords satisfying (the list-size in this work is a constant depending only on ). In fact, this code is obtained by randomly folding Spielmanβs linear-time encodable code.
We remark that such prior constructions of linear time encodable codes typically have sparse parity-checks; in particular, the duals cannot be asymptotically good. This is a challenge that we overcome, by carefully adding encoding steps specifically designed to improve the dual distance while also not harming the original codeβs distance.
1.3 Future directions
Before moving onto the technical portion of our paper, we now take some time to highlight some open problems that we consider worthy of study. Firstly, our analysis is inherently limited to the binary field case. One could naturally define similar codes over larger fields: the main thing which should change is that instead of just randomly permuting, one should also randomly rescale the entries, i.e., multiply by a uniformly random full-rank diagonal matrix.333Note that over , the only full-rank diagonal matrix is the identity; hence, this is a natural generalization. However, even for the case of codes most analyses up till now have focused on the binary case. The simple reason for this is that, once the IOWEF is in fact exponentially large;444For as well it is unclear how to bound the IOWEF; already for this field size, new ideas appear to be required. thus, an argument simply applying Markovβs inequality cannot succeed. This is elucidated in the work of Block et al [5], where the authors managed to develop some nontrivial analysis of the minimum distance of RA codes over large fields that does not directly use Markovβs inequality. Nonetheless, the current best argument proving that RMA codes over large alphabets have nontrivial distance follows from simply analyzing the code over , and then using the same generator matrix to define a code over , i.e., some (large) extension of [6]. It would be very interesting to find an analysis over large fields that leads to improved rate/distance tradeoffs.
Continuing with questions concerning codes, we now have a fairly good understanding of their minimum distance; in particular, Brehm et al [6] provide a fairly thorough investigation of the probability they fail to achieve good distance, demonstrating they achieve good distance for concrete values of . A next task could be to determine what list-decodability they might possess. A reasonable approach for this could be to show that they are locally similar to random linear codes [15, 21], which would (roughly) imply that they inherit the list-decodability of a typical linear code.555Technically, will not be fully locally similar to random linear codes, as they contain constant-weight codewords with an overly large probably . The same issue arises with LDPC codes, but can be resolved [20]. It would additionally be very interesting to find explicit codes achieving nontrivial distance; to the best of our knowledge the only result in this vein is due to Guruswami and Machmouchi [14], which essentially partially derandomizes the construction of an asymptotically good code (namely, it requires only the second permutation to be sampled randomly; the first can be deterministically chosen). Finally, we remark that every question asked above could additionally be asked for the codes we define and study.
Next, we list a couple interesting questions motivated by cryptographic applications. Specifically, we consider the code property of multiplicativity. Given two vectors , we define their (Schur) product as as the component-wise product, and then given two linear codes and their (Schur) product is defined as . A code pair is said to be multiplicative if ; namely, it does not span the whole space. Firstly, it can be observed that a binary linear code and its dual are multiplicative, as only contains even weight vectors. It is known [9] that multiplicative codes yield multiplicative secret-sharing schemes,666Briefly, secret-sharing schemes allow a dealer holding to a secret to generate shares to be given to parties such that authorized sets of parties can reconstruct the secret, but no unauthorized set of parties can. As for multiplicativity, this can be viewed as an additional property allowing parties to locally convert shares of secrets into a new value such that the product is a linear combination of the βs. and additionally that such a multiplicative secret-sharing scheme can be used for general-purpose secure multiparty computation (MPC) [3, 28]. The encoding efficiency of the codes and directly translate into the complexity of sharing a secret [12], which must be done by each party for each multiplication gate of the circuit representing the function one is securely computing. Thus, in the quest for βconstant-overhead cryptography [16]β (where the hope is that, if the cost of computing a functionality without security is , the cost of computing it with security is just ) multiplicative secret-sharing scheme with linear-time encoding can play an important role. We observe that typical multiplicative secret-sharing schemes are βalgebraicβ (e.g., Shamir secret-sharing [26], which is based on polynomial evaluations); here, one can deal the shares in quasilinear time (using fast Fourier-transform-type ideas), but getting linear-time dealing appears to require more βcombinatorialβ approaches.
To summarize the above, our work provides a multiplicative secret sharing scheme over with linear-time encoding. One could hope for more. Firstly, one can hope for higher-degree multiplicative secret-sharing [1] allowing for multiplying more secrets together, again with linear-time algorithms for dealing the shares. Next, one could additionally hope for strong multiplicativity of a secret-sharing scheme, which informally would follow from a pair of asymptotically good codes such that has constant distance (such codes are said to satisfy the multiplication property). Note that for a linear code and its dual , as only contains even weight vectors, it has minimum distance , which is nontrivial, but far from constant. Strongly multiplicative secret-sharing schemes lead to general MPC protocols with malicious security [9], i.e., security even in the presence of parties that may actively deviate from the prescribed protocol. One could hope to have such multiplication codes with linear time encoding towards getting general-purpose MPC with constant-computational overhead and malicious security. We remark that prior work has already considered the possibility of constructing somewhat βcombinatorialβ codes (i.e., codes that could admit linear time encoding) that additionally have the multiplication property [10].
Broadly speaking, we view our work as a stepping stone towards a broader suite of βfast codesβ with interesting combinatorial properties. We emphasize that from a cryptographic perspective, decodability is often not required,777And in fact, in certain cases the security of the scheme rests on the assumed hardness of decoding; this is (essentially) the case for the encrypted matrix-vector product protocol we sketch in SectionΒ 4. but instead ask for nontrivial conditions concerning, e.g., the dual code or multiplicativity.
1.4 Organization
The remainder of this paper is organized as follows. In Section 2 we set notation, define RMA codes and review their existing analysis, after which we define our pair of dual codes. In Section 3 we give a broad overview of our proof strategy for Theorem 2. We leave the details of this proof to Sections 4 and 5 in the full version of this paper [7]. Finally, in Section 4, we discuss the utility of these codes in the context of the encrypted matrix-vector product problem.
2 Preliminaries
Throughout this work we will use Latin letters to refer to absolute weights (integers from to ) and Greek letters to refer to relative weights (reals in ). By default, denotes the base-2 logarithm.
We use standard Landau notation, e.g., , , , , etc. In all contexts the growing parameter will be . We use to refer to a function of the form and a function of the form . The notation suppresses terms of the form .
Next, we recall Markovβs inequality, and the specific way in which we use it in this work.
Theorem 3 (Markovβs inequality).
Let be a non-negative random variable. Then for any ,
In particular, if takes values in then
Now, recall that we defined the dual of a linear code of dimension as
We recall the following standard facts. Firstly, and . Additionally, if linear codes and are generated by matrices and , respectively, in the sense that and , then if and only if .
Lastly, as we wish to discuss encoding complexity of binary linear codes, we choose the standard model of Boolean circuits where gates of fan-in 2 are available.888Of course, any other constant fan-in only affects the encoding complexities up to constants; the choice of 2 is just for concreteness. We remark that this circuit model is robust to the precise set of available gates, but for simplicity we assume all gates are available. This should be contrasted with more liberal models such as arithmetic circuits or RAM models, which are more sensitive to ring or word size, respectively. Additional discussion of this model choice can be found in [27].
2.1 Repeat-multiple-accumulate codes
2.1.1 Definition
The codes we study in this paper are directly inspired by the well-studied repeat-multiple-accumulate (RMA) codes over the binary field . These are parametrised by three integers , where is the number of rounds of the code, is the repetition factor which fixes the rate of the code, and finally is the block-length. We assume is divisible by .
The encoding function of an code is simple to describe. First, take your message vector of length and repeat it times. Then apply a permutation to the resulting length vector. Next, apply the accumulator operation to this vector, which is simply a prefix sum: bit of the output will be equal to the xor of the first bits in the input vector. We repeat this permute-accumulate step times. More formally, the three operations in the encoding can be described in terms of the following linear operations.
-
For a constant dividing , let denote the repetition matrix corresponding to the linear operator that repeats each entry in the vector times. That is, if and only if .
-
Let be the accumulator matrix, if and only if .
-
For a permutation , let be the permutation matrix corresponding to . That is, if and only if .
Say we fix and have . We then obtain a rate code with two permute-accumulate rounds, which we refer to as an code. Its generator matrix code can be defined as . More generally, we will refer to an code of rounds as an code.
Note that computing the encoding can be done by a Boolean circuit consisting of just xor gates of fan-in 2; additionally, classical work of Ladner and Fischer [19] gives an implementation with gates and depth (and the constants are very reasonable).
Rather than considering a fixed choice of code, we will consider a random codes defined by sampling uniformly at random the permutations making up the code. Thus, in the analysis, for a fixed vector weight one can imagine that going into each accumulator round we in fact have a uniformly random vector of that weight. To establish that a random code achieves good distance, the important fact is that a uniformly random vector of any weight has expected weight after accumulating. Thus, a random code typically βpushes the weights towards the middle,β which is exactly what we want when we recall that, for a linear code, achieving minimum distance is equivalent to having no codewords of weight below weight .
2.1.2 Distance analysis
As the analysis of the minimum distance of our codes is inspired by prior analyses of codes, we now sketch these approaches. As mentioned in the introduction, codes (with only a single round of permute and accumulate) were introduced by Divsalar, Jin and McEliece [11]. Beyond the efficiency of the encoding, part of the appeal of these codes is the fairly simple expression of their IOWEF: the expression telling you the expected number of message vectors of a given weight that are mapped to a codeword of weight . This expression is very useful because, as noted in the introduction, to show that a code achieves relative minimum distance with probability for some , by Markovβs inequality it suffices to show that the expected number of codewords of relative weight at most (which is simply the sum of the IOWEF for absolute codeword weights ). When introducing codes, the authors indeed show that we can express the probability that a weight vector is mapped to weight after permuting and accumulation as follows (where we rewrite the binomials as this will be useful in the later analysis):
With in hand, one can easily express the expectation that we are interested in.999Note also that a glance at reveals the previous claim that the expected outcome is roughly . For example, consider a random code of rate . After repeating a message of absolute weight , there are vectors of absolute weight . We then expect of these vectors to be mapped to absolute weight after applying the first permute-accumulate operation. Now sum over all permitted values of and , but restrict .
Using this, Kahale and Urbanke proved that these single-round codes are not asymptotically good [17]. This led Pfister and Siegel, in a 1999 conference paper, to first study codes with multiple rounds of permute and accumulate [22]. They numerically estimate the expected number of low weight codewords, which suggests that with at least two rounds, codes achieve asymptotic goodness, and in fact distance relatively close to the GV-bound. This work was extended into chapter 3 of Pfisterβs dissertation [23], which contains the first formal proof of the asymptotic goodness of codes with at least two rounds, as well as precise numerical estimates of the minimum distance attained by codes of varying rates and number of rounds (similar to our Table 1). Importantly, the provably attained minimum distance is not equal to these numerical estimates, and is in fact far below the GV-bound. Thus, this does not yet prove distance close to the GV-bound.
It takes a few more years before another group of authors formally prove that codes obtain minimum distance according to these numerical estimates [18]. They achieve this by taking a more analytic approach. Instead of analyzing the IOWEF directly (a complicated expression with many binomial coefficients), they use Stirlingβs approximation,101010There are some subtleties regarding floors and ceiling, which can be addressed, as we do in Lemma 5.3 of the full version of this paper [7]. to say that , where
This, along with the standard bound , gives a fairly natural representation for the exponent of the terms appearing in the IOWEF, which is called the (asymptotic) spectral shape function (which we formally define below, see Definition 4). This spectral shape function admits an analysis of its critical points, allowing us to maximize over the non-final weights. This reveals a tradeoff between the repetition factor (which recall determines the rate as ), and the target minimum distance , reminiscent of the tradeoff appearing in the proof of the GV bound (although the expression involved is more complicated). Using this method, they reproduce Pfisterβs numerical estimates of the minimum distance of codes, but now proving this distance can be achieved.
This work, however, only proves that the expectation (and hence probability of attaining this minimum distance quite close to the GV-bound) goes to 1 with the block length ; it does not explicate how fast this happens. Building on this work, Ravazzi and Fagnani first prove that this probability has the form and specify precisely what this polynomial is. Moreover, they prove that the minimum distance converges to the GV-bound as the number of rounds goes to infinity (this was only conjectured before based on numerical estimates) [24]. Many years later, another group of authors characterise the expectation more precisely, showing for the first time that we can expect codes to have good distance for concrete block lengths [6].
Let us now formally define the spectral shape function, as we will require it in the analysis of our codes.
Definition 4.
Let . The asymptotic spectral shape function of a rate code is defined recursively as
and we use it to define
where we will use the shorthands and , as we will only consider codes of rate throughout.
The spectral shape function is thus flat at 0 for , where it was proven that converges to the GV-bound [24]. After this point, the spectral shape function grows and becomes strictly positive. This implies that we expect exponentially many codewords of weight in a rate code, showing that one cannot hope to achieve distance beyond in an code.111111At least, not when using Markovβs inequality; a stronger inequality may be able to prove better distance, but this seems unlikely to us. When the spectral shape function is equal to 0, for , we do not expect exponentially many vectors. But observe we canβt conclude there are such vectors: just subexponentially many. Despite this, previous authors established that we expect few [18], and eventually more precisely only [24, 6], such vectors. How did they prove this?
To answer this question, we need to ask why the spectral shape function is flat at 0 for in the first place. This happens because for such small , the expression over (recall that we maximize over ) is in fact decreasing with . To maximize, we are then forced to fix , which yields the function . Suppose now that one has a non-zero lower bound on , say . In that case, one would be forced to pick to maximize and this would yield a strictly negative value for the spectral shape function. One can use this negative value of the spectral shape function to argue that there will only be about codewords of weight at most in expectation.
Why can we assume we have a lower bound on ? Well, described the weight of the codeword preceding the final round of permute-accumulate. Hence, if we can argue that only very few (say, some inverse polynomial number) vectors have relative weight below before entering this last round of the encoding, then we can consider that case dealt with, and assume for the rest of the argument that .
We now have two conflicting forces. We need to pick large enough so that is decreasing in , but also pick small enough so that we can realistically argue that there are only few vectors of weight at most after rounds of permute-accumulate. A sensible assignment is , so that is negligible in , but turns out to be small enough to argue that the expected number of vectors of weight at most after rounds is . We will use this same general proof strategy to analyse our codes: split the computation of the expectation based on whether the weight of the codeword before going into the final round of the encoding is at least or not.
2.1.3 Convergence of distance to GV-bound
Let us end this section by making a note about the convergence of to the GV-bound with , which as we said was proven by [24]. The closer we wish to approximate , the higher needs to be. Unfortunately, we lack a simple analytical expression for , and thus have no theoretical understanding of how fast converges to the GV-bound with . Therefore, if one wishes to get -close to the GV-bound, we know this is possible for large enough , but whether this is already true for or requires , or even , is not something we can theoretically argue.
What we are left with is numerically estimating . To do so, we need to estimate the spectral shape function. Suppose you have a rate code where we describe the weights in between the rounds using , and the non-maximized asymptotic spectral shape function is described by . To determine the value of the spectral shape function, we need to maximize over the βs. Pfister first did this by a grid search over the domains of these variables [23]. A more complicated approach was taken by [18]. They gave the constraints
and
Say we hope to achieve some relative minimum distance . Then we can use the above expressions to fix , and so on, to eventually obtain an expression of the form , which one can solve for . This yields assignments to which guarantee the partial derivatives to all these variables are 0. In short, this lets one find critical points of the asymptotic spectral shape function, for some target minimum distance. Find the local maxima, and if these are negative for your choice of and , then this means that . We used the latter method to fill up Table 1 which contains lower bounds on various . For example, to get -close to the GV-bound you need .
2.2 Our codes
The codes introduced in this paper are directly inspired by codes and their analysis as introduced by the previously cited works. As hinted in the introduction, our idea is to βfixβ the distance of the dual code, and to do that we introduce rounds where we perform the inverse of the accumulation operation. This inverse operation is the following:
-
Let denote the discrete derivative matrix, i.e., iff or .
To see this is the inverse, note that if we have , so . Again, this matrix can be implemented with xor gates (and in fact here the depth is just !).
With this operation in hand, we are able to construct pairs of dual codes of rate . For instance the and codes are dual to one another when , assuming the accumulation orders are βreversedβ (i.e., in one code, and are transposed). More precisely, we have the following.
Proposition 5.
Let be permutations. Consider the generator matrices
and
Then . In particular, they generate dual codes.
Proof.
Since for matrices we have and the transpose of a permutation matrix is its inverse, it follows that
Thus , this last equality being immediate from the definition.
Our goal will be to study the pair of codes and for rate over a uniformly random choice of and prove that both achieve distance converging to the GV-bound as grows.
Since is the inverse of , it is not hard to describe , the probability that a uniformly random vector of absolute weight is mapped to a vector of absolute weight under , in terms of : we can simply swap and in the numerator:
We can then also define
such that . We will often use the shorthands and . With this, we can define the asymptotic spectral shape function for our codes of interest.
Definition 6.
Let . The asymptotic spectral shape function of the rate and codes are defined, respectively, as
Lastly, we note that the probability distribution of for a uniformly random of absolute weight is the same as the probability distribution of , and similarly for and . This follows from the property that is obtained by flipping each column of , which means operationally that instead of accumulating βdown,β now accumulates βupβ (and similarly for and ). Thus, while technically one of the generator matrices needs to use the transpose of these matrices, the functions appearing in the analysis (, etc.) are unchanged. That is, our analysis applies regardless of whether or not the and matrices are transposed.
3 Proof strategy
Our goal is to prove Theorem 2: to find a pair of binary linear codes that are encodable with a linear sized circuit (in the block-length of the code), that are dual to each other, and that can attain minimum distance arbitrarily close to the GV-bound. We will do so for the pair of and codes of rate , as introduced in Section 2.2. By Proposition 5, these can be chosen dual to one another and are encodable with a linear sized circuit: in fact a circuit of size . The task that remains is thus to prove that both of these codes can attain minimum distance arbitrarily close to the GV-bound. We will show this is the case for a randomly sampled such code, except with probability. Getting closer to the GV-bound will require larger , and thus a longer encoding time. In other words, we aim to prove the following theorem, which implies the main result stated as Theorem 2.
Theorem 7.
For all and all (even) large enough, there exists some such that and codes of rate and block-length achieve relative minimum distance , except with probability . The circuit size of the encoding function for either code is , or with depth .
The natural question raised by this theorem is what the function looks like. If is too big this could make the codes practically irrelevant (despite linear circuit size asymptotically). The way we will prove the above theorem is to prove instead that the and codes can attain relative distance -close to , where we recall from Section 2.1 that this was the distance achievable by an code of rate . We recall from that same section that converges to with [24]. This, in turn, would establish the above result, as it implies that our codes can achieve minimum distance arbitrarily close to .
However, as the reader may recall from that same section, we do not have a theoretical understanding of how is related to . Instead, we have a program which takes and computes . From its behaviour we can see that the convergence is quite fast: for example, to get -close to the GV-bound you need (see Table 1). Getting a better quantitative understanding of this convergence remains an interesting open question for future work.
| m | 2 | 3 | 4 | 5 | () |
|---|---|---|---|---|---|
| to | 0 |
Proof of Theorem 7.
As explained above, to establish this theorem, it suffices to prove that rate and codes achieve relative minimum distance -close to , except with probability . By a union bound over the failure probabilities for both codes, we then obtain the desired result.
Our strategy, which is directly inspired by the method used to prove that codes achieve this same minimum distance, is as follows. Recall and , which describe the probability that a uniformly random vector of absolute weight is mapped by , , respectively to a vector of absolute weight . These let us express the expected number of codewords that have weight at most , a quantity which, by Markovβs inequality, translates into an upper bound on the probability that a randomly sampled code fails to achieve the given distance .
We will prove this expectation asymptotically behaves like , proving the theorem. Just like with codes, we prove this by splitting the computation of the expectation based on the weight of a vector when entering the final round of the encoding (where we consider to be one round and to be one round). Specifically, we split based on whether the vector has a weight that is within of the endpoints and of the weight range. To work this out formally, let us write and for the expected number of weight codewords in the given code, e.g. . We can then upper bound the error probability we wish to bound as follows
Note that we can write out an analogous expression for the dual code .
In Section 4 of the full version of this paper [7], we will bound the term called as something negligible in for both codes. In Section 5 of the full version of this paper [7], we will bound the term called as for both codes. Together, we find , and the same for the dual code. Of course, since we want both codes to attain this distance, we take a final union bound, which doubles this error probability.
Let us give a high-level overview of these two cases, starting with the bound . Recall from the discussion in Section 2.1 that one encounters a similar case in the analysis of codes. There, we analysed the critical points of the spectral shape function, which led to the conclusion that the spectral shape function is flat at 0 for . Recall that the spectral shape function is built up round by round by adding a term to the previous function and maximizing over . What we found for this small initial range of is that the function over is decreasing. Hence, to maximize it, we should set , making the spectral shape function equal to 0 for such . In this context, however, we have a lower bound so that we should instead fix , making the spectral shape function strictly negative (instead of 0), and allowing us to argue that : we only expect a negligible number of the vectors with relative weight at least after rounds of accumulation, to then drop below the target distance of after the -th round.
We want to adapt this general strategy to bound for and codes. Unfortunately, due to having twice as many operations and weights, directly working out the critical points is infeasible.121212At least, the analytic expressions for the critical points of the spectral shape function of an code (as found by Kliewer et al [18]) are obtained after making some very clever substitutions. It is unclear to us how this technique could be adapted for or codes. A numerical approach, using a grid search to estimate maximizers, as Pfister applied to codes, could work to estimate the minimum distance of these codes. But this would not prove the codes attain this minimum distance, nor would it quantify the error probability.
We therefore came up with another approach: directly upper bound the spectral shape function of our codes by that of codes. If this is true, and if this upper bound remains true when the range over is restricted, then the upper bound on will follow almost immediately (up to slightly higher polynomial factors from the union bound, which will be irrelevant anyway). This motivates us to consider spectral shape functions where the input weight is bounded away from and . Formally, we consider the following.
Definition 8 (Restricted Spectral Shape Function).
Fix . The -restricted spectral shape function for , and codes respectively, are
Note that the upper bound on the range of for codes follows because is only defined for . This doesnβt apply to the other two codes, as there any pair is a valid input to or (though the choice can limit the range over ). This is also the reason why we constrain on both sides of the weight range, while in the analysis of codes it sufficed to just lower bound . Because of these mismatched ranges we aim to prove an inequality between the restricted spectral shape functions (and likewise for the dual code ), instead of directly proving (as it is not meaningful to prove such a pointwise inequalities as the domains are different).
More specifically, we prove first that and can both be upper bounded by the same function , which is quite similar to . We then use this upper bound of to prove that the restricted spectral shape function of both and codes are upper bounded by the restricted spectral shape function of codes. Finally, we show that this means that the existing argument that the analogue of for is carries over to our codes.
Next, we consider the bound . Recall that represents the expected number of low weight codewords which entered the final round of the encoding with a weight very close (within ) to the endpoints of the weight range. We need to do this for both and codes. We will in fact simplify by counting all codewords with weight near the boundaries of the weight range after rounds (as opposed to only codewords which also have low weight after the entire encoding). Formally, we can express (here for codes) as:
To bound the above, we will split it into two cases based on the weight of a vector in earlier rounds. The point is that the vectors with weight or after rounds can have one of two sources. Either, they had weight or before all preceding or rounds. Or, there was some earlier βth or round before which the vector had weight in the middle of the weight range, and after which it dropped back down to weight or , where it stayed until after round .
In the latter case, we know from our bound on that there are only vectors that can have weight in and then drop to below or above . This lets us argue that these cases are indeed negligible, but only from the second round on (as ). It turns out that we can give a separate argument that there are only vectors dropping from inside to outside weight range in round 1 as well (though for codes specifically this only seems to be true after two rounds, which means we can only expect these codes to attain good distance for ). This then leaves the vectors which are in the weight range throughout the entire encoding, which is the βhardβ case (in terms of contributing a non-negligible term to the expectation). We carefully deal with this case by analyzing the binomial coefficients, and note that these two cases are only when .
4 Cryptographic application
As mentioned in the introduction, such fast codes with fast good duals can be used to construct efficient secure multiparty computation (MPC) protocols for the problem of encryption matrix-vector product (EMVP). In this section, we sketch this application, but refrain from providing precise definitions, preferring to refer to [4] where appropriate.
Briefly, consider a client that wishes to delegate the task of computing matrix-vector products for a matrix to a server in the cloud. In an initial setup phase, the client takes the matrix and encrypts it into a matrix (using a secret key), which is then sent to the server. Later, in the online phase, the client takes query vectors and sends encryptions thereof to the server, keeping an associated secret key . The server then returns a value . The correctness requirement is that from , and the initial secret key, the client learns the value of the matrix vector-product . The security requirement is that the server learns nothing about the matrix or any of the query vectors.
Benhamouda et al [4] suggest resolving this problem in the following way.131313This, admittedly, simplifies certain details. The first step is for the server to sample two secret, dual codes: one could use an code and its dual code . The code will be used to encrypt the matrix : one sets , where is a generator matrix for and is a pseudorandom matrix (which serves to hide ). (One technical caveat is that the matrix must be systematic for this application; while we would like to be able to guarantee that this step can be done in linear time since admits a linear time encoding algorithm, we unfortunately cannot.)
Next, in the online phase, to mask the query one must use a uniformly random codeword . To sample such a codeword, one can sample a uniformly random and then output , where generates . In particular, assuming admits linear time encoding this step can be done in linear time!
Thus, we see that by finding self-dual codes with fast encoding we can speed up this algorithm, making our codes quite promising for this application. We remark that Benhamouda et al [4] already suggested using quasi-cyclic codes to get the desired dual codes, which admit quasilinear encoding (but not truly linear, as we obtain). In fact, the authors write that βone could potentially use other families of (dual) linear codes that admit fast encodingβ [4, Section 3.1].
Of course, this entire discussion is moot if the resulting scheme is insecure. Naturally, the code we sample needs to satisfy a certain hardness assumption: namely, a variant of the learning subspace with noise (LSN) assumption [4, Definition 3.1] must hold, which informally states that if one can obtain random codewords from which, with probability , are rerandomized (i.e., one obtains a uniformly random vector a -fraction of the time), it is hard to recover the secret code . One can ask whether a secret (or ) code can be reasonably expected to satisfy this LSN assumption. For the close cousin learning parity with noise (LPN) assumption β where essentially the task is to decode β the general consensus is that unless a code displays notable βalgebraic structure,β the best general strategy is to look for low-weight dual codewords to hopefully recover information about the codeword untainted by the noise (see, e.g., [8, Section 3]). But, note that we have explicitly argued that does not have any light dual codewords: (quite likely) approaches the GV bound!
Of course, this is merely a sketch of this potential application. Nonetheless, we believe it is emblematic of the principle that such codes with fast encoding and non-trivial dual properties can be useful for cryptography, especially when targetting extremely efficient implementations. We anticipate there to be many further applications in the future.
References
- [1] Omer Barkol, Yuval Ishai, and Enav Weinreb. On d-multiplicative secret sharing. Journal of cryptology, 23(4):580β593, 2010. doi:10.1007/s00145-010-9056-z.
- [2] Louay Bazzi, Mohammad Mahdian, and Daniel A. Spielman. The minimum distance of turbo-like codes. IEEE Transactions on Information Theory, 55(1):6β15, 2009. doi:10.1109/TIT.2008.2008114.
- [3] Michael Ben-Or, Shafi Goldwasser, and Avi Wigderson. Completeness theorems for non-cryptographic fault-tolerant distributed computation. In Proceedings of the Twentieth Annual ACM Symposium on Theory of Computing, STOC β88, pages 1β10, New York, NY, USA, 1988. Association for Computing Machinery. doi:10.1145/62212.62213.
- [4] Fabrice Benhamouda, Caicai Chen, Shai Halevi, Yuval Ishai, Hugo Krawczyk, Tamer Mour, Tal Rabin, and Alon Rosen. Encrypted matrix-vector products from secret dual codes. In Chun-Ying Huang, Jyh-Cheng Chen, Shiuh-Pyng Shieh, David Lie, and VΓ©ronique Cortier, editors, Proceedings of the 2025 ACM SIGSAC Conference on Computer and Communications Security, CCS 2025, Taipei, Taiwan, October 13-17, 2025, pages 394β408. ACM, 2025. doi:10.1145/3719027.3765194.
- [5] Alexander R Block, Zhiyong Fang, Jonathan Katz, Justin Thaler, Hendrik Waldner, and Yupeng Zhang. Field-agnostic snarks from expand-accumulate codes. In Annual International Cryptology Conference, pages 276β307. Springer, 2024. doi:10.1007/978-3-031-68403-6_9.
- [6] Martijn Brehm, Binyi Chen, Ben Fisch, Nicolas Resch, Ron D. Rothblum, and Hadas Zeilberger. Blaze: Fast SNARKs fromΒ interleaved RAA codes. In Serge Fehr and Pierre-Alain Fouque, editors, Advances in Cryptology β EUROCRYPT 2025, pages 123β152, Cham, 2025. Springer Nature Switzerland. doi:10.1007/978-3-031-91134-7_5.
- [7] Martijn Brehm and Nicolas Resch. Linear time encodable binary code achieving gv bound with linear time encodable dual achieving gv bound, 2025. doi:10.48550/arXiv.2509.07639.
- [8] Geoffroy Couteau, Peter Rindal, and Srinivasan Raghuraman. Silver: silent vole and oblivious transfer from hardness of decoding structured ldpc codes. In Annual International Cryptology Conference, pages 502β534. Springer, 2021. doi:10.1007/978-3-030-84252-9_17.
- [9] Ronald Cramer, Ivan DamgΓ₯rd, and Ueli Maurer. General secure multi-party computation from any linear secret-sharing scheme. In International Conference on the Theory and Applications of Cryptographic Techniques, pages 316β334. Springer, 2000. doi:10.1007/3-540-45539-6_22.
- [10] Irit Dinur, Siqi Liu, and Rachel Yun Zhang. New codes on high dimensional expanders. In Srikanth Srinivasan, editor, 40th Computational Complexity Conference, CCC 2025, Toronto, Canada, August 5-8, 2025, volume 339 of LIPIcs, pages 27:1β27:42. Schloss Dagstuhl β Leibniz-Zentrum fΓΌr Informatik, 2025. doi:10.4230/LIPIcs.CCC.2025.27.
- [11] Dariush Divsalar, Hui Jin, and Robert J McEliece. Coding theorems for βturbo-likeβ codes. In Proceedings of the annual Allerton Conference on Communication control and Computing, volume 36, pages 201β210. University Of Illinois, 1998.
- [12] Erez Druk and Yuval Ishai. Linear-time encodable codes meeting the Gilbert-Varshamov bound and their cryptographic applications. In Proceedings of the 5th conference on Innovations in theoretical computer science, pages 169β182, 2014. doi:10.1145/2554797.2554815.
- [13] Venkatesan Guruswami and Piotr Indyk. Linear-time encodable/decodable codes with near-optimal rate. IEEE Transactions on Information Theory, 51(10):3393β3400, 2005. doi:10.1109/TIT.2005.855587.
- [14] Venkatesan Guruswami and Widad Machmouchi. Explicit interleavers for a repeat accumulate accumulate (raa) code construction. In 2008 IEEE International Symposium on Information Theory, pages 1968β1972. IEEE, 2008. doi:10.1109/ISIT.2008.4595333.
- [15] Venkatesan Guruswami and Jonathan Mosheiff. Punctured low-bias codes behave like random linear codes. In 2022 IEEE 63rd Annual Symposium on Foundations of Computer Science (FOCS), pages 36β45. IEEE, 2022. doi:10.1109/FOCS54457.2022.00011.
- [16] Yuval Ishai, Eyal Kushilevitz, Rafail Ostrovsky, and Amit Sahai. Cryptography with constant computational overhead. In Proceedings of the fortieth annual ACM symposium on Theory of computing, pages 433β442, 2008. doi:10.1145/1374376.1374438.
- [17] N. Kahale and R. Urbanke. On the minimum distance of parallel and serially concatenated codes. In Proceedings. 1998 IEEE International Symposium on Information Theory (Cat. No.98CH36252), page 31, Cambridge, MA, USA, 1998. IEEE. doi:10.1109/ISIT.1998.708611.
- [18] JΓΆrg Kliewer, Kamil Sh. Zigangirov, Christian Koller, and Daniel J. Costello Jr. Coding theorems for repeat multiple accumulate codes. CoRR, abs/0810.3422(arXiv:0810.3422), October 2008. arXiv:0810.3422.
- [19] Richard E Ladner and Michael J Fischer. Parallel prefix computation. Journal of the ACM (JACM), 27(4):831β838, 1980. doi:10.1145/322217.322232.
- [20] Jonathan Mosheiff, Nicolas Resch, Noga Ron-Zewi, Shashwat Silas, and Mary Wootters. Ldpc codes achieve list decoding capacity. In 2020 IEEE 61st Annual Symposium on Foundations of Computer Science (FOCS), pages 458β469. IEEE, 2020. doi:10.1109/FOCS46700.2020.00050.
- [21] Jonathan Mosheiff, Nicolas Resch, Kuo Shang, and Chen Yuan. Randomness-efficient constructions of capacity-achieving list-decodable codes. CoRR, abs/2402.11533, 2024. doi:10.48550/arXiv.2402.11533.
- [22] H.D. Pfister and P.H. Siegel. The serial concatenation of rate-1 codes through uniform random interleavers. IEEE Transactions on Information Theory, 49(6):1425β1438, 2003. doi:10.1109/TIT.2003.811907.
- [23] Henry David Pfister. On the capacity of finite state channels and the analysis of convolutional accumulate-m codes. PhD thesis, University of California, San Diego, 2003.
- [24] Chiara Ravazzi and Fabio Fagnani. Spectra and Minimum Distances of Repeat MultipleβAccumulate Codes. IEEE Transactions on Information Theory, 55(11):4905β4924, November 2009. doi:10.1109/TIT.2009.2030459.
- [25] Atri Rudra and Mary Wootters. Itβll probably work out: improved list-decoding through random operations. In Proceedings of the 2015 Conference on Innovations in Theoretical Computer Science, pages 287β296, 2015. doi:10.1145/2688073.2688092.
- [26] Adi Shamir. How to share a secret. Communications of the ACM, 22(11):612β613, 1979. doi:10.1145/359168.359176.
- [27] Daniel A Spielman. Linear-time encodable and decodable error-correcting codes. In Proceedings of the twenty-seventh annual ACM symposium on Theory of computing, pages 388β397, 1995. doi:10.1145/225058.225165.
- [28] Andrew Chi-Chih Yao. How to generate and exchange secrets. In 27th annual symposium on foundations of computer science (Sfcs 1986), pages 162β167. IEEE, 1986. doi:10.1109/SFCS.1986.25.
