S-box dynamic generation method and device on finite field

By dynamically generating S-boxes over finite fields and utilizing the artificial jellyfish optimization algorithm and affine transformation, the problem of insufficient algebraic expressions for AES S-boxes is solved. The generated S-boxes have high nonlinearity and difference uniformity, which can resist algebraic attacks and improve generation efficiency.

CN119675846BActive Publication Date: 2026-01-20NORTH CHINA ELECTRICAL POWER RES INST +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411675433.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2026-01-20
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

In existing technologies, the algebraic expression of the AES S-box has only nine terms, which cannot effectively resist algebraic attacks, and the generation of the S-box takes a long time.

Method used

A three-layer optimization algorithm based on the artificial jellyfish optimization algorithm is used to generate the S-box. The S-box is dynamically generated by performing squaring calculation, affine transformation and XOR operation on a 256th order finite field. The computational efficiency is improved by using a pre-stored reference table.

Benefits of technology

The generated S-boxes exhibit high nonlinearity and difference uniformity, effectively resisting algebraic attacks and improving generation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119675846B_ABST
    Figure CN119675846B_ABST
Patent Text Reader

Abstract

The application provides a S-box dynamic generation method and device on a finite field, and relates to the technical field of information security. The method comprises the following steps: inputting a first affine transformation variable and a second affine transformation variable, taking the independent variable of a S-box as the initialization assignment of the S-box, performing square calculation on the initialization assignment in a 256-order finite field, performing first affine transformation in a 2-order finite field according to the square calculation result, a pre-determined target affine matrix and the first affine transformation variable; solving the multiplicative inverse element of the first affine transformation result in the 256-order finite field, performing second affine transformation in the 2-order finite field according to the multiplicative inverse element, the target affine matrix and the second affine transformation variable, and obtaining a numerical element of the S-box; and traversing each independent variable value until 255 is reached. The device executes the above method. The method and device provided in the application can resist algebraic attacks and efficiently generate dynamic S-boxes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, specifically to a method and apparatus for dynamically generating S-boxes over a finite domain. Background Technology

[0002] The applications of the S-box mainly include the following aspects:

[0003] Cryptographic Applications: The S-box is the only non-linear component in many block cipher algorithms, and its strength determines the overall security of the algorithm. Optimizing the performance of the S-box can improve the overall security of the cryptographic algorithm and prevent it from being cracked.

[0004] Image Encryption: The optimized S-box can be applied to image encryption algorithms. By generating pseudo-random numbers through chaotic iteration, the sorting structure of the S-box is changed, thereby enhancing the complexity and security of image encryption.

[0005] Parallel computing: Optimizing S-boxes using parallel computing techniques can improve computational efficiency. For example, using a master-slave parallel genetic algorithm framework to improve the traditional serial genetic algorithm can optimize higher-order S-boxes and increase computation speed.

[0006] Distributed computing: The distributed S-box optimization algorithm based on membrane computing can handle multiple group searches, is suitable for distributed computing environments, and can effectively resist linear cryptanalysis and differential cryptanalysis.

[0007] These applications demonstrate the important role of S-box optimization in improving cryptographic security and computational efficiency.

[0008] The leakage of critical data poses a serious threat to individuals, making data confidentiality a key focus of research. Meanwhile, the rapid pace of modern life demands efficient data transmission, thus placing higher demands on secure and efficient cryptographic algorithms. Cryptographic operations such as permutation, substitution, and modular addition can be summarized into two basic design principles: confusion and diffusion. Confusion breaks the connection between ciphertext and the key, while diffusion breaks the connection between ciphertext and plaintext. Therefore, any effective cryptographic algorithm that guarantees data security contains fundamental components that fulfill both confusion and diffusion functions.

[0009] The S-box is a common non-linear component that can serve to confuse and spread information. As the only non-linear component in many cryptographic algorithms, it plays a crucial role in preventing ciphertext from being effectively subjected to linear approximation attacks and algebraic attacks.

[0010] The most typical scheme for generating S-boxes based on finite fields is AES, whose S-box is defined on GF(2). 8AES S-box is generated in the background of multiplication of GF(2) and addition of GF(2). Although the nonlinearity, differential uniformity and linear approximation probability of the AES S-box are good, the algebraic expression of the AES S-box has only nine terms, and cannot resist algebraic attacks. The prior art uses different irreducible polynomials in GF(2 8 ) to generate random S-boxes and inverse S-boxes, but does not change the result that the algebraic expression has only nine terms. The prior art also uses different irreducible polynomials and affine matrices from those in the AES, but does not solve the problem of the small number of algebraic terms of the AES S-box. The inventor himself designed an S-box three-layer optimization algorithm based on a jellyfish optimization algorithm, and generated an S-box with a nonlinearity of 113, but the time for generating the S-box is long. SUMMARY

[0011] In view of the problems in the prior art, the embodiments of the present application provide an S-box dynamic generation method and device on a finite field, which can at least partially solve the problems in the prior art.

[0012] In one aspect, the present application provides an S-box dynamic generation method on a finite field, comprising:

[0013] inputting a first affine transformation variable and a second affine transformation variable, initializing and assigning the independent variable of the S-box as an S-box, performing square calculation on the initialized assignment in a 256-order finite field, performing first affine transformation in a 2-order finite field according to the square calculation result, a pre-determined target affine matrix and the first affine transformation variable;

