Methods, apparatus, equipment, and media for dynamically adjustable block cipher algorithm structure

By iteratively executing 32 rounds of encryption operations and generating round functions with different structures using keys and control parameters, the problem of cumbersome design and limited security of iterative block cipher algorithms is solved, and the dynamic adjustability and enhanced security of block cipher algorithms are realized.

CN115664637BActive Publication Date: 2026-06-30NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211313869.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-25
Publication Date
2026-06-30
Estimated Expiration
2042-10-25

AI Technical Summary

Technical Problem

Existing iterative block cipher algorithms are limited in their use during algorithm initialization, are cumbersome to design and difficult to extend, and affect security and adjustability.

Method used

By inputting the master key and master control parameters, 32 rounds of encryption operations are executed iteratively. Round functions with different structures are generated using key expansion and parameter expansion algorithms, including S-box and P-box control parameters. The round function components are dynamically adjusted to ensure the algorithm's resistance to differential attacks.

Benefits of technology

The structure of the block cipher algorithm is dynamically adjustable, which improves the algorithm's adjustability and security, and enhances its resistance to differential attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115664637B_ABST
    Figure CN115664637B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, device, and medium for dynamically adjustable block cipher algorithm structures, relating to the field of information security. The method includes: inputting a master key, master control parameters, and plaintext to be encrypted; iteratively executing 32 rounds of encryption operations using the master key and master control parameters on the plaintext until 128 bits of ciphertext are obtained. This application achieves dynamic adjustability of the cryptographic algorithm structure by adding parameter control, allowing for the generation of round functions with different structures through parameter adjustment, while simultaneously ensuring the algorithm's resistance to differential attacks. This enriches the diversity of block cipher algorithm structures and improves the algorithm's security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information security, and in particular to a method, apparatus, device, and medium for dynamically adjustable block cipher algorithm structure. Background Technology

[0002] Data encryption technology is the cornerstone of network security, and it is implemented through encryption algorithms. Block ciphers are characterized by their speed, ease of standardization, and suitability for hardware and software implementation, and are often one of the core mechanisms for data encryption in information and network security.

[0003] Currently, most cryptographic algorithms are iterative cryptographic algorithms, and the round functions for each round are almost identical. In practical applications, the algorithm's use is severely limited during the initialization process.

[0004] Block cipher algorithms are designed based on cryptographic components with excellent cryptographic properties, such as S-boxes with optimal differential uniformity and linearity, and linear layers with optimal differential branch number and linear branch number, among other cryptographic metrics. The design process is quite complex and not easily extendable to new cryptographic algorithms. In other words, if cryptographic components are applied to the design of a new cryptographic algorithm, the overall security of the algorithm still needs to be reassessed. Summary of the Invention

[0005] To address the aforementioned technical problems, embodiments of this application provide a method for dynamically adjustable structure of block cipher algorithms.

[0006] In a first aspect, embodiments of this application provide a method for dynamically adjusting the structure of a block cipher algorithm, the method comprising:

[0007] Input the master key, master control parameters and plaintext to be encrypted, wherein the length of the plaintext to be encrypted is 128 bits, the length of the master key is 256 bits, and the length of the master control parameters is 256 bits;

[0008] The plaintext to be encrypted is iteratively encrypted for 32 rounds using the master key and the master control parameters until 128 bits of ciphertext are obtained.

[0009] The step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes:

[0010] The 64-bit round key for each round is obtained based on the 256-bit master key, and the 68-bit round function control parameters for each round are obtained based on the 256-bit master control parameters. The 68-bit round function control parameters include 64-bit S-box control parameters and 4-bit P-box control parameters.

[0011] The 128-bit plaintext to be encrypted is processed according to the round function of each round.

[0012] According to a specific embodiment disclosed in this application, the step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes:

[0013] The 256-bit master key is divided into eight 32-bit keys. The first 32-bit key and the fifth 32-bit key of the 256-bit master key are extracted as the 64-bit round key for the first round.

