A fast method for balanced general key expansion
By fragmenting and performing XOR, shifting, and S-box transformations on the 256-bit encryption key to generate a 128-bit round key, the problem of imbalance in existing key expansion methods is solved, achieving efficient and fast key expansion.
Patent Information
- Application Number
- CN202211216340.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-09-30
AI Technical Summary
Existing technologies struggle to provide an efficient and well-balanced general-purpose key expansion method suitable for encryption key lengths of 256 bits and round key lengths of 128 bits.
The key expansion is achieved by dividing the input 256-bit encryption key into eight 32-bit key segments, and generating a 128-bit round key through XOR, shifting, and AES standard S-box transformation.
The generated key expansion method has high balance and randomness, fast key expansion speed, and low correlation between round keys.
Smart Images

Figure CN116132015B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cryptography technology, specifically relating to a fast method for balanced general key expansion. Background Technology
[0002] Block ciphers are the mainstream algorithms for encrypting long data, and key expansion algorithms are a crucial component supporting block ciphers. Given the rapid development of computer computing power, 256 bits will remain the preferred encryption key length for most block cipher algorithms for a considerable period. Therefore, it is necessary to provide a universal key expansion method applicable to encryption keys with a length of 256 bits and round keys with a length of 128 bits. Summary of the Invention
[0003] The purpose of this invention is to provide a universal key expansion method applicable to encryption key lengths of 256 bits and round key lengths of 128 bits.
[0004] The present invention adopts the following technical solution:
[0005] A fast method for balanced general-purpose key expansion, comprising the following steps:
[0006] Step 1: Divide the 256-bit input encryption key into eight key words, each key word being a 32-bit key segment. Arrange the eight key segments in sequence to obtain the key segment sequence for the first round.
[0007] Step 2: Perform a first transformation on the key fragment sequence of the current round to obtain the four second key words of the current round;
[0008] The first transformation is:
[0009] The eight key segments of the key segment sequence are combined in pairs to obtain four groups of key segments. The two key segments within each group are XORed and then shifted.
[0010] The two key segments in each group are not adjacent key segments, and the key segments in each group are spaced at the same position.
[0011] Step 3: Perform a second transformation on the four second key words of the current round to obtain the four third key words of the current round, which are the round keys of the current round;
[0012] The second transformation is as follows: each second key word is input into four parallel S-boxes (Substitution-boxes) for nonlinear transformation, and the outputs of the four S-boxes are connected to obtain the third key word after the current second key word is transformed.
[0013] Step 4: If the number of rounds reaches the preset maximum number of rounds, proceed to step 5; otherwise, configure the key fragment sequence for the next round and continue to execute steps 2 to 4.
[0014] The key fragment sequence for the next round is as follows:
[0015] If the current round is 1, then the last four key words obtained in step 1 and the four third key words obtained in the current round are used to form the key fragment sequence for the second round.
[0016] If the current round number r is greater than or equal to 2, then the four third key words obtained in the (r-1)th round and the four third key words obtained in the rth round are used to form the key fragment sequence of the (r+1)th round.
[0017] Step 5: Connect the four third key words of all wheels in sequence to obtain the final output wheel key.
[0018] Furthermore, in step 2, the number of bits used in the shift operations of the four key segments are 0, 8, 16, and 24, respectively.
[0019] Furthermore, in step 3, the S-box used is an AES (Advanced Encryption Standard) standard S-box with 8-bit input and 8-bit output.
[0020] The technical solution provided by this invention brings at least the following beneficial effects:
[0021] This invention provides a general key expansion method with a 256-bit encryption key and a 128-bit round key. Specifically, an input 256-bit encryption key is expanded through a predetermined number of rounds to generate an output key. In each round, the first 256 bits of the key are XORed, shifted, and subjected to S-box operations to obtain the final 128 bits of the expanded key. This results in higher overall balance and randomness of the expanded key, lower correlation between keys, and faster key generation. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram illustrating the processing of a fast, balanced general key expansion method provided in an embodiment of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0025] This embodiment provides a balanced, general-purpose, fast key expansion method. Its input is a 256-bit encryption key, and it iteratively outputs a round key of 128 bits with a predetermined number of rounds L. Therefore, the total length of the round key is 128 × L.
[0026] See Figure 1 The specific implementation steps of this embodiment are as follows:
[0027] Step 1 (CK) r Initialization): The algorithm's output uses CK. r It is said that CK r It is also the round key of the encryption algorithm, 0≤r≤L, and CK0 is initialized to "NULL".
[0028] Step 2 (Algorithm Input): The 256-bit seed key is represented by eight characters w. i (i = 0 to 7).
[0029] Step 3: Process the eight input key words w i Perform an XOR operation (r represents the current round number):
[0030]
[0031] In this embodiment of the invention, the original input encryption key is divided into eight key words, which are represented as: w0, w1, w2, w3, w4, w5, w6, w7.
[0032] Step 4: Perform a shift operation on the result calculated in the previous step:
[0033]
[0034] Step 5: Convert the output of Step 4 (w″) 4·(r-1)+4 w″ 4·(r-1)+5 w″ 4·(r-1)+6 and w″ 4·(r-1)+7 Each is transformed using the AES standard S-box:
[0035]
[0036] Step Six (Loop Operation): Concatenate the four words obtained from Step Five to obtain the 128-bit round key CK for the current round. r =w 4·(r-1)+8 ||w 4·(r-1)+9 ||w 4·(r-1)+10 ||w 4·(r-1)+11, r represents the number of rounds. The symbol "‖" is for the join operation.
[0037] Step 7: Set r = r + 1, which means proceeding with the next round of key output. Repeat steps 3-6 until the value of r equals the pre-set number of rounds L, then exit the loop.
[0038] Before outputting the next round of keys, the eight key words for the next round need to be configured. i (Also known as a key fragment sequence), specifically: if the current round is 1, then the last four characters of the input and the round key obtained in the first round are combined to form the 8 key characters for the second round: w4, w5, w6, w7, w8, w9, w 10 w 11 If the current round number is greater than or equal to 2, then the next round's 8 key words are formed based on the round keys obtained from the last two rounds.
[0039] For 256-bit encryption keys, this invention provides a fast, balanced, and universal key expansion method. The 256-bit encryption key is expanded using only XOR, shift, and S-box operations. Besides possessing excellent balance and other randomness properties, this key expansion method also satisfies the property of lower correlation between round keys, resulting in faster key expansion. Depending on the needs of the encryption process, this key expansion method can generate round keys of arbitrarily long lengths. Therefore, this invention is a universal key expansion method applicable to 256-bit encryption keys and 128-bit round keys.
[0040] When the balanced universal key expansion fast method provided in this embodiment of the invention is used for message encryption, that is, a message encryption method based on balanced universal key expansion, the specific processing procedure is as follows: For the message blocks to be encrypted, iterative encryption processing is used to obtain the encrypted ciphertext of each block: First, the block message is encrypted using the key CK1 output in the first round to obtain the first round encryption result. Then, the first round encryption result is encrypted using the key CK2 output in the second round to obtain the second round encryption result. This process is repeated multiple times to obtain the final encrypted block message, that is, based on the key CK1 of the r-th round. r The previous round of block encryption results is encrypted again, and the resulting block encryption result will be used as the encryption target for the next round. Finally, the final encryption results of all blocks are concatenated to generate the ciphertext of the message to be encrypted. This achieves encrypted transmission of the message to be encrypted.
[0041] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
[0042] The above descriptions are merely some embodiments of the present invention. Those skilled in the art can make various modifications and improvements without departing from the inventive concept of the present invention, and these all fall within the scope of protection of the present invention.
Claims
1. A fast method for balanced general-purpose key expansion, characterized in that, Includes the following steps: Step 1: Divide the 256-bit input encryption key into eight key words, each key word being a 32-bit key segment. Arrange the eight key segments in sequence to obtain the key segment sequence for the first round. Step 2: Perform a first transformation on the key fragment sequence of the current round to obtain the four second key words of the current round; The first transformation is as follows: Group two key segments that are 3 segments apart in the key segment sequence into a group. Combine the eight key segments in the key segment sequence in pairs to obtain four groups of key segments. XOR the two key segments in each group and then perform a shift operation. The number of bits for the shift operation of the four groups of key segments are 0, 8, 16, and 24, respectively. The two key segments in each group are not adjacent key segments, and the interval between the key segments in each group is the same. Step 3: Perform a second transformation on the four second key words of the current round to obtain the four third key words of the current round; The second transformation is as follows: each second key word is input into four parallel S-boxes for nonlinear transformation, and the outputs of the four S-boxes are connected to obtain the third key word after the current second key word is transformed; wherein, the S-box used is an AES standard S-box with 8-bit input and 8-bit output; Step 4: If the number of rounds reaches the preset maximum number of rounds, proceed to step 5; otherwise, configure the key fragment sequence for the next round and continue to execute steps 2 to 4. The key fragment sequence for the next round is as follows: If the current round is 1, then the last four key words obtained in step 1 and the four third key words obtained in the current round are used to form the key fragment sequence for the second round. If the current round number r is greater than or equal to 2, then the four third key words obtained in the (r-1)th round and the four third key words obtained in the rth round are used to form the key fragment sequence of the (r+1)th round. Step 5: Connect the four third key words of all wheels in sequence to obtain the final output wheel key.
Citation Information
Patent Citations
Expansion system and method for 256-bit keys
CN102647272A
Universal key expansion rapid method
CN114640437A