[0014] wherein the initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a 256-order finite field;

[0015] solving the multiplicative inverse of the first affine transformation result in a 256-order finite field, performing second affine transformation in a 2-order finite field according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, and obtaining a numerical element of the S-box;

[0016] adding 1 to the independent variable to update the assignment, and using the updated assignment to replace the pre-updated assignment to perform the square calculation on the initialized assignment in the 256-order finite field and the subsequent steps, until the independent variable reaches 255, and all numerical elements at this time are taken as the dynamically generated S-box;

[0017] wherein the first pre-updated assignment is the initialized assignment.

[0018] The first affine transformation is performed according to the square calculation result, the target affine matrix and the first affine transformation variable in a finite field of order 2, and includes:

[0019] The target affine matrix is multiplied by the square calculation result to obtain a first intermediate result;

[0020] The first intermediate result is subjected to exclusive or calculation with the first affine transformation variable to obtain the first affine transformation result.

[0021] The second affine transformation is performed according to the multiplicative inverse, the target affine matrix and the second affine transformation variable in a finite field of order 2, and includes:

[0022] The target affine matrix is multiplied by the multiplicative inverse to obtain a second intermediate result;

[0023] The second intermediate result is subjected to exclusive or calculation with the second affine transformation variable to obtain a numerical element of the S-box.

[0024] The S-box dynamic generation method in the finite field further includes:

[0025] A first reference table stored in advance is called to perform square calculation on the initialization assignment in a finite field of order 256.

[0026] The S-box dynamic generation method in the finite field further includes:

[0027] A second reference table stored in advance is called to multiply the target affine matrix by the square calculation result to obtain the first intermediate result.

[0028] The S-box dynamic generation method in the finite field further includes:

[0029] A third reference table stored in advance is called to solve the multiplicative inverse of the first affine transformation result in a finite field of order 256.

[0030] The target affine matrix is determined in advance, including:

[0031] A plurality of candidate irreducible binary polynomials are obtained by screening irreducible binary polynomials based on nonlinearity, and a plurality of candidate affine matrices are selected based on balance and bijectivity;

[0032] An S-box performance index of each candidate irreducible binary polynomial under each candidate affine matrix is obtained;

[0033] A target irreducible binary polynomial is selected from the plurality of candidate irreducible binary polynomials according to a comparison result of the S-box performance index;

[0034] The target affine matrix is selected from a plurality of candidate affine matrices by comparing the performance index corresponding to the target S-box with the performance index of the target irreducible binary polynomial.

[0035] In one aspect, the application provides an S-box dynamic generation device over a finite field, comprising:

[0036] The first conversion unit is configured to input the first affine transformation variable and the second affine transformation variable, take an independent variable of the S-box as an initialization assignment of the S-box, perform a square calculation on the initialization assignment over a 256-order finite field, and perform a first affine transformation over a 2-order finite field according to a result of the square calculation, a predetermined target affine matrix, and the first affine transformation variable.

[0037] The initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable, and the second affine transformation variable is a 256-order finite field.

[0038] The second conversion unit is configured to solve a multiplicative inverse of the first affine transformation result over the 256-order finite field, perform a second affine transformation over the 2-order finite field according to the multiplicative inverse, the target affine matrix, and the second affine transformation variable, and obtain a numerical element of the S-box.

[0039] The generation unit is configured to update the assignment by adding 1 to the independent variable, and perform the square calculation on the initialization assignment over the 256-order finite field and subsequent steps by using the updated assignment to replace the previous assignment until the independent variable reaches 255, and take all the numerical elements at this time as the dynamically generated S-box.

[0040] The first previous assignment is the initialization assignment.

[0041] In still another aspect, the application provides an electronic device, comprising a processor, a memory, and a bus, wherein

[0042] The processor and the memory complete communication with each other through the bus.

[0043] The memory stores program instructions executable by the processor, and the processor calling the program instructions can execute the following method:

[0044] The first conversion unit is configured to input the first affine transformation variable and the second affine transformation variable, take an independent variable of the S-box as an initialization assignment of the S-box, perform a square calculation on the initialization assignment over a 256-order finite field, and perform a first affine transformation over a 2-order finite field according to a result of the square calculation, a predetermined target affine matrix, and the first affine transformation variable.

[0045] The initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a finite field of 256 orders;

[0046] The multiplicative inverse of the first affine transformation result is solved in the finite field of 256 orders, and the second affine transformation is performed in the finite field of 2 orders according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, so as to obtain a numerical element of the S box;

[0047] The independent variable is added by 1 to update the assignment, and the square calculation of the initialization assignment in the finite field of 256 orders and the subsequent steps are performed by using the updated assignment instead of the previous assignment until the independent variable reaches 255, and all numerical elements at this time are taken as the dynamically generated S box;

[0048] The first previous assignment is the initialization assignment.

[0049] The embodiment of the application provides a kind of non-transient computer readable storage medium, comprising:

[0050] The non-transient computer readable storage medium stores computer instructions, and the computer instructions make the computer execute the following method:

[0051] Input first affine transformation variable and second affine transformation variable, take the independent variable of S box as the initialization assignment of S box, carry out square calculation in the finite field of 256 orders to the initialization assignment, and perform first affine transformation in the finite field of 2 orders according to the square calculation result, the target affine matrix determined in advance and the first affine transformation variable;