[0014] The 256-bit master key is subjected to a key expansion algorithm to obtain the 64-bit round keys for rounds 2 to 32.

[0015] According to a specific embodiment disclosed in this application, the step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes:

[0016] The 256-bit master control parameters are used to obtain the S-box control parameters for rounds 1 to 32 through a parameter expansion algorithm;

[0017] The 256-bit master control parameter is divided into eight 32-bit groups. The fourth 32-bit master control parameter and the eighth 32-bit master control parameter are used as the 64-bit S-box control parameter for the first round.

[0018] The S-box control parameters for rounds 2 to 32 are obtained using the S-box parameter expansion algorithm.

[0019] According to a specific embodiment disclosed in this application, after the step of obtaining the S-box control parameters for rounds 2 to 32 according to the S-box parameter expansion algorithm, the method further includes:

[0020] The 64-bit S-box control parameters of the first round are divided into 16 4-bit groups, which are used as the 4-bit P-box control parameters of the first to 16th rounds respectively.

[0021] The 64-bit S-box control parameters of the first round are used to perform the P-box parameter expansion algorithm, and are then used as the P-box control parameters for rounds 17 to 32.

[0022] According to a specific embodiment disclosed in this application, the step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes:

[0023] Use the 128 bits of plaintext as the 128 bits of input variable for the first round;

[0024] The 128-bit input variables of the first round, the 64-bit round key of the first round, and the 64-bit round function control parameters of the first round are executed to obtain the 128-bit input variables of the second round.

[0025] According to a specific embodiment disclosed in this application, the step of executing the 128-bit input variable of the first round, the 64-bit round key of the first round, and the 64-bit round function control parameters of the first round into the first round's round function to obtain the 128-bit input variable of the second round includes:

[0026] The dynamic components used by the round function include a dynamic obfuscation layer and a dynamic diffusion layer.

[0027] According to a specific embodiment disclosed in this application, the step of performing calculations on the 128-bit plaintext to be encrypted based on the round function control parameters of each round includes:

[0028] The round function in round 32 does not perform the swap operation between the left and right branches.

[0029] Secondly, embodiments of this application provide an apparatus for dynamically adjustable structure of a block cipher algorithm, comprising:

[0030] The input module is used to input the master key, master control parameters and plaintext to be encrypted, wherein the length of the plaintext to be encrypted is 128 bits, the length of the master key is 256 bits, and the length of the master control parameters is 256 bits.

[0031] An iterative module is used to iteratively execute 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained; wherein, the step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes:

[0032] The 64-bit round key for each round is obtained based on the 256-bit master key, and the 68-bit round function control parameters for each round are obtained based on the 256-bit master control parameters. The 68-bit round function control parameters include 64-bit S-box control parameters and 4-bit P-box control parameters. The 128-bit plaintext to be encrypted is then processed according to the round function of each round.

[0033] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the computer program executes the method for dynamically adjustable structure of the block cipher algorithm provided in the first aspect when the processor is running.

[0034] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a processor, executes a method for dynamically adjustable structure of the block cipher algorithm provided in the first aspect.

[0035] The method for dynamically adjustable block cipher algorithm provided in this application involves inputting a master key, master control parameters, and plaintext to be encrypted. The plaintext is 128 bits long, the master key is 256 bits long, and the master control parameters are 256 bits long. The method iteratively executes 32 rounds of encryption using the master key and master control parameters until a 128-bit ciphertext is obtained. The step of encrypting the plaintext using the master key and master control parameters includes: obtaining a 64-bit round key for each round based on the 256-bit master key, and obtaining a 68-bit round function control parameter for each round based on the 256-bit master control parameters. The 68-bit round function control parameter includes a 64-bit S-box control parameter and a 4-bit P-box control parameter. Finally, the method performs calculations on the 128-bit plaintext according to the round function. By adding parameters for adjustment, the structure of the cryptographic algorithm becomes dynamically adjustable. Different round functions with different structures can be generated by adjusting the parameters, while ensuring the algorithm's resistance to differential attacks, thus improving the algorithm's adjustability and security. Attached Figure Description

