Submitted:
20 June 2023
Posted:
21 June 2023
You are already at the latest version
Abstract
Keywords:
1. Introduction
- The first approach involves the attacker guessing all the Legendre symbols used in the scheme. Subsequently, they solve the resulting system of equations and verify the correctness of the guessed symbols based on the obtained solution. The complexity of this attack increases by approximately a factor of 2 for each correctly guessed symbol, considering the probability of accurate guessing is around .
- On the other hand, the second approach avoids guessing the Legendre symbols and instead relies on the introduction of auxiliary variables to facilitate the establishment of the equation system. For more detailed information, please refer to [10].
| Instance | Attacked Rounds in [10] | Attacked Rounds in [18] | Our result |
|---|---|---|---|
| (2,3) | 28 | 25 | 27 |
| (2,4) | 21 | 20 | 22 |
| (2,8) | 11 | 12 | 14 |
| (2,12) | 7 | 8 | 10 |
| (3,3) | 22 | 22 | 24 |
| (3,4) | 16 | 18 | 20 |
| (3,8) | 8 | 11 | 13 |
| (3,12) | 6 | 8 | 10 |
| (5,3) | 16 | 19 | 21 |
| (5,4) | 12 | 16 | 18 |
| (5,8) | 6 | 10 | 12 |
| (5,12) | 4 | 7 | 9 |
2. Preliminaries
2.1. Notations
2.2. CICO Problem
2.3. Solve the Systems of Algebraic Equations
2.3.1. Solve a System of Univariate Equations
-
Compute .The computation of requires field operations with a double-and-add algorithm.
-
Compute .H has the same roots as F in since , but its degree is likely much lower. This step [28] requires field operations.
-
Factor H.In general, the polynomial H has only a few roots in . Thus, this step is negligible in complexity.
2.3.2. Solve a System of Multivariate Equations
- To launch a Gröbner basis attack, the first step is to construct a set of polynomial equations describing the primitive. After that, a Gröbner basis for the ideal generated by these equations is computed, usually concerning the degrevlex ordering for better efficiency. The algorithm used for the computation of the Gröbner basis could be Buchberger’s algorithm [29], F4 [30] and F5 [31].
- After computing the Gröbner basis for the given system of polynomial equations, the next step is to perform a change of term order to facilitate the computation of the elimination ideals and the elimination of variables. This is typically done by going from the degrevlex term order to the lex one, using an algorithm such as FGLM[32]. It is worth noting that in many applications, including those in cryptography, the systems of algebraic equations result in zero-dimensional ideals, meaning they have only finitely solutions.
- The final step of a Gröbner basis attack is to solve the univariate equation for the last variable using a polynomial factoring algorithm. This allows us to obtain the specific value of the last variable, which can then be substituted into the remaining equations to obtain the full solution of the system. This step can use the algorithm given above to find the univariate equation system. Once the polynomial has been factored, we can easily find its roots, which correspond to the possible values of the last variable. By substituting each root into the remaining equations, we can obtain all possible solutions to the system of equations.
2.4. Description of Hash Function Grendel
-
The Nonlinear Layer: Let . consists of independent n identical S-boxes. , whereis the Legendre symbol, and is an integer that satisfies .
- The Linear Layer: The is a MDS matrix .
- Adding Round Constants: Round constant , where .
| Algorithm 1:The Grendel Permutation |
|
- Padding. If the length of the message is already a multiple of r, no padding is necessary. However, if the length is not a multiple of r, we first append a to the message. Then, we pad the message with 0 until its length becomes a multiple of r.
- Absorption. The message is divided into blocks of size r. Each block is added to the first r blocks of the state using the addition operation. Afterwards, the entire state is processed by applying the permutation function . Repeat the above operation until all the messages are absorbed.
- Squeezing.In each iteration of the squeezing phase, a block of length r is squeezed out. The permutation function is applied to the entire state and the squeezed block is extracted. This process is repeated until the squeezing phase is completed.

