Next Article in Journal
Adaptive Switching Surrogate Model for Evolutionary Multi-Objective Community Detection Algorithm
Previous Article in Journal
Sport-Specific Shoulder Rotator Adaptations: Strength, Range of Motion, and Asymmetries in Female Volleyball and Handball Athletes
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Unified Method for Selecting Parameters and Primitive Elements in 2 × 2 Matrix Fields for Cryptographic Protocols

1
Department of Telecommunications and Space Engineering, Almaty University of Power Engineering and Telecommunications Named After Gumarbek Daukeyev, 050013 Almaty, Kazakhstan
2
Research & Development Systems LLC, Karasai District, Pervomaysky Rural District, 040911 Bekbolat Village, Kazakhstan
3
Department of Information Security and Computer Engineering, Cherkasy State Technological University, 18006 Cherkasy, Ukraine
4
Department of Scientific and Technical Expertise, State Scientific and Research Institute of Cybersecurity Technologies and Information Protection, 03142 Kyiv, Ukraine
5
Department of Forensic Investigation and Duplication of Vehicle Identification Numbers, Cherkasy Research Forensic Centre of the Ministry of Internal Affairs of Ukraine, 18023 Cherkasy, Ukraine
6
Department of Computer Engineering, International University of Information Technology, 050013 Almaty, Kazakhstan
*
Author to whom correspondence should be addressed.
Symmetry 2025, 17(8), 1212; https://doi.org/10.3390/sym17081212
Submission received: 31 May 2025 / Revised: 29 June 2025 / Accepted: 15 July 2025 / Published: 31 July 2025
(This article belongs to the Section Computer)

Abstract

This paper introduces a novel method for selecting parameters of finite fields formed by 2 × 2 matrices over a finite field of integers modulo a prime p. The method aims to simultaneously determine both the field parameters and primitive elements, thereby optimizing the construction of cryptographic algorithms. The proposed approach leverages the properties of quadratic residues and non-residues, simplifying the process of finding matrix field parameters while maintaining computational efficiency. The method is particularly effective when the prime number p is either a Mersenne prime or (p + 1)/2 is also a prime. This study demonstrates that the resulting matrix fields can be practically computed, offering a high degree of flexibility for cryptographic protocols such as key agreement and secure data transmission. Compared to previous methods, the new method reduces the parameter search space and provides a structured way to identify primitive elements without the need for a separate search procedure. The findings have significant implications for the development of efficient cryptographic systems using matrix-based finite fields.

1. Introduction

Finite fields are fundamental to cryptography since they provide the mathematical foundation for various cryptographic algorithms and protocols. They enable computations over a limited set of elements, ensuring operation completeness, the absence of overflow errors, and efficient implementation. For instance, asymmetric cryptographic algorithms, such as RSA [1], elliptic curves [2], and lattice-based cryptography [3] rely on the properties of finite fields to ensure the computational complexity of inverse problems, e.g., discrete logarithms and factorization of large numbers, which are critical to their security.
A well-known example of applying finite fields in symmetric cryptography is the Advanced Encryption Standard (AES) [4]. The AES utilizes a finite field G F 2 8 that enables efficient operations on data bytes. The SubBytes transformation is based on computing multiplicative inverses in G F 2 8 , ensuring non-linearity, while the MixColumns operation relies on matrix multiplication in a finite field.
Matrices themselves are a powerful tool in cryptographic applications. Beyond AES, they are deployed in various data encryption methods, including public-key encryption [5], image encryption [6,7,8,9,10], group cryptographic transformations [11], homomorphic encryption [12], key agreement protocols [13,14], network coding [15], etc. On the other hand, matrix applications in cryptography present challenges such as computational complexity, security vulnerabilities, high implementation-related costs, and key management. These challenges highlight the demand for continuous research and development to enhance the security and efficiency of matrix-based cryptographic systems.
In our previous studies [16,17] we have examined the principles for constructing Galois fields of square 2 × 2 matrices over a prime field of integers p . This approach aims to enhance the reliability of cryptographic systems operating in finite fields by increasing the order of the multiplicative group while preserving the order p of the base field p used for transformations. The latter assertion refers to the fact that the complexity of algorithms solving the discrete logarithm problem depends significantly on the order of the cyclic group [18,19,20,21,22,23]. By utilizing the proposed field of square matrices over p , the order of the multiplicative group can be increased to p 2 1 compared to the base field p .
The study [16] investigates the properties of a commutative (abelian) group under the multiplication of 2 × 2 square matrices over p , as follows:
C G L b , k 2 , p = t · a 1 b a + k , s · 1 0 0 1 , t , s , a , b , k p , t , s 0 , a a + k b 0 ,
where b , k represent fixed group parameters.
The C G L b , k 2 , p group order is p 2 1 if D = k 2 + 4 b u 2 p and p > 2 . We will also assume further in this research that p > 2 .
The study [16] also demonstrates that a simple algebraic expansion F p 2 = p D is a decomposition field for characteristic polynomials of matrices from the group C G L b , k 2 , p . Eigenvalues of the group C G L b , k 2 , p matrix over the field F p 2 = p D are λ 1 , 2 a , t = t 2 2 a + k ± D , t 0 .
Evidence from the study [16] also demonstrates that the commutative family of matrices C G L b , k 2 , p over the field F p 2 = p D is simultaneously diagonalizable [24,25]. Then the following family of matrices:
F b , k = t · a 1 b a + k , s · 1 0 0 1 , t , s , a , b , k p , D = k 2 + 4 b u 2 p
with fixed b and k values is a Galois field of order p 2 with standard matrix addition and multiplication operations.
The survey [17] addresses the perspectives of deploying a finite field F b , k in cryptographic applications, in particular, in the Diffie–Hellman key agreement protocol [26]. For this purpose, the study [17] presents an approach to defining matrices t · A = t · a 1 b a + k , which are primitive elements of a finite field F b , k , along with demonstrating the set structure of such primitive elements in F b , k . The study [17] presents an algorithm that efficiently identifies all such primitive elements by iterating through possible values and verifying their suitability using number-theoretical criteria such as quadratic residue testing.
In cases when parameters b and k of a field F b , k are not previously specified, its use in cryptographic applications requires solving two independent tasks: selecting parameters b and k to satisfy condition k 2 + 4 b u 2 p and finding primitive elements of F b , k for the found parameters. This approach is demanding in terms of required resources and hence motivates the search for methods that would allow a single procedure to simultaneously determine both the necessary parameters of the field F b , k and its primitive elements.
Thus, the major objective of this study is to develop and investigate a method for selecting parameters of the finite field of 2 × 2 matrices while simultaneously generating primitive elements for them.
This paper is organized as follows: Section 2 will present the materials and methods, including the mathematical foundations of finite fields of 2 × 2 matrices over the prime field of integers and the proposed parameter selection algorithm; Section 3 will present the theoretical results and practical applications of the proposed method; Section 4 will discuss the efficiency and cryptographic relevance of the method compared to existing approaches; and Section 5 will conclude this paper.

2. Materials and Methods

2.1. Characteristics and Conditions for F b , k

Theorem 5 from [17] proves that there exist exactly φ p + 1 different matrices A j = a j 1 b a j + k F b , k over p with p e r i o d A j = p + 1 and det A j u 2 p , that define all φ p 2 1 primitive elements of F b , k over p , i.e.,:
t j i · A j ,
where t j i T j = ± σ i γ j 2 : i , p 1 = 1 , γ j = i n d det A j , 1 j φ p + 1 ;
σ is the smallest primitive root in p ;
i n d det A j = γ is the index of det A j number by σ base: det A j σ γ mod p , 0 γ p 2 .
In order to simplify computational procedures, this situation justifies the relevance of studying the special case of a primitive element of the form A = a 1 b a + k for t = 1 .
Theorem 5 from the study [17] includes the following definitions, which we will use in this study.
Definition 1. 
The A , A 2 , , A L = δ · E power sequence of the matrix A F b , k is termed as a power chain of length L , if for i < L : A i s · E , where δ , s p . L = 1 if A = δ · E .
Definition 2. 
The period of the matrix A is defined as the length L of its power chain: p e r i o d A = L .
The order of the matrix A as an element of the multiplicative group F b , k * has the notation o r d A .
Consider matrix A = a 1 b a + k . Thus A = Δ a = a a + k b 0 .
The characteristic equation of the matrix A has the following notation: λ 2 2 a + k λ + a a + k b = 0 , or λ 2 2 a + k λ + Δ a = 0 .
The roots of the characteristic equation λ 1 , 2 a are the eigenvalues of the matrix A . Further, we will abbreviate λ 1 , 2 a values through λ 1 , 2 .
In order for a matrix to acquire the maximum number of linearly independent eigenvectors, a sufficient condition is that all roots of its characteristic equation be distinct [24,25]. For the matrix A , the necessary and sufficient condition is D = k 2 + 4 b 0 .
The study [17] has demonstrated the following:
  • For D = u 2 p , u 0 , the values are o r d A = L C M o r d λ 1 , o r d λ 2 in p and o r d A p 1 . The maximum limit of o r d A can be reached if and only if the smallest common multiple of the λ 1 , 2 orders is p 1 , for example, when at least one of the elements λ 1 , 2 is primitive in p ;
  • For D u 2 p , u 0 , the following equality holds:
