Block cipher implementation method, device and equipment based on lightweight algorithm structure

By designing a lightweight algorithm structure, the implementation problem of the packet cipher algorithm on resource-constrained devices is solved, and an efficient and secure encryption and decryption process is realized, which is suitable for network and communication transmission data.

CN120263394AActive Publication Date: 2025-07-04KAIYUAN INTERNATIONAL MATHEMATICS RESEARCH INSTITUTE

Patent Information

Application Number
CN202510744187.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-07-04
Estimated Expiration
2045-06-05

AI Technical Summary

Technical Problem

Existing packet cipher algorithms are difficult to effectively implement on resource-constrained devices, especially in devices with weak computing power, limited storage space and high energy consumption requirements. Traditional packet cipher algorithms have shortcomings in balancing lightweight, algorithm complexity, encryption and decryption consistency, efficiency and security.

Method used

A packet cryptography implementation method based on a lightweight algorithm structure is designed. Through the new round function structure and key scheduling algorithm, the SIMD registers are used to process plaintext branches in parallel, and the nonlinear function and key mixing is combined to achieve encryption and decryption consistency and high security.

Benefits of technology

With the same packet length, the cost of software and hardware implementation is reduced, the encryption and decryption efficiency is improved, and the security is provided, and differential analysis and linear analysis are resisted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120263394A_ABST
    Figure CN120263394A_ABST
Patent Text Reader

Abstract

The invention provides a block cipher implementation method, device and equipment based on a lightweight algorithm structure. The method comprises the steps that cache equipment or a data interface obtains a plaintext needing cipher implementation; loading plaintexts by the register or the cache, and grouping the plaintexts into four branches for parallel processing by using the SIMD register; generating a round key by designing a key scheduling algorithm, and storing the round key in a special register; designing a lightweight algorithm structure for performing password implementation on the four branches stored in the SIMD register; and performing I-round encryption / decryption iteration on four branches of initial input of the plaintext / ciphertext by using a lightweight algorithm structure to generate the ciphertext / plaintext. According to the method disclosed by the invention, the cryptographic algorithm based on the lightweight algorithm structure is designed to encrypt and decrypt the data transmitted by the network or the communication, so that the software and hardware implementation cost in the application process is reduced while the requirement of easily implementing the lightweight password application is met, and the security is good.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of block ciphers, and particularly relates to a method, device and equipment for implementing a block cipher based on a lightweight algorithm structure. Background Art

[0002] With the rapid development of technologies such as high-speed network information transmission, wireless communication technology, and Internet of Things based on data center networks, as well as the increasingly wide application of related technologies such as wireless sensor networks (WSNs) and radio frequency identification (RFID) in resource-constrained devices. These devices usually have the characteristics of weak computing power, limited storage space and high energy consumption requirements. Therefore, traditional block cipher algorithms (such as AES) are difficult to be effectively implemented on these devices. Lightweight block cipher algorithms have gradually become a research hotspot due to their advantages in hardware resource consumption, encryption speed and power consumption.

[0003] Block cipher algorithms are widely used in fields such as data encryption, identity authentication and communication security, and their design is based on the principles of "confusion" and "diffusion" proposed by Shannon. As an important part of the cipher algorithm, the cipher structure plays a crucial role in diffusivity. A "good" iterative structure can not only effectively guarantee the security of the block cipher algorithm, but also effectively support efficient software and hardware implementation.

[0004] The prior art has some emphasis and lacks beneficial aspects in other aspects in balancing lightweight, algorithm complexity, encryption / decryption consistency, efficiency, diffusivity and security. Generally, block cipher structures are divided into two categories: one is the structure that needs to calculate the inverse function of the non-linear function for decryption, such as the SPN structure (Substitution-Permutation Network); the other is the structure that does not need to calculate the inverse function of the non-linear function for decryption, such as the Feistel-like structure. The Feistel-like structure selects different implementation methods according to the block length or the usage mode of the round function, and has the advantage of consistent encryption and decryption, but the diffusivity is slow. Currently widely used Feistel-like structures include: Feistel structure, Lai-Massey structure, SM4 structure, MARS structure, Type-I generalized Feistel structure and Type-II generalized Feistel structure. Due to their weak diffusivity, these structures often have integral distinguishers with a long number of rounds, so a long number of iterative rounds is usually selected when designing cipher algorithms. Summary of the Invention