[0036] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be considered as a limitation on the scope of protection of this application. In the various drawings, similar components are numbered similarly.

[0037] Figure 1 This illustration shows a flowchart of a method for dynamically adjusting the structure of a block cipher algorithm according to an embodiment of this application;

[0038] Figure 2 This illustration shows a schematic diagram of the encryption process of a method for dynamically adjustable block cipher algorithm provided in an embodiment of this application;

[0039] Figure 3 This illustration shows a schematic diagram of the round function structure of a method for dynamically adjustable block cipher algorithm provided in an embodiment of this application;

[0040] Figure 4 This illustration shows a schematic diagram of a device structure for a dynamically adjustable block cipher algorithm provided in an embodiment of this application. Detailed Implementation

[0041] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0042] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0043] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.

[0044] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0045] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.

[0046] Example 1

[0047] This disclosure provides a method for dynamically adjusting the structure of a block cipher algorithm.

[0048] For details, see Figure 1 Methods for dynamically adjusting the structure of block cipher algorithms include:

[0049] Step S101: Input the master key, master control parameters and plaintext to be encrypted, wherein the length of the plaintext to be encrypted is 128 bits, the length of the master key is 256 bits, and the length of the master control parameters is 256 bits;

[0050] Specifically, the structure of the round function used in each round is dynamically adjusted through control parameters. The master key refers to the 256-bit initial key, and the round key for each round is obtained using a key expansion algorithm, which then executes the round function operation. The master control parameters are used to obtain the control parameters of the round function. By adding parameters for adjustment, round functions with different structures are generated, making the structure dynamically adjustable during the block encryption process. At the same time, it ensures resistance to differential attacks during encryption, and the dynamically adjustable algorithm maintains consistency in encryption and decryption processes, thus increasing security.

[0051] Specifically, the process involves inputting a master key, master control parameters, and plaintext to be encrypted. Based on the master key, a key parameter expansion algorithm is used to obtain the round key for each round. The master control parameters are then used to obtain the control parameters for the round function of the first round through a parameter expansion algorithm. The plaintext to be encrypted is iteratively encrypted 32 times, and finally, 128 bits of encrypted ciphertext information are output.

[0052] The DSTP dynamic encryption algorithm is an iterative block cipher algorithm based on a generalized Feistel structure. Each round's round function consists of a key addition layer, a dynamic confusion layer, and a dynamic diffusion layer. The round key and control parameters participating in the round function operation are generated by the key expansion algorithm and parameter expansion algorithm, respectively.

[0053] Step S102: Iteratively execute 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained;

[0054] The step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes:

[0055] The 64-bit round key for each round is obtained based on the 256-bit master key, and the 68-bit round function control parameters for each round are obtained based on the 256-bit master control parameters. The 68-bit round function control parameters include 64-bit S-box control parameters and 4-bit P-box control parameters.

[0056] The 128-bit plaintext to be encrypted is processed according to the round function of each round.

[0057] In one embodiment, the step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes:

[0058] The 256-bit master key is divided into eight 32-bit keys. The first 32-bit key and the fifth 32-bit key of the 256-bit master key are extracted as the 64-bit round key for the first round.

[0059] The 256-bit master key is subjected to a key expansion algorithm to obtain the 64-bit round keys for rounds 2 to 32.

[0060] Specifically, see Figure 2 The 256-bit master key is stored in a key register MK, represented as eight 32-bit keys, i.e., MK = K0K1K2K3K4K5K6K7, where K0 to K7 are the eight 32-bit keys respectively. In the i-th round, the 64-bit key consists of the first and fifth 32-bit keys, i.e., K... (i-1) = K0K4, where 1≤i≤32. After extracting the round key, the key register is updated by executing the key expansion algorithm. Thus, the 64-bit round keys for rounds 1 to 32 are obtained based on the 256-bit master key.

