Abstract
We design a decoding algorithm for linear codes over finite chain rings given by their parity check matrices. It is assumed that decoding algorithms over the residue field are known at each degree of the adic decomposition.
1. Introduction
One of the first applications of linear codes whose underlying alphabet is not a finite field appears in [1], where nonlinear binary codes are built from -linear codes by means of the Gray map. Since then, considerable research efforts have focused on linear codes having a finite ring R as their alphabet. Normally, R is assumed to enjoy suitable properties. For instance, Wood, in [2], states MacWilliams identities for finite Frobenius rings, extending the foundations of coding theory to linear codes over Frobenius rings. In [3] it is proven that finite Frobenius rings are Frobenius algebras over their characteristic subrings, which enriches the duality theory for linear codes over this kind of alphabet.
Feng et al. connect linear codes over finite chain rings to network coding in [4,5] by means of matrix channels. They provide a general description of linear codes over finite chain rings, where the –adic decomposition is made with respect to any set of representatives containing the element zero.
Concerning efficient decoding algorithms, a framework for decoding linear codes over Galois rings is proposed in [6], which generalizes previous works like [7]. This decoding framework assumes that there is a chain of linear codes over the residue field which have efficient decoding algorithms. These codes are defined by their generating matrices.
In this paper we improve the decoding framework of [6] in two ways. In Appendix A we observe that the decoding scheme from [6] works, with slight modifications, over any finite chain ring and for any set of representatives containing 0 in each degree. Anyway, the efficiently decodable codes are still ordered in a chain. In Section 3 we introduce a new framework where the codes are provided by parity check matrices. This viewpoint has an advantage: the codes over the residue field which are associated to each degree in the corresponding -adic decomposition do not need to be ordered in a chain. We gain thus flexibility to build them from codes over fields with good decoding algorithms. In Section 4, Smith normal form of matrices over chain rings are used to compute generating matrices from parity check ones. So a complete coding/decoding scheme is provided. We have also included the Sagemath code of the proposed framework in Appendix B.
2. Preliminaries
Throughout this paper, the word ring means finite commutative ring with identity. A ring is said to be a chain ring if its ideals form a chain under inclusion. Every chain ring is a local ring and, therefore, its elements admit “adic” expansions with respect to the maximal ideal. More precisely, let R be a finite local ring with maximal ideal . Nakayama’s Lemma shows that the powers of form a finite chain with strict inclusions
with for some positive integer called the nilpotency index of R. If R is a chain ring, then all its ideals appear in this chain.
Given , we set
the degree of r. For we consider the canonical projection maps
and we fix maps
such that .
Every is expressed as
for uniquely determined , for . This expression is referred to as the –adic expansion of r. Indeed, if r is written as in (1), then, since whenever , we have
for every . Now, implies , so we deduce
From (1) we also get that and, thus,
Equality (4), in conjunction with the recursive formula (3), shows that the elements are uniquely determined by r.
This idea also shows how to compute, granting in this way the existence of the expression (1), the elements from a given . In fact, is computed according to (4), and the subsequent elements are defined recursively by (3). Observe that
as a consequence of a recursive application of the identities , (4) and (3). Finally, we may see that implies , which, by (3), gives
leading to (1).
When R is a chain ring, its maximal ideal is principal, and we may then choose such that (see e.g., Proposition 2.1 in [8] or §XVII in [9]). It follows that for each .
Taking advantage of the well known fact that is a vector space of dimension 1 over the residue field , we obtain a bijective map
as follows. The multiplication map induces an isomorphism of R–modules
In this way, for each , given such that , we may define the map . Now, since , we get
The maps obey the rule
Summing up the relevant information so far obtained, we state the following proposition.
Proposition 1.
Let denote the residue field of R. Fix a generator m of and splitting maps such that for all . Then, for each , there exist uniquely determined such that
Moreover, if for each , then if and only if .
Proof.
Remark 1.
The coefficients can be computed recursively from (7).
The decomposition (6) depends on and m. We call it the -adic decomposition of r, or m-adic decomposition, when no ambiguity is expected. If and , this decomposition coincides with that of Equation (2) in [4], since gives a choice of residuals modulo m.
Definition 1.
A tuple such that is called a splitting structure for R if, for each , satisfies and ,
Remark 2.
The m–adic expansion (6) is extended to matrices in a straightforward way. Let denote the set of all matrices of size with coefficients in a commutative ring A, which is a free A–module. We may extend any map component-wise to a map . Then, every matrix has an m–adic expansion
for uniquely determined matrices .
Although the splitting maps are not additive neither multiplicative, they obey some relations which will be used. Concretely, let and splittings. Since is a ring morphism, it follows that
and
hence
The structure of the finite chain rings is well known, see (XVII.5) Theorem in [9]. We will not use this description in full generality, so we only recall the rings that appear in our examples.
Example 1.
Recall that a Galois ring is an extension of degree β of , i.e., , where f is a basic monic irreducible polynomial in of degree β. Its maximal ideal is generated by the prime p. The nilpotency index of p is α, and , where is the canonical projection of f to . In particular, is a chain ring. On the other side, is a field, so it is trivially a chain ring.
Example 2.
The ring , where is the field with elements, is also a chain ring. The maximal ideal is generated by x, and it has nilpotency index β. Of course .
In the rest of the paper, is an R–linear code of length n. Vectors are represented by boldface letters, whilst matrices with uppercase letters. We use Latin alphabet to represent elements in R and greek alphabet to represent elements of F. Moreover, given a matrix M over R with n rows, we denote
The same applies to matrices over the residue field F.
Remark 3.
By an abuse of language, for , we say that if for all . The same convention applies to matrices.
3. Decoding via Parity Check
Let us fix a chain ring R with maximal ideal and nilpotency index , i.e., and . We also fix a splitting structure for R. There are two standard ways to present an R–linear code , as the image of a generating matrix G or as the kernel of a parity check matrix H. In the first case, by §IV in [5], we do not lose generality if we assume , where
and, for each , is a matrix whose m-adic decomposition is
with matrices whose entries are in F, and is full rank.
The decoding framework introduced in [6] and expounded in Appendix A uses this presentation of codes as images. It needs a chain of linear codes over the residue field F
with efficient decoding algorithms. There are several ways to get it. For instance, even with classical linear codes, if we want to use BCH (Bose-Chaudhuri-Hocquenghem) codes, we shall use a decreasing chain of defining sets to build the chain of codes. Goppa codes can also be used but taking as the Goppa polynomial of one code in the chain a divisor of the Goppa polynomial of the previous code. Anyway, this is a limitation of the possible codes we can use at each degree.
We are interested in the second presentation, so let be an R-linear code given by a parity check matrix , i.e.,
In this section, we develop a new decoding framework based on syndrome decoding for each degree, i.e., we use the parity check matrices and the syndromes of the received words to decode. This strategy allows one to choose independently the linear codes over the residue field at each degree.
By §II.D in [4], we can replace H by its column reduced canonical form, so we do not lose generality if we assume
for suitable matrices such that the matrices are full rank.
As usual, let , where and is the error vector. The syndrome is
and we denote
Our decoding framework computes from H and by means of an iterative process. Let us introduce notation for the corresponding m-adic expansions:
We have taken into account that . Observe that, for each ,
where we use that and we performed the change of variable . Hence,
for each . The right hand side of (12) needs not to be an m-adic decomposition, so we cannot infer from (12) any equality of the corresponding coefficients of each .
Let us describe the iterative decoding framework.
3.1. First Step: Computing
Proposition 2.
Let be a decoding algorithm for the linear code . If the weight of is below the correction capability of , then .
Proof.
Just observe that is the only one solution of (13) whose weight is below the correction capability of . □
3.2. Second Step: Computing
We include this second step to help the reader to follow the framework. At this step, is known. If we put in (12), we have
Since the vector is assumed to be known, the element
can be computed. Hence, by Proposition 1, there exists such that
which can be computed since all elements appearing in its definition are known. Equations (14) and (15) imply
By (8),
hence
By Proposition 1, it follows that
Proposition 3.
Let be a decoding algorithm for the linear code . If the weight of is below the correction capability of , then .
Proof.
Same proof that Proposition 2, is the only one solution of (16) whose weight is below the correction capability of . □
3.3. General Step: Computing
We assume that have been computed. Proceeding as in the previous cases, Equation (12) for provides
By Proposition 1, there exists such that
The left hand side of the equality in (18) is known because in all summands. So vector can be computed. By (8),
hence
Proposition 4.
Let be a decoding algorithm for the linear code . If the weight of is below the correction capability of , then .
Proof.
As we observed before in Propositions 2 and 3, is the unique solution of (20) whose weight is below the correction capability of . □
The decoding framework is summarized in Algorithm 1.
| Algorithm 1: Syndrome decoding. |
|
Theorem 1.
Let and for each . If there exists such that and the weight of is below the correction capability of for each , then Algorithm 1 correctly computes it.
Proof.
Follows directly from Propositions 2–4. □
Example 3.
In order to explain how this decoding framework works, we are going to develop a step by step example. Let , so . Let , where
The splitting structure is , where
According to this splitting structure, we have
and
| 0 | 1 | a | ||
| 0 | ||||
| 0 | 3 |
Observe that and are the parity check matrices of a Hamming code of length 5 and dimension 3, which corrects one single error. It can be checked that
Although the error vector
has Hamming weight 2, its -adic decomposition is
so our framework should be able to decode the received word
The syndrome of the received word is
whose -decompositions are
Algorithm 1 can now be applied. In the first round, , we have , which is a times the fourth row of . So .
In the second round, , we need to compute the -adic decomposition of
which is
So, , the first row of multiplied by . Therefore, . It follows
as expected.
Unlike the former case, if we make use of a different splitting structure to decode, the framework could not work. For instance, consider the splitting structure , where
The -decomposition of the error vector is
which provides a vector of Hamming weight 2 in degree 1, so Algorithm 1 does not apply.
| 0 | 1 | a | ||
| 0 | ||||
| 0 |
Remark 4.
Our parity check decoding framework could be used to design a McEliece like cryptosystem following the proposal in [10]. However, by Remark 2, given H as in (9), the matrices do not depend on the splitting structure, so an eavesdropper could use any structure to compute the parity check matrices of the linear codes over F. Therefore, the security of this possible cryptosystem would be equivalent to ν consecutive linear codes over the residue field F.
Remark 5.
The time complexity of Algorithm 1 is bounded by the theoretical efficiency of the chosen decoding algorithms (Line 4), and the intermediate calculations are described in Lines 1 and 3. Indeed, with respect to the number of elementary operations (additions, multiplications, and map images) over the residue field, let us assume that belongs to for with respect to the length of the code. Moreover, for simplicity, assume that for all i.
According to (7), an m-adic expansion can be computed by operations, so that Line 1 belongs to . Now, the calculation of δ in Line 4 is obtained by solving a linear system over the residue field F. This can be computed by Gaussian elimination, which can be done in , where ω is the matrix multiplication exponent and t is the dimension of the matrix. We may consider the classical algorithm and set , so that Line 3 in each iteration of the loop belongs to , where n is the length of the code. Thus Algorithm 1 can be executed in . In general, since , we may say that the complexity belongs to .
4. Parity Check and Encoders
There are known interesting applications of linear codes over finite chain rings as those mentioned in [4,5]. So, even though the decoding framework is based on the syndrome decoding by means of parity check matrices, it is needed to provide an encoding process. So we need to build a generating matrix from the parity check matrix H which defines our code. This task may be performed by using the Smith normal form. Recall that a matrix M over an arbitrary ring has a Smith normal form if there exist invertible and matrices and a diagonal (non necessarily square) matrix D, where are the elements in the main diagonal, such that and .
Any matrix over a commutative principal ideal ring has a Smith normal form (Chapter 15 in [11]). In the particular case of a chain ring, Algorithm 2 gives a way to compute this normal form which simplifies the general procedure in [11].
We may assume , otherwise we can compute it for its transpose , and if we have .
| Algorithm 2: Smith normal form for finite chain rings. |
|
Remark 6.
Observe that, once a generator m has been fixed for the maximal ideal of R, it is easy to check that if and only if where , the set of units of R. Therefore, and are equivalent conditions on r. Since implies , we get
Since for all , once is an element of lowest degree, any operation involving sums and products cannot decrease the degree, so, by (21), we can compute in lines 6, 16 and 20, and all entries of have degree greater or equal than the degree of . Since S and T are built to obtain
it follows
so the output of Algorithm 2 is correct.
Once the Smith normal form of the parity check matrix has been found, we may compute a generating matrix. Indeed, assume and let matrices such that D is a Smith normal form for H and . Since Q is invertible, it follows that if and only if . Moreover, if and only if , so, if we get . Now, recall D is diagonal with which, by (21), is equivalent to say that It follows that E can be taken as an diagonal matrix whose diagonal elements are . We may summarize these ideas in Algorithm 3.
| Algorithm 3: Generating matrix computation from a parity check matrix. |
|
Author Contributions
All authors equally contributed to every aspect of this work. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by AEI (https://doi.org/10.13039/501100011033 (accessed on 6 August 2021)), grant number PID2019-110525GB-I00.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Not applicable.
Conflicts of Interest
The authors declare no conflict of interest.
Appendix A. Decoding via Encoders
In this appendix we show that the decoding framework for linear codes over Galois rings presented in [6] is still valid for the broader class of chain rings. In addition, we amend a subtle gap in [6].
A splitting structure is fixed for a chain ring R with maximal ideal and nilpotency index . As we pointed out in Section 3, we may assume , where
and, for each , is a matrix whose m-adic decomposition is
with matrices whose entries are in F, and is full rank.
Information is presented as vectors
where the m-adic expansion of is
with . Observe that The reason for this restriction is that terms of higher degree are annihilated in the encoding process. Indeed, let . Then
This is not necessarily the m-adic decomposition of , since we do not know if the coefficients of each belong to . Actually, this is the inaccuracy in Equation (11) in [6]. However, we may fix this issue, since the knowledge of , for and , allows one to recover the codeword.
We use (A2) to describe the decoding framework. We start by computing and . Let . By (A2) with ,
By (8),
These last two equations imply that
i.e.,
Observe that is a codeword in and is a received word with error . If we can decode , then we can compute and . It follows from (8) that
For the general recursive step, assume that for and for are known. Let us describe how to compute and . Equation (A2) implies
Rearranging its summads we get
Equation (8) implies
Appendix B. SageMath Code
Here we provide the SageMath [12] code we have implemented to check our algorithms and to produce examples. We have tested our implementation on the Galois rings (see Example 1). As far as we have checked, code inside the boxes can be cut and pasted from a PDF file opened with Adobe Acrobat Reader in a Sagemath notebook running under Jupyter. The character ␣ represents a white space. Although the code inside the boxes is uglier using this character, it is needed to obtain the correct indentation when pasting the code into Jupyter.
- p,nu,r␣=␣2,3,2
- #p,nu,r␣=␣2,5,1
- #p,nu,r␣=␣3,3,1
- if␣r␣==␣1:
- ␣␣␣␣F␣=␣GF(p)
- ␣␣␣␣R␣=␣IntegerModRing(p^nu)
- else:
- ␣␣␣␣F.<a>␣=␣GF(p^r)
- ␣␣␣␣R.<a>␣=␣IntegerModRing(p^nu).extension(F.modulus())
The splitting structure is introduced as a list of lists, each one having the images of the elements of the residue field F. The last element is a generator for the maximal ideal.
- #␣p,nu,r␣=␣2,3,2
- splitting_structure␣=␣[[R(0),R(5*a+4),R(3*a+7),R(4*a+3)],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(3*a+6),R(1*a+5),R(2*a+7)],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(5*a+6),R(5*a+1),R(6*a+1)]]␣+␣[p]
- #␣p,nu,r␣=␣2,5,1
- #splitting_structure␣=␣[[R(0),R(7)],
- #␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(5)],
- #␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(3)],
- #␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(1)],
- #␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(3)]]␣+␣[p]
- #␣p,nu,r␣=␣3,3,1
- #splitting_structure␣=␣[[R(0),R(7),R(8)],
- #␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(25),R(17)],
- #␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣[R(0),R(19),R(11)]]␣+␣[p]
- mm␣=␣splitting_structure[nu]
The canonical projection , splitting maps, m-adic expansion, and its inverse are defined as follows.
- def␣proj(rr):
- ␣␣␣␣if␣r␣==␣1:
- ␣␣␣␣␣␣␣␣return(F(rr))
- ␣␣␣␣else:
- ␣␣␣␣␣␣␣␣return␣F(rr.list())
- def␣splitting(ff,splitting_list␣=␣[R(ele)␣for␣ele␣in␣F.list()]):
- ␣␣␣␣if␣ff.parent()␣==␣F:
- ␣␣␣␣␣␣␣␣if␣(len(splitting_list)␣!=
- ␣␣␣␣␣␣␣␣␣␣␣␣F.cardinality())␣or␣([proj(r_)
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣r_␣in␣splitting_list]␣!=
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣F.list()):
- ␣␣␣␣␣␣␣␣␣␣␣␣return␣’Incorrect␣splitting’
- ␣␣␣␣␣␣␣␣return␣splitting_list[F.list().index(ff)]
- ␣␣␣␣elif␣isinstance(ff,sage.modules.free_module_element.FreeModuleElement):
- ␣␣␣␣␣␣␣␣ff_␣=␣ff.list()
- ␣␣␣␣␣␣␣␣aux␣=␣[splitting(ele,␣splitting_list)␣for␣ele␣in␣ff_]
- ␣␣␣␣␣␣␣␣output␣=␣vector(R,aux)
- ␣␣␣␣␣␣␣␣return␣output
- ␣␣␣␣elif␣isinstance(ff,sage.matrix.matrix0.Matrix):
- ␣␣␣␣␣␣␣␣n_rows␣=␣ff.nrows()
- ␣␣␣␣␣␣␣␣ff_␣=␣ff.list()
- ␣␣␣␣␣␣␣␣aux␣=␣[splitting(ele,␣splitting_list)␣for␣ele␣in␣ff_]
- ␣␣␣␣␣␣␣␣output␣=␣matrix(R,n_rows,aux)
- ␣␣␣␣␣␣␣␣return␣output
- ␣␣␣␣else:
- ␣␣␣␣␣␣␣␣return␣’Type␣non␣supported’
- def␣m_adic(rr,splitting_structure):
- ␣␣␣␣mm_␣=␣splitting_structure[nu]
- ␣␣␣␣if␣rr.parent()␣==␣R:
- ␣␣␣␣␣␣␣␣rr_␣=␣rr
- ␣␣␣␣␣␣␣␣output␣=␣[]
- ␣␣␣␣␣␣␣␣for␣ii␣in␣range(nu):
- ␣␣␣␣␣␣␣␣␣␣␣␣if␣r␣==␣1:
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣output␣+=␣[proj(R(ZZ(rr_)//mm^ii))]
- ␣␣␣␣␣␣␣␣␣␣␣␣else:
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣output␣+=␣[proj(R([ZZ(ele)//mm_^ii
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ele␣in␣(rr_).list()]))]
- ␣␣␣␣␣␣␣␣␣␣␣␣rr_␣=␣rr_␣-␣mm_^ii*splitting(output[-1],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[ii])
- ␣␣␣␣␣␣␣␣return␣output
- ␣␣␣␣elif␣isinstance(rr,
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣sage.modules.free_module_element.FreeModuleElement):
- ␣␣␣␣␣␣␣␣rr_␣=␣rr.list()
- ␣␣␣␣␣␣␣␣aux␣=␣[m_adic(ele,␣splitting_structure)␣for␣ele␣in␣rr_]
- ␣␣␣␣␣␣␣␣output␣=␣[vector(F,[aux[jj][ii]
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣jj␣in␣range(len(rr_))])
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ii␣in␣range(nu)]
- ␣␣␣␣␣␣␣␣return␣output
- ␣␣␣␣elif␣isinstance(rr,
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣sage.matrix.matrix0.Matrix):
- ␣␣␣␣␣␣␣␣n_rows␣=␣rr.nrows()
- ␣␣␣␣␣␣␣␣rr_␣=␣rr.list()
- ␣␣␣␣␣␣␣␣aux␣=␣[m_adic(ele,␣splitting_structure)␣for␣ele␣in␣rr_]
- ␣␣␣␣␣␣␣␣output␣=␣[matrix(F,n_rows,[aux[jj][ii]
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣jj␣in␣range(len(rr_))])
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ii␣in␣range(nu)]
- ␣␣␣␣␣␣␣␣return␣output
- ␣␣␣␣else:
- ␣␣␣␣␣␣␣␣return␣’Type␣non␣supported’
- def␣inv_m_adic(rr,splitting_structure):
- ␣␣␣␣mm_␣=␣splitting_structure[nu]
- ␣␣␣␣return␣sum(splitting(rr[ii],splitting_structure[ii])*mm_^ii
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ii␣in␣range(nu))
In our experiments we have used Goppa codes as efficiently decodable codes over the residue field. The current implementation of Goppa codes in [12] works only for prime fields. Since some of our tests need Goppa codes over , we have implemented their construction and decoding by means of the Sugiyama algorithm.
- from␣sage.rings.finite_rings.hom_finite_field␣import␣FiniteFieldHomomorphism_generic
- def␣GoppaCodeConstructor(n_,t_,F_):
- ␣␣␣␣m_␣=␣ceil(n_.log(F_.cardinality()))
- ␣␣␣␣k_␣=␣n␣-␣2*m_*t_
- ␣␣␣␣L_␣=␣GF(F_.cardinality()^m_)
- ␣␣␣␣embFL_␣=␣FiniteFieldHomomorphism_generic(Hom(F_,L_))
- ␣␣␣␣secLF_␣=␣embFL_.section()
- ␣␣␣␣V_,␣from_V_,␣to_V_␣=␣L_.vector_space(embFL_,␣map=True)
- ␣␣␣␣R_.<x>␣=␣PolynomialRing(L_)
- ␣␣␣␣tg␣=␣cputime()
- ␣␣␣␣print(’Starting␣generation’)
- ␣␣␣␣tt␣=␣cputime()
- ␣␣␣␣g_␣=␣R_(x^(2*t_))␣+␣R_.random_element(2*t_-1)
- ␣␣␣␣while␣not(g_.is_irreducible()):
- ␣␣␣␣␣␣␣␣g_␣=␣R_(x^(2*t_))␣+␣R_.random_element(2*t_-1)
- ␣␣␣␣print(’Goppa␣polynomial’,cputime(tt))
- ␣␣␣␣#␣Goppa␣points
- ␣␣␣␣tt␣=␣cputime()
- ␣␣␣␣pts_␣=␣[]
- ␣␣␣␣aux␣=␣L_.list()
- ␣␣␣␣for␣ii␣in␣range(n_):
- ␣␣␣␣␣␣␣␣ind␣=␣ZZ.random_element(len(aux))
- ␣␣␣␣␣␣␣␣pts_␣+=␣[aux[ind]]
- ␣␣␣␣␣␣␣␣aux.remove(aux[ind])
- ␣␣␣␣print(’Points’,cputime(tt))
- ␣␣␣␣tt␣=␣cputime()
- ␣␣␣␣Htilde␣=␣matrix.vandermonde(pts_).transpose()[0:2*t_]
- ␣␣␣␣Htilde␣*=␣diagonal_matrix([g_(ele)^(-1)␣for␣ele␣in␣pts_])
- ␣␣␣␣print(cputime(tt))
- ␣␣␣␣tt␣=␣cputime()
- ␣␣␣␣aux␣=␣[]
- ␣␣␣␣for␣cc␣in␣range(Htilde.nrows()):
- ␣␣␣␣␣␣␣␣aux2␣=␣Htilde[cc]
- ␣␣␣␣␣␣␣␣aux3␣=␣[]
- ␣␣␣␣␣␣␣␣for␣ele␣in␣aux2:
- ␣␣␣␣␣␣␣␣␣␣␣␣aux3␣+=␣[to_V_(ele).list()]
- ␣␣␣␣␣␣␣␣aux␣+=␣(matrix(aux3).transpose()).list()
- ␣␣␣␣Hhat␣=␣matrix(F_,len(aux)/n_,aux).rref()
- ␣␣␣␣Paux␣=␣random_matrix(F,n_-k_)
- ␣␣␣␣while␣Paux.is_singular()␣==␣True:
- ␣␣␣␣␣␣␣␣Paux␣=␣random_matrix(F,n_-k_)
- ␣␣␣␣H_␣=␣Hhat.transpose()*Paux
- ␣␣␣␣print(’Parity␣check␣matrix’,␣cputime(tt))
- ␣␣␣␣print(’Generation␣success’,␣cputime(tg))
- ␣␣␣␣return␣H_,[L_,␣g_,␣pts_,␣embFL_,␣secLF_]
- def␣GoppaCodeDecoder(received_,GoppaDecodingData_):
- ␣␣␣␣L_␣=␣GoppaDecodingData_[0]
- ␣␣␣␣g_␣=␣GoppaDecodingData_[1]
- ␣␣␣␣pts_␣=␣GoppaDecodingData_[2]
- ␣␣␣␣t_␣=␣floor(g_.degree()/2)
- ␣␣␣␣R_.<x>␣=␣PolynomialRing(L_)
- ␣␣␣␣synd_poly␣=␣sum(received_[ii]*R_(x␣-␣pts_[ii]).inverse_mod(g_)
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ii␣in␣range(len(received_)))
- ␣␣␣␣remainders␣=␣[g_,synd_poly]
- ␣␣␣␣coefs␣=␣[R_(0),R_(1)]
- ␣␣␣␣while␣remainders[-1].degree()␣>=␣t_:
- ␣␣␣␣␣␣␣␣cociente,resto␣=␣remainders[-2].quo_rem(remainders[-1])
- ␣␣␣␣␣␣␣␣remainders␣+=␣[resto]
- ␣␣␣␣␣␣␣␣coefs␣+=␣[coefs[-2]␣-␣coefs[-1]*cociente]
- ␣␣␣␣locator␣=␣coefs[-1]
- ␣␣␣␣evaluator␣=␣remainders[-1]
- ␣␣␣␣error_␣=␣[]
- ␣␣␣␣for␣ii␣in␣range(len(pts_)):
- ␣␣␣␣␣␣␣␣root_␣=␣pts_[ii]
- ␣␣␣␣␣␣␣␣if␣locator(root_)␣==␣0:
- ␣␣␣␣␣␣␣␣␣␣␣␣error_␣+=␣[evaluator(root_)/locator.derivative()(root_)]
- ␣␣␣␣␣␣␣␣else:
- ␣␣␣␣␣␣␣␣␣␣␣␣error_␣+=␣[L_(0)]
- ␣␣␣␣return␣vector(error_)
The parity check matrix H, as described in (9), is built as follows.
- length,␣correction_capability␣=␣60,␣3
- #length,␣correction_capability␣=␣256,␣7
- #length,␣correction_capability␣=␣20,␣2
- n,t␣=␣length,␣correction_capability
- Decoding_info␣=␣[]
- blocks␣=␣[]
- for␣ii␣in␣range(nu):
- ␣␣␣␣parity_check,decoding_data␣=␣GoppaCodeConstructor(n,t,F)
- ␣␣␣␣blocks␣+=␣[mm^ii*splitting(parity_check,
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[ii])
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣+␣sum(mm^jj*splitting(random_matrix(F,
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣parity_check.nrows(),
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣parity_check.ncols()),
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[jj])
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣jj␣in␣range(ii+1,nu))]
- ␣␣␣␣Decoding_info␣+=␣[decoding_data]
- H␣=␣block_matrix(1,blocks)
The error vector is built taking random words of bounded Hamming weight at each degree. We assume the codeword is the zero word.
- error␣=␣zero_vector(R,n)
- for␣ll␣in␣range(nu):
- ␣␣␣␣xi␣=␣zero_vector(F,n)
- ␣␣␣␣while␣xi.hamming_weight()␣<␣t:
- ␣␣␣␣␣␣␣␣xi␣=␣xi.list()
- ␣␣␣␣␣␣␣␣jj␣=␣floor(n*random())
- ␣␣␣␣␣␣␣␣xi[jj]␣=␣F.random_element()
- ␣␣␣␣␣␣␣␣xi␣=␣vector(xi)
- ␣␣␣␣error␣+=␣splitting(xi,
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[ll])*mm^ll
- received␣=␣error
- error,␣error.hamming_weight()
The decoding algorithm (Algorithm 1) is the last piece of code.
- syndrome␣=␣[received*H.subdivision(0,ii)␣for␣ii␣in␣range(nu)]
- sigma␣=␣[m_adic(ele,splitting_structure)␣for␣ele␣in␣syndrome]
- Theta␣=␣[m_adic(H.subdivision(0,ii),
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure)␣for␣ii␣in␣range(nu)]
- xi␣=␣[]
- for␣ii␣in␣range(nu):
- ␣␣␣␣delta␣=␣m_adic(
- ␣␣␣␣␣␣␣␣sum(splitting(sigma[nu-1-ii][jj],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[jj])*mm^jj
- ␣␣␣␣␣␣␣␣␣␣␣␣for␣jj␣in␣range(nu-1-ii,nu))
- ␣␣␣␣␣␣␣␣-␣sum(sum(splitting(xi[ll],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[ll])*
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting(Theta[nu-1-ii][jj-ll],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[jj-ll])*mm^jj
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ll␣in␣range(jj-nu+ii+2))
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣jj␣in␣range(nu-1-ii,nu-1))
- ␣␣␣␣␣␣␣␣-␣sum(splitting(xi[ll],␣splitting_structure[ll])*
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting(Theta[nu-1-ii][nu-1-ll],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣splitting_structure[nu-1-ll])*mm^(nu-1)
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ll␣in␣range(ii)),␣splitting_structure)[nu-1]
- ␣␣␣␣rec_aux␣=␣Theta[nu-1-ii][nu-1-ii].solve_left(delta)
- ␣␣␣␣error_L␣=␣GoppaCodeDecoder([Decoding_info[nu-1-ii][3](ele)
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ele␣in␣rec_aux],
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣Decoding_info[nu-1-ii])
- ␣␣␣␣xi␣+=␣[vector([Decoding_info[nu-1-ii][4](ele)
- ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣for␣ele␣in␣error_L.list()])]
- computed_error␣=␣inv_m_adic(xi,␣splitting_structure)
References
- Hammons, A.R.; Kumar, P.V.; Calderbank, A.R.; Sloane, N.J.; Sole, P. The ℤ4-linearity of kerdock, preparata, goethals, and related codes. IEEE Trans. Inf. Theory 1994, 40, 301–319. [Google Scholar] [CrossRef]
- Wood, J.A. Duality for modules over finite rings and applications to coding theory. Am. J. Math. 1999, 121, 555–575. [Google Scholar] [CrossRef]
- Gómez-Torrecillas, J.; Hieta-Aho, E.; Lobillo, F.J.; López-Permouth, S.; Navarro, G. Some remarks on non projective Frobenius algebras and linear codes. Des. Codes Cryptogr. 2020, 88, 1–15. [Google Scholar] [CrossRef]
- Feng, C.; Nóbrega, R.W.; Kschischang, F.R.; Silva, D. Communication over finite-ring matrix channels. In Proceedings of the 2013 IEEE International Symposium on Information Theory, Istanbul, Turkey, 7–12 July 2013; pp. 2890–2894. [Google Scholar]
- Feng, C.; Nóbrega, R.W.; Kschischang, F.R.; Silva, D. Communication over finite-chain-ring matrix channels. IEEE Trans. Inf. Theory 2014, 60, 5899–5917. [Google Scholar] [CrossRef][Green Version]
- Babu, N.S.; Zimmermann, K.-H. Decoding of linear codes over Galois rings. IEEE Trans. Inf. Theory 2001, 47, 1599–1603. [Google Scholar] [CrossRef]
- Greferath, M.; Vellbinger, U. Efficient decoding of ℤpk-linear codes. IEEE Trans. Inf. Theory 1998, 44, 1288–1291. [Google Scholar] [CrossRef]
- Dinh, H.Q.; Lopez-Permouth, S.R. Cyclic and negacyclic codes over finite chain rings. IEEE Trans. Inf. Theory 2004, 50, 1728–1744. [Google Scholar] [CrossRef]
- McDonald, B.R. Finite Rings with Identity; Marcel Dekker: New York, NY, USA, 1974. [Google Scholar]
- Albrecht, M.R.; Bernstein, D.J.; Chou, T.; Cid, C.; Gilcher, J.; Lange, T.; Maram, V.; von Maurich, I.; Misoczki, R.; Niederhagen, R.; et al. Classic McEliece: Conservative Code-Based Cryptography; Technical Report; NIST’s Post-Quantum Cryptography Standardization Project: Gaithersburg, MD, USA, 2020. [Google Scholar]
- Brown, W.C. Matrices over Commutative Rings; Number 169 in Monographs and Textbooks in Pure and Applied Mathematics; Marcel Dekker, Inc.: New York, NY, USA, 1993. [Google Scholar]
- The Sage Developers. SageMath, the Sage Mathematics Software System (Version 9.1). 2020. Available online: https://www.sagemath.org (accessed on 6 August 2021).
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).