3. Algebraic Cryptanalysis of Hash Function Grendel
3.1. Preimage Attack on Hash Function Grendel in [18]
- Iterating over all possible sets of Legendre symbols. The probability of a Legendre symbol being is approximately , while the probability of it being 0 is . Consequently, the probability that l Legendre symbols are different from zero can be calculated as . For a large number of rounds, if p is approximately , this probability exceeds . In their attack, . In the first round, it is possible to compute Legendre symbols deterministically because there is no linear layer before the initial application of the S-boxes.
- Solving the resulting univariate equation to identify a preimage. They focus on the case in which the number of hash output elements is 1. By fixing all Legendre symbols, there are only a single unknown (the input variable) and a single equation of degree at most in the end. The equation system hence consists of only one univariate equation and can be solved by applying a root-finding algorithm to this equation.
- Verifying if the solution obtained is a valid preimage. Furthermore, once the roots are discovered, they proceed to verify the validity of the obtained solution. They do this by comparing the computed Legendre symbols to the fixed ones for the given instance. If any inconsistency is found between the computed symbol using their solution and the fixed symbol, they promptly terminate the verification process, indicating that the trial is invalid. Considering that we only need to compute the first Legendre symbol in each instance with a probability of , the first two symbols with a probability of , and so on, we can expect to compute an average of 3 Legendre symbols for each trial before encountering an inconsistency.
3.2. Techniques to Skip SPN Rounds

3.3. Application to Hash Function Grendel
-
We first divide the Grendel permutation into two parts and as before. The Grendel permutation has R rounds. Consider the hash function Grendel with the following parameters: . The Grendel S-box, denoted as satisfies the Formula 4, which can be proven straightforwardly. Similarly, we set , and the is a vector subspace. The Grendel permutation takes an input where represent the input messages, and it produces an output . The initial value IV of Grendel is set to all zeros, and the last c elements of the output are also zeros. Consequently, after passes through , it yields . As indicated in the previous section, we have and satisfyThus, for , there is only one unknown input variable . Then we can process it similarly as in [18].
- According to [18], it can be observed that when , the probability of the Legendre symbol being is greater than . Therefore, we only consider guessing . Based on the previous step, has an input with only one unknown variable . The has rounds; we must guess the number of Legendre symbols, given by . Because only the Legendre symbol of needs to be guessed in the first round of , and other values are constant, the Legendre symbol is known. Consequently, there are at most distinct sets of Legendre symbols to guess until the correct set of Legendre symbols is found.
- After fixing the Legendre symbols, we can construct a polynomial with as an unknown variable. The polynomial equation, as defined in Formula 11, has a degree of . To determine the specific value of , we can employ the root-finding algorithm in Section 2.3.1. The complexity of the root-finding algorithm is
- Upon obtaining ’s value, we need to verify its validity. This requires checking the correctness of each guessed Legendre symbol. According to [18], for each set of guessed Legendre symbols, we only need to verify three of them to exclude an invalid set. The complexity of computing a Legendre symbol [37] is evaluated as for . Therefore, the complexity of this step is .
3.4. The Gröbner Basis Attacks for Hash Function Grendel