[0052] The initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a finite field of 256 orders;

[0053] The multiplicative inverse of the first affine transformation result is solved in the finite field of 256 orders, and the second affine transformation is performed in the finite field of 2 orders according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, so as to obtain a numerical element of the S box;

[0054] The independent variable is added by 1 to update the assignment, and the square calculation of the initialization assignment in the finite field of 256 orders and the subsequent steps are performed by using the updated assignment instead of the previous assignment until the independent variable reaches 255, and all numerical elements at this time are taken as the dynamically generated S box;

[0055] The first previous assignment is the initialization assignment.

[0056] The S-box dynamic generation method and device provided by the embodiment of the present application are characterized in that: inputting a first affine transformation variable and a second affine transformation variable, taking an independent variable of an S-box as an initialization assignment of the S-box, performing square calculation on the initialization assignment in a 256-order finite field, performing first affine transformation in a 2-order finite field according to a square calculation result, a pre-determined target affine matrix and the first affine transformation variable; wherein the initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a 256-order finite field; solving the multiplicative inverse of the first affine transformation result in the 256-order finite field, performing second affine transformation in the 2-order finite field according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, and obtaining a numerical element of the S-box; updating the assignment by adding 1 to the independent variable, and using the updated assignment to replace the previous assignment to perform the square calculation on the initialization assignment in the 256-order finite field and the subsequent steps until the independent variable reaches 255, and taking all the numerical elements at this time as the dynamically generated S-box; wherein the first previous assignment is the initialization assignment, and the dynamically generated S-box can resist algebraic attacks and be efficiently generated. BRIEF DESCRIPTION OF DRAWINGS

