An 8-bit s-box construction method based on improved genetic algorithm
By improving the initialization of the complex chaotic system and the multi-objective fitness function of the genetic algorithm, and combining crossover and mutation operations, the cryptographic properties of the S-box are optimized. This solves the problems of poor initial population properties and few fitness function indicators in the existing genetic algorithm for constructing the S-box, and improves the security of the S-box.
Patent Information
- Application Number
- CN202411866044.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-12-18
AI Technical Summary
Existing methods for constructing S-boxes based on genetic algorithms suffer from problems such as poor initial population properties, limited fitness function indicators, and insufficient crossover and mutation operations, which affect the cryptographic properties of S-boxes.
The population is initialized using a composite chaotic system consisting of Logistic chaotic mapping and Tent chaotic mapping. The fitness function is generated by combining nonlinearity, differential uniformity and strict avalanche criterion. The cryptographic properties of the S-box are optimized by crossover operation that guarantees the bijectivity of the S-box and mutation operation in 2N rounds of search.
The cryptographic properties of the generated S-box are improved. By improving the 8-bit S-box constructed by the genetic algorithm, the nonlinearity and differential uniformity of the S-box are enhanced, thereby improving the security strength of the cryptographic algorithm.
Smart Images

Figure CN119696758B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information security, and particularly relates to an 8-bit S-box construction method based on an improved genetic algorithm. BACKGROUND
[0002] The confusion property of a block cipher algorithm mainly depends on the S-box (S-Box) of a nonlinear transformation, and the security of the S-box determines the security strength of the whole cipher algorithm. The evaluation indexes of the security of the S-box mainly include nonlinearity, differential uniformity, algebraic degree, signal-to-noise ratio, etc. The common construction methods of the S-box include mathematical construction, random generation, generation by using a cipher structure, and construction by using an intelligent optimization algorithm.
[0003] Intelligent optimization algorithms are commonly used for solving classical NP-C problems, and searching for an S-box by using an intelligent optimization algorithm can efficiently search for an optimal solution in a larger solution space and improve the efficiency of global optimization. Common intelligent optimization algorithms include a genetic algorithm (GA), a cellular automaton, a neural network, etc. The genetic algorithm mainly simulates the genetic optimization effect of organisms at the chromosome level, and transmits high-quality chromosomes to offspring through selection, crossover and mutation operations. The construction of an S-box by using a genetic algorithm can search for an optimal solution of the S-box in a global range, and simultaneously stably generate an S-box with excellent cipher properties. However, the existing methods for constructing an S-box based on a genetic algorithm have some problems: (1) the random generation method is used to initialize the S-box population, which makes the initial population of the generated S-box have poor cipher properties and affects the final result; (2) the cipher indexes of the S-box are less considered in the calculation of the fitness function; and (3) the crossover and mutation operations are less optimized according to the cipher properties of the S-box. SUMMARY
[0004] In view of the problems of poor initial population properties, less fitness function indexes and insufficient property optimization when an S-box is constructed by using a genetic algorithm, the present application provides an 8-bit S-box construction method based on an improved genetic algorithm. The method initializes a population by using a composite chaotic system composed of a Logistic chaotic mapping and a Tent chaotic mapping, generates a fitness function in combination with the nonlinearity, differential uniformity and strict avalanche criterion of the S-box, adopts a crossover operation ensuring the bijectivity of the S-box, and constructs a 2N-round search mutation operation to optimize the cipher properties of the S-box, thereby improving the genetic algorithm, and finally constructing an 8-bit cipher S-box based on the improved genetic algorithm.
[0005] The technical scheme for achieving the object of the present application is as follows:
[0006] An 8-bit S-box construction method based on an improved genetic algorithm, comprising the following steps:
[0007] (1) initializing a population based on a composite chaotic system;
[0008] The Logistic mapping and the Tent mapping are compounded by exponential multiplication to establish a compound chaotic system to initialize the S-box population;
[0009] (2) a multi-property combined fitness function is generated;
[0010] A multi-objective segmented weighted function is generated as a fitness function based on nonlinearity, differential uniformity and strict avalanche criterion to comprehensively evaluate the properties of the S-box, and the smaller the fitness function value of the S-box is, the better the cryptographic properties are;
[0011] (3) a crossover operation ensuring the bijectivity of the S-box is adopted;
[0012] The crossover operation is adopted to keep the bijectivity of the S-box, to keep the excellent properties of the parent S-box as much as possible, and to increase the diversity of the offspring population;
[0013] (4) a mutation operation of 2N rounds of search is performed on each population to optimize the nonlinearity and differential uniformity of the S-box;
[0014] A reverse search method is constructed to search for mutation points, and a mutation operation based on 2N rounds of search is generated based on hill climbing search, random search and reverse search; 2-point mutation point search is performed in the first N rounds, and 3-point mutation point search is performed in the last N rounds, to optimize the nonlinearity and differential uniformity of the S-box, and a table lookup statistical method is further used to evaluate the properties of the optimized S-box;
[0015] (5) an 8-bit S-box is constructed based on the improved genetic algorithm;
[0016] Based on the improved genetic algorithm, an 8-bit S-box with excellent cryptographic properties is constructed through iteration.
[0017] In the 8-bit S-box construction method based on the improved genetic algorithm, step (1) is to initialize the population based on the compound chaotic system, and the specific steps are as follows:
[0018] (1.1) in order to increase the opportunity to search for a global optimal solution and cover a larger search space, a chaotic system is used to generate an initial population, and the Tent mapping and the Logistic mapping are compounded to form a compound chaotic system mapping formula as follows:
[0019] (1)
[0020] wherein, is an input sample state variable, the parameter ∈(0, 0.1], ∈[0, 1];
[0021] (1.2) The S-box population is initialized by the composite chaotic system, initial S-boxes with good cryptographic properties are generated, the diversity of the genetic algorithm population is enriched, the possibility of searching for the optimal solution is increased, and the process of generating initial S-boxes by the composite chaotic system is as follows:
[0022] (1.2.1) Define an array S with a length of 256, and set the initial value of the chaotic mapping ;
[0023] (1.2.2) In order to eliminate the transient effect of the chaotic system, the system is idled for 50 times without outputting chaotic values;
[0024] (1.2.3) The state value of the composite chaotic system in each round generates an integer Z as follows:
[0025] (2)
[0026] (1.2.4) In order to ensure the bijectivity of the S-box, it is judged whether Z has been added to the array S, if not, Z is put into S; if yes, go to (1.2.5);
[0027] (1.2.5) If the number of elements in S is less than 256, go to (1.2.3) to regenerate Z, otherwise go to (1.2.6);
[0028] (1.2.6) Output the array S to generate an initial S-box sample population.
[0029] In the 8-bit S-box construction method based on the improved genetic algorithm, the step (2) generates a multi-property combined fitness function, and the specific steps are as follows:
[0030] (2.1) A multi-objective weighted fitness function is generated by combining the differential uniformity, nonlinearity, and strict avalanche criterion, and the formula is as follows:
[0031] (3)
[0032] Wherein, is a single individual S-box, is the nonlinearity of S-box t, is the differential uniformity of S-box t; SAC is the strict avalanche criterion; a, b, and c are the weights of the nonlinearity, differential uniformity and strict avalanche criterion of the S-box, respectively;
[0033] (2.2) Since the fitness function must meet the characteristics of single value and continuity, and based on the optimization test of the cryptographic properties of the S-box, according to the different cryptographic properties, the corresponding weights are set, and the above fitness function G(t) is converted into a multi-objective segmented weighted fitness function as follows:
[0034] (4)
[0035] (2.3) Differential uniformity of S-box The calculation formula is as follows:
[0036] (5)
[0037] wherein, are input difference and output difference of S-box respectively, called differential pair; is the set of n-tuple elements in F2 field, F2 is a binary finite field containing 2 elements; is the differential value of differential pair , the calculation formula is as follows:
[0038] (6)
[0039] wherein x is the input of S-box, , is the vector Boolean function representation method of S-box, namely , is the addition operation on binary finite field, represents the number of elements of the set satisfying the condition;
[0040] (2.4) Nonlinearity of S-box The calculation formula is as follows:
[0041] (7)
[0042] wherein, are input mask and output mask of S-box respectively, called mask pair; is an 8-bit S-box; is the Walsh transform of S-box, and the calculation formula is as follows:
[0043] (8)
[0044] wherein "·" represents the vector inner product operation on binary finite field. In the 8-bit S-box construction method based on improved genetic algorithm, the step (3) is to adopt the cross operation for ensuring the bijectivity of S-box, and the specific steps are as follows:
[0045] In order to retain the excellent properties of parent S-box as much as possible in the cross operation, increase the diversity of offspring population, and maintain the bijectivity of S-box, the specific process of improved cross operation is as follows:
[0046]
[0047] (3.1) Let the S-boxes before crossing as B1, B2, and the S-boxes after crossing as C1, C2;
[0048] (3.2) Generate a random number R in the range of [0, 255];
[0049] (3.3) Copy the first R elements in B1 to C1;
[0050] (3.4) Traverse the elements in B2 from the beginning, if the element is not in C1 and the number of elements in C1 is less than 256, add it to C1, otherwise skip the element and continue to traverse, until the elements in C1 are full;
[0051] (3.5) Add the remaining elements in B2 to C2 in order, and then add the remaining elements in B1 to C2 in order to complete 256 elements;
[0052] (3.6) Output the S-boxes C1, C2.
[0053] In the 8-bit S-box construction method based on the improved genetic algorithm, step (4) is a mutation operation of 2N rounds of search for each population, which optimizes the nonlinearity and differential uniformity of the S-box, and the specific steps are as follows:
[0054] (4.1) In order to better optimize the nonlinearity and differential uniformity of the S-box, according to the linear distribution and differential distribution of the S-box, a reverse search method is constructed to search for mutation points, which first searches for mutation points to optimize the nonlinearity of the S-box, and then searches for mutation points according to the differential distribution of the S-box to optimize the differential uniformity of the S-box;
[0055] (4.1.1) In order to improve the nonlinearity of the S-box, the linearity of the S-box needs to be reduced, and the search of the mutation point in the reverse search method will first calculate the linearity Line of the S-box, and then traverse the input / output mask pairs of the S-box to find all S-box inputs x that satisfy formula (9), wherein, are the input mask and output mask of the S-box, respectively:
[0056] (9)
[0057] Put x into the corresponding set, randomly select two different values from the set as the element index of the S-box to exchange elements, calculate the linearity of the S-box after element exchange, and evaluate whether the linearity of the S-box after mutation is better than the result before mutation;
[0058] (4.1.2) In order to optimize the differential uniformity of the S-box, the mutation points are searched according to the differential distribution of the S-box. Firstly, the differential uniformity of the S-box is calculated. Then, all input / output differential pairs of the S-box are traversed, and x satisfying formula (6) is found and put into the corresponding set. Two different values are randomly selected from the set as element indexes of the S-box to perform element exchange. The differential uniformity of the S-box after element exchange is calculated. Whether the differential uniformity of the S-box after mutation is better than that before mutation is evaluated.
[0059] (4.2) In order to accelerate the execution efficiency of the mutation operation and optimize the properties of the S-box, a 2N-round search method is generated based on 2-point mutation point search and 3-point mutation point search of hill climbing search, random search and reverse search method. In the first N rounds, 2-point mutation point search of the three methods is used respectively. In the last N rounds, 3-point mutation point search of the three methods is used respectively.
[0060] (4.3) The specific steps of the 2-point mutation search method in the first N rounds are as follows:
[0061] (4.3.1) In the 2-point mutation point search in the first N rounds, the mutation point search for nonlinearity optimization is performed. The search round numbers of 2-point hill climbing search, random search and reverse search method in N rounds are set as f1, f2 and f3 respectively, and f1+f2+f3=1. The 2-point random search is to generate two different numbers in the interval [0, 255] as element indexes of the S-box by a random function to exchange two elements.
[0062] (4.3.2) The 2-point mutation search method of hill climbing search, random search and reverse search is used to search for the corresponding number of rounds. If a mutation point is found, the S-boxes before and after mutation in each round are evaluated for nonlinearity. The S-box with better nonlinearity is retained. Finally, N results are obtained.
[0063] (4.3.3) The mutation point search for differential uniformity optimization is performed. Random search and reverse search method are used. The round numbers of the two methods in N rounds are set as c1 and c2, and c1+c2=1.
[0064] (4.3.4) The 2-point mutation search method of random search and reverse search is used to search for the corresponding number of rounds. If a mutation point is found, the S-boxes before and after mutation in each round are evaluated for differential uniformity. The S-box with better differential uniformity is retained. Finally, N results are obtained.
[0065] (4.4) In the 3-point mutation search of the latter N rounds, the 3-point hill climbing algorithm is used to replace the 2-point hill climbing algorithm, the random search is to generate three different numbers in the interval [0, 255] as the element subscript of the S-box by a random function to exchange two elements, and the reverse search method is to randomly select three different numbers from the set satisfying the condition as the element subscript of the S-box and then exchange two elements, and the specific method is as follows:
[0066] (4.4.1) Perform 3-point mutation search for nonlinearity optimization, set the number of rounds of hill climbing search, random search, and reverse search method in N rounds as ff1, ff2, ff3, and ff1+ff2+ff3=1;
[0067] (4.4.2) Use the 3-point mutation search method of hill climbing search, random search, and reverse search method to search for the corresponding number of rounds, if a mutation point is found, evaluate the nonlinearity of the S-box before and after mutation in each round, and keep the S-box with better nonlinearity, and finally get N results;
[0068] (4.4.3) Perform 3-point mutation search for differential uniformity optimization, set the number of rounds of random search and reverse search in N rounds as cc1 and cc2, and cc1+cc2=1, here, increase the round ratio of random search to search for effective mutation points in a larger solution space;
[0069] (4.4.4) Use the 3-point mutation search method of random search and reverse search to search for the corresponding number of rounds, if a mutation point is found, evaluate the differential uniformity of the S-box before and after mutation in each round, and keep the S-box with better differential uniformity, and finally get N results;
[0070] (4.5) For the evaluation of the S-box after mutation, the traditional mutation operation is to judge whether the nonlinearity or differential uniformity is better, if the property is better, keep it, if the property is worse, discard it, which cannot complete the evaluation of the S-box with unchanged properties before and after mutation. Here, for the case that the nonlinearity and differential uniformity of the S-box before and after mutation are unchanged, a table lookup method is used to count and evaluate the change of the number of elements in the linear distribution table and the differential distribution table of the S-box, if the same element appears less frequently in the linear distribution table and the differential distribution table, the maximum linear path or the maximum differential path will be less, and the property will be better, and the specific method is as follows:
[0071] (4.5.1) If the nonlinearity of the S-boxes before and after mutation is unchanged, the linear distribution tables of the two S-boxes are calculated, the absolute value of each bit element in the linear distribution table is taken, and the number of occurrences is counted; the number of occurrences of the maximum value element in the linear distribution tables of the two S-boxes is compared, the smaller the number of occurrences, the fewer the maximum linear path of the S-box, and the better the linear property; if the number of occurrences of the maximum value element is the same, the number of occurrences of the second maximum value element is compared, and so on until the S-box with fewer occurrences of the same element value in the linear distribution table of the S-box before and after mutation is found, and the S-box is replaced with the original S-box;
[0072] (4.5.2) If the difference uniformity of the S-boxes before and after mutation is unchanged, the difference distribution table of the two S-boxes is calculated, the absolute value of each bit element in the difference distribution table is taken, and the number of occurrences is counted; the smaller the number of occurrences, the fewer the maximum difference path of the S-box, and the better the difference property; if the number of occurrences of the maximum value element is the same, the number of occurrences of the second maximum value element is compared, and so on until the S-box with fewer occurrences of the same element value in the difference distribution table of the S-box before and after mutation is found, and the S-box is replaced with the original S-box.
[0073] In the 8-bit S-box construction method based on the improved genetic algorithm of the present application, step (5) is to construct an 8-bit S-box based on the improved genetic algorithm, and the specific steps are as follows:
[0074] (5.1) The initial population is generated by the composite chaotic system of Logistic mapping and Tent mapping;
[0075] (5.2) The fitness function of each population is calculated;
[0076] (5.3) The crossover operation is performed on each population and the bijectivity of the S-box is ensured;
[0077] (5.4) The mutation operation of 2N rounds of search is performed on each population to optimize the nonlinearity and difference uniformity of the S-box;
[0078] (5.5) The optimal S-box is output through iteration of the population.
[0079] The beneficial effects of the present application are:
[0080] (1) The method of the present application improves the fitness function, crossover operation and mutation operation of the genetic algorithm, and constructs an 8-bit S-box based on the improved genetic algorithm, thereby improving the cryptographic properties of the generated S-box;
[0081] (2) In the improvement of the genetic algorithm, a multi-objective weighted fitness function is generated, which evaluates the S-box from multiple cryptographic indicators by considering the difference uniformity and nonlinearity and combining the strict avalanche criterion; in the crossover operation, the bijectivity of the S-box is ensured to improve the properties of the S-box after the crossover operation;
[0082] (3) The method of the application improves the genetic algorithm, constructs a reverse search method to search for a mutation point, and generates a 2N round search method based on 2-point mutation point search and 3-point mutation point search of hill climbing search, random search, and reverse search method. In the first N rounds, 2-point mutation point search of the three methods is used respectively, and in the last N rounds, 3-point mutation point search of the three methods is used respectively. A lookup table statistical method is used to evaluate and optimize the mutation S-box, effectively improving the cryptographic properties of the generated S-box. BRIEF DESCRIPTION OF DRAWINGS
[0083] Figure 1 is a flowchart of the 8-bit S-box construction method based on the improved genetic algorithm of the application. DETAILED DESCRIPTION
[0084] The content of the application will be further described below in conjunction with the embodiments and the drawings, but is not limited to the application.
[0085] EMBODIMENT
[0086] REFERENCE Figure 1 An 8-bit S-box construction method based on an improved genetic algorithm, comprising the following steps:
[0087] (1) Initialize the population based on a composite chaotic system;
[0088] (2) Generate a multi-property combined fitness function;
[0089] (3) Use a crossover operation to ensure the bijectivity of the S-box;
[0090] (4) Perform a 2N round search mutation operation on each population to optimize the nonlinearity and differential uniformity of the S-box;
[0091] (5) Construct an 8-bit S-box based on the improved genetic algorithm.
[0092] Step (1) initializes the population based on a composite chaotic system, and the specific steps are as follows:
[0093] (1.1) The composite chaotic system mapping formula is constructed by composite Tent mapping and Logistic mapping as follows:
[0094] (1)
[0095] wherein, is the input sample variable, and the parameter ∈(0, 0.1], ∈[0, 1];
[0096] (1.2) The process of generating an initial S-box using a composite chaotic system is as follows:
[0097] (1.2.1) Define an array S of length 256 and set the initial value of the chaotic mapping. ;
[0098] (1.2.2) To eliminate the transient effects of the chaotic system, the system does not output chaotic values after 50 idle cycles;
[0099] (1.2.3) The state values of the complex chaotic system in each round The integer Z is generated as follows:
[0100] (2)
[0101] (1.2.4) To ensure the bijectivity of the S-box, determine whether Z has been added to the array S. If not, add Z to S; if it has been added, go to (1.2.5).
[0102] (1.2.5) If the number of elements in S is less than 256, go to (1.2.3) to regenerate Z; otherwise, go to (1.2.6).
[0103] (1.2.6) Output array S to generate the initial S-box sample population.
[0104] Step (2) involves generating a fitness function that combines multiple properties. The specific steps are as follows:
[0105] (2.1) Combining differential uniformity, nonlinearity, and strict avalanche criterion, a multi-objective weighted fitness function is generated, as shown in the following formula:
[0106] (3)
[0107] in, It is a single individual S-box. It is the nonlinearity of the S-box t. is the difference uniformity of S-box t; SAC is the strict avalanche criterion; a, b, c are the weights of S-box nonlinearity, difference uniformity, and strict avalanche criterion, respectively.
[0108] (2.2) Based on the different cryptographic properties, set corresponding weights to transform the above fitness function G(t) into a multi-objective piecewise weighted fitness function as follows:
[0109] (4)
[0110] (2.3) Difference uniformity of S-box The calculation formula is as follows:
[0111] (5)
[0112] wherein, are the input difference and output difference of S-box respectively, called difference pair; is the set of n-tuple elements in F2 field, F2 is a binary finite field containing 2 elements; is the difference value of difference pair , whose calculation formula is as follows:
[0113] (6)
[0114] wherein x is the input of S-box, , is the vector Boolean function representation method of S-box, namely , is the addition operation on binary finite field, represents the number of elements in the set satisfying the condition;
[0115] (2.4) Nonlinearity of S-box The calculation formula is as follows:
[0116] (7)
[0117] wherein, are the input mask and output mask of S-box respectively, called mask pair; , represents an 8-bit S-box; is the Walsh transform of S-box, whose calculation formula is as follows:
[0118] (8)
[0119] wherein “ ” represents the vector inner product operation on binary finite field.
[0120] The cross operation for ensuring the bijectivity of S-box in step (3) is as follows:
[0121] (3.1) Let the S-boxes before crossing be B1, B2, and the S-boxes after crossing be C1, C2;
[0122] (3.2) Generate a random number R in the range of [0, 255];
[0123] (3.3) Copy the first R elements in B1 to C1;
[0124] (3.4) Traverse the elements in B2 from the beginning, if the element is not in C1 and the number of elements in C1 is less than 256, add it to C1, otherwise skip the element and continue to traverse, until the elements in C1 are full;
[0125] (3.5) Add the remaining elements in B2 to C2 in order, and then add the remaining elements in B1 to C2 in order to complete C2 to 256 elements;
[0126] (3.6) Output S-boxes C1 and C2.
[0127] Step (4) The mutation operation of 2N rounds of search for each population optimizes the nonlinearity and differential uniformity of the S-box. The specific steps are as follows:
[0128] (4.1) In order to better optimize the nonlinearity and differential uniformity of the S-box, according to the linear distribution and differential distribution of the S-box, a reverse search method is constructed to search for mutation points. First, search for mutation points to optimize the nonlinearity of the S-box, and then search for mutation points according to the differential distribution of the S-box to optimize the differential uniformity of the S-box;
[0129] (4.1.1) In order to improve the nonlinearity of the S-box, the linearity of the S-box needs to be reduced. The mutation point search of the reverse search method will first calculate the linearity Line of the S-box, and then traverse all input / output mask pairs of the S-box to find all x that satisfy the following formula: are the input mask and output mask of the S-box, respectively:
[0130] (9)
[0131] Put x into the corresponding set, randomly select two different values from the set as the element index of the S-box to perform element exchange, calculate the linearity of the S-box after element exchange, and evaluate whether the linearity of the S-box after mutation is better than that before mutation;
[0132] (4.1.2) In order to optimize the differential uniformity of the S-box, search for mutation points according to the differential distribution of the S-box. First, calculate the differential uniformity of the S-box, traverse all input / output differential pairs of the S-box, find x that satisfies formula (6), and put it into the corresponding set. Randomly select two different values from the set as the element index of the S-box to perform element exchange, calculate the differential uniformity of the S-box after element exchange, and evaluate whether the differential uniformity of the S-box after mutation is better than that before mutation;
[0133] (4.2) In order to speed up the execution efficiency of the mutation operation and optimize the properties of the S-box, a 2N round search method is generated based on the hill climbing search, random search, 2-point mutation point search and 3-point mutation point search of the reverse search method. In the first N rounds, 2-point mutation point search of the three methods is used respectively, and in the last N rounds, 3-point mutation point search of the three methods is used respectively;
[0134] (4.3) The specific steps of the 2-point mutation search method in the first N rounds are as follows:
[0135] (4.3.1) In the 2-point mutation point search of the first N rounds, the mutation point search of non-linearity optimization is performed, the search round numbers of 2-point hill climbing search, random search and reverse search method in N rounds are set as f1, f2 and f3 respectively, and f1+f2+f3=1, wherein the 2-point random search is to generate two different numbers in the interval [0, 255] as the element index of the S-box through a random function to exchange two elements;
[0136] (4.3.2) The 2-point mutation search methods of hill climbing search, random search and reverse search method are used to search for a corresponding number of rounds, if a mutation point is searched, the S-boxes before and after mutation in each round are evaluated for non-linearity, and the S-box with better non-linearity is retained, and finally N results are obtained;
[0137] (4.3.3) The mutation point search of difference uniformity optimization is performed, random search and reverse search method are used, and the round numbers of the two in N rounds are set as c1 and c2, and c1+c2=1;
[0138] (4.3.4) The 2-point mutation search methods of random search and reverse search method are used to search for a corresponding number of rounds, if a mutation point is searched, the S-boxes before and after mutation in each round are evaluated for difference uniformity, and the S-box with better difference uniformity is retained, and finally N results are obtained;
[0139] (4.4) In the 3-point mutation search of the last N rounds, the 3-point hill climbing algorithm is used to replace the 2-point hill climbing algorithm, the random search is to generate three different numbers in the interval [0, 255] as the element index of the S-box through a random function to exchange two elements, and the reverse search method is to randomly select three different numbers from the set satisfying the condition as the element index of the S-box and then exchange two elements, the specific method is as follows;
[0140] (4.4.1) The 3-point mutation point search of non-linearity optimization is performed, the round numbers of hill climbing search, random search and reverse search method in N rounds are set as ff1, ff2 and ff3 respectively, and ff1+ff2+ff3=1;
[0141] (4.4.2) The 3-point mutation search methods of hill climbing search, random search and reverse search method are used to search for a corresponding number of rounds, if a mutation point is searched, the S-boxes before and after mutation in each round are evaluated for non-linearity, and the S-box with better non-linearity is retained, and finally N results are obtained;
[0142] (4.4.3) 3-point mutation search for differential uniformity optimization, set the proportion of random search and reverse search rounds in N rounds as cc1 and cc2 respectively, and cc1+cc2=1, here, increase the proportion of random search rounds to search for effective mutation points in a larger solution space;
[0143] (4.4.4) 3-point mutation search method using random search and reverse search method, search for a corresponding number of rounds respectively, if a mutation point is found, evaluate the differential uniformity of the S-box before and after mutation in each round, and keep the S-box with better differential uniformity, and finally get N results;
[0144] (4.5) For the case where the nonlinearity and differential uniformity of the S-box before and after mutation are unchanged, a table lookup statistical method is used to count and evaluate the number of changes of elements in the linear distribution table and the differential distribution table of the S-box. The smaller the frequency of the same elements in the linear distribution table and the differential distribution table, the fewer the maximum linear path or the maximum differential path, and the better the property. The specific method is as follows:
[0145] (4.5.1) If the nonlinearity of the S-box before and after mutation is unchanged, calculate the linear distribution table of the two S-boxes, take the absolute value of each element in the linear distribution table and count the number of times it appears. Compare the number of times the maximum value element appears in the linear distribution table of the two S-boxes. The smaller the number of times, the fewer the maximum linear path of the S-box, and the better the linear property. If the number of times the maximum value element appears is the same, compare the number of times the second largest value element appears, and so on until the S-box with fewer times of the same element value appearing in the linear distribution table before and after mutation is found. Replace the original S-box with it;
[0146] (4.5.2) If the differential uniformity of the S-box before and after mutation is unchanged, calculate the differential distribution table of the two S-boxes, take the absolute value of each element in the differential distribution table and count the number of times it appears. The smaller the number of times, the fewer the maximum differential path of the S-box, and the better the differential property. If the number of times the maximum value element appears is the same, compare the number of times the second largest value element appears, and so on until the S-box with fewer times of the same element value appearing in the differential distribution table before and after mutation is found. Replace the original S-box with it.
[0147] Step (5) constructs an 8-bit S-box based on an improved genetic algorithm, and the specific steps are as follows:
[0148] (5.1) Generate an initial population through a composite chaotic system composed of Logistic mapping and Tent mapping;
[0149] (5.2) Calculate the fitness function of each population;
[0150] (5.3) Perform crossover operation on each population and ensure the bijectivity of the S-box.
[0151] (5.4) The mutation operation of 2N rounds of search for each population optimizes the nonlinearity and differential uniformity of the S-box;
[0152] (5.5) The optimal S-box is output through iteration of the population.
Claims
1. An 8-bit S-box construction method based on improved genetic algorithm, comprising the following steps: (1) Compound the Logistic map and the Tent map by exponential multiplication to establish a compound chaotic system to initialize the S-box population; (2) Generate a multi-objective segmented weighted function as the fitness function based on the nonlinearity, differential uniformity and strict avalanche criterion, comprehensively evaluate the properties of the S-box, and the smaller the fitness function value of the S-box, the better the cryptographic properties; (3) Perform crossover operation on each population and ensure the bijectivity of the S-box, and the specific operation is as follows: (3.1) Let the S-boxes before crossover be B1 and B2, and the S-boxes after crossover be C1 and C2; (3.2) Generate a random number R in the range of [0, 255]; (3.3) Copy the first R elements in B1 to C1; (3.4) Traverse the elements in B2 from the beginning, if the element is not in C1 and the number of elements in C1 is less than 256, add it to C1, otherwise skip the element and continue to traverse, until the elements in C1 are full; (3.5) Add the remaining elements in B2 to C2 in order, and then add the remaining elements in B1 to C2 in order to complete 256 elements; (3.6) Output the S-boxes C1 and C2; (4) Perform 2N rounds of mutation operation on each population to optimize the nonlinearity and differential uniformity of the S-box; Construct a reverse search method to search for mutation points, and generate a mutation operation based on 2N rounds of search based on hill climbing search, random search and reverse search method; in the first N rounds of 2-point mutation search, the 2-point mutation search methods of hill climbing search, random search and reverse search are used respectively to search for the corresponding number of rounds, and the S-boxes with better nonlinearity are retained; the 2-point mutation search methods of random search and reverse search are used respectively to search for the corresponding number of rounds, and the S-boxes with better differential uniformity are retained; in the last N rounds of 3-point mutation search, the 3-point mutation search methods of hill climbing search, random search and reverse search are used respectively to search for the corresponding number of rounds, and the S-boxes with better nonlinearity are retained; the 3-point mutation search methods of random search and reverse search are used respectively to search for the corresponding number of rounds, and the S-boxes with better differential uniformity are retained; for the case that the nonlinearity and differential uniformity of the S-box before and after mutation remain unchanged, a table lookup statistical method is generated to count and evaluate the properties of the optimized S-box by counting the number of changes of elements in the linear distribution table and the differential distribution table of the S-box; (5) Construct an 8-bit S-box based on the improved genetic algorithm; Through iteration of the population, the optimal S-box is output.
2. The method for constructing 8-bit S-box based on improved genetic algorithm according to claim 1, characterized in that, The step (1) of establishing a compound chaotic system to initialize the S-box population comprises the following steps: (1.1) Generate an initial population using a chaotic system, compound the Tent map and the Logistic map to form a compound chaotic system mapping formula as follows: (1) wherein, is the input sample state variable, the parameters ∈(0, 0.1], ∈[0, 1]; (1.2) The process of generating an initial S-box using the compound chaotic system is as follows: (1.2.1) define an array S of length 256, set the initial value of the chaotic mapping ; (1.2.2) To eliminate the transient effect of the chaotic system, idle the system for 50 times without outputting chaotic values; (1.2.3) the state value of each round of the composite chaotic system The integer Z is generated as follows: (2) (1.2.4) To ensure the bijectivity of the S-box, it is judged whether Z has been added to the array S, if not, Z is put into S, if yes, go to (1.2.5); (1.2.5) If the number of elements in S is less than 256, go to (1.2.3) to generate Z again, otherwise go to (1.2.6); (1.2.6) Output the array S to generate the initial S-box sample population.
3. The method for constructing 8-bit S-box based on improved genetic algorithm according to claim 2, characterized in that, Step (2) generates a multi-objective segmented weighted function as the fitness function to comprehensively evaluate the properties of the S-box, and the specific method is as follows: (2.1) A multi-objective weighted fitness function is generated as the fitness function by combining the differential uniformity, nonlinearity, and strict avalanche criterion, and the formula is as follows: (3) wherein, is a single individual S-box, is the nonlinearity of S-box t, is the differential uniformity of S-box t; SAC is the strict avalanche criterion; a, b, c are the weights of the nonlinearity, the differential uniformity and the strict avalanche criterion of the S-box, respectively; (2.2) Based on the optimization test of the cryptographic properties of the S-box, the corresponding weight is set according to the different cryptographic properties, and the above fitness function G(t) is converted into a multi-objective segmented weighted fitness function as follows: (4) (2.3) Differential uniformity of S-boxes The calculation formula is shown as follows: (5) wherein, are the input and output differences of the S-box, respectively, called a differential pair; is a set of n-tuple elements in the F2 field, F2 is a binary finite field containing 2 elements; is the differential value of the differential pair The calculation formula is as follows: (6) where x is the input of the S-box, , is the vector Boolean function representation method of the S-box, i.e. , is the addition operation on the binary finite field, denotes the number of elements of the set satisfying the condition; (2.4) Nonlinearity of S-box The calculation formula is shown as follows: (7) wherein are the input mask and the output mask of the S-box, respectively, called a mask pair; denotes an 8-bit S-box; is the Walsh transform of the S-box, which is calculated by the formula: (8) wherein denotes the vector inner product operation over a binary finite field.
4. The method for constructing 8-bit S-box based on improved genetic algorithm according to claim 3, characterized in that, Step (4) of the mutation operation of 2N rounds of search for each population optimizes the nonlinearity and differential uniformity of the S-box, and the specific steps are as follows: (4.1) A reverse search method is constructed to search for mutation points, which optimizes the nonlinearity of the S-box, and according to the differential distribution of the S-box, the mutation points are searched to optimize the differential uniformity of the S-box; (4.1.1) To improve the nonlinearity of the S-box, the linearity of the S-box needs to be reduced. In the reverse search method, the search for the mutation point will first calculate the linearity Line of the S-box, and then traverse the input / output mask pairs of the S-box to find all the inputs x of the S-box that satisfy formula (9), wherein, are the input mask and the output mask of the S-box, respectively: (9) Put x into the corresponding set, randomly select two different values from the set as the element subscript of the S-box to exchange elements, calculate the linearity of the S-box after element exchange, and evaluate whether the linearity of the S-box after mutation is better than that before mutation; (4.1.2) To optimize the differential uniformity of the S-box, search for mutation points according to the differential distribution of the S-box, first calculate the differential uniformity of the S-box, traverse all input / output differential pairs of the S-box, find x that satisfies formula (6) and put it into the corresponding set; randomly select two different values from the set as the element subscript of the S-box to exchange elements, calculate the differential uniformity of the S-box after element exchange; and evaluate whether the differential uniformity of the S-box after mutation is better than that before mutation; (4.2) To speed up the execution efficiency of the mutation operation and optimize the properties of the S-box, a 2N round search method is adopted, which is based on 2-point mutation point search and 3-point mutation point search of hill climbing search, random search, and reverse search method, and 2-point mutation point search is performed in the first N rounds and 3-point mutation point search is performed in the last N rounds; (4.3) The specific steps of 2-point mutation search in the first N rounds are as follows: (4.3.1) In the 2-point mutation point search in the first N rounds, the nonlinearity optimization mutation point search is performed, the search round number of 2-point hill climbing search, random search, and reverse search method in N rounds is set as f1, f2, and f3 respectively, and f1+f2+f3=1, wherein the 2-point random search is to generate 2 different numbers as the element subscript of the S-box by a random function in the interval [0, 255] to exchange 2 elements; (4.3.2) 2-point mutation search with hill climbing search, random search, and reverse search method, with 2 points for mutation, search for corresponding rounds respectively, if the mutation point is searched, evaluate the nonlinearity of the S-box before and after mutation in each round, keep the S-box with better nonlinearity, and finally get N results; (4.3.3) Differential uniformity optimized mutation point search, using random search and reverse search method, set the proportion of the number of rounds of the two in N rounds as c1, c2, and c1+c2=1; (4.3.4) 2-point mutation search method with random search and reverse search method, with 2 points for mutation, search for corresponding rounds respectively, if the mutation point is searched, evaluate the differential uniformity of the S-box before and after mutation in each round, keep the S-box with better differential uniformity, and finally get N results; (4.4) In the 3-point mutation search of the last N rounds, replace the 2-point hill climbing algorithm with the 3-point hill climbing algorithm, and the random search generates 3 different numbers in the interval [0, 255] as the element indexes of the S-box through the random function to exchange the elements in pairs, and the reverse search method randomly selects 3 different numbers as the element indexes of the S-box from the set that meets the conditions and then exchanges the elements in pairs, the specific method is as follows; (4.4.1) 3-point mutation point search for nonlinearity optimization, set the proportion of the number of rounds of hill climbing search, random search, and reverse search method in N rounds as ff1, ff2, ff3, and ff1+ff2+ff3=1; (4.4.2) 3-point mutation search with hill climbing search, random search, and reverse search method, with 3 points for mutation, search for corresponding rounds respectively, if the mutation point is searched, evaluate the nonlinearity of the S-box before and after mutation in each round, keep the S-box with better nonlinearity, and finally get N results; (4.4.3) 3-point mutation point search for differential uniformity optimization, set the proportion of the number of rounds of random search and reverse search in N rounds as cc1, cc2, and cc1+cc2=1, here, increase the proportion of the number of rounds of random search to facilitate searching for effective mutation points in a larger solution space; (4.4.4) 3-point mutation search method with random search and reverse search method, with 3 points for mutation, search for corresponding rounds respectively, if the mutation point is searched, evaluate the differential uniformity of the S-box before and after mutation in each round, keep the S-box with better differential uniformity, and finally get N results; (4.5) For the case where the nonlinearity and differential uniformity of the S-box before and after mutation do not change, generate a lookup table statistics method to count and evaluate the change in the number of elements in the linear distribution table and the differential distribution table of the S-box, the smaller the frequency of the same elements in the linear distribution table and the differential distribution table, the fewer the maximum linear path or the maximum differential path, and the better the property, the specific method is as follows: (4.5.1) If the nonlinearity of the S-boxes before and after mutation is unchanged, calculate the linear distribution table of the two S-boxes, take the absolute value of each bit element in the linear distribution table and count the number of occurrences; compare the number of occurrences of the maximum value element in the linear distribution table of the two S-boxes, the smaller the number of occurrences, the fewer the maximum linear path of the S-box, and the better the linear property; if the number of occurrences of the maximum value element is the same, compare the number of occurrences of the second largest value element, and so on until the S-box with fewer occurrences of the same element value in the linear distribution table of the S-box before and after mutation is found, which replaces the original S-box; (4.5.2) If the difference uniformity of the S-boxes before and after mutation is unchanged, calculate the difference distribution table of the two S-boxes, take the absolute value of each bit element in the difference distribution table and count the number of occurrences; the smaller the number of occurrences, the fewer the maximum difference path of the S-box, and the better the difference property; if the number of occurrences of the maximum value element is the same, compare the number of occurrences of the second largest value element, and so on until the S-box with fewer occurrences of the same element value in the difference distribution table of the S-box before and after mutation is found, which replaces the original S-box.
Citation Information
Patent Citations
S-box optimization method based on improved genetic algorithm
CN111783989A
8-bit S box construction and optimization method based on composite chaotic mapping
CN117938357A