A p + 1 = C λ 1 p + 1 0 0 λ 2 p + 1 C 1 = C Δ a 0 0 Δ a C 1 = Δ a E ,
where Δ a p .
For the element A of the matrix field F b , k with the order F b , k = p 2 , the value o r d A p 2 1 (see Formula (25)). According to Theorem 4 in [17], the maximum limit o r d A = p 2 1 is achieved if p e r i o d A = p + 1 while λ 1 p + 1 = λ 2 p + 1 = Δ a is a primitive element of the field p with order p 1 .
Remark 1. 
For the eigenvalues λ 1 , 2 of the matrix A , D u 2 p , the equality λ 1 i = λ 2 i = δ holds if and only if λ 1 i = δ p .
Proof of Remark 1. 
Let us represent the matrix A as A = C λ 1 0 0 λ 2 C 1 , where C = c i j , c i j p D , is the diagonalizing matrix for A = a i j , a i j p .
If λ 1 i = λ 2 i , then A i = C · λ 1 i 0 0 λ 2 i · C 1 = C · λ 1 i · E · C 1 = λ 1 i · E = δ · E = δ 0 0 δ , where λ 1 i = δ p .
Now, λ 1 i = δ p . Since the characteristic polynomial of matrix A is irreducible over p , the eigenvalue is λ 2 = λ 1 p . By Fermat’s theorem [27], for the elements of p , the following holds: λ 2 i = λ 1 p i = λ 1 i p = δ p = δ , i.e., λ 1 i = λ 2 i = δ . □
Corollary 1. 
Power A i = δ · E if and only if λ 1 i = δ p .
Note that the condition of primitiveness Δ a in p is necessary, even though this condition is not sufficient for ensuring the maximum order of the cyclic subgroup generated by the matrix A . The latter is due to the fact that the equality λ 1 p + 1 = λ 2 p + 1 does not exclude cases where λ 1 i = λ 2 i for i < p + 1 (see Example 1).
Recall that the next expression from [28] serves to raise a square matrix A = a b c d to a power, as follows:
A i = ϑ i + 1 d ϑ i b ϑ i c ϑ i ϑ i + 1 a ϑ i ,
where
ϑ i + 1 = t r A ϑ i det A ϑ i 1 ,
t r A denotes the trace of the matrix A [29]; ϑ 0 = 0 , ϑ 1 = 1 .
Also recall that Theorem 1 in [17] proves that if A F b , k , p e r i o d A = p + 1 if and only if A s · E and
ϑ i 0   for   1 i p + 1 2 .
On the other hand, Theorem 2 in [17] states that the following is true for A F b , k and det A = Δ a u 2 p :
If a prime p is a Mersenne prime p = 2 m 1 , then p e r i o d A = p + 1 ;
3.
If p 2 m 1 , then p e r i o d A = p + 1 if and only if
ϑ i 0   for   1 i p + 1 γ ,
where γ = min f = 2 c + 1 : c 1 , p + 1   f .
Example 1. 
(a) Let us assume that p = 11 , b = 10 , k = 5 , and matrix A = a 1 10 a + 5 F 10 , 5 over 11 .
The value D = k 2 + 4 b = 10 u 2 11 . For a = 8 , the determinant Δ a = 6 D u 2 11 . Here p + 1 2 = 6 is not a prime number.
To find p e r i o d A , we shall apply Theorem 1 from [17]. By calculating t r A = 10 = 1 , det A = Δ a = 5 , we find the values of elements ϑ i of sequence (6) for 1 i 6 by the Formula (7): 0, 1, −1, 6, 0, 8,…. We obtain ϑ 4 = 0 , ϑ 5 = 8 , from whence p e r i o d A p + 1 . The characteristic polynomial of the matrix A = 8 1 10 2 is λ 2 + λ + 6 , it has a discriminant D = 10 u 2 11 and is irreducible over the field 11 . The decomposition field of λ 2 + λ + 6 is the quadratic extension of the field 11 10 , in which the eigenvalues of matrix A are equal to λ 1 , 2 = 1 2 1 ± 10 .
Equation (5) for the A i power yields the following result: A 4 = 8 0 0 8 = 8 E , i.e., p e r i o d A = 4 = p + 1 3 and λ 1 4 = λ 2 4 = 8 11 .
(b) Let p = 13 , b = 7 , k = 4 , and the matrix A = a 1 7 a + 4 F 7 , 4 over 13 .
The discriminant is D = k 2 + 4 b = 5 u 2 13 . For a = 5 , the matrix A = 5 1 7 9 has t r A = 1 and det A = Δ a = 1 . The decomposition field of the characteristic polynomial λ 2 λ + 1 for the matrix A is the simple quadratic extension of the field 13 5 , where eigenvalues are λ 1 , 2 = 1 2 1 ± 5 . The value p + 1 2 = 7 is a prime number; whereas the determinant Δ a = 1 = 5 2 13 . Hence, to determine the period of the matrix A , it is impossible to apply Theorem 2 from the study [17] and condition (8). Therefore, Theorem 1 proved in [17] will be applied, having calculated the sequence (6) for 1 i 7 with expression (7): 0, 1, 1, 2, 3, 5, 8, 0, 8, …, where ϑ 7 = 0 , ϑ 8 = 8 .
According to the Equation (5): A 7 = 8 E , whence p e r i o d A = 7 = p + 1 2 and λ 1 7 = λ 2 7 = 8 13 .
(c) Let p = 19 , b = 11 , k = 3 , and matrix A = a 1 11 a + 3 F 11 , 3 over 19 .
Discriminant D = k 2 + 4 b = 15 u 2 19 . For a = 9 , the matrix A = 9 1 11 12 acquires t r A = 2 , det A = Δ a = 2 and a characteristic polynomial λ 2 2 λ + 2 . Since 1 4 D = 18 u 2 19 , the extension field of the polynomial λ 2 2 λ + 2 will be a quadratic extension of the field 19 18 . The eigenvalues of the matrix A are λ 1 , 2 = 1 ± 18 19 18 . To determine p e r i o d A , we will calculate ϑ i values by Equation (6) for 1 i 4 according to (8): 0, 1, 2, 2, 0, −4, …, wherein ϑ 4 = 0 , ϑ 5 = 4 . This implies that A 4 = 4 E , whence p e r i o d A = 4 = p + 1 5 and λ 1 4 = λ 2 4 = 4 19 .

2.2. Selecting F b , k Parameters

Let r m n mod p + 1 , 0 r p .
Thus, n = ν p + 1 + r , m = μ p + 1 + r . Considering (4) A n = A ν p + 1 + r = A p + 1 ν · A r = Δ a ν · A r   A m = A μ p + 1 + r = A p + 1 μ · A r = Δ a μ · A r .
Thus A m = Δ a μ Δ a ν · A n = Δ a μ ν · A n or
A m = Δ a m n p + 1 · A n .
Note that Equation (9) indicates the “periodicity” of the power values of the matrix A in the field F b , k with an accuracy of up to a defined coefficient from p .
Here we consider in more detail the issue of selecting parameters for the matrix A = a 1 b a + k with D u 2 p , to achieve maximum for the order of the generated cyclic subgroup.
Recall that according to Theorem 4 in [17], it is necessary for Δ a to be primitive in p with order p 1 to ensure the maximum value of o r d A for D = k 2 + 4 b u 2 p . For the smallest primitive root σ 0 in p , that implies that Δ a = σ 0 i , where G C F i , p 1 = 1 . If t 0 , it can be expressed as a power of σ 0 : t = σ 0 ν , 0 < ν < p . A primitive Δ a in the equation Δ a = t j , 0 < j < p yields σ 0 ν j = σ 0 i . This equality is equivalent to the comparison ν · j i mod p 1 , where G C F i , p 1 = 1 . For G C F ν · j , p 1 1 , the specified comparison has no solutions, in particular for G C F j , p 1 1 . Therefore, a necessary condition for primitiveness is the requirement:
Δ a = a a + k b t j p ,
where 1 < j < p , G C F j , p 1 1 .
In this study, we shall confine ourselves to considering the base case for prime p > 2 , when
D = k 2 + 4 b u 2 p , Δ a = a a + k b t 2 p .
As is evident from the above, Δ a = a a + k b t 2 p is a necessary condition. However, this condition cannot be considered sufficient.
It follows from D = k 2 + 4 b u 2 p that b 0 . Therefore, for an arbitrary quadratic non-residue q in p the equalities k 2 + 4 b = q or b = q k 2 4 hold.
Substituting the final expression into Δ a = a a + k b t 2 p yields a + k 2 2 1 2 2 q t 2 p or 2 a + k 2 q 2 t 2 p . Thus, the final expression reduces the problem of selecting the matrix field parameters to finding a quadratic non-residue r in p , which defines the difference 2 a + k 2 q = r or
2 a + k 2 = q + r
for a given a fixed quadratic non-residue q in p .
Remark 2. 
For the simplest case, when 2 a + k = 0 or a = k 2 , the following equalities hold for the values of the Legendre symbol (see [30]):
p q p = q p = 1 p · q p = 1 p 1 2 · q p .
Therefore, the pair q ; r = p q constitutes quadratic non-residues in p only for p = 4 w + 1 , since for p = 4 w + 3 , the value r = p q is always a quadratic residue for a given quadratic non-residue q [30]. The matrix A = a 1 b a + k for a = k 2 has a notation A = k / 2 1 b k / 2 without variable parameters. In this case A 2 = k 2 4 + b · E = D 4 · E , while p e r i o d A = 2 . The multiplicative group has a simple structure C G L p b , k = t · k / 2 1 b k / 2 , s E , t , s , k p , t , s 0 and order 2 p 1 .
Further, we consider the case where 2 a + k 0 .
The solution for the Equation (12) reduces to a search for quadratic non-residues r in p that satisfy the equality q + r = t 2 p for a given fixed quadratic non-residue q in p . Here we determine the number of such pairs q and r that exist.
To solve the problem of finding quadratic non-residues q , r p such that q + r = t 2 p , we first consider the problem of finding quadratic residues q , r p such that q + r = t 2 p . The latter expression can be rewritten in the field p as follows:
q 2 + r 2 = t 2 .
Here we consider the following cases:
  • q r = 0 ;
  • q r 0 ; t = 0 ; ;
  • q r t 0 .