[0005] To solve the above problems existing in the prior art, the present invention proposes a method, apparatus and device for implementing block cipher based on a lightweight algorithm structure. By designing a new round function structure, a lightweight algorithm structure is established, and a block cipher algorithm is designed using the lightweight algorithm structure to implement block cipher. The lightweight algorithm structure adopted by the method enables the data input and output scale to be smaller under the condition of the same block length in the block cipher algorithm, so that it is easy to meet the requirements of lightweight cipher applications, reduce the software and hardware implementation costs during the application process, and has higher security.

[0006] A method for implementing block cipher based on a lightweight algorithm structure includes: Step 110, obtaining the plaintext that needs to be ciphered from a cache device or a data interface, and transmitting the plaintext to a register or a cache; the plaintext includes data transmitted through a network or communication, and the types of the data include at least one of text, image, audio, video, numerical value or structured data; Step 120, loading the plaintext from the register or the cache, and using SIMD registers to group the plaintext into four branches for parallel processing; Step 130, generating round keys by designing a key scheduling algorithm, and storing the round keys in dedicated registers; Step 140, designing a lightweight algorithm structure for implementing block cipher on the four branches stored in SIMD registers, including encrypting the plaintext and decrypting the ciphertext obtained by encryption; each round of the algorithm in the lightweight algorithm structure performs round function operations, and the operation process includes a non-linear function, key mixing and branch crossover; the round function operations include encryption round function operations and decryption round function operations; Step 150, for the four branches stored in SIMD registers in the previous round, using the encryption round function operation to perform exclusive OR operations on the first two branches and the first three branches respectively to obtain two intermediate variables; after mixing the two intermediate variables with the round keys respectively, using a non-linear function to perform transformation to generate non-linear function results; Step 160, using the non-linear function results to perform circular left shift operations on the four branches in the previous round respectively to obtain the four branches in the current round; Step 170, performing rounds of encryption iteration on the initially input plaintext to generate ciphertext, and completing the plaintext encryption process.

[0007] The present invention also protects a block cipher implementation apparatus based on a lightweight algorithm structure, which implements the steps of the aforementioned block cipher implementation method based on a lightweight algorithm structure. The apparatus includes: The first module is used to obtain the plaintext that needs to be implemented with a password from a cache device or a data interface, and transmit the plaintext to a register or a cache; the plaintext includes data transmitted through a network or communication, and the types of data include at least one of text, image, audio, video, numerical value, or structured data; The second module is used to load the plaintext from a register or a cache, and group the plaintext into four branches for parallel processing by using SIMD registers; The third module is used to generate round keys by designing a key scheduling algorithm, and store the round keys in a dedicated register; The fourth module is used to design a lightweight algorithm structure to implement password for the four branches stored in SIMD registers, including encrypting the plaintext and decrypting the ciphertext obtained by encryption; each round of the algorithm in the lightweight algorithm structure performs a round function operation, and the operation process includes a non-linear function, key mixing, and branch crossover; the round function operation includes an encryption round function operation and a decryption round function operation; The fifth module is used to perform exclusive OR operations on the first two branches and the first three branches of the four branches stored in the SIMD register in the previous round by using the encryption round function operation to obtain two intermediate variables; after mixing the two intermediate variables with the round keys respectively, perform transformation by using a non-linear function to generate a non-linear function result; The sixth module is used to perform circular left shift operations on the four branches in the previous round respectively by using the non-linear function result to obtain the four branches in the current round; The seventh module is used to perform round encryption iterations on the initially input plaintext to generate a ciphertext and complete the plaintext encryption process.