[0061] Further, the 256-bit master key stored in the key register is divided into eight 32-bit keys, i.e., MK = K0K1K2K3K4K5K6K7. The first and fifth 32-bit keys from these eight 32-bit round keys are extracted as the 64-bit round key K for the first round. (0) =K0K4. Then, the key register is updated using the key expansion algorithm. The first 32-bit key and the fifth 32-bit key extracted after the update are used as the 64-bit round key for the second round. The key register follows the principle of extracting first and then updating, until the 64-bit round keys for rounds 1 to 32 are obtained.

[0062] In specific implementation, the step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes:

[0063] The 256-bit master control parameters are used to obtain the S-box control parameters for rounds 1 to 32 through a parameter expansion algorithm;

[0064] The 256-bit master control parameter is divided into eight 32-bit groups. The fourth 32-bit master control parameter and the eighth 32-bit master control parameter are used as the 64-bit S-box control parameter for the first round.

[0065] The S-box control parameters for rounds 2 to 32 are obtained using the S-box parameter expansion algorithm.

[0066] The main control parameters are stored in a parameter register, represented as eight 32-bit control parameters. The parameter register first executes a parameter expansion algorithm, then extracts the 68-bit round function control parameters for the i-th round, where 1 ≤ i ≤ 32. The parameter expansion algorithm includes an S-box parameter expansion algorithm and a P-box parameter expansion algorithm. The S-box refers to the dynamic diffusion layer, and the P-box refers to the dynamic obfuscation layer. The S-box parameter expansion algorithm is an expansion algorithm applied to the control parameters of the dynamic diffusion layer, and the P-box parameter expansion algorithm is an expansion algorithm applied to the control parameters of the dynamic obfuscation layer.

[0067] In specific implementation, after obtaining the S-box control parameters for rounds 2 to 32 according to the S-box parameter expansion algorithm, the method further includes:

[0068] The 64-bit S-box control parameters of the first round are divided into 16 4-bit groups, which are used as the 4-bit P-box control parameters of the first to 16th rounds respectively.

[0069] The 64-bit S-box control parameters from the first round are used to perform a P-box parameter expansion algorithm, and are then used as the P-box control parameters for rounds 17 to 32.

[0070] Specifically, the 256-bit main control parameters are stored in the parameter register MT, represented as eight 32-bit control parameters, i.e., MT = T0T1T2T3T4T5T6T7. The fourth and eighth 32-bit parameters output by the S-box parameter expansion algorithm are used as the 64-bit S-box control parameters for the i-th round.

[0071] The 64-bit S-box control parameter T of the first round (0) =T3||T7 is divided into 16 4-bit segments t0||t1||...||t 14 ||t 15 =T3||T7 is used as the P-box control parameter for rounds 1 to 16. Additionally, the 4-bit P-box control parameters t0||t1||...||t for rounds 1 to 16 are... 14 ||t 15 The P-box expansion algorithm is executed sequentially, and the output 16×4 bits are used as the P-box control parameters for rounds 17 to 32.

[0072] The P-box expansion algorithm includes:

[0073]

[0074] In specific implementation, the step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes:

[0075] Use the 128 bits of plaintext as the 128 bits of input variable for the first round;

[0076] The 128-bit input variables of the first round, the 64-bit round key of the first round, and the 64-bit round control parameters of the first round are executed using the round function of the first round to obtain the 128-bit input variables of the second round.

[0077] Specifically, the 128-bit plaintext to be encrypted is divided into two 64-bit pieces of information for round function update encryption.

[0078] Specifically, see Figure 3 The dynamic confusion layer and dynamic diffusion layer of the round function in the i-th round are determined by the S-box control parameters and P-box control parameters corresponding to that round, respectively. Here, L refers to the left branch in the iteration process, R refers to the right branch in the iteration process, K refers to the round key for each round, and F refers to the round function for each round.