Case 1. 
If q r = 0 , then q = 0 ; r 2 t 2 = 0 ; r = 0 ; q 2 t 2 = 0 ; or q = 0 ; r = ± t ; r = 0 ; q = ± t .
The number of pairs q ; r : q r = 0 , that are the solution of Equation (14) for an arbitrary t p , equals 2 p . The number of distinct pairs q ; r with precision up to their permutation is equal to p .
The number of distinct pairs q 2 ; r 2 : q r = 0 , with precision up to their permutation for a given t p is equal to the number of quadratic residues in p , including zero residue: p 1 / 2 + 1 = p + 1 / 2 .
Case 2. 
If q r 0 , t = 0 ; then q 2 + r 2 = 0 , where q 2 , r 2 1 , 2 , 3 , , p 1 . Since q 0 , 1 + r / q 2 = 0 .
Let us assume that w = r / q . Then 1 + w 2 = 0 or
w 2 = 1 .
According to Corollary 3 from Chapter 5 of §1 [30], Equation (15) has a solution for prime p if and only if p = 4 l + 1 .
We shall accept that w 0 is the solution to Equation (15), i.e., 1 + w 0 2 = 0 , p = 4 l + 1 . Therefore, for every q p : q 2 1 + w 0 2 = q 2 + q w 0 2 = 0 , which implies that the set of pairs q ; q w 0 = q ; r defines all possible solutions in the field p of the equation q 2 + r 2 = 0 , p = 4 l + 1 . In addition, since w 0 p , w 0 2 = p 1 or w 0 = ± p 1 1 2 .
For q r 0 ; p = 4 l + 3 , q 2 + r 2 0 always holds.
Therefore, the number of pairs q ; r : q r 0 , that are the solution to Equation (14) for t = 0 , equals 2 p 1 for p = 4 l + 1 , and zero for p = 4 l + 3 , whereas the number of distinct pairs q ; r with precision up to their permutation for p = 4 l + 1 is equal to p 1 .
Corollary 2. 
The number of distinct pairs q 2 ; r 2 : q r 0 with precision up to their permutation that are the solution to Equation (14) for t = 0 , equals p 1 / 4 for p = 4 l + 1 and zero for p = 4 l + 3 .
It is important to notice that the system of nonzero quadratic residues in p , p = 4 l + 1 , possesses the property of symmetric distribution within the ordered set of residues modulo p : 1 ; ; q 2 ; ; p q 2 ; ; p 1 = w 0 2 , q 2 p 1 / 2 (see Equation (13)).
Corollary 3. 
The number of nonzero quadratic residues r 2 in p for a fixed nonzero quadratic residue q 2 , which satisfy the condition q 2 + r 2 = 0 , is equal to one for p = 4 l + 1 and zero for p = 4 l + 3 .
Remark 2 states that quadratic non-residues possess a similar symmetry property in p , p = 4 l + 1 : for every quadratic non-residue η there is a quadratic non-residue f , such that η + f = 0 , i.e., f = p η .
Corollary 4. 
The number of quadratic residues η in p for a fixed quadratic residue f to satisfy the condition η + f = 0 is equal to one for p = 4 l + 1 and zero for p = 4 l + 3 .
Example 2. 
Let p = 4 l + 1 = 13 , w 0 2 = 12 . Therefore, w 0 = ± 5 = 5 ; 8 . Thus, the following values of pairs q ; r are obtained for q 2 + r 2 = 0 : 1 ; ± 5 , 2 ; ± 10 , 3 ; ± 2 , 4 ; ± 7 , 5 ; ± 12 , 6 ; ± 4 , 7 ; ± 9 , 8 ; ± 1 , 9 ; ± 6 , 10 ; ± 11 , 11 ; ± 3 , and 12 ; ± 8 .
The number of pairs q ; r is equal to 2 p 1 = 24 . The number of distinct pairs q ; r up to their permutation will be p 1 = 12 : 1 ; 5 , 1 ; 8 , 2 ; 3 , 2 ; 10 , 3 ; 11 , 4 ; 6 , 4 ; 7 , 5 ; 12 , 6 ; 9 , 7 ; 9 , 8 ; 12 , and 10 ; 11 .
The number of distinct pairs q 2 ; r 2 up to their permutation constitutes p 1 / 4 = 3 : 1 ; 12 , 3 ; 10 , and 4 ; 9 .
Case 3. 
If q r t 0 , the expression q 2 + r 2 = t 2 is equivalent to the expression q t 2 + r t 2 = 1 . Substitution x = q t , y = r t results in the following system:
x y 0 ; x 2 + y 2 = 1 .
It is widely known ([30], Chapter 8 of §3) that the number N x 2 + y 2 = 1 of solutions of the equation x 2 + y 2 = 1 over p is expressed in terms of Jacobi sums and is equal to
N x 2 + y 2 = 1 = p 1 , i f p 1 mod 4 ; p + 1 , i f p 3 mod 4 .
We are interested in the ‘location’ of solutions of the equation x 2 + y 2 = 1 in the multiplicative group p * .
To solve system (16), we shall apply a known method for finding Pythagorean triples in p , which deploys Riemann stereographic projection [31,32,33].
Consider the “line” 1 y = n x and map the parameter n on each pair x ; y of x 2 + y 2 = 1 solutions over p .
If a pair x 0 ; y 0 is the solution to the system (16) then x 0 ± 1 y 0 . There is a unique value of the n p parameter, for which the point x 0 ; y 0 lies on the “line” 1 y 0 = n x 0 and which constitutes
n = 1 y 0 x 0 .
At the same time, the following statement holds for any given value of n Z p :
1 y = n x ; x 2 + y 2 = 1 ; x y 0 ; 1 y = n x ; x 2 = 1 y 1 + y ; x y 0 ; 1 y = n x ; x 2 = n x 1 + y ; x y 0 ; 1 y = n x ; 1 + y = 1 n x ; n 0 ; x y 0 .
Since 2 = x n 2 + 1 n 0 , then x = 2 n n 2 + 1 and y = 1 n 2 n 2 + 1 , where n 2 + 1 0 , n 0 , n ± 1 .
Remark 3. 
The sets 3 \ 0 ; ± 1 = and 5 \ 0 ; ± 1 ; n 2 + 1 = 0 = .
Therefore, if the pair of numbers x ; y is the solution to the system (16), then p 7 is always true and there exist n p \ 0 ; ± 1 , n 2 + 1 0 , such that x = 2 n n 2 + 1 ; y = 1 n 2 n 2 + 1 . . By substituting the values x ; y into the equation x 2 + y 2 = 1 , we obtain 2 n n 2 + 1 2 + 1 n 2 n 2 + 1 2 = 1 . Multiplying the latter equation by n 2 + 1 n 2 , we rewrite Equations (15) and (16) in p for p 7 as one equation, as follows:
2 2 + n 1 n 2 = n + 1 n 2 .
Remark 4. 
Let f and g be quadratic residues in p . In this case, the Equation (14) q 2 + r 2 = t 2 for q = 2 takes the following notation: 2 2 + f = g .
Corollary 5. 
Since Equations (14) and (18) are equivalent for q r 0 and n 1 n 0 , equation 2 2 + f = g , where f 0 and g denotes quadratic residues in p , p 7 , is only feasible if f = n 1 n 2 and g = n + 1 n 2 , where n p \ 0 ; ± 1 .
Next, consider function f n = n 1 n 2 for n p \ 0 ; ± 1 , p 7 . It is evident that in p , the roots of this function are represented by solutions to the equation n 2 1 = 0 , i.e., n = ± 1 , whereas there exist no roots in p \ 0 ; ± 1 .
Remark 5. 
Function f n = n 1 n 2 for n p \ 0 ; ± 1 , p 7 , acquires each of its values f n 4 in p precisely 4 times. The function acquires the value f n = 4 in p twice for p = 4 l + 1 , and never for p = 4 l + 3 .
Proof of Remark 5. 
Let f n 0 = n 0 1 n 0 2 . Now, it is necessary to find all n , for which f n = n 1 n 2 = f n 0 = n 0 1 n 0 2 . It follows from the latter expression that n 1 n 2 n 0 1 n 0 2 = n n 0 + n n 0 n n 0 n + n 0 n + n 0 n n 0 = 0 .
The solution to the latter equation is the set n n 0 1 + 1 n n 0 = 0 ; n + n 0 1 1 n n 0 = 0 or n = ± n 0 ; n = ± 1 n 0 .
Thus, for the arguments n n 0 ; n 0 ; 1 n 0 ; 1 n 0 , the function f n = n 1 n 2 repeats its values: f n 0 = f n 0 = f 1 n 0 = f 1 n 0 . For the remaining argument values n n 0 ; n 0 ; 1 n 0 ; 1 n 0 : f n f n 0 .
Let us now consider the question of the number of distinct elements of the set n ; n ; 1 n ; 1 n in p \ 0 ; ± 1 .
Since n 0 : n = n ; n = 1 n 1 n = 1 n ; n = 1 n n = ± 1 , the solution requires to solve the system n = 1 n ; n = 1 n or n 2 = 1 .
The final equation in p has solutions only for p = 4 l + 1 [30] (see Case 2 for q r 0 ; t = 0 ). Let the solutions have the notation ± n 0 . From the foregoing, it is evident that f ± n 0 = n 0 1 n 0 2 = n 0 2 1 2 n 0 2 = 1 1 2 1 = 4 . □
Example 3. 
Consider the distribution of function f n = n 1 n 2 values for n p \ 0 ; ± 1 , p = 4 l + 1 = 13 , and p = 4 l + 3 = 11 , by performing a direct calculation of f n . Table 1 and Table 2 present the results.
The results provide an illustration for Remark 5:
  • The function f n acquires each its value f n 4 in p precisely 4 times for n p \ 0 ; ± 1 ;
  • The function f n acquires the value f n = 4 in p twice for p = 4 l + 1 = 13 , and never for p = 4 l + 3 = 11 .
Remark 6. 
The number of distinct values of the function f n = n 1 n 2 for n p \ 0 ; ± 1 , p 7 , is equal to the number l = p 1 4 , where x is the floor function of x .
Proof of Remark 6. 
Let k be a number of distinct values of the function f n 4 for n p \ 0 ; ± 1 . Then, by Remark 5, the upper bound estimation for the number of distinct values of the argument of the function f n = n 1 n 2 , n p \ 0 ; ± 1 , is 2 + 4 k p 3 ,   i f   p = 4 l + 1 ; 4 k p 3 ,   i f   p = 4 l + 3 or k l 1 ,   i f   p = 4 l + 1 ; k l ,   i f   p = 4 l + 3 .
We shall denote elements from p \ 0 ; ± 1 by n j 1 , n j 2 , n j 3 , n j 4 , 1 j k , for which the values are f n j 1 = f n j 2 = f n j 3 = f n j 4 = f j 4 .
Since k is the number of distinct values of f n 4 for n p \ 0 ; ± 1 , j = 1 k n j 1 , n j 2 , n j 3 , n j 4 ± n 0 : f ± n 0 = 4 = p \ 0 ; ± 1   i f   p = 4 l + 1 ; j = 1 k n j 1 , n j 2 , n j 3 , n j 4 = p \ 0 ; ± 1   i f   p = 4 l + 3 .
It follows that k = l 1 ,   i f   p = 4 l + 1 ; k = l ,   i f   p = 4 l + 3 , and the number of distinct values of the function f n = n 1 n 2 , n p \ 0 ; ± 1 , constitutes k + 1 = l ,   i f   p = 4 l + 1 ; k = l ,   i f   p = 4 l + 3 , whereas l = p 1 4 . □
Corollary 6. 
Out of p 1 2 nonzero quadratic residues in p , p 7 , precisely l = p 1 4 residues can be presented as n 1 n 2 , n p \ 0 ; ± 1 . Note that p 1 2 = 2 l ,   i f   p = 4 l + 1 ; 2 l + 1 ,   i f   p = 4 l + 3 .
Corollary 7. 
Let f alternately take on the values of all nonzero quadratic residues in p , p 7 . Then, the sum 2 2 + f = g is a nonzero quadratic residue exactly l 1 = p 1 4 1 times for p = 4 l + 1 and l = p 1 4 times for p = 4 l + 3 . The sum 2 2 + f = g is a quadratic non-residue exactly l times for p = 4 l + 1 and l + 1 times for p = 4 l + 3 .
To prove Corollary 7, it is sufficient to apply Equation (18) and Corollaries 5 and 6, taking into account that the sum g becomes zero when g = n + 1 n 2 or n 2 = 1 . While proving Remark 5, it was shown that n 2 = 1 has solutions ± n 0 only for p = 4 l + 1 , and f ± n 0 = ± n 0 1 ± n 0 2 = 4 . Hence, f = 4 decreases by 1 times the number of nonzero quadratic residues f , which form a nonzero quadratic residue by the sum 2 2 + f = g .
Based on the solved cases for Equation (14), we formulate the theorem.
Theorem 1. 
The following holds true:
Let h be a nonzero quadratic residue in p , and let f take on all nonzero quadratic residues in p . Then the sum h + f = g is a quadratic residue exactly l times and is a quadratic non-residue l times for a prime p = 4 l + 1 and l + 1 times for a prime p = 4 l + 3 .
Let h be a quadratic non-residue in p , and let f take on all quadratic residues in p . Then the sum h + f = g is a quadratic residue exactly l + 1 times and is a quadratic non-residue l 1 times for a prime p = 4 l + 1 and l times for a prime p = 4 l + 3 .
Proof of Theorem 1. 
In clause 1 of the theorem, consider cases p = 3 and p = 5 separately.
For p = 3 = 4 · 0 + 3 , the value l = 0 .
For u 3 = 0 ; 1 ; 2 , the value u 2 0 ; 1 . Then h = f = 1 and g = 1 + 1 = 2 u 2 3
Thus, the value g = h + f acquires the following:
  • A quadratic residue—zero times, 0 = l ;
  • A quadratic non-residue—one time, 1 = l + 1 .
The value l = 1 for p = 5 = 4 · 1 + 1 . For u 5 = 0 ; 1 ; 2 ; 3 ; 4 , u 2 0 ; 1 ; 4 .
The value of the sum g = h + f for a fixed h is once a quadratic residue and once a quadratic non-residue, i.e., 1 = l .
Now consider the case of prime p 7 in clause 1 of the theorem.
Let Q R , Q N R be sets of quadratic residues and non-residues in p , respectively. We shall operate with the notation of Corollary 7: f 0 , f , g Q R , 2 2 + f = g . For arbitrary u p , u 0 , the sets are u 2 · Q R Q R , u 2 · Q N R Q N R , while 2 2 · 1 , 2 , , p 1 1 , 2 , , p 1 . Thus, 2 2 · u 2 Q R \ 0 . Let residues f · u 2 take the values of all nonzero quadratic residues in p for a given quadratic residue h = 2 2 · u 2 in the equality 2 2 · u 2 + f · u 2 = g · u 2 . Therefore, clause 1 of Theorem 1 follows from Corollary 7 and Corollary 3.
In clause 2, we shall first consider cases for p = 3 and p = 5 .
For v u 2 3 the value v = 2 and l = 3 / 4 = 0 . Consequently, h = f = 2 and g = 2 + 2 = 1 2 .
The value of the sum g acquires the following:
  • A quadratic residue—one time, 1 = l + 1 ;
  • A quadratic non-residue—zero times, 0 = l .
For v u 2 5 , the value v 2 ; 3 . The values l = 5 / 4 = 1 and g for a fixed h acquire the following:
  • A quadratic residue—two times, 2 = l + 1 ;
  • A quadratic non-residue—zero times, 0 = l 1 .