[0008] The present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the foregoing frequency standard measurement method are implemented.

[0009] In summary, the present invention proposes a method, device, equipment, and storage medium for implementing block cipher based on a lightweight algorithm structure. Compared with the prior art, the advantages and beneficial effects of the method of the present invention include: (1) The lightweight algorithm structure designed and adopted by the present invention has more branches compared with the traditional Feistel structure. Even under the conditions of the same number of branches and block length, the input-output scale of the non-linear function designed by the present invention is smaller for each round, so it is easier to be used to design a lightweight cipher algorithm and reduce the cost of software and hardware implementation for data transmitted through a network or communication.

[0010] (2) The key scheduling algorithm designed based on the above algorithm structure can handle block cipher applications with a master key of more than 128 bits. The number of iterative rounds is 32, which not only provides good diffusion but also ensures high security requirements for a larger amount of data.

[0011] (3) When implementing a block cipher using the lightweight algorithm structure designed by the present invention, since the number of rounds resistant to differential analysis is relatively high (13 rounds or more), while the number of impossible differential rounds, zero - correlation linear hull rounds, and the number of rounds of integral distinguishers is less (5 rounds), the security is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 It is a flowchart of the method for implementing a block cipher based on a lightweight algorithm structure in the first embodiment of the present invention; Figure 2 It is a schematic diagram of the round function structure in the encryption process of the lightweight algorithm structure in the first embodiment of the present invention. Among them, is the four branches input in the - th round encryption process, and are the non - linear functions in the - th round encryption process, is the four branches output in the - th round encryption process; ; Figure 3 It is a schematic diagram of the round function structure in the decryption process of the lightweight algorithm structure in the first embodiment of the present invention. Among them, is the four branches input in the - th round decryption process, and are the non - linear functions in the - th round decryption process, is the four branches output in the - th round decryption process; Figure 4 It is a schematic diagram of the key scheduling process in the second embodiment of the present invention. Among them represents each bit in the master key; Figure 5 It is a schematic design structure diagram of the non - linear function in the round function structure of the second embodiment of the present invention. Among them, is the round key used for the round function operation in the - th round, represents box, represents transformation. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0013] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0014] Aiming at the efficiency and security problems of applying lightweight block cipher technology in the process of network data transmission and communication signal transmission, the present invention proposes a method, device and equipment for implementing block cipher based on a lightweight algorithm structure. By designing a new lightweight algorithm structure, a block cipher algorithm is constructed to implement block cipher. The lightweight algorithm structure adopted by the method has the structural feature of consistent encryption and decryption, making the data input and output scale in the block cipher algorithm smaller, improving the encryption / decryption efficiency and being more conducive to meeting the requirements of lightweight cipher applications, and having high security.

[0015] In the first embodiment, with reference to Figure 1 as shown, the present invention provides a method for implementing block cipher based on a lightweight algorithm structure, which specifically includes the following steps: Step 110, obtain the plaintext that needs to be ciphered from a cache device or a data interface, and transmit the plaintext to a register or a cache; the plaintext includes data transmitted by a network or communication, and the types of the data include at least one of text, image, audio, video, numerical value or structured data.

[0016] Step 120, load the plaintext from the register or the cache, and use the SIMD register to group the plaintext into four branches for parallel processing.

[0017] Specifically, the four branches of the initial input of the plaintext are labeled as , where each corresponds to one branch, and each branch corresponds to the binary data on . The value of is determined according to the data length of the plaintext to be processed. In the round function operation of the lightweight algorithm structure, the four branches parallelly input the branch outputs of the previous round. After the round function operation of this round, the output is , is the round of cipher implementation, and is the total number of rounds executed.

[0018] Step 130, generate the round key , , including: randomly generating a -bit master key by using a random number generator, and filling it into In a stage feedback shift register, the round key is obtained by recursion of the feedback shift register; the round key is stored in a dedicated register which has a high security level setting.