[0079] In one specific implementation, the step of performing calculations on the 128-bit plaintext to be encrypted based on the round function control parameters of each round includes:

[0080] The round function in round 32 does not perform the swap operation between the left and right branches.

[0081] Specifically, to ensure the encryption and decryption consistency of the DSTP algorithm, the round function of round 32 does not include the swapping operation between the left and right branches; that is, the output information of function F is XORed with the output information of the right branch as the output information R of the right branch. (32) The input to the left branch is directly used as the output information L of the right branch. (32) .

[0082] Specifically, the 128-bit plaintext to be encrypted is divided into two 64-bit plaintext messages, denoted as L. (0) ,R (0) This serves as the input information for the first round. The output information for the i-th round is represented as L. (i) ||R (i) Where 1 ≤ i ≤ 32. The 128-bit input information L in the i-th round. (i-1) ||R (i-1) The execution of the round function yields 128 bits of output information L. (i) ||R (i) The round function is as follows:

[0083]

[0084] R (i) =L (i-1)

[0085] The 64-bit input information L of the left branch in the i-th round(i-1) With round key K (i-1) Perform an XOR operation on the corresponding bits and then convert the XOR result to the output. The input information of function F is used as input information. The output information of function F is then subjected to a bit-based XOR operation with the 64-bit information of the right branch to obtain the output information L of the left branch in the i-th round. (i) The input information L of the right branch in the i-th round (i-1) The output information R of the right branch in the i-th round (i) Specifically, the F function is determined by the round control parameters. The input variables of the round function first execute the dynamic obfuscation layer, and then the dynamic diffusion layer. In each round of the round function, the dynamic obfuscation layer and the dynamic diffusion layer have corresponding round control parameters to regulate the algorithm structure. The parameters used to control the round transformation total 68 bits.

[0086] In specific implementation, the step of executing the 128-bit input variable of the first round, the 64-bit round key of the first round, and the 64-bit round control parameters of the first round into the round function of the first round to obtain the 128-bit input variable of the second round includes:

[0087] The dynamic components used by the round function include a dynamic obfuscation layer and a dynamic diffusion layer.

[0088] Specifically, X, as the input information of the dynamic obfuscation layer, is represented as 8 bytes, i.e., X = x0x1…x7. Each byte undergoes dynamic obfuscation, and the corresponding output variable is represented as Y = y0y1…y7. The dynamic obfuscation layer mainly uses eight parallel 8-bit dynamic S-boxes, such as… Figure 2 As shown, the 8-bit dynamic S-box is designed based on the 8-bit S-box of AES (Advanced Encryption Standard). The AES algorithm S-box is denoted as S8. A The corresponding 8-bit S-boxes are shown in Table 1. The 8-bit control parameters used by each 8-bit dynamic S-box are represented as t. i If 0 ≤ i ≤ 7, then the 8-bit dynamic S-box is defined as:

[0089]

[0090] The 64-bit control parameters required for the eight 8-bit dynamic S-boxes are generated by the parameter expansion algorithm. An example of calculating the input and output variables of the dynamic S-box is as follows: when t0 = 00000100, the input is represented as 0x1, and the output variable of the dynamic S-box is represented as... In addition, when t0 = 00000100, the correspondence between the input and output variables of the 8-bit dynamic S-box is shown in Table 3.

[0091] Table 1 S-box in the AES algorithm

[0092]

[0093] Furthermore, the cryptographic properties of the dynamic confusion layer are evaluated: By iterating through the adjustable parameter c0, different 8-bit S-boxes correspond to different parameters, resulting in a total of 256 S-boxes to choose from. The differential uniformity D of these 256 S-boxes... f The value is D f =[10,12,14,16,18,20,22], the total number of difference evennesses is:

[0094] Table 2. Differential uniformity distribution of 256 S-boxes

[0095] Differential uniformity 10 12 14 16 18 20 22 Sbox number 14 105 72 41 19 3 2

