A new hybrid method combining search and direct based construction ideas to generate all 4 × 4 involutory maximum distance separable (MDS) matrices over binary field extensions
- Published
- Accepted
- Received
- Academic Editor
- Vimal Shanmuganathan
- Subject Areas
- Cryptography, Security and Privacy
- Keywords
- MDS matrices, Involutory matrices, Diffusion layer, A new hybrid method, Lightweight Cryptography
- Copyright
- © 2023 Tuncay et al.
- Licence
- This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, reproduction and adaptation in any medium and for any purpose provided that it is properly attributed. For attribution, the original author(s), title, publication source (PeerJ Computer Science) and either DOI or URL of the article must be cited.
- Cite this article
- 2023. A new hybrid method combining search and direct based construction ideas to generate all 4 × 4 involutory maximum distance separable (MDS) matrices over binary field extensions. PeerJ Computer Science 9:e1577 https://doi.org/10.7717/peerj-cs.1577
Abstract
This article presents a new hybrid method (combining search based methods and direct construction methods) to generate all involutory maximum distance separable (MDS) matrices over . The proposed method reduces the search space complexity at the level of , where n represents the number of all invertible matrices over to be searched for. Hence, this enables us to generate all involutory MDS matrices over and . After applying global optimization technique that supports higher Exclusive-OR (XOR) gates (e.g., XOR3, XOR4) to the generated matrices, to the best of our knowledge, we generate the lightest involutory/non-involutory MDS matrices known over , and in terms of XOR count. In this context, we present new involutory MDS matrices over , and , which can be implemented by 13 XOR operations with depth 5, 25 XOR operations with depth 5 and 42 XOR operations with depth 4, respectively. Finally, we denote a new property of Hadamard matrix, i.e., (involutory and MDS) Hadamard matrix form is, in fact, a representative matrix form that can be used to generate a small subset of all involutory MDS matrices, where k > 1. For k = 1, Hadamard matrix form can be used to generate all involutory MDS matrices.
Introduction
Two important properties used in the design of block ciphers and defined by Shannon (1949) are confusion and diffusion. These properties are respectively satisfied by substitution boxes (or shortly S-boxes) and linear transformations in a round function of a block cipher. Maximum distance separable (MDS) matrices are derived from MDS codes and provide the maximum diffusion. They are used as the core component of diffusion layers/linear transformations in the design of cryptographic primitives like block ciphers and hash functions. MDS matrices have the maximum branch number, which is an important cryptographic criterion used for defining diffusion rate. Branch number also helps to measure security against some well-known attacks like differential (Biham & Shamir, 1991) and linear cryptanalysis (Matsui, 1994). Block ciphers (or a cryptographic primitive) generally use MDS matrices over , and in their diffusion layers according to the design strategies and considering implementation issues of a block cipher. Also, using involutory MDS matrices in the design of a diffusion layer of a block cipher has the advantage of reusing the same circuit in the decryption process and helps to implement a block cipher at close encryption and decryption costs. In this context, we present our experimental results by considering the finite fields , and . Note that our construction technique can easily be used for designing new involutory MDS matrices over finite field especially for .
Generally, the construction techniques of MDS matrices can be categorized into three groups: direct construction methods, search based methods, and hybrid methods (combining search based methods and direct construction methods). The direct construction methods include the methods such as Cauchy matrices (Youssef, Mister & Tavares, 1997; Cui, Jin & Kong, 2015), Vandermonde matrices (Sajadieh et al., 2012b) and Companion matrices (Gupta & Ray, 2013). It should also be noted that Cauchy and Vandermonde matrices are generally not efficient for low-cost implementations (Gupta et al., 2019). Recently, unlike the other direct construction methods, a new direct construction method (or a new matrix form) to generate all involutory MDS matrices has been given in Güzel et al. (2019). On the other hand, search based methods to find MDS matrices are based on using hybrid structures (Sim et al., 2015), recursive structures (Sajadieh et al., 2012a, 2012b), and searching some special matrix forms like circulant and Hadamard matrix forms, which have some advantages in the implementation phase and have a higher probability of finding MDS matrix when compared to a randomized square matrix. Moreover, the other special matrix forms used to find (lightweight) MDS matrices are as follows: circulant-like (Gupta & Ray, 2015), Toeplitz, Toeplitz-like, and Hankel matrices (Gupta et al., 2019). The search based construction methods are useful for finding MDS matrices with small orders. But, finding MDS matrices with higher orders is exactly an NP-complete problem (computation cost for checking a matrix to be MDS is still too expensive) (Sim et al., 2015). To handle this problem, the Generalized Hadamard (shortly GHadamard) matrix form, a hybrid construction method, was proposed in Pehlivanoğlu et al. (2018). Overall, in Sakallı et al. (2020), the authors proposed a complementary method for the current construction methods in the literature, which generates isomorphic MDS matrices (new MDS matrices from the implementation point of view) from any existing MDS matrix (due to its ground field structure). All these methods can be evaluated within the local optimization category that focuses on the coefficients of a given matrix. In recent years, global optimization techniques have been proposed to construct smaller diffusion layer circuits for involutory/non-involutory MDS matrices. This challenging problem is also known as the problem of finding the shortest linear straight-line program (SLP) and optimizing circuits globally. In this context, two main global optimization techniques can be given as cancellation-free programs (e.g., Paar’s algorithms (Paar, 1997) and heuristic techniques (e.g., Boyar-Peralta (BP) algorithm (Boyar & Peralta, 2010; Boyar, Matthews & Peralta, 2012) RNBP, A1, A2 (Tan & Peyrin, 2019). All these heuristics support 2-input XOR gates (XOR2) only, but in Baksi et al. (2021) the authors by inspiring the idea given in Banik, Funabiki & Isobe (2019) proposed a new version of the original BP heuristic, called BDKCI, that supports higher input XOR gates such as 3-input XOR (XOR3) and 4-input XOR (XOR4) gates. Utilizing higher input XOR gates can result in a lower cost in specific ASIC libraries, so in this article, we use BDKCI heuristic for finding the efficient implementation of a given matrix. Moreover, we consider not only gate count (GC) and circuit depth but also gate equivalent (GE) metric for lightweight implementations. BDKCI heuristic directly calculates the total GEs for each ASIC library (STM 90 nm (ASIC1), STM 65nm (ASIC2), TSMC 65 nm (ASIC3), and STM 130 nm (ASIC4)), more technical details can be found in Baksi et al. (2021).
To the best of our knowledge, there is no known method in the literature to represent/generate all involutory MDS matrices over . In this study, we present a new hybrid method to generate all involutory MDS matrices over . We consider the problem of finding lightweight involutory/non-involutory MDS matrices with low implementation costs. In this context, we generate all involutory MDS matrices over and and evaluate these matrices up to a threshold value with respect to naive XOR count (d-XOR) (Khoo et al., 2014; Jean et al., 2017), and then we look for the lightest hardware circuits known for involutory MDS matrices in terms of XOR counts and circuit depths by using BDKCI algorithm. Note that when obtaining the lightest non-involutory MDS matrix over , we take the benefit of the elements of the lightest involutory MDS matrix over generated.
In this article, we propose a new hybrid method to generate all involutory MDS matrices over . The proposed hybrid method consists of two parts: the first part includes searching for all representative involutory MDS matrices and the second part includes generating all involutory MDS matrices using all representative involutory MDS matrices found by search in the first part of the proposed method. Hence, we present the number of all involutory MDS matrices over and . In addition, we give the lightest known involutory/non-involutory MDS matrices over , and obtained by using the global optimization algorithm BDKCI, which is an improved version of BP algorithm.
Motivation and our contribution
The demand for low-cost security design targeting resource-constrained devices has triggered the exploration of lightweight diffusion layers (diffusion layers with low implementation costs). In particular, the circuit area is a crucial criterion for lightweight cryptography in terms of hardware. This means that reducing the cost of hardware implementation is to minimize the number of expensive logical gates (especially XOR operations) and the depth of the circuit (for low latency), which is the number of gates on the longest circuit path. However, it is not an easy task to construct lightweight MDS matrices, especially involutory ones. Involutory MDS matrices use the same circuit and have the same implementation costs in the encryption and decryption phases. Therefore, the designers have considered the problem of building optimal or close to optimal linear circuits for involutory/non-involutory MDS matrices.
Previous studies mainly focused on the problem of constructing a lightweight MDS matrix from two perspectives: building a locally optimized implementation of an MDS matrix consisting of the coefficients that are easy to evaluate or finding the globally optimized implementation of a given MDS matrix. However, while searching lightweight MDS matrices, most studies use some heuristic searching methods that cannot find all MDS matrices especially involutory ones in a specific finite field (except for the matrix form given in Güzel et al. (2019) used for generating all involutory MDS matrices). In this article, for the first time in the literature, we focus on a hybrid method generating all involutory MDS matrices over with the lightest known implementation costs because many block ciphers use and (in the form of ) MDS matrices. For example, the Advanced Encryption Standard (AES) (Daemen & Rijmen, 2002) uses a MDS matrix as the main part of its diffusion layer. Moreover, (lightweight) block ciphers to be designed in the future may likely use involutory/non-involutory MDS matrices over with nice hardware implementation costs. In this article, we combine local optimization (new hybrid construction method) and global optimization (BDKCI algorithm) techniques. The main contributions of this article can be given as follows:
A new hybrid construction method to generate all involutory MDS matrices over is proposed. The proposed method reduces the search space complexity (the search space defining the total number of all invertible matrices over ) at the level of , where represents the number of all invertible matrices to be searched for.
It is shown that the number of all involutory MDS matrices over can be calculated by the formula , where #RIM represents the number of all representative involutory MDS matrices. Hence, there are, respectively, 16,464 ( ) and 242,514,000 ( ) involutory and MDS matrices over and .
The new lightest involutory/non-involutory MDS matrices over , and achieved by the proposed hybrid construction method are presented:
-
–
A new involutory MDS matrix over which can be implemented by only 25 XOR operations with depth 5 is presented, whereas the previously known lightest one (Sarkar & Syed, 2016) requires 26 XOR operations to be implemented with the same depth using XOR2 and XOR3 gates (please see the matrix ).
-
–
A new involutory MDS matrix over is presented, which can be implemented by only 13 XOR operations with depth 5 using XOR3 and XOR4 gates (please see the matrix ).
-
–
A new non-involutory MDS matrix over which can be implemented by only 19 XOR operations with depth 3 is presented, whereas previously known lightest one (Sarkar & Syed, 2016) costs 20 XOR operations the same depth using XOR2, XOR3 and XOR4 gates (please see the matrix ).
-
–
A new involutory MDS matrix over can be implemented by only 52 XOR operations with depth 5 using XOR2 and XOR3 gates. Moreover, the same matrix requires only 42 XOR operations with depth 4 using XOR2, XOR3, and XOR4 gates (please see the matrix ). While compare to the previous best-known implementations of linear layers of some block ciphers, it improves the results in GCs and GEs.
-
These findings clearly establish that the circuit implementations of matrices , , and over the specified fields are superior to those given in previous studies. This aspect also underscores one of the key novelties in our article.
A new property of Hadamard matrix is denoted, i.e., (involutory and MDS) Hadamard matrix form is, in fact, a representative matrix form that can be used to generate a small amount of all involutory MDS matrices, where . For , Hadamard matrix form can be used to generate all involutory MDS matrices. For Hadamard matrices, we present the matrix form (which has the generic properties of Hadamard matrix, i.e., XOR sum of the elements in any row or column of a Hadamard matrix is equal to 1 and XOR sum of the elements in the main diagonal is equal to 0) given in “Proposed Method” section for finding all representative involutory MDS matrices by search. The matrix form can also be adaptable to Hadamard matrices for . Hence, one can generate new representative involutory MDS matrices over any finite field by using the matrix form or adapted versions of for Hadamard matrices for , which may help us find new involutory MDS matrices (also, with the help of parameters given in Theorem 1) with better implementation properties.
All the optimization results of matrices are available at https://github.com/mkurtpehlivanoglu/Hybrid_Method.
Organization
This article is organized as follows: We give some notations, properties of MDS matrices, and two metrics used for identifying lightweightness of an MDS matrix in the “Preliminaries” section. In the “Proposed Method” section, we propose a new hybrid method to generate all matrices over . Experimental results on the number of all involutory MDS matrices and some examples for involutory MDS matrices over , and with the lowest XOR counts are presented in “Experimental Results” section. Finally, we conclude the article in the “Conclusion” section.
Preliminaries
In this section, we describe the mathematical background needed throughout the article. In this context, some notations and definitions are presented.
The finite field consisting of elements is defined by an irreducible polynomial of degree over and is denoted by . The elements of the finite field can be represented as polynomials over , i.e., , where and is a root (and a primitive element) of . For simplicity, we denote defined by irreducible polynomial as (the finite field with elements) and use hexadecimal notation to represent the elements of and the irreducible polynomial used for defining . As an example, the four-bit string 1110 which can also be represented by 0xe in hexadecimal notation corresponds to the polynomial in . In the same manner, 0x13 used when denoting stands for the irreducible polynomial .
If an code C reaches the Singleton bound , then C is called an MDS code (where , , and represent the length and the number of rows of the generating matrix of the code C, respectively). Moreover, generator matrices that produce MDS codes are called MDS matrices. MDS matrices derived from MDS codes provide the maximum diffusion in a block cipher and have the maximum differential and linear branch number ( for for MDS matrices), which are two important cryptographic criteria for linear transformations. The followings are the properties of an MDS matrix:
Let be a square matrix. is an MDS matrix, if and only if every square sub-matrix of is non-singular.
If is a MDS matrix, the transpose matrix of ( ) is also an MDS matrix.
Let be a non-zero constant and let be a MDS matrix, then the multiplication of a row (or column) of by does not affect the MDS property of .
If a square matrix is its own inverse (i.e., = ), then the matrix is called an involutory matrix. Equivalently, the matrix is an involution if and only if = , where is the identity matrix.
Definition 1. A Finite Field Hadamard matrix (simply Hadamard matrix) over with for can be expressed as follows:
(1) where sub-matrices and are also Hadamard matrices.
When denoting a Hadamard matrix, we use the notation had( , ,…, ), where for . In this respect, a Hadamard matrix can be given as follows:
(2)
Some important properties of a Hadamard matrix over are as follows (Pehlivanoğlu et al., 2018):
, where parameters are the entries of the first row of a Hadamard matrix .
is a bi-symmetric matrix, namely, and where is a exchange matrix and other elements of are 0),
, where and is the identity matrix.
If XOR sum of the first row elements of a Hadamard matrix over is equal to 1, then is involutory matrix, i.e., and , where is identity matrix and is the inverse of . On the other hand, GHadamard matrix form presented in Pehlivanoğlu et al. (2018) satisfies the last property , where given above for a Hadamard matrix and preserves involutory and MDS properties of a given involutory and MDS Hadamard matrix. The idea in preserving MDS property of GHadamard matrix form is based on the last property for defining an MDS matrix. A GHadamard matrix is generated by using the combination of non-zero more parameters and their inverses with a Hadamard matrix over . In this context, a GHadamard matrix can be denoted as follows:
(3)
We estimate the hardware cost of an (involutory) MDS matrix (i.e., linear transformation) with the number of XOR operations required in hardware implementation which can be described as with , where and are inputs and some subset of s are outputs. In the literature, there are two important approximations of the implementation cost in terms of XOR count: direct XOR (d-XOR) count (Khoo et al., 2014) and sequential XOR (s-XOR) count (Beierle, Kranz & Leander, 2016). While d-XOR count is defined as the Hamming weight (the number of 1 bits) of the corresponding binary matrix (transformed from matrix over ) minus , s-XOR count is defined as the minimum number of XOR operations needed to implement the binary matrix with in-place operations and without extra intermediate computations. Although s-XOR count seems like a better approximation, it causes a high computational cost for optimizing full MDS matrices (Duval & Leurent, 2018).
Local and global optimization techniques are used to find optimized implementations of MDS matrices in terms of the required number of XOR operations. The main difference between these two techniques is that the global optimization technique focuses on the optimization of a linear Boolean function of a whole matrix circuit while the local optimization technique focuses on the evaluation of diffusion matrix coefficients. Local optimization techniques do not guarantee finding efficient circuit implementation of an MDS matrix and therefore, more recently, global optimization techniques have been addressed to find well optimized circuits. The idea is based on the reduction of XOR count which is extracted by the naive implementation of an MDS matrix that contains a lot of repeated calculations.
In this article, while performing global optimization of an (involutory) MDS matrix, the circuit constructed by only XOR gates is handled as a linear Boolean function consisting of input signals and output signals (also called target signals). We also use BDKCI algorithm to build a globally optimized implementation of a (involutory) MDS matrix generated by using the proposed new hybrid method. The aim of BDKCI algorithm is to find efficient circuits with intermediate variables s (calculated once) for other computation sequences. These circuits can reuse intermediate variables s that lead to reducing the number of gates required. More details about BDKCI heuristic can be found in Baksi et al. (2021).
Proposed method
In this section, we present a new method to generate all involutory MDS matrices over . The proposed method is a hybrid construction method and is based on the combination of search based and direct based construction methods. The main idea of the proposed method is first to generate all representative involutory MDS matrices by search, and then to obtain all involutory MDS matrices by applying three more non-zero parameters and their inverses to these representative matrices. When generating representative involutory MDS matrices, we take the benefit of generic properties of a Hadamard matrix satisfying the involutory property, i.e., XOR sum of the elements in any row or column of a Hadamard matrix is equal to 1 and XOR sum of the elements in the main diagonal is equal to 0. Note that these properties also force XOR sum of the elements in the anti-diagonal (counter diagonal) to be equal to 0. Then, we can easily define the matrix form in order to search for all representative involutory MDS matrices over as follows:
The matrix form above for finding representatives involutory MDS matrix is defined by eight parameters over . Note that when defining the matrix form , the finite field element 0 is not considered because of the fact that all entries of an MDS matrix should be non-zero by the first property used for defining an MDS matrix. Hence, the search space for finding representative involutory MDS matrices over is approximately obtained as (by omitting non-invertible or singular matrices). For example, for finding all representative involutory MDS matrices over , the search space is approximately . Before proceeding with the details on the matrix form , we introduce the matrix form used for generating all involutory MDS matrices over in Remark 2 and Lemma 3 from which the main idea of the article comes.
Remark 2. Consider involutory MDS matrices, where is a positive integer. For , we show in Lemma 3 that one can directly generate all involutory MDS matrices by the following matrix form:
where and . Note that the following involutory MDS Hadamard matrix form :
is also representative involutory MDS matrix form for matrices over with the restriction . Hence, the representative involutory MDS matrix form can be used to generate all involutory MDS matrices over .
Lemma 3. Let be a matrix over . If the matrix A is involutory and MDS, then all involutory MDS matrices can be generated by the following matrix form:
where , and for and .
Proof. Let be a involutory matrix with the restriction . Let denote the elements of for , i.e., . Since , where I is the identity matrix, we obtain the following equations (by considering if then and if then ):
(4)
(5)
(6)
(7)
After adding the Eqs. (4) and (7) given above, we obtain the equation . The equation can be rewritten as , and therefore we obtain because the operations are performed in the finite field . On the other hand, we have from the Eq. (4). Then, and depending on and a new parameter are respectively obtained as and with the restrictions and so that the matrix form can also satisfy the MDS property (i.e., the determinant of the matrix form is not equal to 0).
Remark 4 Lemma 3 shows that the parameter and its inverse ( ) are hidden parameters keeping involutory and MDS property for the matrix form , and also that involutory (MDS) matrices are formed as distinct classes in the search space. Similarly, generating all involutory MDS matrices becomes an easier problem i.e., the problem is first to focus on searching for and finding all representative involutory MDS matrices by using the matrix form , and then generate all involutory MDS matrices by using representative involutory MDS matrices obtained and the hidden parameters ( , and with their inverses , and ) given in Theorem 8.
In Lemma 6, we give the mathematical background needed to define matrix form used for finding representative involutory MDS matrices, which constitutes the search side of the proposed method and we give the characteristics of representative involutory MDS matrices with Definition 5. Then, in Theorem 8, we present the mathematical background needed for the direct construction side of the proposed method, which is based on three non-zero parameters preserving involutory and MDS property of a representative involutory MDS matrix given.
By Lemma 6, representative involutory MDS matrices are found by searching through all possible candidates using the matrix form . This allows us to use 8 parameters ( , , , , , , and ) (instead of 16 parameters needed for defining all matrices over ) in the search phase of the matrix and thus enables us to reduce the search space complexity from to , which is approximately at the level of , where represents the number of all invertible matrices over . In this context, we present the matrix form again below:
Definition 5. A representative involutory MDS matrix (or shortly RIM) is a involutory matrix R and satisfies the following conditions: XOR sum of all elements of its main diagonal is equal to 0, XOR sum of any rows (and columns) of R is equal to 1 and the MDS property given in “Preliminaries” section.
Lemma 6. A representative involutory matrix satisfies the first two conditions given in Definition 5 and these two conditions used to define the matrix form guarantee to find all representative involutory matrices.
Proof. Let be a involutory and representative matrix such that all and let denote the elements of for . Then , where I is the identity matrix. If , then . Otherwise, . Hence, the following equations are satisfied:
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)
(18)
(19)
(20)
(21)
(22)
(23)
By adding the Eqs. (8)–(11) side by side, the following equation is obtained:
(24)
Because we study in the finite field the Eq. (24) can be rewritten as follows:
(25)
Hence, we verify the first statement of the lemma. To show the proof of the second statement, we assume that the sum of elements of any row of R is equal to . We prefer to study with rows instead of columns of R without breaking the generality. Then, the equations corresponding to our assumption are obtained as follows:
(26)
(27)
(28)
(29)
By adding the Eqs. (12)–(14) side by side, we get the following equality:
(30)
From the assumption Eqs. (26)–(28), it is clear that:
(31)
(32)
(33)
(34)
By replacing the expressions , , and in the Eq. (30) with the expressions , , and , respectively, the Eq. (35) and then the Eq. (36) are obtained:
(35)
(36)
We can rewrite the Eq. (36) as follows:
(37)
Then, by using the assumption (26), we can obtain the Eq. (8) as follows:
(38)
In a similar manner, the Eqs. (9)–(11) can be obtained by using the equations from (15) to (23) and the assumptions (26)–(29).
Similar assumptions can be given when proving the second part of the lemma, related to the sum of the elements of any column, as follows:
(39)
(40)
(41)
(42)
One can easily show that the Eqs. (8)–(11) can again be obtained by using the equations from (12) to (23) and the assumption Eqs. (39)–(42). For instance, the Eq. (8) can be obtained by applying similar operations shown in proving the first part of the lemma and by using the assumption equations from (39) to (42) and the Eqs. (15), (18) and (21). Hence, the second part of the lemma is satisfied.
Remark 7. Lemma 6 does not guarantee that any matrix satisfying assumptions is exactly a representative involutory matrix.
Theorem 8. Let be a representative involutory MDS matrix, then the matrix form obtained by the matrix RIM and some parameters ( parameters) is also involutory MDS in the following form:
where s for are the elements of .
Proof. Since the representative MDS matrix RIM is involutory, it satisfies all equations from (8) to (23) given in Lemma 6. If we square the matrix , we obtain the following expressions corresponding to ’s, where denote the elements of for :
(43)
(44)
(45)
(46)
(47)
(48)
(49)
(50)
(51)
(52)
(53)
(54)
(55)
(56)
(57)
(58)
The expressions from (43) to (46) are equal to 1 and the expressions from (47) to (58) are equal to 0 because the expressions from (43) to (46) are, respectively, the same with the left side of the equations from (8) to (11) given in Lemma 2, the expressions from (47) to (58) contain the results of multiplying 0 by non-zero finite field element(s) because the same expressions from (12) to (23) in Lemma 6, which are equal to 0, appear respectively in the expressions from (47) to (58). Hence, the involutory property of the matrix RIM is preserved. On the other hand, parameters in the matrix form A can be obtained by multiplying the constant elements , , and with the first column, the second column, the third column and the fourth column, respectively, and by multiplying the inverses of these elements , , and with the first row, the second row, the third row and the fourth row respectively. As given in “Preliminaries” section, the MDS property is invariant under the multiplication of a row/column with a non-zero constant. Hence, the MDS property of the matrix RIM is also preserved.
Remark 9. By Theorem 8, one can directly obtain only one representative involutory (MDS) matrix starting from any involutory (MDS) matrix by using parameters and their inverses given in the matrix form A.
The proposed method can be divided into two stages as follows:
By Lemma 6, representative involutory MDS matrices are found by searching through all possible candidates using the matrix form , which constitutes the search side of the proposed method. This allows us to use 8 parameters ( , , , , , , and ) in the search phase of the matrix . Hence, the search space for finding representative involutory MDS matrices over is by excluding the finite field element 0 in all parameters (the finite field element 0 is ignored in the search space calculation because all entries of an MDS matrix should be non-zero). However, when searching for finding all involutory MDS matrices in a conventional manner, 16 parameters are needed to define a finite field matrix, which makes the search space of a conventional search . Thus, our hybrid method reduces the search space complexity from approximately to , which is approximately at the level of , where represents the number of all invertible matrices over .
By Theorem 8, all involutory MDS matrices are generated directly by using representative involutory MDS matrices found by search in the previous stage and parameters.
In Examples 10 and 11, we obtain involutory MDS matrices over by using the proposed method, which is also given in the literature.
Example 10. Let be generated by the primitive element which is a root of the primitive polynomial (0x13). Consider the -circulant involutory MDS matrix recently given in Cauchois & Loidreau (2019).
over . In fact, the involutory MDS matrix belongs to a class of which representative involutory MDS matrix is as follows:
which is symmetric and is also -circulant involutory MDS matrix. The matrix can easily be obtained by applying the parameters , and (and their inverses) to representative involutory MDS matrix .
Example 11. Let be generated by the primitive element which is a root of the primitive polynomial (0x13). Consider the involutory MDS matrix given in Pehlivanoğlu et al. (2018).
over . In fact, the involutory MDS matrix belongs to a class of which representative involutory MDS matrix is as follows:
The involutory MDS matrix can easily be obtained by applying the parameters , and (and their inverses) to representative involutory MDS matrix .
Experimental results
In this section, we generate all involutory MDS matrices over and by finding all representative involutory MDS matrices over these finite fields. In order to generate all representative involutory MDS matrices, we use the the matrix form given in the “Proposed Method” section.
The experimental results show that there are 48 and 71,856 representative involutory and MDS matrices over and , respectively. After applying parameters to representative involutory MDS matrices, we generated totally and involutory and MDS matrices over and , respectively. Note that one can obtain 24 and 1,512 involutory MDS matrices over and by searching and using Hadamard matrix form, which are, in fact, a small amount of representative involutory MDS matrices. Then, by using GHadamard matrix form given in Pehlivanoğlu et al. (2018), one can totally generate and involutory and MDS matrices over these finite fields.
From the experimental results given above, it is shown that (involutory and MDS) Hadamard matrix form, which is also representative (involutory and MDS) matrix form, can approximately generate 2.1% of all involutory MDS matrices over . It is likely that this percentage will reduce for involutory MDS matrices over larger finite fields. Since Lemma 6 and Theorem 8 given in “Proposed Method” section can be updated for involutory matrices, it is clear that (involutory and MDS) Hadamard matrix form can be used to generate a small subset of all involutory MDS matrices, where , especially over larger finite fields.
Remark 12. As stated above, there are 71,856 representative involutory MDS matrices over , 1,512 of which can also be obtained by Hadamard matrix (by search). Then, 70,344 ( ) representative involutory MDS matrices cannot be generated by Hadamard matrix form. That means, by using the method given in Sakallı et al. (2020), one can map these representative involutory MDS matrices in order to obtain directly isomorphic counterparts over . Note that there are 4 isomorphisms from the finite field (defined by any irreducible polynomial) to the finite field (defined by any irreducible polynomial). Hence, by using the parameters , , and their inverses, one can directly generate 4,665,600,972,000 (= involutory MDS matrices over (defined by any irreducible polynomial), which cannot also be generated by GHadamard matrix.
In Tables 1 and 2, we present the number of occurrences of 1s in all involutory MDS matrices over and , respectively.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
---|---|---|---|---|---|---|---|---|---|---|
The number of matrices | 1,368 | 2,424 | 4,608 | 3,600 | 1,944 | 1,296 | 720 | 432 | 0 | 72 |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
---|---|---|---|---|---|---|---|---|---|---|
The number of matrices | 73,266,816 | 88,442,736 | 53,722,608 | 20,148,576 | 5,555,760 | 1,146,768 | 206,160 | 21,120 | 3,264 | 192 |
Remark 13. In Junod & Vaudenay (2005b), the maximum number of occurrences of 1s in MDS matrices is shown to be 9. In this article, we modify this result by showing that the maximum number of occurrences of 1s for involutory and MDS matrices is also 9 (see “Appendix” section).
In this article, we generate the lightest involutory MDS matrices over , and in terms of XOR count. To do so, we first generate involutory MDS matrices with low naive XOR counts. In this context, we consider all involutory MDS matrices over and consider involutory MDS matrices over with up to a threshold naive XOR count. For involutory MDS matrices over , we consider anti-diagonal symmetric matrices with up to a threshold naive XOR count and choose among them the ones whose results are up to a maximum of 110 XOR operations after optimizing with PAAR 1. Finally, involutory MDS matrices suitable for the given criteria are optimized with BDKCI algorithm.
In Example 14, we present a new involutory MDS matrix over generated by using the proposed method, which can be implemented by only 13 XOR operations with depth 6.
Example 14. Let be generated by the primitive element which is a root of the primitive polynomial (0xd). Consider the involutory MDS matrix as given below:
over . In fact, the involutory MDS matrix belongs to a class of which representative involutory MDS matrix is as follows:
The involutory MDS matrix with d-XOR count 56 ( ) can easily be obtained by applying the parameters , and (and their inverses) to representative involutory MDS matrix . After applying BDKCI heuristic to the matrix , we find the circuits for the matrix with 13 XORs and depth 5 using XOR3 and XOR4 gates (please see Table 5 for details).
Over F2m/Poly | Cost | Ref. | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
# XOR2 | # XOR3 | # XOR4 | Depth | GC | ASIC1(GE) | ASIC2(GE) | ASIC3(GE) | ASIC4(GE) | ||
Involutory | ||||||||||
/0x13 | 10 | 20 | – | 4 | 30 | 85 | 94.11 | 109 | 126.5 | Sim et al. (2015) |
/0x13 | 4 | 22 | – | 5 | 26 | 79.5 | 89.654 | 102.4 | 115.84 | Sarkar & Syed (2016) |
/0x13 | 5 | 23 | – | 4 | 28 | 84.75 | 95.35 | 109.1 | 123.83 | Jean et al. (2017) |
/0x13 | 4 | 21 | – | 5 | 25 | 76.25 | 85.939 | 98.2 | 111.18 | Exam. 15 |
/0xd | – | 2 | 11 | 3 | 13 | 61.5 | 67.93 | 77.15 | 75.21 | Pehlivanoğlu et al. (2023) |
/0xd | – | 5 | 8 | 5 | 13 | 56.25 | 62.575 | 71 | 71.22 | Exam. 14 |
Non-involutory | ||||||||||
/0x13 | – | 10 | 12 | 5 | 22 | 92.5 | 103.15 | 117 | 118.48 | Sim et al. (2015) |
/0x13 | – | 6 | 14 | 4 | 20 | 89.5 | 99.29 | 112.7 | 111.82 | Liu & Sim (2016) |
/0x13 | 4 | 1 | 15 | 4 | 20 | 86.25 | 94.139 | 107.95 | 107.83 | Beierle, Kranz & Leander (2016) |
/0x19 | – | 6 | 14 | 4 | 20 | 89.5 | 99.29 | 112.7 | 111.82 | Beierle, Kranz & Leander (2016) |
/0x19 | 2 | 5 | 13 | 3 | 20 | 85.25 | 94.037 | 107.25 | 107.83 | Sarkar & Syed (2016) |
/0x13 | 2 | 5 | 13 | 5 | 20 | 85.25 | 94.037 | 107.25 | 107.83 | Jean et al. (2017) |
/0x13 | 3 | 3 | 13 | 9 | 19 | 80.75 | 88.588 | 101.35 | 101.84 | Sajadieh & Mousavi (2021) |
/0x19 | 1 | 2 | 15 | 10 | 18 | 83.5 | 91.911 | 104.65 | 102.5 | Sajadieh & Mousavi (2021) |
/0x13 | 1 | 8 | 10 | 3 | 19 | 78 | 86.701 | 98.6 | 100.51 | Exam. 16 |
Bold values indicate the best results.
Matrix | Cost | |||||||
---|---|---|---|---|---|---|---|---|
# XOR2 | # XOR3 | # XOR4 | GC | ASIC1(GE) | ASIC2(GE) | ASIC3(GE) | ASIC4(GE) | |
AES | 31 | 26 | 4 | 61 | 166.5 Liu et al. (2022) | – | – | – |
22 | 21 | 12 | 55 | – | – | – | 243 Liu et al. (2022) | |
ANUBIS Barreto & Rijmen (2000) | 28 | 26 | 7 | 61 | 175.5 Liu et al. (2022) | – | – | – |
21 | 24 | 12 | 57 | – | – | – | 253.6 Liu et al. (2022) | |
CLEFIA M0 Shirai et al. (2007) | 32 | 32 | 2 | 66 | 178 Liu et al. (2022) | – | – | – |
23 | 16 | 18 | 57 | – | – | – | 258.9 Liu et al. (2022) | |
CLEFIA M1 Shirai et al. (2007) | 35 | 31 | 3 | 69 | 185.7 Liu et al. (2022) | – | – | – |
20 | 27 | 13 | 60 | – | – | – | 270.2 Liu et al. (2022) | |
FOX MU4 Junod & Vaudenay (2005a) | 46 | 43 | – | 89 | 231.7 Banik, Funabiki & Isobe, 2021 | – | – | – |
32 | 26 | 20 | 78 | – | – | – | 347.5 Liu et al. (2022) | |
Exam. 17 | 8 | 44 | – | 52 (depth 5) | 159 | 179.308 | 204.8 | 231.68 |
3 | 10 | 29 | 42 (depth 4) | 183.5 | 202.593 | 230.75 | 230.3 |
Bold values indicate the best results.
No. | Operation | No. | Operation |
---|---|---|---|
1 | 8 | ||
2 | 9 | ||
3 | 10 | ||
4 | 11 | ||
5 | 12 | ||
6 | 13 | ||
7 |
In Example 15, we present a new involutory MDS matrix over by using the proposed method, which is better than the matrices given in the literature. It can be implemented by only 25 XOR operations with depth 5, whereas the previously known lightest one (Sarkar & Syed, 2016) requires 26 XOR operations with the same depth using XOR2 and XOR3 gates.
Example 15. Let be generated by the primitive element which is a root of the primitive polynomial (0x13). Consider involutory MDS matrix as given below:
over . In fact, the involutory MDS matrix belongs to a class of which representative involutory MDS matrix is as follows:
The involutory MDS matrix with d-XOR count 79 can easily be obtained by applying the parameters , and (and their inverses) to representative involutory MDS matrix . After applying BDKCI heuristic to the matrix , we find the circuits for the matrix with 25 XORs and depth 5 using XOR2 and XOR3 gates (please see Table 6 for details).
No. | Operation | No. | Operation |
---|---|---|---|
1 | 14 | ||
2 | 15 | ||
3 | 16 | ||
4 | 17 | ||
5 | 18 | ||
6 | 19 | ||
7 | 20 | ||
8 | 21 | ||
9 | 22 | ||
10 | 23 | ||
11 | 24 | ||
12 | 25 | ||
13 |
In Example 16, we present a new non-involutory MDS matrix over . We have found this matrix by searching through all anti-diagonal symmetric matrices with the same elements of the involutory MDS matrix presented in Example 15. This non-involutory MDS matrix can be implemented by only 19 XOR operations with depth 3.
Example 16. Let be generated by the primitive element which is a root of the primitive polynomial (0x13). Consider the anti-diagonal symmetric non-involutory MDS matrix as given below:
over . The non-involutory MDS matrix is with d-XOR count 68 . After applying BDKCI heuristic to , we find the circuits with 19 XORs and depth 3 using XOR2, XOR3 and XOR4 gates.
As shown in Table 3, our proposed method leads to better results than the best-known XOR GCs and GEs given in the literature. In the case of involutory MDS matrices over with depth 5, the matrix presented in Example 15 offers 1 XOR operations improvement from the best-known result given in Sarkar & Syed (2016). On the other hand, the lightest involutory MDS matrix over with the lowest known XOR count 13 (the lowest XOR count known so far) with depth 5 is presented in Table 3. In non-involutory MDS matrices section in Table 3, we compare the matrix presented in Example 16 with the best known XOR count results in the literature. The matrix as depth 3 is the lightest XOR count result with 19 XOR operations offering 1 XOR operations improvement.
Example 17. Let be generated by the primitive element which is a root of the primitive polynomial (0x12d). Consider the involutory MDS matrix as given below:
over . In fact, the involutory MDS matrix belongs to a class of which representative involutory MDS matrix is as follows:
The involutory MDS matrix with d-XOR count 162 ( ) can easily be obtained by applying the parameters , and (and their inverses) to representative involutory MDS matrix . After applying BDKCI heuristic to the matrix , we find the circuit for the matrix with 52 XOR operations and depth 5 using XOR2 and XOR3 gates. Moreover, the same matrix requires only 42 XOR operations with depth 4 using XOR2, XOR3 and XOR4 gates (please see Table 7 for details).
No. | Operation | No. | Operation |
---|---|---|---|
1 | 23 | ||
2 | 24 | ||
3 | 25 | ||
4 | 26 | ||
5 | 27 | ||
6 | 28 | ||
7 | 29 | ||
8 | 30 | ||
9 | 31 | ||
10 | 32 | ||
11 | 33 | ||
12 | 34 | ||
13 | 35 | ||
14 | 36 | ||
15 | 37 | ||
16 | 38 | ||
17 | 39 | ||
18 | 40 | ||
19 | 41 | ||
20 | 42 | ||
21 | |||
22 |
In Table 4, we compare the matrix with the circuit implementations of ciphers given in the literature. When comparing the matrix with the previous best-known implementations of linear layers of some block ciphers, the involutory MDS matrix improves the results in GCs and GEs with the minimum circuit depths.
Note that in Tables 3 and 4 we do not only consider the construction of circuits with minimum GCs (i.e., XOR gate counts) and GEs but also take into account the minimum circuit depth for low latency criterion. Since we stopped the algorithm after four hours of runtime for each matrix, lighter circuits can be found because the proposed new hybrid method allows us to generate all involutory MDS matrices over . For further improvements, more runtime may be required.
Conclusion and future works
In this article, we proposed a new hybrid method to generate all involutory MDS matrices over . The proposed method reduces the search space complexity at the level of by searching and finding representative involutory MDS matrices, where represents the number of all invertible matrices over . In this respect, we were able to generate all involutory MDS matrices over and . For the finite field , the search space to generate all representative involutory MDS matrices is approximately , which is still too high to be searched for. Nevertheless, one can easily generate involutory and MDS matrices over by focusing on representative involutory MDS matrices. In the future, if the number of parameters in presented in the “Proposed Method” section is reduced by eliminating some parameters and a new search form is obtained, then the search space for finding representative involutory MDS matrices for larger finite fields can be reduced. However, this new form is highly possible to be a more complex structure than . As a result, we believe that our proposed method is not only useful for generating all involutory MDS matrices over , but it is also useful for other methods in the literature like the methods used for constructing lightweight involutory MDS matrices over the general linear groups GL ( , ).
Declarations
All authors have read and agreed to the submitted version of the manuscript. Funding is not applicable. The authors declare no conflict of interest. Data sharing is not applicable to this article as no data sets were generated or analyzed during the current study.
Appendix
Let be generated by the primitive element which is a root of the primitive polynomial (0x13). Consider representative involutory MDS matrix as given below:
over . Then, one can generate involutory and MDS matrix by applying the parameters , and (and their inverses) to as follows:
The number of 1s in the matrix is 9, which is the maximum number of occurrences of 1s in MDS matrices.