[0019] Step 140, design a lightweight algorithm structure (KYS) for cryptographic implementation of four branches stored in SIMD registers, including encryption and decryption of the encrypted ciphertext; each round function operation in the lightweight algorithm structure includes a non-linear function transformation, key mixing, and branch crossover, which is the current round of cryptographic implementation. The round function operation includes an encryption round function operation and a decryption round function operation. The non-linear function is related to the current round key and is directly mapped through dedicated hardware logic: , to implement function transformation, where the "dedicated hardware logic" refers to a dedicated FPGA module using a multi-stage pipeline design, and it takes one or two clock beats to complete the non-linear function operation and result output.

[0020] As Figure 2 shown, use the round algorithm step (round function structure) of the encryption round function operation in the lightweight algorithm structure to implement the process of plaintext encryption, including: Step 150, for the four branches output and stored in SIMD registers in the previous round , take the first branch among them and the second branch to perform an exclusive OR operation, denoted by to obtain the first intermediate variable ; perform an exclusive OR operation on the first three branches , and to obtain the second intermediate variable ; Furthermore, after performing a mixing operation on the first intermediate variable and the corresponding round key , use the non-linear function to perform transformation processing to generate the first non-linear function result ; after performing a mixing operation on the second intermediate variable and the corresponding round key , use the non-linear function to perform transformation processing to generate the second non-linear function result ; Step 160, use the non-linear function results to perform circular left shift operations on the four branches in the previous round respectively to obtain the four branches in the current round, including: for the second branch in the previous round Perform an exclusive OR operation on the results of the first non-linear function and the results of the second non-linear function to obtain the first branch of the current round ; directly use the third branch of the previous round as the second branch of the current round ; perform an exclusive OR operation on the fourth branch of the previous round and the results of the second non-linear function to obtain the third branch of the current round ; perform an exclusive OR operation on the first branch of the previous round with the results of the first non-linear function and the second non-linear function to obtain the fourth branch of the current round .

[0021] Step 170, label the initial input as the plaintext of four branches and perform rounds of encryption iteration to generate the ciphertext that finally meets the requirements of diffusion and security, completing the plaintext encryption process.

[0022] In the aforementioned mixing operation of the round keys, and in the process of using exclusive OR operations and circular left shift operations, use the SIMD instruction set to perform parallel calculations on multiple branches simultaneously, and use a multi-core processor to allocate different branches to multiple threads for task-level parallel operations.

[0023] The lightweight algorithm structure given in the above step 140 satisfies encryption / decryption consistency, that is, in the reverse decryption process, there is no need to calculate the inverse of the non-linear function and . Instead, the input in the aforementioned step 150 can be replaced with the output of the current round , and through reverse solution, the four branches of the output of the previous round (the round) can be obtained . Specifically, the reverse solution process is described by the following algorithm steps: ; Among them, , are intermediate variables set in the decryption process; and are the non-linear function results generated by performing a mixing operation on two intermediate variables respectively with the round key and then using the non-linear function for transformation; the last four formulas are the algorithm process for performing a reverse loop (right shift) operation on the current round branches to obtain the results of the four branches of the previous round.