[0096] Referring to Table 2, the maximum differential uniformity of the 256 S-boxes is 22, and only 2 S-boxes can achieve this maximum differential uniformity, i.e., the constant t0 = 10111110 or t0 = 11010011. When t0 = 00000100, the differential uniformity of the obtained 8-bit S-box is 10, and the corresponding dynamic S-boxes are shown in Table 3.

[0097] Table 3 8-bit S-box

[0098]

[0099] Specifically, the dynamic diffusion layer P consists of linear transformation operations and column mixing operations. First, the 8 bytes of the input state are subjected to byte-based linear transformation operations, and then the column mixing matrix of the AES algorithm is left-multiplied by each column of the state matrix.

[0100] Furthermore, the cryptographic properties of the dynamic diffusion layer are evaluated: the dynamic diffusion layer P of the F function consists of linear transformation operations and column obfuscation operations. Different linear transformation operations are performed under different parameters in the linear transformation layer, breaking the symmetry between round functions. The column obfuscation operation uses the MDS matrix of the AES algorithm, with both the number of difference branches and the number of linear branches being 5, exhibiting good diffusion properties.

[0101] Specifically, L (32) ,R (32) After merging, the encrypted 128-bit ciphertext information is obtained. Similarly, the ciphertext information, along with the corresponding round key and the control parameters of the round function, are used as input information for the round function. After 32 rounds of iteration, the corresponding plaintext information is obtained.

[0102] Specifically, the 256-bit master key is used to obtain 64-bit round keys for rounds 1 to 32 using a key expansion algorithm. The 256-bit master control parameters are used to obtain 64-bit S-box control parameters and 4-bit P-box control parameters for rounds 1 to 32 using a parameter expansion algorithm. The 128-bit plaintext information, along with the round keys and control parameters from rounds 1 to 32, are then subjected to 32 rounds of iterative encryption. The final 128-bit output from round 32 is the encrypted ciphertext information.

[0103] Furthermore, the resistance of the DSTP dynamically adjustable algorithm to differential attacks is evaluated. The minimum number of differentially active S-boxes is typically used to assess the security proof of a cryptographic algorithm against differential attacks. An automated search tool is used to construct a search model for differential features, fixing some adjustable parameters, to search for the minimum number of differentially active S-boxes in the DSTP dynamically adjustable algorithm. The results show that the minimum number of active S-boxes in round 11 is 20, therefore, the minimum number of active S-boxes in round 22 is at least 40. At this point, according to the wide trajectory strategy, as long as the maximum differential probability of the S-box is not less than 2... -3.3 Therefore, a 22-round dynamically adjustable DSTP algorithm is sufficient to resist differential attacks, meaning the optimal probability of the 22-round differential discriminator is 2. -3.3×40 =2 -132 <2 -128 Therefore, the 32-round DSTP dynamically adjustable algorithm has good safety redundancy. Furthermore, among all the parameters used in the DSTP dynamically adjustable algorithm, the maximum difference uniformity of the dynamic S-box is 22, and the difference probability is approximately 2. -3.55 The optimal probability of the differential discriminator in round 22 is approximately 2. -3.55×40 =2 -142 When the difference uniformity of the S-box is 10, the optimal probability of the difference discriminator in the 16th round of the algorithm is as high as 2. -4.68×30 =2 -140 This is sufficient to resist differential attacks. Based on the above analysis, it can be seen that the DSTP dynamically adjustable algorithm is secure and controllable against differential attacks, and is easy to extend and design new algorithms.