| Instance | Attacked Rounds with | Attacked Rounds with |
|---|---|---|
| (2,4) | 16 | 21 |
| (2,8) | 8 | 10 |
| (2,12) | 5 | 7 |
| (3,4) | 12 | 17 |
| (3,8) | 6 | 8 |
| (3,12) | 4 | 5 |
| (5,4) | 9 | 14 |
| (5,8) | 4 | 7 |
| (5,12) | 3 | 4 |
4. Conclusion
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Albrecht, M.R.; Grassi, L.; Rechberger, C.; Roy, A.; Tiessen, T. MiMC: Efficient Encryption and Cryptographic Hashing with Minimal Multiplicative Complexity. Advances in Cryptology - ASIACRYPT 2016 - 22nd International Conference on the Theory and Application of Cryptology and Information Security, Hanoi, Vietnam, -8, 2016, Proceedings, Part I; Cheon, J.H.; Takagi, T., Eds., 2016, Vol. 10031, Lecture Notes in Computer Science, pp. 191–219. 4 December. [CrossRef]
- Albrecht, M.R.; Grassi, L.; Perrin, L.; Ramacher, S.; Rechberger, C.; Rotaru, D.; Roy, A.; Schofnegger, M. Feistel Structures for MPC, and More. Computer Security - ESORICS 2019 - 24th European Symposium on Research in Computer Security, Luxembourg, -27, 2019, Proceedings, Part II; Sako, K.; Schneider, S.A.; Ryan, P.Y.A., Eds. Springer, 2019, Vol. 11736, Lecture Notes in Computer Science, pp. 151–171. 23 September. [CrossRef]
- Grassi, L.; Lüftenegger, R.; Rechberger, C.; Rotaru, D.; Schofnegger, M. On a Generalization of Substitution-Permutation Networks: The HADES Design Strategy. Advances in Cryptology - EUROCRYPT 2020 - 39th Annual International Conference on the Theory and Applications of Cryptographic Techniques, Zagreb, Croatia, -14, 2020, Proceedings, Part II; Canteaut, A.; Ishai, Y., Eds. Springer, 2020, Vol. 12106, Lecture Notes in Computer Science, pp. 674–704. 10 May. [CrossRef]
- Grassi, L.; Khovratovich, D.; Rechberger, C.; Roy, A.; Schofnegger, M. Poseidon: A New Hash Function for Zero-Knowledge Proof Systems. 30th USENIX Security Symposium, USENIX Security 2021, -13, 2021; Bailey, M.; Greenstadt, R., Eds. USENIX Association, 2021, pp. 519–535. 11 August.
- Ha, J.; Kim, S.; Choi, W.; Lee, J.; Moon, D.; Yoon, H.; Cho, J. Masta: An HE-Friendly Cipher Using Modular Arithmetic. IEEE Access 2020, 8, 194741–194751. [Google Scholar] [CrossRef]
- Dobraunig, C.; Grassi, L.; Helminger, L.; Rechberger, C.; Schofnegger, M.; Walch, R. Pasta: A Case for Hybrid Homomorphic Encryption. IACR Transactions on Cryptographic Hardware and Embedded Systems 2023, 2023, 30–73. [Google Scholar] [CrossRef]
- Dobraunig, C.; Grassi, L.; Guinet, A.; Kuijsters, D. Ciminion: Symmetric Encryption Based on Toffoli-Gates over Large Finite Fields. Advances in Cryptology - EUROCRYPT 2021 - 40th Annual International Conference on the Theory and Applications of Cryptographic Techniques, Zagreb, Croatia, -21, 2021, Proceedings, Part II; Canteaut, A.; Standaert, F., Eds. Springer, 2021, Vol. 12697, Lecture Notes in Computer Science, pp. 3–34. 17 October. [CrossRef]
- Ashur, T.; Mahzoun, M.; Toprakhisar, D. Chaghri - A FHE-friendly Block Cipher. Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security, CCS 2022, Los Angeles, CA, USA, -11, 2022; Yin, H.; Stavrou, A.; Cremers, C.; Shi, E., Eds. ACM, 2022, pp. 139–150. 7 November. [CrossRef]
- Grassi, L.; Onofri, S.; Pedicini, M.; Sozzi, L. Invertible Quadratic Non-Linear Layers for MPC-/FHE-/ZK-Friendly Schemes over Fnp Application to Poseidon. IACR Trans. Symmetric Cryptol. 2022, 2022, 20–72. [Google Scholar] [CrossRef]
- Szepieniec, A. On the Use of the Legendre Symbol in Symmetric Cipher Design. Cryptology ePrint Archive, Paper 2021/984, 2021. https://eprint.iacr.org/2021/984.
- Tóth, V. Collision and avalanche effect in families of pseudorandom binary sequences. Period. Math. Hung. 2007, 55, 185–196. [Google Scholar] [CrossRef]
- Gyarmati, K.; Mauduit, C.; Sárközy, A. The cross-correlation measure for families of binary sequences. In Applied Algebra and Number Theory; Larcher, G.; Pillichshammer, F.; Winterhof, A.; Xing, C., Eds.; Number Theory, Cambridge University Press, 2014; pp. 126–143. [CrossRef]
- Khovratovich, D. Key recovery attacks on the Legendre PRFs within the birthday bound. Cryptology ePrint Archive, Paper 2019/862, 2019. https://eprint.iacr.org/2019/862.
- Beullens, W.; Beyne, T.; Udovenko, A.; Vitto, G. Cryptanalysis of the Legendre PRF and Generalizations. IACR Trans. Symmetric Cryptol. 2020, 2020, 313–330. [Google Scholar] [CrossRef]
- Kaluđerović, N.; Kleinjung, T.; Kostić, D. Cryptanalysis of the generalised Legendre pseudorandom function. Open Book Series 2020, 4, 267–282. [Google Scholar] [CrossRef]
- Seres, I.A.; Horváth, M.; Burcsi, P. The Legendre Pseudorandom Function as a Multivariate Quadratic Cryptosystem: Security and Applications. Cryptology ePrint Archive, Paper 2021/182, 2021. Available online: https://eprint.iacr.org/2021/182.
- Shallue, C.J. Permutation polynomials of finite fields. 2012; arXiv:math.NT/1211.6044]. [Google Scholar]
- Grassi, L.; Khovratovich, D.; Rønjom, S.; Schofnegger, M. The Legendre Symbol and the Modulo-2 Operator in Symmetric Schemes over Fnp Preimage Attack on Full Grendel. IACR Trans. Symmetric Cryptol. 2022, 2022, 5–37. [Google Scholar] [CrossRef]
- Biham, E.; Shamir, A. Differential Cryptanalysis of DES-like Cryptosystems. Advances in Cryptology - CRYPTO 1990, 10th Annual International Cryptology Conference, Santa Barbara, California, USA, -15, 1990, Proceedings; Menezes, A.; Vanstone, S.A., Eds. Springer, August 11-15, 1990, Vol. 537, Lecture Notes in Computer Science, pp. 2–21. [CrossRef]
- Matsui, M. Linear Cryptanalysis Method for DES Cipher. Advances in Cryptology - EUROCRYPT 1993, Workshop on the Theory and Application of of Cryptographic Techniques, Lofthus, Norway, May 23-27, 1993, Proceedings; Helleseth, T., Ed. Springer, 1993, Vol. 765, Lecture Notes in Computer Science, pp. 386–397. [CrossRef]
- Ashur, T.; Dhooghe, S. MARVELlous: a STARK-Friendly Family of Cryptographic Primitives. Cryptology ePrint Archive, Paper 2018/1098, 2018. Available online: https://eprint.iacr.org/2018/1098.
- Beyne, T.; Canteaut, A.; Dinur, I.; Eichlseder, M.; Leander, G.; Leurent, G.; Naya-Plasencia, M.; Perrin, L.; Sasaki, Y.; Todo, Y.; Wiemer, F. Out of Oddity - New Cryptanalytic Techniques Against Symmetric Primitives Optimized for Integrity Proof Systems. Advances in Cryptology - CRYPTO 2020 - 40th Annual International Cryptology Conference, CRYPTO 2020, Santa Barbara, CA, USA, August 17-21, 2020, Proceedings, Part III; Micciancio, D.; Ristenpart, T., Eds. Springer, 2020, Vol. 12172, Lecture Notes in Computer Science, pp. 299–328. [CrossRef]
- Eichlseder, M.; Grassi, L.; Lüftenegger, R.; ygarden, M.; Rechberger, C.; Schofnegger, M.; Wang, Q. An Algebraic Attack on Ciphers with Low-Degree Round Functions: Application to Full MiMC. Advances in Cryptology - ASIACRYPT 2020 - 26th International Conference on the Theory and Application of Cryptology and Information Security, Daejeon, South Korea, December 7-11, 2020, Proceedings, Part I; Moriai, S.; Wang, H., Eds. Springer, 2020, Vol. 12491, Lecture Notes in Computer Science, pp. 477–506. [CrossRef]
- Bouvier, C.; Canteaut, A.; Perrin, L. On the algebraic degree of iterated power functions. Des. Codes Cryptogr. 2023, 91, 997–1033. [Google Scholar] [CrossRef]
- Cui, J.; Hu, K.; Wang, M.; Wei, P. On the Field-Based Division Property: Applications to MiMC, Feistel MiMC and GMiMC. Advances in Cryptology - ASIACRYPT 2022 - 28th International Conference on the Theory and Application of Cryptology and Information Security, Taipei, Taiwan, December 5-9, 2022, Proceedings, Part III; Agrawal, S.; Lin, D., Eds. Springer, 2022, Vol. 13793, Lecture Notes in Computer Science, pp. 241–270. [CrossRef]
- Liu, F.; Anand, R.; Wang, L.; Meier, W.; Isobe, T. Coefficient Grouping: Breaking Chaghri and More. Advances in Cryptology - EUROCRYPT 2023 - 42nd Annual International Conference on the Theory and Applications of Cryptographic Techniques, Lyon, France, April 23-27, 2023, Proceedings, Part IV; Hazay, C.; Stam, M., Eds. Springer, 2023, Vol. 14007, Lecture Notes in Computer Science, pp. 287–317. [CrossRef]
- Bariant, A.; Bouvier, C.; Leurent, G.; Perrin, L. Algebraic Attacks against Some Arithmetization-Oriented Primitives. IACR Trans. Symmetric Cryptol. 2022, 2022, 73–101. [Google Scholar] [CrossRef]
- von zur Gathen, J.; Gerhard, J. Modern Computer Algebra (3. ed.); Cambridge University Press, 2013.
- Buchberger, B. A theoretical basis for the reduction of polynomials to canonical forms. SIGSAM Bull. 1976, 10, 19–29. [Google Scholar] [CrossRef]
- Faugere, J.C. A new efficient algorithm for computing Gröbner bases (F4). Journal of pure and applied algebra 1999, 139, 61–88. [Google Scholar] [CrossRef]
- Faugere, J.C. A new efficient algorithm for computing Gröbner bases without reduction to zero (F 5). Proceedings of the 2002 international symposium on Symbolic and algebraic computation, 2002, pp. 75–83.
- Faugère, J.; Gianni, P.M.; Lazard, D.; Mora, T. Efficient Computation of Zero-Dimensional Gröbner Bases by Change of Ordering. J. Symb. Comput. 1993, 16, 329–344. [Google Scholar] [CrossRef]
- Bettale, L.; Faugère, J.; Perret, L. Solving polynomial systems over finite fields: improved analysis of the hybrid approach. International Symposium on Symbolic and Algebraic Computation, ISSAC’12, Grenoble, France July 22 - 25, 2012; van der Hoeven, J.; van Hoeij, M., Eds. ACM, 2012, pp. 67–74. [CrossRef]
- Bardet, M.; Faugère, J.; Salvy, B. On the complexity of the F5 Gröbner basis algorithm. J. Symb. Comput. 2015, 70, 49–70. [Google Scholar] [CrossRef]
- Bertoni, G.; Daemen, J.; Peeters, M.; Van Assche, G. Sponge functions. ECRYPT hash workshop, 2007, Vol. 2007.
- Bertoni, G.; Daemen, J.; Peeters, M.; Assche, G.V. On the Indifferentiability of the Sponge Construction. Advances in Cryptology - EUROCRYPT 2008, 27th Annual International Conference on the Theory and Applications of Cryptographic Techniques, Istanbul, Turkey, April 13-17, 2008. Proceedings; Smart, N.P., Ed. Springer, 2008, Vol. 4965, Lecture Notes in Computer Science, pp. 181–197. [CrossRef]
- Brent, R.P.; Zimmermann, P. An O(M(n) logn) Algorithm for the Jacobi Symbol. Algorithmic Number Theory, 9th International Symposium, ANTS-IX, Nancy, France, July 19-23, 2010. Proceedings; Hanrot, G.; Morain, F.; Thomé, E., Eds. Springer, 2010, Vol. 6197, Lecture Notes in Computer Science, pp. 83–95. [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 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 (http://creativecommons.org/licenses/by/4.0/).