Dynamic variable block cipher algorithm implementation method and device
By designing a dynamic variable block cipher algorithm and adopting an SPN structure and parameter control layer, the problem of insufficient iteration speed and anti-attack capability of existing block cipher algorithms under multiple security requirements is solved, and rapid iteration and efficient resource utilization are achieved.
Patent Information
- Application Number
- CN202511452384.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-10-11
AI Technical Summary
Existing block cipher algorithms struggle to adapt to different encryption and decryption transformations for different plaintext blocks under various security requirements, exhibiting slow iteration speeds and insufficient resistance to attacks.
Design a dynamic variable block cipher algorithm with an SPN structure, including a key addition layer, a parameter control layer, and a static diffusion layer. The algorithm iterates dynamically through master control parameters, adapting to various types of attacks.
It improves the algorithm's resistance to attacks and iteration speed, reduces latency, enhances resource utilization efficiency, and adapts to various security requirements.
Smart Images

Figure CN120934740A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of block cipher technology, and specifically to a method and apparatus for implementing a dynamic variable block cipher algorithm. Background Technology
[0002] Symmetric cryptography algorithms are the primary algorithms used in protecting core and critical information in important sectors such as enterprises, institutions, security, and finance. Symmetric cryptography is an important branch of cryptography, primarily studying block ciphers, stream ciphers, and hash functions. Block ciphers, as a crucial component of symmetric cryptography, are a core element of many cryptographic systems and a vital means of ensuring information confidentiality and integrity. Block ciphers are characterized by security, efficiency, and ease of standardization; they can be used for encryption and decryption, as well as for designing cryptographic primitives such as hash functions, message authentication codes, pseudo-random number generators, and authentication encryption schemes. SPN (Substitution-Permutation Network) and Feistel structures are two typical structures in block cipher algorithms, enhancing security by encrypting fixed-length plaintext blocks into fixed-length ciphertext blocks and employing multiple rounds of iterative operations. In the SPN structure, the plaintext (data) group is subjected to substitution (S) and permutation (P) operations in each round. The substitution operation is usually implemented by the S-box to perform nonlinear transformation on the data, while the permutation spreads the data (for example, by using a linear layer) so that the different parts of the data are intertwined to achieve the effect of confusion and diffusion. In contrast, the Feistel structure divides the data group into two parts: the left half and the right half. Nonlinearity and key information are introduced through round functions. For example, in each round of iteration, the right half is kept unchanged, and the left half and the right half are XORed by a round function. Then the left and right halves are swapped as the input for the next round.
[0003] Traditional block ciphers are mostly static cryptographic algorithms, meaning they can be viewed as a cluster of pseudo-random permutations controlled by a key, with the encryption and decryption process typically uniquely determined by the key. For example, Chinese invention application CN107707343B (published on October 16, 2020) discloses a lightweight block cipher implementation method with a consistent encryption and decryption SP network structure. Specifically, it designs a consistent SP network cipher structure where the plaintext and ciphertext data input directions are the same. Encryption and decryption are achieved through iteration using specific round functions, including round key addition transformation, S-box substitution transformation, column mixing transformation, and row mixing transformation. While this solves the problem of consistent encryption and decryption in SP network ciphers and offers advantages in lightweight implementation (e.g., low hardware resource consumption), all round function components are completely static: core modules such as the S-box and diffusion matrix cannot be dynamically adjusted. This results in a lack of algorithmic diversity, making it vulnerable to attacker modeling and analysis in the long term, and difficult to adapt to the needs of different security level scenarios.
[0004] With the emergence of new application scenarios, static ciphers are gradually failing to meet the current demands for efficient integration of information and data security. For example, full-disk encryption, as a crucial means of protecting the security of data stored on user computing devices, requires the use of random permutations with sufficient security distances to ensure that the encryption results of the same file are independent across different sectors. This necessitates that block ciphers provide security parameters in addition to the key. Furthermore, authentication encryption algorithms can simultaneously protect the confidentiality and integrity of data, avoiding the performance loss caused by encrypting and authenticating data separately. Current authentication encryption modes based on block ciphers, in order to surpass the security bounds, typically require different encryption and decryption transformations for different plaintext blocks. The emergence of such application scenarios places multi-parameter control design requirements on block ciphers. For example, Chinese invention application CN115664637A (published on January 31, 2023) discloses a method, apparatus, device and medium for dynamically adjustable block cipher algorithm structure. It introduces the concept of "control parameters" (256 bits) and achieves dynamic adjustment of the round function structure by expanding and generating 68 bits of dynamic control parameters per round, which significantly improves the ability to resist differential attacks. However, it has two main drawbacks: it relies on the Feistel structure (which requires multiple rounds of iteration to achieve full state diffusion), resulting in a slower diffusion speed than the SPN structure; and the control parameters are deeply coupled with the diffusion layer, increasing the implementation complexity and making it difficult to verify global security, especially in high round number (32 rounds) scenarios where resource consumption is significant.
[0005] In summary, there is an urgent need to propose a novel dynamic encryption method with multi-parameter control, so as to realize the dynamic adjustment of encryption and decryption transformation for different plaintext blocks through parameter control, and obtain a dynamic variable block encryption algorithm with good anti-attack capability and rapid iteration under various security requirements. Summary of the Invention
[0006] In view of this, to address the problems of insufficient encryption and decryption transformation capabilities for different plaintext blocks under multiple security requirements in existing technologies, as well as insufficient iteration speed and attack resistance, this invention provides a method and apparatus for implementing a dynamic variable block cipher algorithm. The method for implementing the dynamic variable block cipher algorithm, by designing an SPN structure algorithm whose round function consists of a key addition layer, a parameter control layer, and a static diffusion layer, utilizes master control parameters and iterates through a dynamic block cipher algorithm to achieve the cryptographic algorithm, providing a dynamically adjustable block encryption algorithm adaptable to various types of attacks.
[0007] This invention provides a method for implementing a dynamic variable block cipher algorithm, comprising the following steps: Step 110: Obtain the plaintext that needs to be cryptographically implemented from the cache device or data interface, and transmit the plaintext to the register or cache; the plaintext includes data transmitted over the network or communication. Step 120: Load plaintext from registers or buffers, and use SIMD registers to group the plaintext into blocks. Data for each branch; Step 130: Using an SPN structure, a parameter-controlled dynamic cryptographic algorithm is constructed for plaintext encryption and ciphertext decryption. The round function of the dynamic cryptographic algorithm consists of a key addition layer, a parameter control layer, and a static diffusion layer. The parameter control layer includes at least two first-type parameter control layers and one second-type parameter control layer. The first-type parameter control layer sets master control parameters and parameter control transformations. This enables bit-by-bit controllable swapping of data between two adjacent branches; the second type of parameter control layer sets master control parameters and is based on... Parameter control transformation of the wheel Feistel structure This enables dynamic diffusion and nonlinear injection of branch data; the parameter control layer places the second type of parameter control layer between two first type of parameter control layers, forming a nested combination into a branch coupling structure; the round functions of the dynamic cryptographic algorithm include encryption round functions and decryption round functions; Step 140: During the encryption process, when executing each round of dynamic cryptographic algorithm using the encryption round function, a pipeline architecture is adopted. The round key of the current round and the branch data output from the previous round of encryption are sequentially input into the key layer, and the main control parameters are input into the corresponding first type of parameter control layer or second type of parameter control layer using a parameter selector. The branch data output from the parameter control layer is input into the static diffusion layer to obtain the branch data encrypted in the current round. Step 150: Execute the initially input plaintext. The encryption process iterates through rounds to generate ciphertext, thus completing the plaintext encryption process.
[0008] On the other hand, the present invention also provides a device for implementing a dynamic variable block cipher algorithm, comprising: The first module is used to obtain the plaintext that needs to be cryptographically implemented from a cache device or data interface, and transmit the plaintext to a register or cache; the plaintext includes data transmitted over a network or communication. The second module is used to load plaintext from registers or buffers and to group the plaintext using SIMD registers. Data for each branch; The third module is used to construct a parameter-controlled dynamic cryptographic algorithm using an SPN structure for plaintext encryption and ciphertext decryption. The round function of the dynamic cryptographic algorithm consists of a key addition layer, a parameter control layer, and a static diffusion layer. The parameter control layer includes at least two first-type parameter control layers and one second-type parameter control layer. The first-type parameter control layer sets master control parameters and parameter control transformations. This enables bit-by-bit controllable swapping of data between two adjacent branches; the second type of parameter control layer sets master control parameters and is based on... Parameter control transformation of the wheel Feistel structure This enables dynamic diffusion and nonlinear injection of branch data; the parameter control layer places the second type of parameter control layer between two first type of parameter control layers, forming a nested combination into a branch coupling structure; the round functions of the dynamic cryptographic algorithm include encryption round functions and decryption round functions; The fourth module is used in the encryption process. When executing each round of dynamic cryptographic algorithm using the encryption round function, a pipeline architecture is adopted. The round key of the current round and the branch data output from the previous round of encryption are sequentially input into the key layer. The main control parameters are input into the corresponding first type of parameter control layer or second type of parameter control layer using a parameter selector. The branch data output from the parameter control layer is input into the static diffusion layer to obtain the branch data encrypted in the current round. The fifth module is used to execute the initial plaintext input. The encryption process iterates through rounds to generate ciphertext, thus completing the plaintext encryption process.
[0009] In summary, the present invention provides a method and apparatus for implementing a dynamic variable block cipher algorithm. Compared with the prior art, the method and apparatus of the present invention have the following advantages: (1) The method of the present invention borrows mature cryptographic components with excellent cryptographic properties, adopts the simple SPN architecture, and designs a dynamic cryptographic algorithm based on parameter control. This improves the adaptability of different encryption and decryption transformations for different plaintext blocks, enhances the anti-attack capability, and improves the iteration speed and resource utilization efficiency.
[0010] (2) The present invention is based on a parameter-controlled dynamic cryptographic algorithm and designs a round function that includes a key addition layer, a parameter control layer and a static diffusion layer. In particular, the parameter control layer includes three dynamic layers. The branch-coupled structure enables dynamic obfuscation-diffusion-obfuscation operations on branch data, which greatly improves the algorithm's resistance to structural analysis, ensures security, effectively reduces latency, and improves algorithm iteration efficiency.
[0011] (3) In the method of the present invention, compared with the traditional static block cipher, an algorithm structure control variable is introduced, which greatly improves the security of the algorithm. The theoretical analysis results are superior to the mainstream static block cipher algorithms and can be used as a backup algorithm for quantum attack resistant block ciphers. In addition, by designing a static diffusion layer, the diffusion performance and security of the algorithm are further protected. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating the steps of a dynamic variable block cipher algorithm implementation method in one embodiment of the present invention; Figure 2 This is a schematic diagram of the encryption round function in one embodiment of the present invention; Figure 3 In one embodiment of the present invention, parameters are set to control the transformation. of Function structure diagram; Figure 4 This is a schematic diagram of an extended process for generating control parameters in one embodiment of the present invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this invention clearer, the 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 for illustrative purposes only and are not intended to limit the invention.
[0014] In one embodiment, such as Figure 1 As shown, this invention provides a method for implementing a dynamic variable block cipher algorithm, comprising: Step 110: Obtain the plaintext that needs to be cryptographically implemented from the cache device or data interface, and transmit the plaintext to the register or cache; the plaintext includes data transmitted over the network or communication. Step 120: Load plaintext from registers or buffers, and use SIMD registers to group the plaintext into blocks. Data for each branch; Step 130: Using an SPN structure, a parameter-controlled dynamic cryptographic algorithm is constructed for plaintext encryption and ciphertext decryption. The round function of the dynamic cryptographic algorithm consists of a key addition layer, a parameter control layer, and a static diffusion layer. The parameter control layer includes at least two first-type parameter control layers and one second-type parameter control layer. The first-type parameter control layer sets master control parameters and parameter control transformations. This enables bit-by-bit controllable swapping of data between two adjacent branches; the second type of parameter control layer sets master control parameters and is based on... Parameter control transformation of the wheel Feistel structure This enables dynamic diffusion and nonlinear injection of branch data; the parameter control layer places the second type of parameter control layer between two first type of parameter control layers, forming a nested combination into a branch coupling structure; the round functions of the dynamic cryptographic algorithm include encryption round functions and decryption round functions; Step 140: During the encryption process, when executing each round of dynamic cryptographic algorithm using the encryption round function, a pipeline architecture is adopted. The round key of the current round and the branch data output from the previous round of encryption are sequentially input into the key layer, and the main control parameters are input into the corresponding first type of parameter control layer or second type of parameter control layer using a parameter selector. The branch data output from the parameter control layer is input into the static diffusion layer to obtain the branch data encrypted in the current round. Step 150: Execute the initially input plaintext. The encryption process iterates through rounds to generate ciphertext, thus completing the plaintext encryption process.
[0015] Specifically, in step 110, the data types used as plaintext include text, images, audio, video, numerical data, or structured data.
[0016] In one embodiment, the input plaintext is 128 bits of data, and the number of branches after grouping the plaintext is... To balance resistance to differential attacks with reducing latency and improving resource efficiency, the number of rounds is selected. The Feistel structure serves as the parameter control transformation for the second type of parameter control layer.
[0017] Specifically, during the encryption process, such as Figure 2 As shown, the encryption round function constructs a branch-coupling structure that implements dynamic obfuscation-diffusion-obfuscation of branch data in the order of key layering, parameter control layer, and static diffusion layer. The static diffusion layer is set as a linear layer. Furthermore, in the final round of encryption, no linear layer is set, and the final ciphertext is directly output from the parameter control layer.
[0018] Let the encrypted first The input to each round is 128 bits of branch data. 128-bit round key and 256 bits of control parameters ,in, and It is 8 bits long. and These are two master control parameters of the first type of parameter control layer, each 64 bits in length. It is the master control parameter of the second type of parameter control layer, with a length of 128 bits.
[0019] In step 130, the encrypted round function sets key components in the dynamic cryptographic algorithm: function, Functions and linear transformations and Construct its parameter control layer and static diffusion layer.
[0020] The Functions are used to implement parameter control transformations in the first type of parameter control layer. In this embodiment, if The function takes two 8-bit bytes as input. and 1 8-bit control parameter The output is two 8-bit bytes. ,but The function can be written as Each bit in a specific byte is given by the following formula: ; in, and They are and The Each bit number, and They are and The The _th bit. In other words, when the control parameter's _th _th bit... When the bit is 1, swap. The first of these two 8-bit inputs Bits; otherwise, do not swap.
[0021] The Functions used to implement parameter control transformations in the second type of parameter control layer. In this embodiment, it is The function is a three-round Feistel structure with four inputs, each consisting of two 8-bit bytes. and two 8-bit control parameters The output is two 8-bit bytes. ,Right now The specific structure is as follows: Figure 3 As shown, the The function can be specifically represented as: ; ; in," " indicates the XOR operation. The AES algorithm uses an 8-bit S-box as shown in Table 1. This represents an operation with parameters, specifically expressed as: , In the above formula, " "Represents AND operation, It is an 8-bit control parameter. The input data is 8 bits. express In addition to the usual left shift by 1 bit, the last bit is padded with 1. " indicates a left shift operation, " " indicates bit concatenation; respectively using express The 8 bits then have: .
[0022] Table 1: S-box in the AES algorithm
[0023] The linear transformation and This is used to set up a linear layer, ensuring the diffusion capability of the static diffusion layer in each round of encryption. The linear transformation... The tuple consisting of the 8 bytes of input status Mapped to Its specific definition is as follows: ; ; ; ; ; in, This represents a vector space consisting of 8 binary field elements. Each element is an 8-bit binary vector; It means there are 8 A set of tuples composed of vectors; " indicates a mapping.
[0024] It can also be written as a matrix representation as follows: .
[0025] Linear transformation and Similar. Let To represent a circular left shift of 1 byte for 8 8-bit words (64-bit words), then... In other words, linear transformation The specific operation process is as follows: the input state first performs a circular left shift operation of 1 byte, and then performs a linear transformation. The operation is performed, and finally, a circular left shift operation of 1 byte is executed again.
[0026] Furthermore, in step 140, for the current... In the round encryption process, when executing the dynamic cryptographic algorithm in each round using the encryption round function, a pipelined architecture is adopted, such as implementing it using an FPGA hardware platform, sequentially processing the round key for the current round. The branch data from the previous round of encryption output The input key is added to the layer, and the main control parameters are input to the corresponding first-type parameter control layer or second-type parameter control layer using a parameter selector; the branch data output from the parameter control layer is input to the static diffusion layer to obtain the encrypted branch data for the current round, specifically including: Step 141, branch data and the current round key Add a layer to the input key, for and Perform a bitwise XOR operation to obtain the output of the key layer, denoted as: , .
[0027] Preferably, the process of generating and loading the round keys involves first generating 128-bit round keys for 10 rounds using a key expansion algorithm from the 128-bit master key, and then XORing each round key into the internal state of each round.
[0028] The key expansion algorithm used in this embodiment is AES. Dynamic encryption iterative co-creation The master key is 128 bits, and each round uses a 128-bit round key. Therefore, the entire algorithm requires a total of [number missing] rounds. The subkey of the bit, denoted as the first bit The subkey of the round is , The key expansion scheme is mainly generated in the following way: First, the master key is... Expanded into a 4-row, 64-column extended key byte structure, with each column containing 4 bytes, totaling 32 bits. Indicates the first Column. At this time, the first wheel subkey .
[0029] First, the master key Mapped in the following order The matrix: ; Extended key The first four columns correspond to the master key, and the key words in each subsequent column are generated recursively from the previous columns as follows: If If it is a multiple of 4, then the first... The column is the first Column and number The bitwise XOR operation of a non-linear function of a column, which is a cyclic shift of bytes within a word. Byte replacement within the word Constituting, otherwise, the first The column is the first Column and number The bitwise XOR of the column, i.e. .
[0030] In nonlinear functions and They are defined as follows: ; .
[0031] Step 142, add the key layer output Input parameter control layer, using parameters in the parameter control layer to control the transformation: 2 Transformation and 1 Transformation, along with master control parameters, enables dynamic obfuscation-diffusion-obfuscation operations on branch data. The overall parameter control of the transformation can be summarized as follows: The aforementioned The transformation contains 8 Function, each The function operates on two adjacent 8-bit branches, and the output value is controlled by an 8-bit control parameter. Therefore, the entire... The transformation requires a total of 64 bits of control parameters. The overall definition of the main control parameters of the first type of parameter control layer is as follows: ; ; in, These are the main control parameters. Included control parameters, These are the main control parameters. Included control parameters, ;but Transformation available The function is represented as: .
[0032] The The transformation contains 8 Function, each The function operates on two 8-bit data points and requires two 8-bit control parameters for output control. Therefore, the entire... The transformation requires a total of 128 bits of control parameters, which are collectively defined as the main control parameters of the second type of parameter control layer: ; in: ; ; The above and These are the main control parameters. The included control parameters will The two 8-bit data outputs are denoted as: ; but Transformation is using The function operates on two adjacent 8-bit data.
[0033] Will After inputting the parameter control layer, the parameter selector generates three master control parameters, which are then input into the parameter control layer. These can be collectively represented as 256 bits of master control parameters. The output state is ,but .
[0034] Preferably, the parameter selector generates master control parameters using a control parameter expansion algorithm, specifically including: First, define a block cipher with a block length of 512 bits. Assuming the first The input and output of the wheel are respectively and ,in and Both are 64 bits. Their round transformation is defined as follows: ; in: ; ; In the above formula, " " indicates a circular left shift, Indicates to Invert bits.
[0035] Let the initial master control parameters be ,in Both are 64 bits, let: ; Furthermore, let The master control parameters for each round are generated as follows: As The input is first iterated for 8 rounds; then, after every 4 rounds, the lower 4 branches, i.e., 256 bits, are output. The above process for generating master control parameters is as follows: Figure 4 As shown, where, Transformation .
[0036] Step 143, output the parameter control layer Input the static diffusion layer to obtain the encrypted branch data for the current round.
[0037] The static diffusion layer of the encrypted round function is ,in This can be represented as two 64-bit linear transformations. and Let the input and output of the static diffusion layer be respectively... and The odd-indexed branches of the input are concatenated into a 64-bit array, denoted as [example of the array]. The even-numbered branches are concatenated into a 64-bit array, denoted as .but ; ; After that Through linear transformation respectively and Finally, the output is split into odd or even branches corresponding to the inputs: , .
[0038] The ciphertext decryption process of the dynamic cryptographic algorithm differs from the encryption round function in that the decryption round function is structured as a static diffusion layer, a parameter control layer, and a key addition layer, with the order of use of the round key and master control parameters reversed compared to encryption. The static diffusion layer during decryption is a linear layer. ,in .
[0039] make To represent a 1-byte circular right shift of 8 8-bit words (64-bit words), then... Due to the parameter control layer The transformation is actually a Feistel-like transformation, therefore the decryption process... The structure of the transformation is basically the same as that of the encryption algorithm, the only difference being that the left and right branches are swapped at the input, but not at the output. Therefore, the parameter control layer in the decryption algorithm simply takes the control parameters from the encryption algorithm. and Simply swap the order, that is... .
[0040] The dynamic variable block cipher algorithm implementation method provided in the foregoing embodiments of the present invention mainly utilizes mature cryptographic components with excellent cryptographic properties, adopts a simple SPN architecture, and designs a parameter-controlled dynamic cryptographic algorithm. This improves the adaptability to different encryption and decryption transformations for different plaintext blocks, enhances anti-attack capabilities, and improves iteration speed and resource utilization efficiency. Specifically, the parameter-controlled dynamic cryptographic algorithm designs a round function that includes a key addition layer, a parameter control layer, and a static diffusion layer. In particular, the parameter control layer includes three dynamic layers. The branch-coupling structure enables dynamic confusion-diffusion-confusion operations on branch data, significantly improving the algorithm's resistance to structural analysis. Combined with partial white-box cryptographic mechanisms, it exhibits excellent immunity to side-channel analysis, ensuring security while effectively reducing latency and improving iteration efficiency. Furthermore, the design of a static layer provides further safeguards for the algorithm's diffusion performance and security. Moreover, compared to traditional static block ciphers, the introduction of algorithm structure control variables significantly enhances security, with theoretical analysis results outperforming mainstream static block cipher algorithms, making it a viable backup algorithm for quantum-resistant block ciphers. Therefore, the overall design architecture of the algorithm ensures both the synergistic optimization of iteration speed and resource efficiency in cryptographic implementation, while also guaranteeing adaptability to various scenarios (e.g., quantum cryptography design) and security performance. The resistance to structural analysis is specifically reflected in: Differential analysis and linear analysis: The cryptographic algorithm implementation method designed in this invention uses the S-box of the AES algorithm, with a difference uniformity of 4, i.e., the maximum difference probability is... Based on the number of active S-boxes in the differential method, this invention shows that when the number of rounds is 5, the number of active S-boxes is 26, therefore the obtained differential probability is... Therefore, it can be concluded that the security boundary for differential attacks is 5 rounds. (Search results...) The maximum difference probability of the function is When the number of rounds is 5, the number of branches is 13, therefore the difference probability is... Therefore, it can be concluded that the security boundary of differential attacks is 5 rounds.
[0041] The nonlinearity of the S-box in AES is 112, then Therefore, similar to difference analysis, it can be stated that the safety boundary of linear analysis is 5 rounds.
[0042] Impossible difference analysis: An impossible difference with two rounds was found using the intermediate phase shift method.
[0043] Integral analysis: This algorithm has only two rounds of integrators.
[0044] Full diffusion rounds: The parameter-controlled dynamic encryption algorithm has 2 full diffusion rounds. It can be proven that there is no impossible differential discriminator with more than 4 rounds.
[0045] Furthermore, in practical applications, the main control parameters in the round function structure can also be provided by the fingerprint data of the hardware device. Especially for IoT devices, this can easily and effectively implement device authentication. By deploying software or firmware through static compilation, each device can have a different algorithm, ensuring that even if it is analyzed and compromised, it will not affect the security of other IoT devices. It also has broad application prospects in areas such as disk encryption.
[0046] In one embodiment, the present invention provides an apparatus for implementing a dynamic variable block cipher algorithm, the apparatus comprising: The first module is used to obtain the plaintext that needs to be cryptographically implemented from a cache device or data interface, and transmit the plaintext to a register or cache; the plaintext includes data transmitted over a network or communication. The second module is used to load plaintext from registers or buffers and to group the plaintext using SIMD registers. Data for each branch; The third module is used to construct a parameter-controlled dynamic cryptographic algorithm using an SPN structure for plaintext encryption and ciphertext decryption. The round function of the dynamic cryptographic algorithm consists of a key addition layer, a parameter control layer, and a static diffusion layer. The parameter control layer includes at least two first-type parameter control layers and one second-type parameter control layer. The first-type parameter control layer sets master control parameters and parameter control transformations. This enables bit-by-bit controllable swapping of data between two adjacent branches; the second type of parameter control layer sets master control parameters and is based on... Parameter control transformation of the wheel Feistel structure This enables dynamic diffusion and nonlinear injection of branch data; the parameter control layer places the second type of parameter control layer between two first type of parameter control layers, forming a nested combination into a branch coupling structure; the round functions of the dynamic cryptographic algorithm include encryption round functions and decryption round functions; The fourth module is used in the encryption process. When executing each round of dynamic cryptographic algorithm using the encryption round function, a pipeline architecture is adopted. The round key of the current round and the branch data output from the previous round of encryption are sequentially input into the key layer. The main control parameters are input into the corresponding first type of parameter control layer or second type of parameter control layer using a parameter selector. The branch data output from the parameter control layer is input into the static diffusion layer to obtain the branch data encrypted in the current round. The fifth module is used to execute the initial plaintext input. The encryption process iterates through rounds to generate ciphertext, thus completing the plaintext encryption process.
[0047] On the other hand, the present invention provides a computer device including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the dynamic variable block cipher algorithm implementation method provided in any of the above embodiments. The computer device can be a server. The computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and 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 computer program in the non-volatile storage medium. The database of the computer device stores sample data. The network interface of the computer device is used for communication with external terminals via a network connection.
[0048] On the other hand, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the dynamic variable block cipher algorithm implementation method provided in any of the above embodiments.
[0049] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0050] Matters not covered in this invention are common knowledge. The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered to be within the scope of this specification.
[0051] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for implementing a dynamic variable block cipher algorithm, characterized in that, include: Step 110: Obtain the plaintext that needs to be cryptographically implemented from the cache device or data interface, and transmit the plaintext to the register or cache; The plaintext includes data transmitted over a network or communication; Step 120: Load plaintext from registers or buffers, and use SIMD registers to group the plaintext into blocks. Data for each branch; Step 130: Using an SPN structure, a parameter-controlled dynamic cryptographic algorithm is constructed for plaintext encryption and ciphertext decryption. The round function of the dynamic cryptographic algorithm consists of a key addition layer, a parameter control layer, and a static diffusion layer. The parameter control layer includes at least two first-type parameter control layers and one second-type parameter control layer. The first-type parameter control layer sets master control parameters and parameter control transformations. This enables bit-by-bit controllable swapping of data between two adjacent branches; the second type of parameter control layer sets master control parameters and is based on... Parameter control transformation of the wheel Feistel structure This enables dynamic diffusion and nonlinear injection of branch data; The parameter control layer places the second type of parameter control layer between the two first type of parameter control layers, forming a nested combination into a branch-coupled structure; the round functions of the dynamic cryptographic algorithm include encryption round functions and decryption round functions; Step 140: During the encryption process, when executing each round of dynamic cryptographic algorithm using the encryption round function, a pipeline architecture is adopted. The current round key and the branch data of the previous round encryption output are sequentially input into the key layer, and the parameter selector is used to input the master control parameters into the corresponding first type of parameter control layer or second type of parameter control layer. The branch data output from the parameter control layer is input into the static diffusion layer to obtain the encrypted branch data for the current round; Step 150: Execute the initially input plaintext. The encryption process iterates through rounds to generate ciphertext, thus completing the plaintext encryption process.
2. The method for implementing the dynamic variable block cipher algorithm according to claim 1, characterized in that, The plaintext is 128 bits in length; the data type of the plaintext includes text, images, audio, video, numerical data, or structured data; the number of branches after grouping the plaintext. .
3. The method for implementing the dynamic variable block cipher algorithm according to claim 2, characterized in that, In step 130, the number of rounds is selected. The Feistel structure serves as the parameter control transformation for the second type of parameter control layer; The static diffusion layer is configured as a linear layer. In the final round of encryption, no linear layer is set, and the final ciphertext is directly output from the parameter control layer.
4. The method for implementing the dynamic variable block cipher algorithm according to claim 2, characterized in that, In step 130, the encrypted round function sets key components in the dynamic cryptographic algorithm: function, Functions and linear transformations and Construct a parameter control layer and a static diffusion layer; The Functions are used to implement parameter control transformations in the first type of parameter control layer. The The function takes two 8-bit bytes and one 8-bit control parameter as input, and outputs two 8-bit bytes. When the control parameter's first... When bit is 1, the corresponding bit in the two 8-bit bytes of the input is swapped. Bit, ; Otherwise, no exchange; The Functions are used to implement parameter control transformations in the second type of parameter control layer. The The function is a three-round Feistel structure with four inputs: two 8-bit bytes and two 8-bit control parameters, and an output of two 8-bit bytes. The linear transformation The tuple consisting of the 8 bytes of input status Mapped to The specific definition is as follows: , , , , ; in, This represents a vector space consisting of 8 binary field elements. Each element is an 8-bit binary vector; It means there are 8 A set of tuples composed of vectors; Represents a mapping; Linear transformation The operation is as follows: first, perform a circular left shift of 1 byte on the input state, then perform a linear transformation. The operation is performed, and finally, a circular left shift operation of 1 byte is executed again; let To represent a 1-byte circular left shift of 8 8-bit words, then... .
5. The method for implementing the dynamic variable block cipher algorithm according to claim 4, characterized in that, If the input is set The function's two 8-bit bytes are and two 8-bit control parameters The output is two 8-bit bytes. Then the The function is denoted as ,in: ; ; In the above formula, This represents the XOR operation. This refers to the 8-bit S-box in the AES algorithm. This represents an operation with parameters, specifically expressed as: ; AND operation, It is an 8-bit control parameter. The input data is 8 bits. express In addition to the usual left shift by 1 bit, the last bit is padded with 1; Indicates a left shift operation. Represents bit concatenation; respectively using express The 8 bits then have: 。 6. The method for implementing the dynamic variable block cipher algorithm according to claim 5, characterized in that, Step 140 includes: Step 141, set the current round number Branch data of the wheel Wheel key Add a layer to the input key, for and Perform a bitwise XOR operation to obtain the output of the key layer, denoted as: , , ; Step 142, add the key layer output Input parameter control layer, using parameters in the parameter control layer to control the transformation: 2 Transformation and 1 Transformation, and master control parameters To implement dynamic obfuscation-diffusion-obfuscation operations on branch data, where: ; ; ; ; ; In the above formula, These are the main control parameters. Included control parameters, These are the main control parameters. Included control parameters, ; and These are the main control parameters. Included control parameters; The The transformation contains 8 Function, each The function operates on two adjacent 8-bit branches, and the output value is controlled by an 8-bit control parameter; therefore... Transformation available The function is represented as: ; The The transformation contains 8 Function, each The function operates on two 8-bit data points and requires two 8-bit control parameters for output control. Therefore, the entire... The transformation requires a total of 128 bits of control parameters, utilizing... The function operates on two adjacent 8-bit data. Will After inputting the parameter control layer, the parameter selector generates three master control parameters and inputs them into the parameter control layer. These are collectively represented as 256 bits of master control parameters. The output state is ,but ; Step 143, output the parameter control layer Input the static diffusion layer to obtain the encrypted branch data for the current round.
7. The method for implementing the dynamic variable block cipher algorithm according to claim 6, characterized in that, The process of generating and loading round keys includes generating 128-bit round keys for 10 rounds from a 128-bit master key using a key expansion algorithm, and then XORing each round key into the internal state of each round; the key expansion algorithm used is the AES key expansion algorithm.
8. The method for implementing the dynamic variable block cipher algorithm according to claim 7, characterized in that, The parameter selector generates master control parameters using a control parameter expansion algorithm, specifically including: Define a block cipher with a block length of 512 bits. Assuming the first The input and output of the wheel are respectively and ,in, and Both are 64 bits; Define wheel transformation: ; in: ; ; In the above formula, Indicates a circular left shift. Indicates to Invert bits; Let the initial master control parameters be ,in, Both are 64 bits, let: Furthermore, let The master control parameters for each round are generated as follows: As The input is first iterated for 8 rounds; then after every 4 rounds, the lower 4 branches, i.e., 256 bits, are output.
9. The method for implementing the dynamic variable block cipher algorithm according to claim 8, characterized in that, It also includes the use of dynamic cryptographic algorithms for ciphertext decryption, including: The decryption round function is structured as follows: a static diffusion layer, a parameter control layer, and a key addition layer. The order in which the round key and master control parameters are used in each round is the reverse of that during encryption, thus controlling the parameters during the encryption process. and By swapping the order, we get: ; Set the static diffusion layer as a linear layer: ,in: ; make To represent a 1-byte circular right shift of 8 8-bit words, then... .
10. A device for implementing a dynamic variable block cipher algorithm, characterized in that, The device includes: The first module is used to obtain the plaintext that needs to be cryptographically implemented from a cache device or data interface, and transmit the plaintext to a register or cache; the plaintext includes data transmitted over a network or communication. The second module is used to load plaintext from registers or buffers and to group the plaintext using SIMD registers. Data for each branch; The third module is used to construct a parameter-controlled dynamic cryptographic algorithm using an SPN structure for plaintext encryption and ciphertext decryption. The round function of the dynamic cryptographic algorithm consists of a key addition layer, a parameter control layer, and a static diffusion layer. The parameter control layer includes at least two first-type parameter control layers and one second-type parameter control layer. The first-type parameter control layer sets master control parameters and parameter control transformations. This enables bit-by-bit controllable swapping of data between two adjacent branches; the second type of parameter control layer sets master control parameters and is based on... Parameter control transformation of the wheel Feistel structure This enables dynamic diffusion and nonlinear injection of branch data; the parameter control layer places the second type of parameter control layer between two first type of parameter control layers, forming a nested combination into a branch coupling structure; the round functions of the dynamic cryptographic algorithm include encryption round functions and decryption round functions; The fourth module is used in the encryption process. When executing each round of dynamic cryptographic algorithm using the encryption round function, a pipeline architecture is adopted. The round key of the current round and the branch data output from the previous round of encryption are sequentially input into the key layer. The main control parameters are input into the corresponding first type of parameter control layer or second type of parameter control layer using a parameter selector. The branch data output from the parameter control layer is input into the static diffusion layer to obtain the branch data encrypted in the current round. The fifth module is used to execute the initial plaintext input. The encryption process iterates through rounds to generate ciphertext, thus completing the plaintext encryption process.
Citation Information
Patent Citations
Lightweight Block Cipher Implementation Method for SP Network Structure with Consistent Encryption and Decryption
CN107707343B
Method, device and equipment for dynamically adjusting structure of block cipher algorithm and medium
CN115664637A
Novel low-resource efficient lightweight Surge block cipher implementation method
CN104065474A
2D-LCLM-based energy internet data packet encryption algorithm
CN113806781A
Block cipher implementation method, device and equipment based on lightweight algorithm structure
CN120263394A