[0104] This application provides a method for dynamically adjustable block cipher algorithm structure, comprising: inputting a master key, master control parameters, and plaintext to be encrypted, wherein the plaintext to be encrypted is 128 bits long, the master key is 256 bits long, and the master control parameters are 256 bits long; iteratively executing 32 rounds of encryption operations using the master key and the master control parameters to encrypt the plaintext to be encrypted until 128 bits of ciphertext are obtained; wherein the step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes: obtaining a 64-bit round key for each round based on the 256-bit master key, and obtaining a 68-bit round function control parameter for each round based on the 256-bit master control parameters, wherein the 68-bit round function control parameter includes a 64-bit S-box control parameter and a 4-bit P-box control parameter; and performing operations on the 128-bit plaintext to be encrypted according to the round function of each round. By adding parameters for adjustment, the cryptographic algorithm's structure becomes dynamically adjustable. Different round function structures can be generated by adjusting the parameters, while simultaneously ensuring the algorithm's resistance to differential attacks, thus improving its adjustability and security.

[0105] Example 2

[0106] Furthermore, embodiments of this disclosure provide an apparatus for dynamically adjustable structure of a block cipher algorithm.

[0107] Specifically, such as Figure 4 As shown, the device 400 for dynamically adjustable block cipher algorithm structure includes:

[0108] Input module 401 is used to input the master key, master control parameters and plaintext to be encrypted, wherein the length of the plaintext to be encrypted is 128 bits, the length of the master key is 256 bits, and the length of the master control parameters is 256 bits.

[0109] Iteration module 402 is used to iteratively execute 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained; wherein, the step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes:

[0110] The 64-bit round keys for each round are obtained based on the 256-bit master key, and the 68-bit round function control parameters for each round are obtained based on the 256-bit master control parameters. The round key is 64 bits, and the 68-bit round function control parameters include 64-bit S-box control parameters and 4-bit P-box control parameters. The 128-bit plaintext to be encrypted is then processed according to the round function of each round.

[0111] The device 400 for dynamically adjustable block cipher algorithm structure provided in this embodiment can be the block cipher adjustment method shown in Embodiment 1. To avoid repetition, it will not be described again here.

[0112] The above-described device for a dynamically adjustable block cipher algorithm provides a master key, master control parameters, and plaintext to be encrypted as input. The plaintext is 128 bits long, the master key is 256 bits long, and the master control parameters are 256 bits long. Iterative encryption is performed for 32 rounds using the master key and master control parameters until a 128-bit ciphertext is obtained. The step of encrypting the plaintext using the master key and master control parameters includes: obtaining a 64-bit round key for each round based on the 256-bit master key, and obtaining a 68-bit round function control parameter for each round based on the 256-bit master control parameters. The 68-bit round function control parameter includes a 64-bit S-box control parameter and a 4-bit P-box control parameter. Operations are then performed on the 128-bit plaintext according to the round function. By adding parameters for adjustment, the cryptographic algorithm's structure becomes dynamically adjustable. Different round function structures can be generated by adjusting the parameters, while simultaneously ensuring the algorithm's resistance to differential attacks, thus improving its adjustability and security.

[0113] Example 3

[0114] Furthermore, this disclosure provides an electronic device including a memory and a processor. The memory stores a computer program, which, when executed on the processor, performs a method for dynamically adjustable structure of the block cipher algorithm provided in Embodiment 1.

[0115] The electronic device provided in this embodiment of the invention can implement the method of dynamically adjustable structure of the block cipher algorithm provided in Embodiment 1. To avoid repetition, it will not be described again here.

[0116] The electronic device provided in this embodiment makes the cryptographic algorithm structure dynamically adjustable by adding parameters. Different round functions with different structures can be generated by adjusting the parameters, while ensuring the algorithm's resistance to differential attacks. This enriches the diversity of block cipher algorithm structures and improves the algorithm's security.

[0117] Example 4

[0118] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the following steps:

[0119] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0120] The computer-readable storage medium provided in this embodiment can implement the dynamic control method of the cryptographic algorithm structure shown in Embodiment 1. To avoid repetition, it will not be described again here.

[0121] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.