[0024] Combined with the above reverse solution process, the decryption round function structure of the lightweight algorithm structure (KYS) is as Figure 3 shown, where each decryption round function operation takes the current round (the The encrypted output result of the round is used to calculate the encrypted output result of the previous Figure 3 round in reverse through the inverse process to implement the decryption process. In the and are the four branches of the input of the round decryption process. and are the non-linear functions in the

[0025] round decryption process. round decryption iteration is performed on the ciphertext that has experienced a total of round encryption iterations using the decryption round function operation in the lightweight algorithm structure to recover the plaintext before encryption.

[0026] In fact, during the round iteration of the above KYS algorithm structure, if the operation of branch permutation is ignored in the last round, the plaintext under the action of the round key generates the ciphertext . Then, during the round iteration of the KYS decryption structure, the operation of branch permutation is also ignored in its last round, and the ciphertext recovers the plaintext under the action of the round key .

[0027] The intermediate variables in the above steps are written back to memory through the cache line (Cache Line), and the cache coherence protocol is used to ensure data synchronization in a multi-core environment.

[0028] In the second embodiment of the present invention, for the data volume with a main key length of 128 bits and each branch data length of 32 bits after plaintext grouping, the round key length is set to 64 bits. For this case, the lightweight algorithm structure is used to implement the encryption. For ease of description, the lightweight algorithm structure designed in step 140 is numbered KYS-BC-128.

[0029] Specifically, in the above step 130, the process of generating the round key using the key scheduling algorithm includes: Randomly generate a 128-bit main key using a random number generator, where represents each bit in the main key, and fill it into a 128-stage linear feedback shift register; the generating polynomial of the linear feedback shift register is Figure 4As shown, the recurrence relation is: ; Since is a primitive polynomial, the period of this linear feedback shift register is , with an entropy of 128 bits. Let , be the round key for the th round, where the last 32 bits are used as the round key to perform an exclusive - or operation with the input of the non - linear function , and the first 32 bits are used as the round key to perform an exclusive - or operation with the input of the non - linear function .

[0030] Furthermore, in step 140, the four branches of the initial input plaintext are , the input for the th round is , the output for the th round is , and each branch is taken from the elements of . The input of the non - linear function is , and the input of the non - linear function is .

[0031] Specifically, the non - linear functions and adopt the structure. As shown in Figure 5 , the function transformation process consists of three operation steps: addition with the round key, Substitution Box (S - Box) replacement layer, Permutation Box (P - Box) layer.

[0032] For the non - linear function used in the th round, , the input first performs an exclusive - or operation with the round key to obtain the input for the S - Box replacement layer: , where is 32 bits long. Let: ; Set the S - Box as an 8 - in - 8 - out bijective mapping, then the input for the P - Box layer is: .

[0033] The box used here is the box used in the traditional AES algorithm. Specifically, the box substitution table is shown in Table 1 below: Table 1 S-box substitution table designed for KYS-BC-128

[0034] The transformation layer adopts the column mixing operation of the AES-128 standard algorithm, and let the output of the transformation layer be: ; Therefore, there is: ; Regarding as an element in the finite field , it corresponds one-to-one with the polynomial: ; wherein, are the polynomial coefficients respectively, . Therefore: ; At the same time is also the output of the non-linear function , .

[0035] Regarding the output value of and the output value of and performing an exclusive OR operation with simultaneously, we get: ; Regarding the output value of and the output value of and performing an exclusive OR operation with Let the intermediate variable ; Regarding the output value of and performing an exclusive OR operation with we get: Regarding performing a branch cyclic left shift operation to obtain the output value of the round: .

[0036] Therefore, the ciphertext obtained using the KYS-BC-128 algorithm structure is as follows: .

[0037] In the lightweight algorithm structure of this embodiment, a pipeline architecture is adopted. For example, in an FPGA or ASIC, stages such as non-linear function transformation, shift operation, key mixing, and round key addition in the round function structure are designed as multi-stage pipelines, and one data block is processed per clock cycle to maximize throughput.

[0038] Differential analysis and linear analysis of the lightweight algorithm structure (KYS-BC-128) adopted in this embodiment: Since the maximum differential probability of the box is and the minimum number of differentially active boxes in 13 rounds is 22,

[0039] similarly, since the maximum absolute value of the correlation of the box adopted by this algorithm is and the minimum number of linearly active boxes in 13 rounds is 22,

[0040] Therefore, there is no effective differential path for the KYS-BC-128 block cipher algorithm with 13 or more rounds, that is, the KYS-BC-128 cipher algorithm resists differential analysis.

[0041] Similarly, there is no effective linear path for the KYS-BC-128 block cipher algorithm with 13 or more rounds, that is, the KYS-BC-128 cipher algorithm resists linear analysis. First, compared with the traditional Feistel structure, the KYS algorithm structure has more branch numbers. Therefore, under the premise of the same block length, the input and output scale of the non-linear function is smaller, making it easier to design a lightweight cipher algorithm and reducing the implementation cost of software and hardware.

[0042] Second, compared with the SM4 structure, the MARS structure, and the four-branch Type-II generalized Feistel structure, the KYS algorithm structure has fewer impossible differential rounds, zero-correlation linear hull rounds, and integral integrator rounds, better diffusion, and higher security.

[0043] Third, since the SM4 structure has 11-round impossible differentials, 11-round zero-correlation linear hulls, and 11-round integral distinguishers, the MARS structure has 11-round impossible differentials, 11-round zero-correlation linear hulls, and 11-round integral distinguishers, and the four-branch Type-II generalized Feistel structure has 9-round impossible differentials, 9-round zero-correlation linear hulls, and 9-round integral distinguishers. However, the lightweight algorithm structure KYS proposed in the present invention has 5-round impossible differentials, 5-round zero-correlation linear hulls, and 5-round integral distinguishers. Therefore, when the internal details of the non-linear function are the same, the security of the cryptographic algorithm designed based on the lightweight algorithm structure KYS is superior to that of the cryptographic algorithms designed based on the SM4 structure, the MARS structure, and the four-branch Type-II generalized Feistel structure in terms of impossible differential analysis, zero-correlation linear analysis, and integral analysis.

[0044] The third embodiment of the present invention provides a block cipher implementation device based on a lightweight algorithm structure, which is used to implement the steps of the block cipher implementation method based on the lightweight algorithm structure in the foregoing embodiment. The device includes the following modules: The first module is used to obtain the plaintext to be cryptographically implemented from a cache device or a data interface and transmit the plaintext to a register or a cache; the plaintext includes data transmitted over a network or in communication, and the types of data include at least one of text, image, audio, video, numerical value, or structured data; The second module is used to load the plaintext from a register or a cache and group the plaintext into four branches for parallel processing using SIMD registers; The third module is used to generate round keys by designing a key scheduling algorithm and store the round keys in a dedicated register; The fourth module is used to design a lightweight algorithm structure to perform cryptographic implementation on the four branches stored in SIMD registers, including encrypting the plaintext and decrypting the ciphertext obtained by encryption; each round of the algorithm in the lightweight algorithm structure performs a round function operation, and the operation process includes a non-linear function, key mixing, and branch crossover; the round function operation includes an encryption round function operation and a decryption round function operation; The fifth module is used to perform exclusive OR operations on the first two branches and the first three branches respectively on the four branches stored in the SIMD register in the previous round to obtain two intermediate variables; after mixing the two intermediate variables with the round keys respectively, perform transformation using a non-linear function to generate a non-linear function result; The sixth module is configured to perform circular left shift operations on the four branches of the previous round respectively by using the results of the non - linear function to obtain the four branches of the current round; The seventh module is configured to perform round - based encryption iterations on the initially input plaintext to generate ciphertext, thereby completing the plaintext encryption process.

[0045] On the other hand, in one embodiment of the present invention, there is provided a computer device, which may be a server. The device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the device is used to provide computing and control capabilities. The memory of the device includes a non - volatile storage medium and an internal memory. The non - volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non - volatile storage medium. The database of the device is used to store data for implementing block ciphers based on a lightweight algorithm structure. The network interface of the device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements the method for implementing block ciphers based on a lightweight algorithm structure.

[0046] Those skilled in the art can understand that the description of the technical features of the device in the above - mentioned embodiments does not constitute a limitation on all devices to which the solution of the present invention is applied. Specific devices may include more or fewer components, or combine certain components, or have different component arrangements.

[0047] In another embodiment, the present invention provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the foregoing method for implementing block ciphers based on a lightweight algorithm structure.

[0048] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0049] Matters not covered by this invention are well-known techniques.