Next, we consider the case with prime p 7 in clause 2.
Now, let f acquire those nonzero values of quadratic residues in p , for which the sum 2 2 + f = g is a quadratic non-residue according to Corollary 7.
For an arbitrary quadratic non-residue u Q N R p , the following equality holds: 2 2 · u + f · u = g · u 0 .
From the multiplicative property of the Legendre symbol, the sets u · Q R = Q N R and u · Q N R = Q R (see Corollary 2, Chapter 5, §1 [30]).
Let a fixed quadratic non-residue h = 2 2 · u be given, and let the quadratic non-residue f · u take all values from the set Q N R .
According to Corollary 7, for a prime p = 4 l + 1 , the sum 2 2 + f results in a quadratic non-residue g exactly l times, while for p = 4 l + 3 , it occurs l + 1 times. Consequently, the sum 2 2 + f · u = h + f · u = g · u for a prime p = 4 l + 1 yields a quadratic residue g · u 0 exactly l times, and for p = 4 l + 3 , it occurs l + 1 times. Taking into account Corollary 4 regarding the symmetry property of the distribution of quadratic residues and non-residues in an ordered set of residues modulo a prime p = 4 l + 1 , we deduce that the value f · u = p h is also a quadratic non-residue for a given quadratic non-residue h . Thus, the following statement holds: the sum g · u = h + f · u of a quadratic non-residue h with all possible quadratic non-residues f · u in p results in a quadratic residue exactly l + 1 times.
To complete the proof of the second clause of the theorem, recall that for p = 4 l + 1 in p , there exist 2 l quadratic non-residues f , while for p = 4 l + 3 , the number of such values f is 2 l + 1 . As demonstrated above, for a fixed non-residue h , the sum h + f = g is a residue exactly l + 1 times in p . Therefore, the sum h + f = g is a quadratic non-residue 2 l l + 1 = l 1 times for p = 4 l + 1 and 2 l + 1 l + 1 = l times for p = 4 l + 3 .
Theorem 1 is proven. □
Theorem 2. 
Let h be a nonzero quadratic residue (non-residue), and f acquires all possible quadratic non-residues (nonzero residues) in p . Therefore, the sum h + f = g is
  • l times quadratic residue and non-residue for a prime p = 4 l + 1 ;
  • l + 1 times quadratic residue and l times quadratic non-residue for a prime p = 4 l + 3 .
Proof of Theorem 2. 
First, consider cases where p = 3 and p = 5 .
For 3 , the value l = 3 / 4 = 0 , quadratic residue is h = 1 , and quadratic non-residue is f = 2 . Thus, g = h + f results in a quadratic residue once 1 = l + 1 , and in a quadratic non-residue zero times, 0 = l .
For 5 , the value l = 5 / 4 = 1 , quadratic residues h 1 ; 4 , and quadratic non-residues f 2 ; 3 . The value g for a fixed h is a quadratic residue once and a quadratic non-residue once, i.e., 1 = l .
Now we consider a case of prime p 7 .
Let h 0 and f 1 ; 2 ; ; p 1 . The possible values of the sum h + f = g form a set F h = 0 ; 1 ; 2 ; ; p 1 \ h .
Let the prime p = 4 l + 1 .
If h 0 is a quadratic residue, F h has 2 l quadratic residues and quadratic non-residues.
According to clause 1 of Theorem 1, for quadratic residues f 0 , the value of g = h + f becomes a quadratic residue exactly l times and a quadratic non-residue l times. In accordance with Corollary 4, g = h + f 0 for quadratic non-residues f . Therefore, by Dirichlet’s principle, the value of g in the set F h for 2 · l quadratic non-residues f becomes a quadratic residue exactly 2 · l l = l times and a quadratic non-residue 2 · l l = l times.
If h is a quadratic non-residue, then in F h , there exist 2 l + 1 quadratic residues and 2 l 1 quadratic non-residues.
According to clause 2 of Theorem 1, for quadratic non-residues f , the value g = h + f becomes a quadratic residue exactly l + 1 times and a quadratic non-residue l 1 times. Thus, summing a quadratic non-residue h sequentially with 2 · l quadratic residues f 0 , the sum g = h + f will be a quadratic residue 2 · l + 1 l + 1 = l times and a quadratic non-residue 2 · l 1 l 1 = l times.
Now, consider the case when the prime p = 4 l + 3 .
If h 0 is a quadratic residue, then in F h , there are equal numbers of quadratic residues and non-residues, both being 2 l + 1 .
According to clause 1 of Theorem 1, the sum g = h + f for quadratic residues f 0 becomes a quadratic residue l times and a quadratic non-residue l + 1 times. Consequently, for 2 · l quadratic non-residues f , the sum g = h + f is a quadratic residue 2 · l + 1 l = l + 1 times and a quadratic non-residue 2 · l + 1 l + 1 = l times.
If h is a quadratic non-residue, then in F h , there are exactly 2 l + 2 quadratic residues and 2 l non-residues. According to clause 2 of Theorem 1, the sum for quadratic non-residues f is a quadratic residue l + 1 times and a quadratic non-residue l times. Consequently, for 2 · l + 1 quadratic residues f 0 , the sum g = h + f becomes a quadratic residue 2 · l + 2 l + 1 = l + 1 times and a quadratic non-residue 2 · l l = l times.
Thus, Theorem 2 is proven. □
To summarize Theorems 1 and 2, Table 3 and Table 4 will demonstrate how the numbers of quadratic residues and non-residues are distributed for the sums q r \ 0 + Q R \ 0 , q n r + Q N R , and q r \ 0 + Q N R , when the first term is fixed (it is denoted by lowercase letters), and the second term acquires all possible values from the definition set, for prime p = 4 l + 1 and p = 4 l + 3 .
Table 3 and Table 4 are some analogues of Formula (17). According to the proof of Theorem 1 and 2 using relation (18), a regularity is established for the sum of two nonzero elements from p , which can be either quadratic residue or non-residue.
Here, consider examples for p = 4 l + 1 and p = 4 l + 3 .
Example 4. 
Let us construct possible combinations Q R \ 0 + Q R \ 0 , Q N R + Q N R , and Q R \ 0 + Q N R , and determine the frequency with which values of the sets Q R and Q N R occur in these sums.
(a) p = 4 l + 1 .
Let p = 4 l + 1 = 4 · 4 + 1 = 17 .
For p = 17 , nonzero quadratic residues are 1 ; 2 ; 4 ; 8 ; 9 ; 13 ; 15 ; 16 . Accordingly, quadratic non-residues are 3 ; 5 ; 6 ; 7 ; 10 ; 11 ; 12 ; 14 .
The possible sums Q R \ 0 + Q R \ 0 , Q N R + Q N R , and Q R \ 0 + Q N R will be summarized in Table 5, Table 6 and Table 7.
Grey shading in Table 5, Table 6 and Table 7 highlights the cases when the sum is a quadratic residue in 17 .
The obtained result corroborates Theorems 1 and 2 as follows:
Each row (column) of Table 5 contains exactly l = 4 quadratic residues and l = 4 quadratic non-residues.
Each row (column) of Table 6 contains exactly l + 1 = 5 quadratic residues and l 1 = 3 quadratic non-residues.
Each row (column) of Table 7 contains exactly l = 4 quadratic residues and l = 4 quadratic non-residues. (b) p = 4 l + 3 .
Let  p = 4 l + 3 = 4 · 4 + 3 = 19 .
For  p = 19 , nonzero quadratic residues are  1 ; 4 ; 5 ; 6 ; 7 ; 9 ; 11 ; 16 ; 17 . Accordingly, quadratic non-residues are  2 ; 3 ; 8 ; 10 ; 12 ; 13 ; 14 ; 15 ; 18 .
The possible sums  Q R \ 0 + Q R \ 0 ,  Q N R + Q N R , and  Q R \ 0 + Q N R  will be totaled up in Table 8, Table 9 and Table 10.
In Table 8, Table 9 and Table 10, cases where the sum is a quadratic residue in 19 are highlighted in grey.
The obtained result also illustrates Theorems 1 and 2:
Each row (column) of Table 8 contains exactly l = 4 quadratic residues and l + 1 = 5 quadratic non-residues.
Each row (column) of Table 9 contains exactly l + 1 = 5 quadratic residues and l = 4 quadratic non-residues.
Each row (column) of Table 10 contains exactly l + 1 = 5 quadratic residues and l = 4 quadratic non-residues.
Remark 7. 
Matrix A acquires maximum order o r d A if and only if r 4 is a primitive element in p .
Proof of Remark 7. 
From relation (4), o r d A acquires maximum value if and only if Δ a is primitive in p with order p 1 .
Note that Δ a = λ 1 λ 2 = a a + k b . Since b = q k 2 4 , we obtain Δ a = a a + k b = 2 a + k 2 q 4 . Considering expression (12) 2 a + k 2 = q + r , the value Δ a = r 4 . □
The previous example proves that Remark 7 is correct.
Remark 8. 
Since the mapping Q N R 4 is a transformation of the set Q N R : Q N R 4 = Q N R , the value of r for the maximum order o r d A is computed by multiplying the primitive elements p by 4.
Remark 9. 
The order o r d A is determined by the pair of values q ; r for arbitrary k p , b = q k 2 4 , and a p : 2 a + k 2 = q + r .
Proof of Remark 9. 
The characteristic equation of matrix A = a 1 b a + k has the form λ 2 2 a + k λ + Δ a = 0 . Since, according to (12), 2 a + k 2 = q + r and Δ a = r 4 , the characteristic equation can be rewritten as λ 2 q + r 1 2 λ + 4 1 r = 0 . Thus, the eigenvalues λ 1 , 2 of matrix A depend solely on the values of q and r .
Given that o r d A values determine the eigenvalues λ 1 , 2 of matrix A , as well as the value of Δ a = r 4 , the selection of k does not affect o r d A . □

3. Results

The theoretical basis developed in the previous section allows us to create a method for selecting parameters b and k of the matrix field F b , k and a primitive element in it.
We first consider the case where the prime p is a Mersenne number or 3 p + 1 2 = ρ is a prime number.

3.1. A Special Important Case of the Method for Selecting Parameters b and k of the Matrix Field F b , k and a Primitive Element in It, When p Is a Mersenne Number or 3 p + 1 2 = ρ Is a Prime

According to Remark 4 in [17], matrix A = a 1 b a + k with a k 2 will be a primitive element of the matrix field F b , k if and only if its determinant det A = Δ a is a primitive element in the field p .
Therefore, the method for selecting the parameters b and k of the matrix field F b , k , as well as a primitive element in it, will include the following five steps:
  • Find the primitive root σ 0 in p and select the primitive element σ in p : σ = σ 0 i , G C F i , p 1 = 1 ; assign the value r = 4 σ , i.e., choose Δ a = σ ;
  • For the 2 a + k = y p * value, i.e., y = 1 , 2 , , p 1 , calculate q = y 2 4 σ ;
  • Using the law of quadratic reciprocity [30], verify whether the value q is a quadratic non-residue in p : according to the definition of the Legendre symbol, verify the equality as follows:
    q p = 1 or   y 2 4 σ p = 1 ;
  • For solution y 0 of Equation (19), and for an arbitrary value of parameter k p , compute the parameters as follows:
    q 0 = y 0 2 4 σ ,   b 0 = q 0 k 2 4 ,   a 0 = y 0 k 2 ;
  • Matrix
    A k = a 0 1 b 0 a 0 + k = y 0 k 2 1 y 0 2 k 2 4 σ 4 y 0 + k 2
    is a primitive element F b , k for every k p .
Recall that the law of quadratic reciprocity has the following formulation in terms of Legendre symbols: q p = 1 p 1 2 · q 1 2 · p q for two distinct odd prime numbers p and q . Moreover, 1 p = 1 p 1 2 and 2 p = 1 p 2 1 8 .
Remark 10. 
The number N q σ of Equation (19) solutions with respect to y for the given primitive element σ p is estimated as follows:
p 4 N q σ p 4 + 1 .
Proof of Remark 10. 
The primitive element σ p is obviously a quadratic non-residue, otherwise all elements p would be quadratic residues (see also (10)). Therefore, the value of Legendre symbol is 4 σ p = 1 p · 2 2 p · σ p = 1 p 1 2 · 1 · 1 = 1 p + 1 2 .
Thus, element 4 σ is a non-residue for p = 4 l + 1 and a residue for p = 4 l + 3 . Hence, by virtue of Theorem 2 and clause 1 of Theorem 1, it follows that
  • The sum 4 σ + y 2 of the element 4 σ as a quadratic non-residue for p = 4 l + 1 with all nonzero quadratic residues y 2 from p * will be a non-residue exactly l = p / 4 times;
  • The sum 4 σ + y 2 of the element 4 σ as a quadratic residue for p = 4 l + 3 with all nonzero quadratic residues y 2 will be a non-residue in p exactly l + 1 times. □