[0122] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0123] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for dynamically adjusting the structure of a block cipher algorithm, characterized in that, The method includes: Input the master key, master control parameters and plaintext to be encrypted, wherein the length of the plaintext to be encrypted is 128 bits, the length of the master key is 256 bits, and the length of the master control parameters is 256 bits; The plaintext to be encrypted is iteratively encrypted for 32 rounds using the master key and the master control parameters until 128 bits of ciphertext are obtained. The step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes: The 64-bit round key for each round is obtained based on the 256-bit master key, and the 68-bit round function control parameters for each round are obtained based on the 256-bit master control parameters. The 68-bit round function control parameters include 64-bit S-box control parameters and 4-bit P-box control parameters. The 128-bit plaintext to be encrypted is processed according to the round function of each round.

2. The method according to claim 1, characterized in that, The step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes: The 256-bit master key is divided into eight 32-bit keys. The first 32-bit key and the fifth 32-bit key of the 256-bit master key are extracted as the 64-bit round key for the first round. The 256-bit master key is subjected to a key expansion algorithm to obtain the 64-bit round keys for rounds 2 to 32.

3. The method according to claim 1, characterized in that, The step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes: The 256-bit master control parameters are used to obtain the S-box control parameters for rounds 1 to 32 through a parameter expansion algorithm; The 256-bit master control parameter is divided into eight 32-bit groups. The fourth 32-bit master control parameter and the eighth 32-bit master control parameter are used as the 64-bit S-box control parameter for the first round. The S-box control parameters for rounds 2 to 32 are obtained using the S-box parameter expansion algorithm.

4. The method according to claim 3, characterized in that, After obtaining the S-box control parameters for rounds 2 to 32 according to the S-box parameter expansion algorithm, the method further includes: The 64-bit S-box control parameters of the first round are divided into 16 4-bit groups, which are used as the 4-bit P-box control parameters of the first to 16th rounds respectively. The 64-bit S-box control parameters of the first round are used to perform the P-box parameter expansion algorithm, and are then used as the P-box control parameters for rounds 17 to 32.

5. The method according to claim 1, characterized in that, The step of iteratively executing 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained includes: Use the 128 bits of plaintext as the 128 bits of input variable for the first round; The 128-bit input variables of the first round, the 64-bit round key of the first round, and the 64-bit round function control parameters of the first round are executed to obtain the 128-bit input variables of the second round.

6. The method according to claim 5, characterized in that, The step of executing the 128-bit input variables of the first round, the 64-bit round key of the first round, and the 64-bit round function control parameters of the first round into the first round's round function to obtain the 128-bit input variables of the second round includes: The dynamic components used by the round function include a dynamic obfuscation layer and a dynamic diffusion layer.

7. The method according to claim 1, characterized in that, The step of performing calculations on the 128-bit plaintext to be encrypted based on the round function control parameters of each round includes: The 32nd round of the round function does not perform the swap operation between the left and right branches.

8. A device for dynamically adjustable structure of a block cipher algorithm, characterized in that, The device includes: The input module is used to input the master key, master control parameters and plaintext to be encrypted, wherein the length of the plaintext to be encrypted is 128 bits, the length of the master key is 256 bits, and the length of the master control parameters is 256 bits. An iterative module is used to iteratively execute 32 rounds of encryption operations on the plaintext to be encrypted using the master key and the master control parameters until 128 bits of ciphertext are obtained; wherein, the step of encrypting the plaintext to be encrypted using the master key and the master control parameters includes: The 64-bit round key for each round is obtained based on the 256-bit master key, and the 68-bit round function control parameters for each round are obtained based on the 256-bit master control parameters. The 68-bit round function control parameters include 64-bit S-box control parameters and 4-bit P-box control parameters. The 128-bit plaintext to be encrypted is then processed according to the round function of each round.

9. An electronic device, characterized in that, The method includes a memory and a processor, wherein the memory stores a computer program that, when the processor is run, executes a method for dynamically adjustable structure of the block cipher algorithm according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores a computer program that, when run on a processor, executes a method for dynamically adjusting the structure of the block cipher algorithm according to any one of claims 1 to 7.