[0050] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0051] The above-described embodiments merely represent several implementation manners of the present invention. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.

Claims

1. A method for implementing a block cipher based on a lightweight algorithm structure, characterized in that Including: Step 110: Obtain the plaintext that needs to be implemented with a password from a cache device or a data interface, and transmit the plaintext to a register or a cache; the plaintext includes data transmitted over a network or in communication, and the type of the data includes at least one of text, image, audio, video, numerical value, or structured data. Step 120: Load the plaintext from the register or the cache, and use the SIMD register to group the plaintext into four branches for parallel processing. Step 130: Generate round keys by designing a key scheduling algorithm, and store the round keys in a dedicated register. Step 140: Design a lightweight algorithm structure for implementing the password for the four branches stored in the SIMD register, including encrypting the plaintext and decrypting the ciphertext obtained by encryption. Each round of the algorithm in the lightweight algorithm structure performs a round function operation, and the operation process includes a non-linear function, key mixing, and branch crossover. The round function operation includes an encryption round function operation and a decryption round function operation. Step 150: For the four branches stored in the SIMD register in the previous round, perform exclusive OR operations on the first two branches and the first three branches respectively using the encryption round function operation to obtain two intermediate variables. After performing a mixing operation on the two intermediate variables with the round keys respectively, use a non-linear function to perform a transformation to generate a non-linear function result. Step 160: Perform circular left shift operations on the four branches in the previous round respectively using the non-linear function result to obtain the four branches in the current round. Step 170, perform the round of encryption iteration to generate the ciphertext and complete the plaintext encryption process.