Algorithm 1 is used for selecting parameters b and k of the field F b , k and the primitive element in it.
Algorithm 1. The algorithm for selecting parameters b and k of the field F b , k and the primitive element in it for prime p = 2 m 1 or prime p + 1 2 3 .
  • Set prime p : p = 2 m 1 or 3 p + 1 2 = ρ is a prime
  • Factorize p 1 , find the primitive root σ 0 in p
  • σ σ 0 i , G C F i , p 1 = 1
  • r 4 σ
  • for  y = 1 to p 1
  •      q y 2 4 σ
  •     if  q p = 1  then
  •        y 0 y
  •       break
  •     end if
  • end for
  • q 0 y 0 2 4 σ
  • b 0 q 0 k 2 4
  • a 0 y 0 k 2
  • A k y 0 k 2 1 y 0 2 k 2 4 σ 4 y 0 + k 2 , k p
Let us estimate the time complexity of this algorithm.
To do this, we will use well-known estimates of the complexity of operations in a finite field [21,34,35,36].
In addition, the results presented in Table 3 and Table 4 play a significant role for estimating the predicted time for constructing the matrix field and finding the primitive element of this field. They show that by arbitrarily choosing a quadratic residue or non-residue on the interval 0 ; p and adding it to a predetermined residue or non-residue, we obtain a non-residue (residue) with a probability close to 0.5 (for large p ).
Therefore,
  • The complexity of the probabilistic algorithm for calculating the primitive root modulo p for a given factorization of p 1 is equal to O log 2 p ;
  • The complexity of factoring a number into prime factors using the fast general number field sieve (GNFS) method [37] is equal to L p 1 3 , 64 9 3 = O exp 64 9 3 + o 1 log p 1 3 log log p 2 3 ;
  • The complexity of finding the inverse element in p is equal to O log p ;
  • The complexity of finding the Legendre symbol is equal to O log p ;
The predicted time of the algorithm (number of arithmetic operations) in Algorithm 1 is L p 1 3 , 64 9 3 + O log 2 p + O log p + O log p = L p 1 3 , 64 9 3 .
Example 5. 
Let p = 2 5 1 = 31 . Thus,
  • Let σ = 3 be the smallest primitive root.
  • Let y = 1 , hence q = 1 4 · 3 = 11 = 20 ;
  • q p = 20 31 = 2 2 · 5 31 = 2 31 2 · 5 31 = 1 · 1 30 2 · 4 2 · 31 5 = 1 5 = 1 . We return to Step 2 of the proposed method.
  • Let y = 2 , hence q = 2 2 4 · 3 = 8 .
  • q p = 2 3 31 = 1 31 · 2 31 3 = 1 30 2 · 1 30 · 32 8 = 1 . Therefore, select y = 2 as a solution to Equation (19).
  • Based on (20), the parameters are calculated as q 0 = 8 = 23 , b 0 = 23 k 2 4 , and a 0 = 2 k 2 .
  • Matrix A k = 2 k 2 1 23 k 2 4 2 + k 2 is a primitive element of the matrix field F b 0 , k for every k 31 . For example, for k = 12 , value A 12 = 26 1 24 7 is a primitive element of the matrix field F 24 , 12 of order F 24 , 12 = p 2 = 31 2 .
Example 6. 
Let p = 61 , and let 3 p + 1 2 = 31 be a prime. Thus:
  • σ = 2 is the smallest primitive root.
  • Let y = 1 , thus q = 1 4 · 2 = 7 = 54 .
  • Calculate q p = 54 61 = 2 61 · 3 61 3 = 1 60 · 62 8 · 1 30 2 · 2 2 · 61 3 = 1 · 1 · 1 3 = 1 . We return to Step 2 of the method.
  • Let y = 2 , thus q = 2 2 4 · 2 = 4 .
  • q p = 2 2 61 = 1 . We return to Step 2 of the method.
  • Let y = 3 , then q = 3 2 4 · 2 = 1 .
  • q p = 1 61 = 1 . We return to Step 2 of the method.
  • Let y = 4 , thus q = 4 2 4 · 2 = 8 .
  • q p = 2 3 61 = 1 . Hence, select y = 4 as a solution to Equation (19).
  • In accordance with (20), q 0 = 8 , b 0 = 8 k 2 4 , a 0 = 4 k 2 .
  • Matrix A k = 4 k 2 1 8 k 2 4 4 + k 2 is a primitive element of the matrix field F b 0 , k for every k 61 . In particular, value A 5 = 30 1 11 35 is a primitive element for the matrix field F 11 , 5 of order F 11 , 5 = p 2 = 61 2 .