[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort based on these drawings. In the drawings:

[0058] Figure 1 is a flowchart of the S-box dynamic generation method provided by an embodiment of the present application in a finite field.

[0059] Figure 2 is a flowchart of the S-box dynamic generation method provided by another embodiment of the present application in a finite field.

[0060] Figure 3 is a flowchart of the S-box dynamic generation method provided by another embodiment of the present application in a finite field.

[0061] Figure 4 is a structural diagram of the S-box dynamic generation device provided by an embodiment of the present application in a finite field.

[0062] Figure 5 is an electronic device physical structure diagram provided by an embodiment of the present application. DETAILED DESCRIPTION

[0063] For the purposes of making the purposes, technical solutions and advantages of the embodiments of the present application clearer, further detailed description of the embodiments of the present application is made below in combination with the drawings. Herein, the illustrative embodiments of the present application and the description thereof are used to explain the present application, but are not as limitations to the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other at will without conflicts.

[0064] Figure 1 is a flowchart of the method for dynamically generating an S-box over a finite field provided by an embodiment of the present application, as shown in Figure 1 The method for dynamically generating an S-box over a finite field provided by the embodiment of the present application comprises:

[0065] Step S1: input a first affine transformation variable and a second affine transformation variable, take an independent variable of an S-box as an initialization assignment of the S-box, perform a square calculation on the initialization assignment over a 256-order finite field, and perform a first affine transformation over a 2-order finite field according to a square calculation result, a pre-determined target affine matrix and the first affine transformation variable.

[0066] The initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a 256-order finite field.

[0067] Step S2: solve a multiplicative inverse of the first affine transformation result over a 256-order finite field, perform a second affine transformation over a 2-order finite field according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, and obtain a numerical element of the S-box.

[0068] Step S3: add 1 to the independent variable to update the assignment, and use the updated assignment to replace the pre-updated assignment to perform the square calculation on the initialization assignment over the 256-order finite field and the subsequent steps, until the independent variable reaches 255, and all the numerical elements at this time are taken as the dynamically generated S-box.

[0069] The first pre-updated assignment is the initialization assignment.

[0070] In the above step S1, the device inputs a first affine transformation variable and a second affine transformation variable, takes an independent variable of an S-box as an initialization assignment of the S-box, performs a square calculation on the initialization assignment over a 256-order finite field, and performs a first affine transformation over a 2-order finite field according to a square calculation result, a pre-determined target affine matrix and the first affine transformation variable.

[0071] The initial value of the independent variable is 0, and the values ​​of the independent variable, the first affine transformation variable, and the second affine transformation variable are within a finite field of order 256. The apparatus can be a computer device that executes the method. It should be noted that the data acquisition and analysis involved in this embodiment of the invention are authorized by the user.

[0072] like Figure 2 As shown, the first affine transformation variable is b, the second affine transformation variable is c, and the independent variable of the S-box is x, where x,b,c∈Z. 256 b≠0, c≠0. A finite field of order 256 is represented as GF(2 8 The second-order finite field is represented as GF(2).

[0073] The argument of the S-box is used as the initialization value of the S-box, that is, S(x) is assigned the value x, where S(x) = x. The expression for S(x) is as follows:

[0074] S(x)=A(Ax 2 +b) -1 +c (1)

[0075] Here, A is the affine matrix, and the target affine matrix can be used later.

[0076] The target affine matrix is ​​determined in advance, including:

[0077] The irreducible binary polynomials are screened based on nonlinearity to obtain multiple candidate irreducible binary polynomials; multiple candidate affine matrices are obtained based on balance and bijectivity selection.

[0078] Obtain the S-box performance index of each candidate irreducible binary polynomial under each candidate affine matrix;

[0079] Based on the comparison results of S-box performance metrics, the target irreducible binary polynomial is selected from multiple candidate irreducible binary polynomials.

[0080] By comparing the performance index of the target S-box corresponding to the irreducible binary polynomial of the target, the target affine matrix is ​​selected from multiple candidate affine matrices.

[0081] An irreducible binary polynomial is a binary polynomial that satisfies the following conditions: it is divisible only by 1 and itself, and it has a multiplicative inverse. The general representation of an irreducible binary polynomial of degree 8 is as follows:

[0082] {d8x 8 +d7x 7 +d6x 6 +d5x 5 +d4x 4 +d3x3 +d2x 2 +d1x 1 +1};

[0083] wherein, d i ∈{0,1}, a total of 30, which corresponds to the coefficient hexadecimal are 0X11B, 0X11D, 0X12B, 0X12D, 0X139, 0X13F, 0X14D, 0X15F, 0X163, 0X165, 0X169, 0X171, 0X177, 0X17B, 0X187, 0X18B, 0X18D, 0X19F, 0X1A3, 0X1A9, 0X1B1, 0X1BD, 0X1C3, 0X1CF, 0X1D7, 0X1DD, 0X1E7, 0X1F3, 0X1F5, 0X1F9.

[0084] The highest nonlinearity of the above 30 is 112, as shown in Table 1:

[0085] Table 1

[0086]

[0087] That is, a plurality of candidate irreducible binary polynomials are x 8 +x 4 +x 3 +x+1, x 8 +x 6 +x 5 +x+1 and x 8 +x 7 +x 6 +x 5 +x 4 +x+1.

[0088] The representation method of affine transformation is:

[0089] Ax+b

[0090] wherein A is an n x n affine matrix, b∈Z 2n When n is 8, there are 2 64 affine matrices. Since the S-box needs to satisfy the balance and bijectivity, the affine matrix needs to satisfy the above requirements. For example, A1, A2 and A3 are candidate affine matrices (satisfying balance and bijectivity), and the corresponding affine transformations are shown in formula (2), formula (3) and formula (4) respectively. Assuming that the affine matrix A is A1 and b is 63, the expression of the affine transformation is shown in formula (5):

[0091]

[0092]

[0093] According to formula (1), take b∈Z 101 ∩b≠0, c∈Z 11 ∩c≠0, respectively in the case of the irreducible binary polynomial is 0X11B, 0X163, 0X1F3 and the affine matrix is A1, A2 and A3, 1000 S-boxes are generated. As shown in table 2, it is the performance average of 1000 S-boxes under different irreducible binary polynomials and affine matrices, wherein NL, LP, DU, SAC_Offset, BIC_NL and BIC_SAC_Offset represent nonlinearity, linear approximation probability, differential uniformity, strict avalanche criterion offset value, the average value of 56 Boolean function nonlinearity and the average value of 56 Boolean function strict avalanche criterion offset value, respectively.

[0094] As shown in table 2, when the affine matrix is A1, the S-box does not satisfy the bijectivity. When the affine matrix is A2, the irreducible binary polynomial is x 8 +x 4 +x 3 +x+1(0X11B) and x 8 +x 7 +x 6 +x 5 +x 4 +x+1(0X163), the performance of 1000 S-boxes generated is relatively good, the irreducible binary polynomial is x 8 +x 4 +x 3 +x+1(0X11B) S-box SAC-Offset reduces the performance of x 8 +x 7 +x 6 +x 5 +x 4 +x+1(0X163) by 11.15%, and BIC-SAC-Offset improves the performance by 17.07%, so the irreducible binary polynomial of the application is selected as x 8 +x 4 +x 3 +x+1(0X11B), and the target affine matrix is selected as A2.

[0095] Table 2

[0096]

[0097] The S-box dynamic generation method on the finite field further comprises:

[0098] The first reference table pre-stored is called T1, as shown in table 3:

[0099] Table 3

[0100]

[0101] The first affine transformation according to the square calculation result, the predetermined target affine matrix and the first affine transformation variable in the finite field of order 2 includes:

[0102] Multiplying the target affine matrix and the square calculation result to obtain a first intermediate result; the square calculation result is denoted as M, and the first intermediate result Temp1=A 2× M.

[0103] XOR calculating the first intermediate result and the first affine transformation variable to obtain the first affine transformation result. The XOR calculation is as shown in Figure 3 The first affine transformation result is denoted as F. The S-box dynamic generation method in the finite field further includes:

[0104] Calling a second reference table stored in advance to realize multiplication of the target affine matrix and the square calculation result to obtain the first intermediate result. The second reference table is denoted as T2, and is as shown in Table 4:

[0105] Table 4

[0106]

[0107]

[0108] In the above step S2, the device solves the multiplicative inverse of the first affine transformation result in the finite field of order 256, and performs a second affine transformation according to the multiplicative inverse, the target affine matrix and the second affine transformation variable in the finite field of order 2 to obtain a numerical element of the S-box. The multiplicative inverse is denoted as F -1 , which can also be denoted as H, and the second affine transformation according to the multiplicative inverse, the target affine matrix and the second affine transformation variable in the finite field of order 2 includes:

[0109] Multiplying the target affine matrix and the multiplicative inverse to obtain a second intermediate result; the multiplicative inverse is denoted as H, and the second intermediate result Temp2=A 2× H.

[0110] XOR calculating the second intermediate result and the second affine transformation variable to obtain a numerical element of the S-box. The XOR calculation is as shown in Figure 3 The calculated numerical element of the S-box.

[0111] The S-box dynamic generation method in the finite field further includes:

[0112] The third reference table is called T3, as shown in Table 5:

[0113] Table 5

[0114]

[0115] The first reference table, the second reference table and the third reference table are explained as follows:

[0116] The main operation of the S-box is the square, affine multiplication and multiplicative inverse in GF(2 8 ). The input variable range is x∈Z 256 . In order to generate the S-box more efficiently, the irreducible binary polynomial is selected as x 8 +x 4 +x 3 +x+1 (0X11B), and the target affine matrix is selected as A2, and the obtained 8x8 size square data, affine multiplication data and multiplicative inverse data are listed in Table T1, Table T2 and Table T3. As shown in Table 3, there are 256 results of x 2 . As shown in Table 4, there are 256 results of A2x. As shown in Table 5, there are 256 multiplicative inverse results of x 8 +x 4 +x 3 +x+1 (0X11B).

[0117] As shown in Table 6, there are 100 times average values of the time spent in direct calculation and using tables for 256 times of square, affine multiplication and multiplicative inverse operations. As shown in Table 6, using tables to calculate 256 times of square, affine multiplication and multiplicative inverse operations can compress the time, and improve the efficiency of generating the S-box.

[0118] Table 6

[0119]

[0120] In the above step S3, the device adds 1 to the independent variable to update the assignment, and uses the updated assignment to replace the pre-updated assignment to perform the square calculation of the initialization assignment in the finite field of 256 orders and the subsequent steps until the independent variable reaches 255, and all numerical elements at this time are used as a dynamically generated S-box;

[0121] The first pre-updated assignment is the initialization assignment. Further process flow of the present application is explained as follows:

[0122] Step 1: variable input. The values of variables b and c are input.

[0123] Step 2: Initialize S-box. Assign S(x) as x.

[0124] Step 3: Square. Refer to Table T1 to obtain the square M of x.

[0125] Step 4: First affine multiplication calculation. Refer to Table T2 to obtain the first intermediate result Temp1 after multiplying the target affine matrix A2 and M.

[0126] Step 5: First XOR calculation. XOR Temp1 and variable b to obtain F.

[0127] Step 6: Multiplicative inverse calculation. Solve F -1 , refer to Table T3 to obtain the multiplicative inverse H.

[0128] Step 7: Second affine multiplication calculation. Refer to Table T2 to obtain the second intermediate result Temp2 after multiplying the affine matrix A2 and H.

[0129] Step 8: Second XOR calculation. XOR Temp2 and variable c to obtain S(x).

[0130] Step 9: Determine whether all x have been processed. If not, execute Step 3. If yes, end the S-box generation process and output the S-box Sbox.

[0131] When b = 10 and c = 10, the obtained S-box is denoted as Sbox1, as shown in Table 7:

[0132] Table 7

[0133]

[0134] When x = 0, one numerical element of the corresponding S-box is "61" in Table 7, when x = 1, one numerical element of the corresponding S-box is "9" in Table 7, and so on.

[0135] The present application analyzes the performance of S-boxes through six indicators such as bijectivity, nonlinearity, and differential uniformity, and compares the performance and efficiency of S-boxes:

[0136] 1. Bijectivity analysis:

[0137] When x∈Z 2n and S∈Z 2n correspond one by one, the S-box satisfies bijectivity. As shown in Table 7, when n = 8, the S-box meets the bijectivity requirement.

[0138] 2. Nonlinearity analysis:

[0139] The nonlinearity of a Boolean function is measured by Walsh transform, so Walsh transform is used to test the nonlinearity of the n n Boolean functions constituting the S-box, and the higher the nonlinearity of the S-box, the stronger the ability to resist linear attack. The nonlinearity of the 8 Boolean functions of Sbox1 is 112.

[0140] 3. Differential uniformity analysis:

[0141] Differential uniformity is used to measure the relationship between input difference and output difference of S-box, and there should be no obvious statistical characteristics between input difference and output difference, that is, the smaller the differential uniformity, the stronger the ability of S-box to resist differential attack. As shown in Table 8, the differential uniformity of Sbox1 is 4.

[0142] Table 8

[0143]

[0144] 4. Strict avalanche criterion analysis:

[0145] Strict avalanche criterion is used to measure the probability of the change of input value to the change of output value, and the closer the probability of the change of input value to the change of output value to 0.5, the more difficult it is to deduce the output value from the input value, that is, the closer the offset value of strict avalanche effect to 0, the more S-box satisfies the strict avalanche effect. As shown in Table 9, the SAC correlation matrix of Sbox1, and the average value of the absolute value of the difference between the calculated data and 0.5 is 0.0278, which is very close to 0.

[0146] Table 9

[0147]

[0148] 5. Bit independence analysis:

[0149] Bit independence is measured by the nonlinearity and strict avalanche offset value of the Boolean function obtained by XORing different Boolean functions of S-box. As a result, the higher the nonlinearity of the Boolean function, the closer the strict avalanche offset value to 0, and the better the bit independence of the S-box. As shown in Table 10, the nonlinearity of the XORing of different Boolean functions in Sbox1 is 112.

[0150] Table 10

[0151]

[0152] As shown in Table 11, the SAC value of the XORing of different Boolean functions in Sbox1. After calculation, the average value of the offset of all SAC from 0.5 is 0.0068.

[0153] Table 11

[0154]

[0155] 6. Generation cycle analysis:

[0156] The longer the iteration cycle of the S-box, the higher the security factor of the S-box. As shown in Table 12, the data in Sbox1 all need to undergo a certain iteration cycle to obtain the original numerical value.

[0157] Table 12

[0158]

[0159]

[0160] 7. S-box performance and efficiency comparison:

[0161] As shown in Table 13, the performance and efficiency of the S-box of the present application and the prior art are compared, and it can be seen that the S-box generated by the present application not only has better performance but also has high efficiency.

[0162] Table 13

[0163]

[0164] The S-box dynamic generation method on a finite field provided by the embodiment of the present application inputs a first affine transformation variable and a second affine transformation variable, takes the independent variable of the S-box as the initialization assignment of the S-box, performs square calculation on the initialization assignment in a 256-order finite field, performs first affine transformation on a 2-order finite field according to the square calculation result, a pre-determined target affine matrix and the first affine transformation variable; wherein the initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a 256-order finite field; the multiplicative inverse of the first affine transformation result is solved in a 256-order finite field, second affine transformation is performed on a 2-order finite field according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, and a numerical element of the S-box is obtained; the independent variable is added by 1 to update the assignment, and the updated assignment is used to replace the pre-updated assignment to perform the square calculation on the initialization assignment in a 256-order finite field and the subsequent steps, until the independent variable reaches 255, and all numerical elements at this time are taken as the dynamically generated S-box; wherein the first pre-updated assignment is the initialization assignment, which can resist algebraic attacks and efficiently generate dynamic S-boxes.

[0165] Further, the first affine transformation on a 2-order finite field according to the square calculation result, a pre-determined target affine matrix and the first affine transformation variable includes:

[0166] Multiplying the target affine matrix with the square calculation result to obtain a first intermediate result; refer to the above embodiment description, and no further elaboration is made.

[0167] XOR calculating the first intermediate result with the first affine transformation variable to obtain the first affine transformation result. Refer to the above embodiment description, and no further elaboration is made.

[0168] Further, the second affine transformation according to the multiplicative inverse, the target affine matrix and the second affine transformation variable in the finite field of order 2 includes:

[0169] Multiplying the target affine matrix with the multiplicative inverse to obtain a second intermediate result; refer to the above embodiment description, and no further elaboration is made.

[0170] XOR calculating the second intermediate result with the second affine transformation variable to obtain a numerical element of the S-box. Refer to the above embodiment description, and no further elaboration is made.

[0171] Further, the S-box dynamic generation method on the finite field further includes:

[0172] Calling a pre-stored first reference table to perform square calculation on the initialization assignment in the finite field of order 256. Refer to the above embodiment description, and no further elaboration is made.

[0173] Further, the S-box dynamic generation method on the finite field further includes:

[0174] Calling a pre-stored second reference table to multiply the target affine matrix with the square calculation result to obtain the first intermediate result. Refer to the above embodiment description, and no further elaboration is made.

[0175] Further, the S-box dynamic generation method on the finite field further includes:

[0176] Calling a pre-stored third reference table to solve the multiplicative inverse of the first affine transformation result in the finite field of order 256. Refer to the above embodiment description, and no further elaboration is made.

[0177] Further, the target affine matrix is determined in advance, including:

[0178] Based on the nonlinearity, the irreducible binary polynomials are screened to obtain a plurality of candidate irreducible binary polynomials; based on the balance and the bijectivity, a plurality of candidate affine matrices are selected; refer to the above embodiment description, and no further elaboration is made.

[0179] Obtaining the S-box performance index of each candidate irreducible binary polynomial under each candidate affine matrix; refer to the above embodiment description, and no further elaboration is made.

[0180] According to the comparison result of the S-box performance index, a target irreducible binary polynomial is selected from the plurality of candidate irreducible binary polynomials; refer to the above embodiment description, which will not be repeated.

[0181] According to the comparison result of the target S-box performance index corresponding to the target irreducible binary polynomial, the target affine matrix is selected from the plurality of candidate affine matrices; refer to the above embodiment description, which will not be repeated.

[0182] Figure 4 is a structural schematic diagram of the S-box dynamic generation device on a finite field provided by an embodiment of the present application, as shown in Figure 4 The S-box dynamic generation device on a finite field provided by the embodiment of the present application comprises a first transformation unit 401, a second transformation unit 402 and a generation unit 403, wherein:

[0183] The first transformation unit 401 is configured to input a first affine transformation variable and a second affine transformation variable, take a self-variable of an S-box as an initialization assignment of the S-box, perform a square calculation on the initialization assignment in a 256-order finite field, and perform a first affine transformation in a 2-order finite field according to a square calculation result, a target affine matrix determined in advance and the first affine transformation variable; wherein an initial value of the self-variable is 0, and a value range of the self-variable, the first affine transformation variable and the second affine transformation variable is a 256-order finite field; the second transformation unit 402 is configured to solve a multiplicative inverse of the first affine transformation result in the 256-order finite field, perform a second affine transformation in the 2-order finite field according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, and obtain a numerical element of the S-box; the generation unit 403 is configured to update the assignment by adding 1 to the self-variable, and perform the square calculation on the initialization assignment in the 256-order finite field and subsequent steps by using the updated assignment to replace the previous assignment until the self-variable reaches 255, and all numerical elements at this time are taken as a dynamically generated S-box; wherein the first previous assignment is the initialization assignment.

[0184] Specifically, the first transformation unit 401 in the device is configured to input a first affine transformation variable and a second affine transformation variable, take a self-variable of an S-box as an initial assignment of the S-box, perform a square calculation on the initial assignment in a 256-order finite field, perform a first affine transformation in a 2-order finite field according to a square calculation result, a predetermined target affine matrix and the first affine transformation variable; wherein an initial value of the self-variable is 0, and a value range of the self-variable, the first affine transformation variable and the second affine transformation variable is a 256-order finite field; the second transformation unit 402 is configured to solve a multiplicative inverse of a first affine transformation result in the 256-order finite field, perform a second affine transformation in the 2-order finite field according to the multiplicative inverse, the target affine matrix and the second affine transformation variable, and obtain a numerical element of the S-box; the generation unit 403 is configured to add 1 to the self-variable to update the assignment, and perform the square calculation on the initial assignment in the 256-order finite field and subsequent steps by using the updated assignment to replace the previous assignment until the self-variable reaches 255, and all numerical elements at this time are taken as a dynamically generated S-box; wherein the first previous assignment is the initial assignment.

[0185] The S-box dynamic generation device on a finite field provided by the embodiment of the present application can resist algebraic attacks and efficiently generate a dynamic S-box.

[0186] The embodiment of the S-box dynamic generation device on a finite field provided by the embodiment of the present application can be used to execute the processing flow of each method embodiment, and the function thereof will not be described here again, and the detailed description can be referred to the above method embodiment.

[0187] Figure 5An electronic device entity structure schematic diagram provided by an embodiment of the present application is shown in Figure 5 The electronic device includes a processor 501, a memory 502, and a bus 503.

[0188] The processor 501, the memory 502, and the bus 503 complete communication with each other.

[0189] The processor 501 is configured to invoke program instructions in the memory 502 to execute the method provided by each of the method embodiments described above, for example, including:

[0190] inputting a first affine transformation variable and a second affine transformation variable, taking an independent variable of an S-box as an initial assignment of the S-box, performing square calculation on the initial assignment in a 256-order finite field, performing first affine transformation in a 2-order finite field according to a square calculation result, a predetermined target affine matrix, and the first affine transformation variable;

[0191] The initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable, and the second affine transformation variable is a 256-order finite field.

[0192] solving a multiplicative inverse of the first affine transformation result in the 256-order finite field, performing second affine transformation in the 2-order finite field according to the multiplicative inverse, the target affine matrix, and the second affine transformation variable, and obtaining a numerical element of the S-box;

[0193] adding 1 to the independent variable to update the assignment, and using the updated assignment to replace the pre-update assignment to perform the square calculation on the initial assignment in the 256-order finite field and subsequent steps, until the independent variable reaches 255, and all numerical elements at this time are taken as a dynamically generated S-box.

[0194] The first pre-update assignment is the initial assignment.

[0195] The embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the method provided by each of the method embodiments described above, for example, including:

[0196] inputting a first affine transformation variable and a second affine transformation variable, taking an independent variable of an S-box as an initial assignment of the S-box, performing square calculation on the initial assignment in a 256-order finite field, performing first affine transformation in a 2-order finite field according to a square calculation result, a predetermined target affine matrix, and the first affine transformation variable;

[0197] wherein the initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a finite field of order 256;

[0198] solving the multiplicative inverse of the first affine transformation result in the finite field of order 256, performing the second affine transformation according to the multiplicative inverse, the target affine matrix and the second affine transformation variable in the finite field of order 2, to obtain a numerical element of the S-box;

[0199] adding 1 to the independent variable to update the assignment, and performing the square calculation of the initialization assignment in the finite field of order 256 and the subsequent steps using the updated assignment instead of the updated assignment, until the independent variable reaches 255, and all numerical elements at this time are taken as the dynamically generated S-box;

[0200] wherein the first updated assignment is the initialization assignment.

[0201] The embodiment provides a computer readable storage medium storing a computer program, the computer program causing the computer to execute the method provided by each method embodiment, for example, comprising:

[0202] inputting the first affine transformation variable and the second affine transformation variable, taking the independent variable of the S-box as the initialization assignment of the S-box, performing the square calculation of the initialization assignment in the finite field of order 256, and performing the first affine transformation according to the square calculation result, the target affine matrix determined in advance and the first affine transformation variable in the finite field of order 2;

[0203] wherein the initial value of the independent variable is 0, and the value range of the independent variable, the first affine transformation variable and the second affine transformation variable is a finite field of order 256;

[0204] solving the multiplicative inverse of the first affine transformation result in the finite field of order 256, performing the second affine transformation according to the multiplicative inverse, the target affine matrix and the second affine transformation variable in the finite field of order 2, to obtain a numerical element of the S-box;

[0205] adding 1 to the independent variable to update the assignment, and performing the square calculation of the initialization assignment in the finite field of order 256 and the subsequent steps using the updated assignment instead of the updated assignment, until the independent variable reaches 255, and all numerical elements at this time are taken as the dynamically generated S-box;

[0206] wherein the first updated assignment is the initialization assignment.

[0207] Those skilled in the art will appreciate that embodiments of the present application can be readily used as a method, a system or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code.

[0208] The present application is described in reference to the flowchart illustrations and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 means for carrying out each of the

[0209] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 means for carrying out each of the

[0210] The computer program instructions can also be loaded into a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the function specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 one or more functions specified in the flowchart illustrations and / or block diagrams block or blocks. Figure 1 means for carrying out each of the

[0211] In the description of the present specification, the description of the terms "one embodiment", "one specific embodiment", "some embodiments", "for example", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Also, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in one or more embodiments or examples.

[0212] The specific embodiments described above further illustrate the purposes, technical solutions and beneficial effects of the present application. It should be understood that the above description is only for specific embodiments of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for dynamically generating S-boxes over a finite field, characterized in that, include: Input the first affine transformation variable and the second affine transformation variable, use the independent variable of the S-box as the initialization value of the S-box, perform the square calculation on the initialization value in a finite field of order 256, and perform the first affine transformation in a finite field of order 2 based on the square calculation result, the predetermined target affine matrix and the first affine transformation variable. Wherein, the initial value of the independent variable is 0, and the values ​​of the independent variable, the first affine transformation variable and the second affine transformation variable are within a finite field of order 256. The multiplicative inverse of the first affine transformation result is obtained in a finite field of order 256. Based on the multiplicative inverse, the target affine matrix, and the second affine transformation variable, a second affine transformation is performed in a finite field of order 2 to obtain a numerical element of the S-box. The independent variable is incremented by 1 to update the assignment, and the updated assignment is used to replace the original assignment. The initial assignment is then squared in a finite field of order 256, and subsequent steps are performed until the independent variable reaches 255. All the numerical elements at this point are used as dynamically generated S-boxes. The first assignment before the update is the initial assignment.

2. The method for dynamically generating S-boxes over a finite field according to claim 1, characterized in that, The step of performing the first affine transformation in a finite field of order 2 based on the squared calculation result, the predetermined target affine matrix, and the first affine transformation variable includes: Multiply the target affine matrix by the squared result to obtain the first intermediate result; The first intermediate result is XORed with the first affine transformation variable to obtain the first affine transformation result.

3. The method for dynamically generating S-boxes over a finite field according to claim 2, characterized in that, The second affine transformation, performed in a finite field of order 2 based on the multiplicative inverse, the target affine matrix, and the second affine transformation variable, includes: Multiply the target affine matrix by the multiplicative inverse to obtain the second intermediate result; The second intermediate result is XORed with the second affine transformation variable to obtain a numerical element of the S-box.

4. The method for dynamically generating S-boxes over a finite field according to claim 3, characterized in that, The method for dynamically generating S-boxes over finite fields also includes: The initialization assignment is squared in a finite field of order 256 by calling a pre-stored first reference table.

5. The method for dynamically generating S-boxes over a finite field according to claim 4, characterized in that, The method for dynamically generating S-boxes over finite fields also includes: The first intermediate result is obtained by multiplying the target affine matrix with the squared result by calling the pre-stored second reference table.

6. The method for dynamically generating S-boxes over a finite field according to claim 5, characterized in that, The method for dynamically generating S-boxes over finite fields also includes: The multiplicative inverse of the first affine transformation result is obtained by calling a pre-stored third reference table in a finite field of order 256.

7. The method for dynamically generating S-boxes over a finite field according to any one of claims 1 to 6, characterized in that, Predetermining the target affine matrix includes: The irreducible binary polynomials are screened based on nonlinearity to obtain multiple candidate irreducible binary polynomials; multiple candidate affine matrices are obtained based on balance and bijectivity selection. Obtain the S-box performance index of each candidate irreducible binary polynomial under each candidate affine matrix; Based on the comparison results of S-box performance metrics, the target irreducible binary polynomial is selected from multiple candidate irreducible binary polynomials. By comparing the performance index of the target S-box corresponding to the irreducible binary polynomial of the target, the target affine matrix is ​​selected from multiple candidate affine matrices.

8. A dynamic generation device for S-boxes over a finite field, characterized in that, include: The first transformation unit is used to input the first affine transformation variable and the second affine transformation variable, take the independent variable of the S-box as the initialization value of the S-box, perform a square calculation on the initialization value in a finite field of order 256, and perform the first affine transformation in a finite field of order 2 based on the square calculation result, the predetermined target affine matrix and the first affine transformation variable. Wherein, the initial value of the independent variable is 0, and the values ​​of the independent variable, the first affine transformation variable and the second affine transformation variable are within a finite field of order 256. The second transformation unit is used to solve the multiplicative inverse of the first affine transformation result in a finite field of order 256. Based on the multiplicative inverse, the target affine matrix and the second affine transformation variable, a second affine transformation is performed in a finite field of order 2 to obtain a numerical element of the S-box. The generation unit is used to increment the independent variable by 1 to update the assignment, and use the updated assignment to replace the original assignment to perform the square calculation of the initial assignment in the finite field of order 256 and subsequent steps until the independent variable reaches 255. All the numerical elements at this time are used as dynamically generated S-boxes. The first assignment before the update is the initial assignment.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Implementation method and system of SM4 algorithm S box based on basis transformation

    CN111786775A

  • A small hardware implementation of the subbyte function of rijndael

    WO2004056036A1