2. The method for implementing block cipher based on lightweight algorithm structure according to claim 1, wherein Use to represent the four branches of the plaintext initial input, where each corresponds to one branch, and each branch corresponds to binary data on, The value of is determined according to the data length of the plaintext to be processed; In the round function operation of the lightweight algorithm structure, the four branches parallelly input the branch outputs of the previous round using the SIMD instruction set , after the round function operation of the current round, the output , is the current round of the cipher implementation , is the total number of rounds executed; The non-linear function includes and , and the non-linear function is related to the current round key and is directly mapped through dedicated hardware logic: , to achieve function transformation.

3. The method for implementing a block cipher based on a lightweight algorithm structure according to claim 2, wherein, In step 130, the key scheduling algorithm includes: Randomly generate a master key of bits; Fill the master key into the level feedback shift register, and use the feedback shift register to recursively obtain the round key ( ), ; Store the round keys in a dedicated register, and the dedicated register has a high security level setting.

4. The method for implementing a block cipher based on a lightweight algorithm structure according to claim 3, wherein Step 150 includes: Four branches that input the previous round of output and store it in the SIMD register , the first branch among them is XORed with the second branch to obtain the first intermediate variable , indicating the XOR operation; the first three branches and are XORed to obtain the second intermediate variable ; the intermediate variable is written back to memory through the cache line, and the cache coherence protocol is used to ensure data synchronization in a multi-core environment; Mix the first intermediate variable with the corresponding round key After that, perform a transformation using the non-linear function to generate the result of the first non-linear function ; Mix the second intermediate variable with the corresponding round key After that, perform a transformation using the non-linear function to generate the result of the second non-linear function .

5. The method for implementing a block cipher based on a lightweight algorithm structure according to claim 4, wherein In step 160, perform circular left shift operations on the four branches in the previous round respectively using the non-linear function result to obtain the four branches in the current round, including: XOR the second branch of the previous round with the results of the first non-linear function and the second non-linear function to obtain the first branch of the current round ; Directly use the third branch of the previous round as the second branch of the current round ; XOR the fourth branch of the previous round with the result of the second non-linear function to obtain the third branch of the current round ; XOR the first branch of the previous round with the results of the first non-linear function and the second non-linear function to obtain the fourth branch of the current round .

6. The method for implementing block cipher based on lightweight algorithm structure according to claim 5, wherein It also includes the process of decrypting the ciphertext using the decryption round function operation, including: Four branches of the current round obtained by encrypting the plaintext , respectively perform exclusive OR operations on the first two branches and the first three branches to obtain two intermediate variables: , ; Mix two intermediate variables ( , ) with the round keys ( , ) respectively, and then use the non - linear function to perform a transformation to generate the non - linear function results: and ; Perform a reverse circular operation on the current round branches to obtain the four branches in the previous round: ; ; ; ; Execute Perform round decryption iterations to recover the plaintext before encryption.

7. The method for implementing a block cipher based on a lightweight algorithm structure according to claim 6, wherein In step 130, the length of the master key is 128 bits, the data volume of each branch after the plaintext is grouped is 32 bits, and each branch is taken from the elements on it. If the round key length is set to 64 bits, the process of generating round keys using the key scheduling algorithm includes: Fill the 128-bit master key into a 128-stage linear feedback shift register, representing each bit in the master key, ; Using a primitive polynomial, set the period to The generating polynomial of a linear feedback shift register: , Obtain a recurrence relation: ; Set the round key to be: , where ; in the key mixing operation, the 's last 32 bits are used as the round key for exclusive OR operation with the input of the non - linear function , and the first 32 bits are used as the round key for exclusive OR operation with the input of the non - linear function .

8. The method for implementing a block cipher based on a lightweight algorithm structure according to claim 7, characterized in that, In step 140, the non-linear function and adopt structure, and the function transformation process consists of three operation steps: addition with round key, substitution box layer, transformation layer, including: The obtained intermediate variable is XORed with the round key to obtain the input of the S-box layer: , Among them, is the current round number, , is the last 32 bits of is the first 32 bits of; Set The box is an 8-in 8-out bijective mapping, and the After passing through the box replacement layer mapping, we get The input of the transformation layer is: ; The transformation layer performs the column mixing operation of the AES-128 standard algorithm to obtain The output of the transformation layer is used as the output of the non-linear function : ; Wherein, 。 9. A block cipher implementation device based on a lightweight algorithm structure, characterized in that, Use the device to implement the steps of the method according to any one of claims 1-8, and the device includes: The first module is used to obtain the plaintext that needs to be implemented with a password from a cache device or a data interface, and transmit the plaintext to a register or a cache; the plaintext includes data transmitted over a network or in communication, and the type of the data includes at least one of text, image, audio, video, numerical value, or structured data. The second module is used to load the plaintext from the register or the cache, and use the SIMD register to group the plaintext into four branches for parallel processing. The third module is used to generate round keys by designing a key scheduling algorithm, and store the round keys in a dedicated register. The fourth module is used to design a lightweight algorithm structure to implement the password for the four branches stored in the SIMD register, including encrypting the plaintext and decrypting the ciphertext obtained by encryption; each round of the algorithm in the lightweight algorithm structure performs a round function operation, and the operation process includes a non-linear function, key mixing, and branch crossover; the round function operation includes an encryption round function operation and a decryption round function operation. The fifth module is used to perform exclusive OR operations on the first two branches and the first three branches respectively on the four branches stored in the SIMD register in the previous round by using the encryption round function operation to obtain two intermediate variables; after respectively performing mixing operations on the two intermediate variables with the round key, use a non-linear function to perform a transformation to generate a non-linear function result; The sixth module is used to perform circular left shift operations on the four branches in the previous round respectively by using the non-linear function result to obtain the four branches in the current round; The seventh module is used to perform rounds of encryption iterations on the initially input plaintext to generate ciphertext and complete the plaintext encryption process.

10. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1-8.

Citation Information

Patent Citations

  • Lightweight block cipher encryption and decryption method

    CN113645615A

  • Implementation method and device of lightweight block cipher algorithm RainSP and electronic equipment

    CN115314187A

  • Lightweight block cipher implementation method and system of novel PSP structure

    CN116647328A

Cited By

  • Dynamic variable block cipher algorithm implementation method and device

    CN120934740A