Definition 3. 
Counting function N q of non-residues is a number of different values of non-residues q p that the function q = y 2 4 σ takes for different y ± 1 ; ± 2 ; ; ± p 1 2 and primitive elements σ p (see (20)).
Definition 4. 
Frequency n q of non-residue q p as a value of the function q = y 2 4 σ denotes a number of different values of primitive elements σ p , which result in this non-residue.
Definition 5. 
Multiplicity κ q of non-residue q p as a value of the function q = y 2 4 σ denotes a number of different values of y ± 1 ; ± 2 ; ; ± p 1 2 , which result in this non-residue.
Here we introduce notation N b , k for the number of distinct pairs of parameters b ; k selected by the proposed method and set all matrix fields F b , k over p . Based on Formula (20), the parameter b = q k 2 / 4 . For a fixed parameter k , function f = q k 2 is a bijection with respect to argument q . Therefore, according to Definition 3, number N b , k settles the equality N b , k = N q · p , where N q p 1 / 2 .
By Remark 10, among the values of function q = y 2 4 σ , for each primitive element σ p , there are at least l = p / 4 quadratic non-residues. Therefore, from estimate (21) it follows that N q N q σ p / 4 .
Remark 11. 
If prime p is a Mersenne prime or 3 p + 1 / 2 = ρ is a prime, then the cardinality of the family F b , k of the finite matrix fields over p constructed by the proposed method, satisfies the following equation:
p 4 · p F b , k = N q · p p 1 2 · p .
In accordance with (20), parameter a = y k / 2 . Thus, for non-residue q as a value of the function q = y 2 4 σ , multiplicity κ q indicates the number of primitive elements in the matrix field F b , k of form A k = a 1 b a + k .
By Theorem 5 in [17] (see Equation (3)), there exist exactly φ p + 1 matrices A k , k p , that generate primitive elements in the field F b , k . Therefore, for multiplicity κ q , the following inequality holds:
κ q φ p + 1 .
If for a fixed value y 2 p of the quadratic residue, the values of the function q = y 2 4 σ coincide for primitive elements σ 1 , σ 2 from p , then σ 1 = σ 2 is true. Thus, the frequency n q of the non-residue q p is equal to the number of distinct quadratic residues y 2 that set this q as the function value. Equality y 2 = z 2 in p holds if and only if z = ± y . Hence, each non-residue q p for y 0 can be a value of the function q = y 2 4 σ for a fixed primitive σ p only for two values of ± y ± 1 ; ± 2 ; ; ± p 1 / 2 . Thus, the following statements are obtained.
Remark 12. 
Multiplicity κ q of non-residue q p as a value of the function q = y 2 4 σ equals double the frequency n q , i.e.,
κ q = 2 n q .
Corollary 8. 
Multiplicity κ q of quadratic non-residue q p is equal to the number of distinct pairs y ; σ , for which q = y 2 4 σ .
Corollary 9. 
To calculate the counting function N q of non-residues q p and frequency values n q (as well as multiplicities κ q according to (24)), it is sufficient to explore the set of values of the function q = y 2 4 σ for y 1 ; 2 ; ; p 1 2 , σ p .
Example 7. 
Let the prime number p = 37 . Then p + 1 / 2 = 19 is also a prime number.
To describe the family of finite fields F b , k over 37 , we define all possible pairs of parameters b ; k . We also note all primitive elements A k in matrix fields F b , k of form a 1 b a + k .
The smallest primitive root in 37 is σ 0 = 2 , and the number of all primitive elements in the field 37 is φ p 1 = 12 . The set of all primitive elements 37 is = 2 j : j , 36 = 1 = 2 ; 32 ; 17 ; 13 ; 15 ; 18 ; 35 ; 5 ; 20 ; 24 ; 22 ; 19 . Number the elements of set in sequential order: = σ i : 1 i 12 = 2 ; 32 ; 17 ; 13 ; 15 ; 18 ; 35 ; 5 ; 20 ; 24 ; 22 ; 19 . Then the set of 4 σ i values builds a set 4 σ i : 1 i 12 = 8 ; 17 ; 31 ; 15 ; 23 ; 35 ; 29 ; 20 ; 6 ; 22 ; 14 ; 2 .
In Formula (20), element q y i = y 2 4 σ i must be a non-residue in 37 (to satisfy Equation (19). Squares y 2 , 1 y 18 , set all the residues in 37 .
According to Corollary 9, we will compute q y i values, 1 y 18 , 1 i 12 , and build Table 11.
Each column for 4 σ i of Table 11 contains a non-residue for values q y i exactly l = 9 times p = 4 · 9 + 1 . This corresponds exactly to Remark 10.
Let us calculate the values of the function N q and frequency n q for non-residues q 37 as function q = y 2 4 σ values. As per Corollary 9, we will compile Table 12 for possible values y , 1 y 18 , respective to all quadratic residues q 2 ; 5 ; 6 ; 8 ; 13 ; 14 ; 15 ; 17 ; 18 ; 19 ; 20 ; 22 ; 23 ; 24 ; 29 ; 31 ; 32 ; 35 37 and primitive elements σ i 2 ; 32 ; 17 ; 13 ; 15 ; 18 ; 35 ; 5 ; 20 ; 24 ; 22 ; 19 37 .
Each of the 13 quadratic non-residues q 37 is a solution for system (20), which determines the corresponding parameter b = q k 2 4 value for a given parameter k 37 . Therefore, N q = 18 for p = 37 .
The cardinality of the matrix field family is F b , k = 18 · 37 . This satisfies the equality F b , k = p 1 2 · p , which indicates that the upper bound established in (22) is attainable.
In the matrix field F b , k there exist exactly κ q primitive elements of the form A k = a 1 b a + k . According to estimate (23), the multiplicity κ q φ 38 = 18 . Based on Formula (24) in Example 7, we obtain the following:
  • For q 2 ; 6 ; 8 ; 14 ; 15 ; 17 ; 20 ; 22 ; 23 ; 29 ; 31 ; 35 , there are exactly 2 · 5 = 10 of such matrices;
  • For q 5 ; 13 ; 18 ; 19 ; 24 ; 32 there are exactly 2 · 8 = 16 of such matrices.
Specifically, for q = 2 , the field F b , k with parameter b = 2 k 2 4 has 10 primitive elements A y k = y k 2 1 2 k 2 4 y + k 2 , y ± 11 ; ± 12 ; ± 5 ; ± 4 ; ± 2 , namely, A 11 k = ± 11 k 2 1 2 k 2 4 ± 11 + k 2 , A 12 k = ± 12 k 2 1 2 k 2 4 ± 12 + k 2 , A 5 k = ± 5 k 2 1 2 k 2 4 ± 5 + k 2 , A 4 k = ± 4 k 2 1 2 k 2 4 ± 4 + k 2 , and A 2 k = ± 2 k 2 1 2 k 2 4 ± 2 + k 2 .

3.2. General Case of the Method for Selecting Parameters b and k of the Matrix Field F b , k and a Primitive Element in It

For a general case, when the prime number p is not a Mersenne number p 2 m 1 or 3 p + 1 2 = ρ is not a prime number, the method for selecting parameters b and k of the matrix field F b , k and a primitive element in it involves the following steps:
  • For a given prime p , arbitrarily choose quadratic non-residues q and r in p , such that r 4 is a primitive element in p , and q + r Q R \ 0 ;
  • Arbitrarily select a value for k p ;
  • Compute b = q k 2 4 p ;
  • Find the value of a p from the expression 2 a + k 2 = q + r ;
  • Check p e r i o d A = p + 1 .
We should note that the proposed method does not guarantee achieving the maximum order of the cyclic subgroup generated by matrix A , but it significantly reduces the search space for the matrix parameters.
To check the condition p e r i o d A = p + 1 , it is necessary to factor the number p + 1 and for a = 0 , 1 , , p 1 , to check the inequality A p + 1 n a s · E for all prime divisors of p + 1 , where s p , E is the identity matrix (see statement 1 of [17]).
For this case, Algorithm 2 is used for selecting parameters b and k of the field F b , k and searching for a primitive element in it.
Algorithm 2. The algorithm for selecting parameters b and k of the field F b , k and searching for a primitive element in it for arbitrary prime p .
  • Set prime p , k p
  • Factorize p 1 , find r 4 as a primitive root in p , find quadratic non-residue q in p : q + r is a non-zero quadratic residue in p
  • b q k 2 4
  • Find a p : 2 a + k 2 = q + r
  • Factorize p + 1
  • for  a = 0 to p 1
  •      c h e c k s u c c e s s
  •     for  n p + 1   d e v i d e r s
  •       if  A p + 1 n a = s · E  then
  •          c h e c k f a i l
  •       end if
  •     end for
  •     if  c h e c k = s u c c e s s  then
  •        A a 1 b a + k
  •       break
  •     end if
  • end for
Using the above estimates of the complexity of field operations, the predicted time of the algorithm in Algorithm 2 is L p 1 3 , 64 9 3 + O log 2 p + O log p + O log p + O log p = L p 1 3 , 64 9 3 .
Example 8. 
Let us first assume p = 4 l + 1 .
Let p = 17 .
For p = 17 , nonzero quadratic residues are Q R \ 0 = 1 ; 2 ; 4 ; 8 ; 9 ; 13 ; 15 ; 16 . Consequently, quadratic non-residues are Q N R = 3 ; 5 ; 6 ; 7 ; 10 ; 11 ; 12 ; 14 .
Thus q 3 ; 5 ; 6 ; 7 ; 10 ; 11 ; 12 ; 14 .
Primitive elements in 17 from Q N R are 3 ; 5 ; 6 ; 7 ; 10 ; 11 ; 12 ; 14 . Thus r 3 ; 5 ; 6 ; 7 ; 10 ; 11 ; 12 ; 14 .
Table 13 provides information on the number of matrix A parameter sets: q , r 3 ; 5 ; 6 ; 7 ; 10 ; 11 ; 12 ; 14 , k 17 , and a 17 : 2 a + k 2 = q + r to achieve maximum order o r d A = p 2 1 . The data are grouped for pairs q ; r , and cases q + r Q R \ 0 are highlighted in grey.
The presence of zeros in Table 13 for certain pairs q ; r indicates that, for these parameter combinations, the matrix A cannot serve as a generator of a multiplicative cyclic group of maximal order p 2 1 . This is due to the fact that the developed method accounts for the basic case (11) Δ a = a a + k b t 2 p , but does not encompass the general condition (see Equation (10)).
It should be noted that, according to Fermat’s theorem [27], t p 1 0 ; 1 , while G C F p 2 , p 1 = G C F p 2 , 1 = 1 . Therefore, for p 5 Equation (10) is rewritten as Δ a t j p , 2 j p 3 , G C F j , p 1 1 .
For example, for q = 7 , r = 6 , and k = 0 , the value Δ a = a a + k b = 4 4 + 0 6 = 10 . On the other hand, 10 3 3 mod 17 , whence A 18 3 = 3 · E and A 18 = A 6 3 = 10 · E .
This example confirms the necessity but not the sufficiency of condition (11) for achieving the maximal order of matrix A . At the same time, as noted above, the proposed method significantly narrows the search space for matrix parameters compared to an exhaustive search.
The cardinality of the set of possible parameter values of matrix A = a 1 b a + k in 17 amounts to 32 pairs q ; r , whereas a complete brute-force search over parameters a , b , k 17 would require analyzing 17 3 = 4913 combinations. The probability of selecting the desired matrix A in 17 using the proposed method is 24 32 = 0.75 as opposed to 816 4913 0.166 in the case of a full enumeration.
Here we consider examples where p = 4 l + 3 .
Let p = 11 .
Nonzero quadratic residues are 1 ; 3 ; 4 ; 5 ; 9 . Therefore, quadratic non-residues are 2 ; 6 ; 7 ; 8 ; 10 .
Thus q 2 ; 6 ; 7 ; 8 ; 10 .
Primitive elements in 11 from Q N R are 2 ; 6 ; 7 ; 8 . Thus, r 2 ; 6 ; 8 ; 10 .
Table 14 presents information on the number of matrix A parameter sets: q 2 ; 6 ; 7 ; 8 ; 10 , r 2 ; 6 ; 8 ; 10 , k 11 , and a 11 : 2 a + k 2 = q + r to achieve maximum order o r d A = 11 2 1 . The data are grouped for pairs q ; r , and cases q + r Q R \ 0 are highlighted in grey.
The cardinality of the set of possible matrix A parameters values in 11 amounts to 12 pairs q ; r , whereas a complete brute-force search over parameters a , b , k 11 would require analyzing 11 3 = 1331 combinations. The probability of selecting the desired matrix A in 11 using the proposed method is 8 / 12 0.667 as opposed to 176 / 1331 0.132 in the case of a full enumeration.
Now let p = 19 .
Nonzero quadratic residues are 1 ; 4 ; 5 ; 6 ; 7 ; 9 ; 11 ; 16 ; 17 . Therefore, quadratic non-residues are 2 ; 3 ; 8 ; 10 ; 12 ; 13 ; 14 ; 15 ; 18 .
Thus  q 2 ; 3 ; 8 ; 10 ; 12 ; 13 ; 14 ; 15 ; 18 .
Primitive elements in 19 from Q N R are 2 ; 3 ; 10 ; 13 ; 14 ; 15 . Hence, r 2 ; 3 ; 8 ; 12 ; 14 ; 18 .
Table 15 summarizes information on the number of matrix A parameter sets: q 2 ; 3 ; 8 ; 10 ; 12 ; 13 ; 14 ; 15 ; 18 , r 2 ; 3 ; 8 ; 12 ; 14 ; 18 , k 19 , and a 19 : 2 a + k 2 = q + r to achieve maximum order o r d A = 19 2 1 . The data are grouped for pairs q ; r , and cases q + r Q R \ 0 are highlighted in grey.
The cardinality of the set of possible values for the matrix A parameters in 19 is 30 q ; r pairs, whereas an exhaustive search for parameters a , b , k 19 would require analyzing 19 3 = 6859 combinations. The probability of selecting the desired matrix A using the proposed method is 24 / 30 = 0.8 as compared to 912 / 6859 0.133 for complete enumeration.
Remark 13. 
The algorithm for selecting the parameters of the field F b , k and searching for a primitive element in it, considered in Section 3.2, does not guarantee achieving the maximum order of the cyclic subgroup generated by the matrix A as a special case of a primitive element of the form t · A = t · a 1 b a + k for t = 1 . At the same time, all φ p 2 1 primitive elements of the field F b , k over p for its given parameters are determined by expression (3). Taking into account the above algorithms, the method for selecting parameters b and k of the field F b , k from (2) for an arbitrary t , as well as selecting a primitive element in it, is as follows:
  • For a given prime p , arbitrarily choose a quadratic non-residual q in p ;
  • Arbitrarily choose k p ;
  • Calculate b = q k 2 4 p ;
  • Find a p : p e r i o d A a = p + 1 ;
  • Find t p \ 0 : t 2 r 4 is a primitive element in p ;
  • Matrix t · A = t · a 1 b a + k is a primitive element in F b , k (see Theorem 4 from [17]).
Note that to find t in point 5 of the presented method, the following procedure must be performed. Since the determinant det A = r 4 is a quadratic non-residue (see (2)), the values of det t A = t 2 r 4 form the entire set of non-residues in p for t = 1 , 2 , , p 1 . Therefore, in order to t 2 r 4 be a primitive element in p , it is necessary to factorize p 1 and for successive values t = 1 , 2 , , p 1 , check the inequalities t 2 r 4 p 1 m 1 mod p for all prime divisors of p 1 , until a primitive element t 2 r 4 in p is determined.
In this case, the algorithm for selecting parameters b and k of the field F b , k and the primitive element in it has form of the Algorithm 3.
Algorithm 3. The algorithm for selecting parameters b and k of the field F b , k and a primitive element in it for arbitrary t .
  • Set prime p , k p
  • Find quadratic non-residue q in p
  • b q k 2 4
  • Factorize p + 1
  • for  a = 0 to p 1
  •      c h e c k s u c c e s s
  •     for  n p + 1   d e v i d e r s
  •       if  A p + 1 n a = s · E  then
  •          c h e c k f a i l
  •       end if
  •     end for
  •     if  c h e c k = s u c c e s s  then
  •       break
  •     end if
  • end for
  • Factorize p 1
  • for  t = 1 to p 1
  •      c h e c k s u c c e s s
  •     for  m p 1   d e v i d e r s
  •       if  t 2 r 4 p 1 m = 1 mod p  then
  •          c h e c k f a i l
  •       end if
  •     end for
  •     if  c h e c k = s u c c e s s  then
  •       break
  •     end if
  • end for
  • A t · a 1 b a + k
The predicted time of Algorithm 3 for large p is determined by the factorization time of numbers p + 1 and p 1 and is equal to O log p + O log p + L p 1 3 , 64 9 3 + O log 2 p + L p 1 3 , 64 9 3 + O log 2 p = L p 1 3 , 64 9 3 .

4. Discussion

The findings of this study confirm the efficiency of the proposed method for selecting the parameters of finite matrix fields of order 2. The main advantage of this approach lies in the simultaneous determination of both the field parameters and its primitive elements. This method significantly simplifies the process for constructing cryptographically reliable systems based on finite fields.
The fundamental differences between the results of this study and those presented in the study [17] are as follows:
  • The approach to F b , k construction outlined in [17] was developed for scenarios with known parameters b and k when D = k 2 + 4 b u 2 p . In contrast, this study considers the case when b and k are not predefined.
  • The method described in [17] enables the identification of primitive elements of the form t j i · A j . On the other hand, the approach proposed in this study eliminates the need for selecting specific coefficients t j i p and allows for the direct specification of primitive elements in the form A k , where t = 1 . However, given that the algorithm does not guarantee achieving the maximum order of the cyclic subgroup generated by the matrix A for t = 1 and arbitrary p , Remark 13 extends the obtained approaches to the case of arbitrary p and t .
  • This study simultaneously determines both the parameters of the finite matrix field family and the set of its primitive elements as a function of a single parameter k .
In contrast to the findings described in the earlier study [17], which proposed to first determine the F b , k parameters and then to initiate a separate procedure to search for its primitive elements, the method proposed in this study eliminates this additional step. The present approach reduces computational overhead and enhances the efficiency of cryptographic algorithms. In particular, the process of identifying primitive elements has been simplified by utilizing the Legendre symbol instead of solving quadratic equations in the field. Consequently, the proposed method demonstrates high efficiency even for large values of the parameters b and k , which is crucial for modern cryptographic protocols where large field sizes are essential for attack resistance.
The increase in the complexity of discrete logarithms for cyclic groups in p and F b , k is due to the following. In p , some of the fastest discrete logarithm algorithms are the COS algorithm [22] and the number field sieve algorithm [38]. The complexity of the COS algorithm is L p 1 2 , 1 , and the complexity of the number field sieve algorithm is L p 1 3 , 1.902 . The cyclic group of the field F b , k from (2) is a special group of matrices and has order p 2 1 . In this case, we can use well-known algorithms for an arbitrary finite field to estimate the complexity of discrete logarithm algorithms. In particular, for F b , k , the index calculus algorithm [39] and El Gamal algorithm [23] have complexity L p 1 2 , c . However, the index calculus algorithm is efficient if p is small, and the El Gamal algorithm is applicable to G F p 2 and can be used in this research, but not for fields of higher-order matrices G F q , where q = p m , m > 2 . Then the complexity of the discrete logarithm algorithm can be estimated only as O q [40].
Considering the above, the logical continuation of the presented research is the creation of matrix fields of higher orders, in particular 3 × 3 and higher. At the same time, the results obtained in this work are of extreme importance, since they are basic and key for future research. The principles for constructing 2 × 2 matrix fields are the basis for constructing other fields.
Another important finding was the analysis of the number of possible parameter values that satisfy the condition of the cyclic subgroup’s maximum order. The obtained analytical estimates indicate that the family of such fields is sufficiently large, ensuring a broad selection of parameters for designing cryptographic systems with diverse characteristics.
It should be noted that modern communication technologies, including those applied in lightweight cryptography [41], have developed various alternative approaches to information representation. Specifically, such representations include arrays, vectors, trees, elliptic curve points [42,43], and permutations [44,45,46]. This diversity necessitates harmonizing data structures to facilitate integration of different methods within a unified system for information processing and transmission.
When utilizing a matrix field of the form t · a 1 b a + k , a bijective transformation of a field element into a permutation can be performed as follows. The notation (2) for the matrix field F b , k is equivalent to the following notation:
F b , k = x 1 x 2 b x 2 x 1 + k x 2 , x 1 , x 2 , a , b , k p , D = k 2 + 4 b u 2 p .
Thus, if x 2 0 , we obtain x 1 x 2 b x 2 x 1 + k x 2 = x 2 x 1 / x 2 1 b x 1 / x 2 + k . If x 2 = 0 , we obtain x 1 x 2 b x 2 x 1 + k x 2 = x 1 0 0 x 1 = x 1 · 1 0 0 1 .
Therefore, any matrix x 1 x 2 b x 2 x 1 + k x 2 in the field F b , k can be defined by the elements x 1 , x 2 p in its upper row. In turn, a pair of numbers x 1 ; x 2 can form a p -adic number x 2 · p + x 1 . This number can be easily transformed into a permutation by converting it into a factorial number. Consequently, it is possible to establish a bijection between the elements of the F b , k , represented in the notation (25), and permutations of the factorial code.
A separate issue is the estimation of the computational complexity of breaking the proposed scheme and its comparison with the estimates of existing methods. This will be the subject of a separate subsequent work.

5. Conclusions

This study has presented an efficient method for selecting parameters that ensure a commutative ring of 2 × 2 square matrices form a field over a given p . This method eliminates the need to separately search for a primitive element in a matrix field of order p 2 . Additionally, the procedure for solving a quadratic equation in the given field p has been replaced with a significantly faster computation using the Legendre symbol.
For an arbitrary prime p , the proposed method substantially narrows the search space for both the parameters of matrix fields F b , k and their primitive elements.
A particularly important case has been examined, involving prime numbers p that are either Mersenne primes, or 3 p + 1 2 = ρ is also a prime number. It has been demonstrated that such p values are particularly suitable for constructing matrix fields F b , k , while the cardinality of the family of finite matrix fields under these conditions is no less than a given threshold p 4 · p .
To develop this parameter selection method for finite fields of 2 × 2 square matrices and to construct primitive elements, the properties of the sum of quadratic residues and non-residues in p were thoroughly investigated. This aspect is crucial for ensuring the required statistical properties of the field.
The proposed approach to constructing a family of finite fields of 2 × 2 square matrices over p , along with their primitive elements, is universal and can be applied in various cryptographic protocols, including key agreement schemes and secure encryption algorithms. One example of this universality is the ability to establish a bijection between elements of the matrix field F b , k and permutations in factorial coding.
The obtained results have laid a foundation for further research aimed at optimizing cryptographic algorithms and developing new methods for constructing finite fields with predefined properties.

Author Contributions

Conceptualization, A.S. and E.F.; methodology, A.B., A.S., E.F., and V.K.; validation, A.S., E.F., V.K., and S.T.; formal analysis, A.B., V.K., O.A., and S.T.; investigation, S.T., A.S., V.K., and O.A.; resources, A.B., and E.F.; data curation, A.S., and E.F.; writing—original draft preparation, A.S., E.F., and O.A.; writing—review and editing, A.S., and E.F.; visualization, V.K., and O.A.; funding acquisition, A.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Science Committee of the Ministry of Science and Higher Education of the Republic of Kazakhstan, grant number AP23489168.

Data Availability Statement

All initial data will be provided upon request to the correspondent’s e-mail with appropriate justification.

Acknowledgments

The authors from Ukraine thank the Armed Forces of Ukraine for the opportunity to conduct the research.

Conflicts of Interest

Authors Alimzhan Baikenov, Emil Faure, Sakhybay Tynymbayev and Olga Abramkina were employed by the company Research & Development Systems LLC. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

References

  1. PKCS#1; RSA Cryptography Standard. RSA Laboratories: San Mateo, CA, USA, 2012.
  2. Aranha, D.F.; El Housni, Y.; Guillevic, A. A Survey of Elliptic Curves for Proof Systems. Des. Codes Cryptogr. 2023, 91, 3333–3378. [Google Scholar] [CrossRef]
  3. Wang, X.; Xu, G.; Yu, Y. Lattice-Based Cryptography: A Survey. Chin. Ann. Math. Ser. B 2023, 44, 945–960. [Google Scholar] [CrossRef]
  4. FIPS 197; Advanced Encryption Standard (AES). National Institute of Standards and Technology: Gaithersburg, MD, USA, 2001.
  5. Huang, H.; Li, C.; Deng, L. Public-Key Cryptography Based on Tropical Circular Matrices. Appl. Sci. 2022, 12, 7401. [Google Scholar] [CrossRef]
  6. Wang, X.; Gao, S. Image Encryption Algorithm for Synchronously Updating Boolean Networks Based on Matrix Semi-Tensor Product Theory. Inf. Sci. 2020, 507, 16–36. [Google Scholar] [CrossRef]
  7. Abu-Faraj, M.; Al-Hyari, A.; Alqadi, Z. A Complex Matrix Private Key to Enhance the Security Level of Image Cryptography. Symmetry 2022, 14, 664. [Google Scholar] [CrossRef]
  8. Xu, B.; She, X.; Jiang, L.; Zou, S.; Qiu, G.; Zhao, J. A 3D Discrete Memristor Hyperchaotic Map with Application in Dual-Channel Random Signal Generator. Chaos Solit. Fractals 2023, 173, 113661. [Google Scholar] [CrossRef]
  9. Gao, S.; Iu, H.H.-C.; Erkan, U.; Simsek, C.; Toktas, A.; Cao, Y.; Wu, R.; Mou, J.; Li, Q.; Wang, C. A 3D Memristive Cubic Map with Dual Discrete Memristors: Design, Implementation, and Application in Image Encryption. IEEE Trans. Circuits Syst. Video Technol. 2025, in press. [Google Scholar] [CrossRef]
  10. Gao, S.; Zhang, Z.; Iu, H.H.-C.; Ding, S.; Mou, J.; Erkan, U.; Toktas, A.; Li, Q.; Wang, C.; Cao, Y. A Parallel Color Image Encryption Algorithm Based on a 2D Logistic-Rulkov Neuron Map. IEEE Internet Things J. 2025, 12, 18115–18124. [Google Scholar] [CrossRef]
  11. Sysoienko, S.; Myronets, I.; Babenko, V. Practical Implementation Effectiveness of the Speed Increasing Method of Group Matrix Cryptographic Transformation. CEUR Workshop Proc. 2019, 2353, 402–412. [Google Scholar] [CrossRef]
  12. Rupa, C.; Greeshmanth; Shah, M.A. Novel Secure Data Protection Scheme Using Martino Homomorphic Encryption. J. Cloud Comput. 2023, 12, 47. [Google Scholar] [CrossRef]
  13. Jackson, J.; Perumal, R. A Secure Key Exchange Protocol for Industrial Internet of Things Based on Tropical Triad Matrix Semiring. Int. J. Inf. Technol. 2024, 17, 293–300. [Google Scholar] [CrossRef]
  14. Amutha, B.; Perumal, R. Public Key Exchange Protocols Based on Tropical Lower Circulant and Anti Circulant Matrices. MATH 2023, 8, 17307–17334. [Google Scholar] [CrossRef]
  15. Bartz, H.; Holzbaur, L.; Liu, H.; Puchinger, S.; Renner, J.; Wachter-Zeh, A. Rank-Metric Codes and Their Applications. Found. Trends Commun. Inf. Theory 2022, 19, 390–546. [Google Scholar] [CrossRef]
  16. Faure, E.; Shcherba, A.; Skutskyi, A.; Lavdanskyi, A. A Finite Field of Square Matrices of Order 2. CEUR Workshop Proc. 2023, 3550, 306–312. [Google Scholar]
  17. Shcherba, A.; Faure, E.; Vartiainen, T.; Khaliavka, V. Primitive Elements in the Finite Field of Square Matrices of Order 2 for Cryptographic Applications. In Information Technology for Education, Science, and Technics; Faure, E., Tryus, Y., Vartiainen, T., Danchenko, O., Bondarenko, M., Bazilo, C., Zaspa, G., Eds.; Lecture Notes on Data Engineering and Communications Technologies; Springer Nature: Cham, Switzerland, 2024; Volume 222, pp. 250–265. ISBN 978-3-031-71803-8. [Google Scholar]
  18. Shor, P.W. Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer. SIAM J. Comput. 1997, 26, 1484–1509. [Google Scholar] [CrossRef]
  19. Hhan, M.; Yamakawa, T.; Yun, A. Quantum Complexity for Discrete Logarithms and Related Problems. arXiv 2023, arXiv:2307.03065. [Google Scholar] [CrossRef]
  20. Hhan, M. A New Approach to Generic Lower Bounds: Classical/Quantum MDL, Quantum Factoring, and More. In Advances in Cryptology—Eurocrypt 2025; Fehr, S., Fouque, P.-A., Eds.; Lecture Notes in Computer Science; Springer Nature: Cham, Switzerland, 2025; Volume 15607, pp. 345–374. ISBN 978-3-031-91097-5. [Google Scholar]
  21. Schneier, B. Applied Cryptography: Protocols, Algorithms, and Source Code in C; 20th Anniversary Edition; Wiley: Indianapolis, IN, USA, 2015; ISBN 978-1-119-09672-6. [Google Scholar]
  22. Coppersmith, D.; Odlzyko, A.M.; Schroeppel, R. Discrete Logarithms inGF(p). Algorithmica 1986, 1, 1–15. [Google Scholar] [CrossRef]
  23. ElGamal, T. On Computing Logarithms Over Finite Fields. In Advances in Cryptology—CRYPTO ’85 Proceedings; Williams, H.C., Ed.; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 1986; Volume 218, pp. 396–402. ISBN 978-3-540-16463-0. [Google Scholar]
  24. Gantmacher, F.R. The Theory of Matrices; Reprinted; American Mathematical Soc: Providence, RI, USA, 1959; Volume 1, ISBN 978-0-8218-1393-5. [Google Scholar]
  25. Horn, R.A.; Johnson, C.R. Matrix Analysis, 2nd ed.; Cambridge University Press: Cambridge, MA, USA, 2012; ISBN 978-0-521-83940-2. [Google Scholar]
  26. Diffie, W.; Hellman, M. New Directions in Cryptography. IEEE Trans. Inform. Theory 1976, 22, 644–654. [Google Scholar] [CrossRef]
  27. Burton, D.M. The History of Mathematics: An Introduction, 7th ed.; McGraw-Hill: New York, NY, USA, 2011; ISBN 978-0-07-338315-6. [Google Scholar]
  28. Laughlin, J.M. Combinatorial Identities Deriving from the N-Th Power of a 2x2 Matrix. Integers 2004, 4, 1–15. [Google Scholar] [CrossRef]
  29. Arnold, V.I. Fermat Dynamics, Matrix Arithmetics, Finite Circles, and Finite Lobachevsky Planes. Funct. Anal. Its Appl. 2004, 38, 1–13. [Google Scholar] [CrossRef]
  30. Ireland, K.F.; Rosen, M.I. A Classical Introduction to Modern Number Theory, 2nd ed.; Graduate Texts in Mathematics; Springer: New York, NY, USA, 1990; ISBN 978-0-387-97329-6. [Google Scholar]
  31. Silverman, J.H.; Tate, J.T. Rational Points on Elliptic Curves; Undergraduate Texts in Mathematics; Springer International Publishing: Cham, Switzerland, 2015; ISBN 978-3-319-18587-3. [Google Scholar]
  32. Davenport, H. Multiplicative Number Theory; Graduate Texts in Mathematics; Springer: New York, NY, USA, 1980; Volume 74, ISBN 978-1-4757-5929-7. [Google Scholar]
  33. Takloo-Bighash, R. A Pythagorean Introduction to Number Theory: Right Triangles, Sums of Squares, and Arithmetic; Undergraduate Texts in Mathematics; Springer International Publishing: Cham, Switzerland, 2018; ISBN 978-3-030-02603-5. [Google Scholar]
  34. Knuth, D.E. The Art of Computer Programming: Seminumerical Algorithms, 3rd ed.; Addison-Wesley Longman Publishing Co., Inc.: Boston, MA, USA, 1997; Volume 2, ISBN 978-0-201-89684-8. [Google Scholar]
  35. Lenstra, A.K. The Development of the Number Field Sieve; Lecture Notes in Mathematics Ser; Springer: Berlin/Heidelberg, Germany, 1993; ISBN 978-3-540-57013-4. [Google Scholar]
  36. Hoffstein, J.; Pipher, J.; Silverman, J.H. An Introduction to Mathematical Cryptography; Undergraduate Texts in Mathematics; Springer: New York, NY, USA, 2014; ISBN 978-1-4939-1710-5. [Google Scholar]
  37. Bernstein, D.J.; Lenstra, A.K. A General Number Field Sieve Implementation. In The Development of the Number Field Sieve; Lenstra, A.K., Lenstra, H.W., Eds.; Lecture Notes in Mathematics; Springer: Berlin/Heidelberg, Germany, 1993; Volume 1554, pp. 103–126. ISBN 978-3-540-57013-4. [Google Scholar]
  38. Coppersmith, D. Modifications to the Number Field Sieve. J. Cryptol. 1993, 6, 169–180. [Google Scholar] [CrossRef]
  39. Adleman, L. A Subexponential Algorithm for the Discrete Logarithm Problem with Applications to Cryptography. In Proceedings of the 20th Annual Symposium on Foundations of Computer Science (sfcs 1979), San Juan, PR, USA, 29–31 October 1979; IEEE: New York, NY, USA, 1979; pp. 55–60. [Google Scholar]
  40. Buchmann, J.; Jacobson, M.; Teske, E. On Some Computational Problems in Finite Abelian Groups. Math. Comput. 1997, 66, 1663–1687. [Google Scholar] [CrossRef]
  41. Rana, M.; Mamun, Q.; Islam, R. Lightweight Cryptography in IoT Networks: A Survey. Future Gener. Comput. Syst. 2022, 129, 77–89. [Google Scholar] [CrossRef]
  42. Koblitz, N. Elliptic Curve Cryptosystems. Math. Comput. 1987, 48, 203–209. [Google Scholar] [CrossRef]
  43. Miller, V.S. Use of Elliptic Curves in Cryptography. In Advances in Cryptology—CRYPTO ’85 Proceedings; Williams, H.C., Ed.; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 1986; Volume 218, pp. 417–426. ISBN 978-3-540-16463-0. [Google Scholar]
  44. Smith, D.H.; Montemanni, R. A New Table of Permutation Codes. Des. Codes Cryptogr. 2012, 63, 241–253. [Google Scholar] [CrossRef]
  45. Borysenko, O.A.; Horiachev, O.Y.; Berezhna, O.V.; Matsenko, S.M.; Novhorodtsev, A.I. Noise-Immune Transfer of Decimal Data with Protection Based on Permutations. In Proceedings of the 2023 IEEE 13th International Conference on Electronics and Information Technologies (ELIT), Lviv, Ukraine, 26–28 September 2023; IEEE: Lviv, Ukraine, 2023; pp. 248–251. [Google Scholar]
  46. Faure, E.; Baikenov, A.; Skutskyi, A.; Faure, D.; Abramkina, O. Algorithms for Reliable Permutation Transmission Protocols in Noisy Communication Channels. In Proceedings of the CEUR Workshop Proceedings, Kyiv, Ukraine, 26 October 2024; Volume 3826, pp. 40–49. [Google Scholar]
Table 1. Values of f n = n 1 n 2 in 13 .
Table 1. Values of f n = n 1 n 2 in 13 .
nf(n)nf(n)
212712
31089
410910
591010
6121112
Table 2. Values of f n = n 1 n 2 in 11 .
Table 2. Values of f n = n 1 n 2 in 11 .
nf(n)nf(n)
2565
3171
4181
5595
Table 3. The number of quadratic residues and non-residues for p = 4 l + 1 .
Table 3. The number of quadratic residues and non-residues for p = 4 l + 1 .
{QR}∖0{QNR}
{qr}∖0 Q R : l ;   Q N R : l Q R : l ;   Q N R : l
{qnr} Q R : l ;   Q N R : l Q R : l + 1 ;   Q N R : l 1
Table 4. The number of quadratic residues and non-residues for p = 4 l + 3 .
Table 4. The number of quadratic residues and non-residues for p = 4 l + 3 .
{QR}∖0{QNR}
{qr}∖0 Q R : l ;   Q N R : l + 1 Q R : l + 1 ;   Q N R : l
{qnr} Q R : l + 1 ;   Q N R : l Q R : l + 1 ;   Q N R : l
Table 5. The values of Q R \ 0 + Q R \ 0 in 17 .
Table 5. The values of Q R \ 0 + Q R \ 0 in 17 .
{QR}∖012489131516
{QR}∖0
123591014160
234610111501
45681213023
891012160467
910111301578
13141504591112
15160267111314
1601378121415
Table 6. The values of Q N R + Q N R in 17 .
Table 6. The values of Q N R + Q N R in 17 .
{QNR}356710111214
{QNR}
3689101314150
58101112151602
6911121316013
7101213140124
1013151603457
111416014568
12150125679
14023478911
Table 7. The values of Q R \ 0 + Q N R in 17 .
Table 7. The values of Q R \ 0 + Q N R in 17 .
{QNR}356710111214
{QR}∖0
1467811121315
2578912131416
47910111415161
8111314151235
9121415162346
131612367810
151345891012
1624569101113
Table 8. The values of Q R \ 0 + Q R \ 0 in 19 .
Table 8. The values of Q R \ 0 + Q R \ 0 in 19 .
{QR}∖0145679111617
{QR}∖0
12567810121718
45891011131512
569101112141623
6710111213151734
7811121314161845
9101314151618167
1112151617181389
16171234681314
17182345791415
Table 9. The values of Q N R + Q N R in 19 .
Table 9. The values of Q N R + Q N R in 19 .
{QNR}238101213141518
{QNR}
2451012141516171
3561113151617182
81011161812347
10121318134569
12141513567811
13151624678912
141617357891013
1517184689101114
1812791112131417
Table 10. The values of Q R \ 0 + Q N R in 19 .
Table 10. The values of Q R \ 0 + Q N R in 19 .
{QNR}238101213141518
{QR}∖0
134911131415160
467121416171803
57813151718014
6891416180125
7910151701236
9111217023458
11131402456710
1618057910111215
1701681011121316
Table 11. Values of q y i .
Table 11. Values of q y i .
σ i 2321713151835520242219
4 σ i 817311523352920622142
y y 2
11302172315391832162436
243324102618612213519272
39129153123111726324327
416836221301824331031214
52517831102273351931123
636281952113171630142234
7124321834261420296273510
827191033124293572151325
97362713292191524122305
102618932113283462041224
1110230163224121827425338
12332516218103541327111931
132113427635232911536719
1411331173325131928526349
153322392517511203418261
16342617319113651428122032
1730221336157321102481628
1828201134135303682261426
Table 12. Values of y .
Table 12. Values of y .
σ i 2321713151835520242219
4 σ i 817311523352920622142
q n q
211 12 5 425
5 3 1815165148 98
6 13 2 10718 5
845 18 17 115
131317918614 12 8 8
14 7 16 61845
1 3171 9 13 5
1751614 15 3 5
1810 71224111 15 8
1986 16 14 5212138
2018 71510 16 5
2217 4 1896 5
23 15 1313 55
24 2 11 491731108
29 3 9 8137 5
31 1453 4 125
321571011 17 1 3168
35 13128 2 7 5
Table 13. The number of matrix A parameter sets to achieve maximum order o r d A = 17 2 1 .
Table 13. The number of matrix A parameter sets to achieve maximum order o r d A = 17 2 1 .
r356710111214
q
3-034-34-34-
534---3434-0
634--340-34-
7--0--343434
10343434--0--
11-34-034--34
120-3434---34
14-34-34-340-
Table 14. The number of matrix A parameter sets to achieve maximum order o r d A = 11 2 1 .
Table 14. The number of matrix A parameter sets to achieve maximum order o r d A = 11 2 1 .
r26810
q
222--22
6-22220
722-0-
8-022-
10022-22
Table 15. The number of matrix A parameter sets to achieve maximum order o r d A = 19 2 1 .
Table 15. The number of matrix A parameter sets to achieve maximum order o r d A = 19 2 1 .
r238121418
q
23838--3838
3383838-38-
8-03838-38
10----380
12--3838038
13-38-0--
143838-3838-
1538-0---
180-3838-38
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.

Share and Cite

MDPI and ACS Style

Baikenov, A.; Faure, E.; Shcherba, A.; Khaliavka, V.; Tynymbayev, S.; Abramkina, O. A Unified Method for Selecting Parameters and Primitive Elements in 2 × 2 Matrix Fields for Cryptographic Protocols. Symmetry 2025, 17, 1212. https://doi.org/10.3390/sym17081212

AMA Style

Baikenov A, Faure E, Shcherba A, Khaliavka V, Tynymbayev S, Abramkina O. A Unified Method for Selecting Parameters and Primitive Elements in 2 × 2 Matrix Fields for Cryptographic Protocols. Symmetry. 2025; 17(8):1212. https://doi.org/10.3390/sym17081212

Chicago/Turabian Style

Baikenov, Alimzhan, Emil Faure, Anatoly Shcherba, Viktor Khaliavka, Sakhybay Tynymbayev, and Olga Abramkina. 2025. "A Unified Method for Selecting Parameters and Primitive Elements in 2 × 2 Matrix Fields for Cryptographic Protocols" Symmetry 17, no. 8: 1212. https://doi.org/10.3390/sym17081212

APA Style

Baikenov, A., Faure, E., Shcherba, A., Khaliavka, V., Tynymbayev, S., & Abramkina, O. (2025). A Unified Method for Selecting Parameters and Primitive Elements in 2 × 2 Matrix Fields for Cryptographic Protocols. Symmetry, 17(8), 1212. https://doi.org/10.3390/sym17081212

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop