A novel lightweight block cipher implementation method and system based on PSP architecture
By designing a novel PSP structure and utilizing symmetrical P1 and P2 diffusion layers and S-box replacement, the inconsistency in encryption and decryption in Feistel and SPN structures is resolved, achieving a low-power and low-resource-consumption encryption and decryption process suitable for IoT devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2026-04-03
AI Technical Summary
The existing Feistel and SPN structures have inconsistencies in encryption and decryption in IoT devices, resulting in high energy and resource consumption, which makes it difficult to meet the low-energy consumption requirements of the 5G era.
A novel PSP structure is adopted, which achieves high consistency in encryption and decryption through the symmetric design of the P1 and P2 diffusion layers. Symmetrical S-box replacement and round key expansion operations are introduced to reduce resource and energy consumption.
Without affecting the diffusion effect and security, it achieves high consistency between encryption and decryption, reduces resource and energy consumption, and is suitable for the low-energy consumption requirements of IoT devices.
Smart Images

Figure CN116647328B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cryptography technology, specifically relating to a lightweight block cipher implementation method and system with a novel PSP structure. Background Technology
[0002] With the arrival of the 5G era, smart homes, smart agriculture, smart industry, smart healthcare, and smart cities are emerging faster and better. It is a powerful driving force for the development of IoT technology. Data exchange between IoT devices is growing at an unprecedented scale, and the security of massive amounts of data is also a growing concern. In the 5G era, new application scenarios for IoT devices face various limitations, potentially leading to issues such as data latency, circuit size, power consumption, and limited energy resources. Subhadeep Banik et al. noted that for some battery-powered IoT devices, such as handheld devices, implantable medical devices, or RFID tags, energy consumption is an even more crucial parameter.
[0003] The main design structures of lightweight block ciphers include the Feistel structure and SPN, corresponding to the classic cryptographic algorithms DES and AES, respectively. The Feistel structure, represented by DES, can achieve consistent encryption and decryption; however, precisely because of this structural characteristic, this type of cryptographic algorithm has poor diffusion and requires more rounds to maintain its security. With the increase in the number of rounds, energy consumption increases exponentially. The SPN structure has the advantages of good diffusion and higher security. However, because SPN structures have inconsistent encryption and decryption, decryption requires additional resources. Therefore, when both encryption and decryption consume energy, the overall energy consumption is often not particularly low. In addition, the area and latency of components can also affect the overall energy consumption of the algorithm.
[0004] Current problems with low-energy, lightweight block cipher algorithms:
[0005] (1) With the advent of the 5G era, new application scenarios for IoT devices have stricter energy requirements, but research on lightweight block ciphers with lower energy consumption is far from sufficient.
[0006] (2) At present, the main cryptographic structures (Feistel structure and SPN) all have advantages and disadvantages. How to avoid or reduce the disadvantages of a certain structure while ensuring its advantages, and ensure that the algorithm has the characteristics of low energy consumption and high security.
[0007] Therefore, it is necessary to study a new structure that is different from the Feistel structure and SPN, which solves the problem of inconsistent encryption and decryption in the traditional SPN structure. At the same time, it is necessary to have a lightweight block cipher with lower energy consumption and resource consumption. Summary of the Invention
[0008] This invention provides a lightweight block cipher implementation method and system for a novel PSP structure, aiming to solve the defects of inconsistent encryption and decryption in the traditional SPN structure. It achieves high consistency in encryption and decryption without affecting the diffusion effect and security of the structure, thereby reducing resource consumption and energy consumption.
[0009] Therefore, the present invention provides the following technical solution:
[0010] On the one hand, the present invention provides a lightweight block cipher implementation method for a novel PSP structure, characterized by comprising the following steps:
[0011] Set the initial key;
[0012] Obtain the plaintext or ciphertext and divide it into two branches in sequence;
[0013] Based on the initial key, perform round key expansion operations to obtain the subkey for each round of operation, and use the subkey for each round to perform Nr rounds of encryption or decryption operations on the plaintext or ciphertext of the left and right branches to obtain the corresponding ciphertext or plaintext. The encryption or decryption result of the previous round is used as the plaintext or ciphertext of the next round, and the result of the round key expansion operation of the previous round is used as the input of the round key expansion operation of the next round.
[0014] If it is an encryption operation, each round of encryption operation is an encryption operation that transforms the plaintext of the left and right branches into a PSP structure. The PSP structure transformation of the encryption operation includes P1 diffusion layer, S-box substitution, and P2 diffusion layer in sequence.
[0015] If it is a decryption operation, each round of decryption operation first swaps the ciphertext of the left and right branches, and then performs a decryption operation of PSP structure transformation on the ciphertext. The PSP structure transformation of the decryption operation includes P1 diffusion layer, S-box replacement, and P2 diffusion layer in sequence.
[0016] In this process, both the P1 diffusion layer and the P2 diffusion layer are symmetrical structures. The subkeys in the decryption operations from the 1st to the Nrth rounds correspond one-to-one with the subkeys obtained in the encryption operations from the Nrth to the 1st round. That is, the subkey in the decryption operation from the 1st round is the subkey in the encryption operation from the Nrth round, the subkey in the decryption operation from the 2nd round is the subkey in the encryption operation from the Nr-1th round, and so on.
[0017] It should be understood that the structures of P1 and P2 are symmetrical. The reason for the symmetry is that both structures are based on round key addition, circular left shift, and XOR operation. The P1 layer follows the order of round key addition, circular left shift, and XOR, while the P2 layer follows the order of XOR, circular left shift, and round key addition. The two are exactly opposite.
[0018] Further, optionally, if it is an encryption operation, the encryption operation of the P1 diffusion layer in the PSP structure transformation is as follows:
[0019] C1: Perform a round key addition operation on the plaintext X0 of the left branch to obtain X'0, wherein the subkey is divided into data block K0 and data block K1 by bit. The round key used when performing the round key addition operation on the plaintext X0 of the left branch is the data block K0 in the subkey corresponding to the current round operation. The data block K1 participates in the P2 diffusion layer encryption operation.
[0020] C2: Perform a circular left shift of 11 bits on the result X'0 from step C1 to obtain X. 01 ;
[0021] C3: Compare the plaintext X1 of the right branch with the result X from step C2. 01 Perform an XOR operation to obtain X'1;
[0022] Among them, the obtained data X'0 and X'1 are the results of the current round of P1 diffusion layer encryption operation;
[0023] If it is a decryption operation, the process of the P1 diffusion layer decryption operation in the PSP structure transformation is as follows:
[0024] c1: Perform a round key addition operation on the left branch ciphertext Y0 to obtain Y'0, wherein the round key used when performing the round key addition operation on the left branch ciphertext Y0 is the data block in the subkey corresponding to the current round operation. The data block The data block K1 is in the same position in its respective subkey;
[0025] c2: Perform a circular left shift operation of 11 bits on the result Y'0 from step c1 to obtain Y. 01 ;
[0026] c3: Compare the plaintext Y1 of the right branch with the result Y of step c2. 01 Perform an XOR operation to obtain Y'1;
[0027] The obtained data Y'0 and Y'1 are the results of the current round of P1 diffusion layer decryption operation.
[0028] Alternatively, if it is an encryption operation, the encryption operation of the P2 diffusion layer in the PSP structure transformation is as follows:
[0029] D1: Perform a circular left shift operation of 11 bits on the plaintext X”1 in the right branch to obtain X. 10 ;
[0030] D2: Compare the plaintext X”0 of the left branch with the result X from step D1. 10 Performing an XOR operation yields X”'0;
[0031] D3: Perform a round key addition operation on the plaintext X”1 in the right branch to obtain X”'1; wherein, the subkey is divided into data block K0 and data block K1 by bit, and the round key used when performing the round key addition operation is the data block K1 in the subkey corresponding to the current round operation, and the data block K0 participates in the P1 diffusion layer encryption operation;
[0032] Among them, the obtained data X”'0 and X”'1 are the results of the current round of P2 diffusion layer encryption operation, and the plaintext X”0 on the left branch and the plaintext X”1 on the right branch are the results of the S-box substitution operation in the PSP structure transformation of the encryption operation;
[0033] If it is a decryption operation, the process of the P2 diffusion layer decryption operation in the PSP structure transformation is as follows:
[0034] d1: Perform a circular left shift of 11 bits on the right branch ciphertext Y”1 to obtain Y 10 ;
[0035] d2: Compare the ciphertext Y”0 of the left branch with the result Y of step d1. 10 Performing an XOR operation yields Y”'0;
[0036] d3: Perform a round key addition operation on the right branch ciphertext Y”1 to obtain Y”'1, where the round key used in step d3 is the data block in the subkey corresponding to the current round operation. The data block The data block K0 is in the same position in its respective subkey; the obtained Y”'0 and Y”'1 are the results of the current round of P2 diffusion layer decryption operation; the left branch ciphertext Y”0 and the right branch ciphertext Y”1 are the results of the S-box substitution operation performed in the PSP structure transformation during the decryption operation.
[0037] Further, optionally, the S-box substitution in the encryption and decryption operations is performed based on substitution rules or logical operations:
[0038] Replacement rules:
[0039] x={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
[0040] S[x]={C, E, 2, A, 6, F, 4, 7, 9, 8, 3, B, 0, D, 1, 5}
[0041] Where x is any number from 0 to F in hexadecimal, which corresponds to the data before the S-box is replaced, and S[x] represents the data before and after the key S-box is replaced;
[0042] The formulas corresponding to the logical operations are as follows:
[0043]
[0044] Where a, b, c, and d represent the four bits of a binary number from 0 to 15, from the most significant bit to the least significant bit. Each bit of data is processed according to the corresponding logical operation formula to obtain a', b', c', and d'. The horizontal line "—" represents the NOT operation.
[0045] Further optionally, the round key expansion operation includes, in sequence, key S-box replacement, cyclic right shift, round constant XOR, and cyclic right shift operation.
[0046] Further, optionally, each round of key expansion operation includes the following steps:
[0047] B1: Replace the high 8 bits of the key in the key before the round key expansion operation with an S-box, while keeping the data in other positions of the key unchanged;
[0048] B2: Circularly right-shift the key after step B1 by 15 bits;
[0049] B3: Subtract 1 from the current round number to obtain the round constant, and perform an XOR operation with the high 4 bits of the result in step B2, while keeping the data in other positions unchanged;
[0050] B4: Circularly shift the result of step B3 5 bits to the right, which is considered to complete the current round key expansion operation.
[0051] Further optionally, the initial key is 128 bits long, the plaintext and ciphertext are 64 bits long, and the subkey for each round is 64 bits long. The high 64 bits of the 128-bit key after the round key expansion operation are used as the subkey, and the high 32 bits of the subkey are used in the round key addition operation of the P1 diffusion layer, while the low 32 bits are used in the round key addition operation of the P1 diffusion layer.
[0052] Secondly, this invention provides a system for implementing a lightweight block cipher based on a novel PSP structure, comprising:
[0053] The initial key setting module is used to set the initial key (Key).
[0054] The acquisition module is used to acquire plaintext or ciphertext and is divided into two branches in sequence;
[0055] The round key expansion module is used to perform round key expansion operations based on the initial key to obtain the subkey for each round of operation;
[0056] The encryption / decryption module is used to perform Nr rounds of encryption or decryption operations on the plaintext or ciphertext of the left and right branches based on the subkey corresponding to each round to obtain the corresponding ciphertext or plaintext.
[0057] If it is an encryption operation, each round of encryption operation is an encryption operation that transforms the plaintext of the left and right branches into a PSP structure. The PSP structure transformation of the encryption operation includes P1 diffusion layer, S-box substitution, and P2 diffusion layer in sequence.
[0058] If it is a decryption operation, each round of decryption operation first swaps the ciphertext of the left and right branches, and then performs a decryption operation of PSP structure transformation on the ciphertext. The PSP structure transformation of the decryption operation includes P1 diffusion layer, S-box replacement, and P2 diffusion layer in sequence.
[0059] Among them, the P1 diffusion layer and the P2 diffusion layer are symmetrical structures, and the subkeys in the 1→Nr rounds of decryption operation correspond one-to-one with the subkeys obtained in the Nr→1 rounds of encryption operation.
[0060] In three aspects, the present invention provides an electronic terminal, comprising at least:
[0061] One or more processors;
[0062] And a memory that stores one or more computer programs;
[0063] The processor calls the computer program to implement:
[0064] Steps for implementing a lightweight block cipher based on a novel PSP structure.
[0065] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that is invoked by a processor to implement:
[0066] Steps for implementing a lightweight block cipher based on a novel PSP structure.
[0067] Beneficial effects
[0068] Compared with existing methods, the advantages of the present invention are:
[0069] 1. The present invention provides a lightweight block cipher implementation method, which proposes a novel PSP structure, distinct from the Feistel and SPN structures. This PSP structure introduces highly symmetrical P1 and P2 diffusion layers, solving the problem of inconsistent encryption and decryption in the traditional SPN structure. It achieves highly consistent encryption and decryption without affecting the diffusion effect and security of the structure, reducing resource and energy consumption. At the same time, due to the symmetry of these two diffusion layers, decryption only requires the exchange of data between the left and right branches on the basis of the encryption process, without consuming additional hardware resources.
[0070] 2. A further preferred embodiment of the present invention provides a new S-box that can achieve cryptographic properties and ensure the security of the algorithm. At the same time, the S-box does not occupy a large amount of resources and area, and has the advantages of low energy consumption, low resource consumption, high performance and high security.
[0071] 3. In a further preferred embodiment of the present invention, the key expansion operation defined in the present invention sequentially includes key S-box replacement, cyclic right shift, round constant XOR, and cyclic right shift operation. Specifically, the S-box replacement in the key expansion achieves a confusion effect, the subsequent shift operation achieves a diffusion effect, and the round constant XOR eliminates symmetry, ensuring the relative security of the key. Attached Figure Description
[0072] Figure 1 This is a flowchart of the encryption process described in this invention;
[0073] Figure 2 This is a flowchart of the round key expansion process described in this invention. Detailed Implementation
[0074] This invention provides a lightweight block cipher implementation method with a novel PSP structure. It proposes a novel PSP structure that addresses the inconsistency in encryption and decryption inherent in traditional SPN structures. Utilizing the high symmetry between the P1 and P2 diffusion layers in the PSP structure, it achieves highly consistent encryption and decryption without increasing hardware resources, thus resolving the inconsistency issue of traditional SPN structures. Furthermore, it reduces algorithm resource and energy consumption without affecting the diffusion effect and security of the structure. The invention will be further illustrated below with examples, specifically using a plaintext length of 64 bits, a key length of 128 bits, and 16 rounds of function iteration as an example for detailed explanation.
[0075] Example 1:
[0076] This invention provides a lightweight block cipher implementation method for a novel PSP structure, which, when applied to encryption, includes the following steps:
[0077] Step A1: Obtain 64 bits of plaintext as the data to be encrypted (Plaintext). Based on the high 32 bits and low 32 bits, obtain two branches (left and right) and determine the number of rounds Nr as 16. The grouping process is as follows:
[0078] Let each group be represented by X. i (i = 0, 1), the high 32 bits are X0 = x 63 ||x 62 …x 33 ||x 32 The lower 32 bits of data are X1 = x 31 ||x 30…x1||x0, where || represents the string concatenation operator.
[0079] Step A2: Set the 128-bit key Key = k 127 ||k 126 …k1||k0, performs round key expansion on the 128-bit key, including sequentially performing key S-box replacement, circular right shift, round constant XOR, and circular right shift operations. The specific process is as follows:
[0080] S-box replacement: The high 8 bits of the 128-bit key are replaced using Table 1 or logical operations to obtain Key1. The logical operations and lookup table for key S-box replacement are as follows:
[0081]
[0082] Where a, b, c, and d represent the four bits of a binary number from 0 to 15, from the most significant bit to the least significant bit. Each bit of data is processed according to the formula to obtain a', b', c', and d'.
[0083] Table 1 Algorithm S-box Elements
[0084]
[0085] x and S[x] represent the data before and after the key S is replaced, respectively.
[0086] Circular right shift: Circularly shift Key1 to the right by 15 bits to obtain Key2;
[0087] Round constant XOR: The current round number minus 1 is used as the round constant, and this constant is XORed with the high 4 bits of Key2. Other data remains unchanged to obtain a 128-bit Key3. The four-bit round constant is represented as (r3||r2||r1||r0). Since the number of rounds is 1 to 16, the round constant for each round is 0-15, which corresponds to 0-F (0000-1111) in hexadecimal, also corresponding to (r3||r2||r1||r0), hence a four-bit round constant. Furthermore, this four-bit round constant is XORed with the high 4 bits of Key2 (other data remains unchanged) to obtain the 128-bit Key3.
[0088] Circular right shift: Circularly shift Key3 5 bits to the right to obtain the new Key;
[0089] Specifically, the high 64 bits of the key after round key expansion are taken and used as the subkey in this round key addition operation. This 64-bit key is then divided into two parts in descending order of high and low bits, i.e., K0 = k 127 ||k 126 …k 97 ||k 96and K1=k 95 ||k 94 …k 65 ||k 64 They participate in the round key addition operation in the P1 diffusion layer and the P2 diffusion layer, respectively.
[0090] Step A3: Encrypt the plaintext data of the left and right branches using the PSP structure. The PSP structure transformation includes the P1 diffusion layer, S-box substitution, and the P2 diffusion layer. First, the P1 diffusion layer operation is performed: the 32-bit left branch plaintext X0 is first incremented using a round key to obtain X'0, and then the data block X'0 is circularly shifted left by 11 bits to obtain X. 01 Finally, the 32-bit right branch plaintext X1 is compared with X... 01 Perform an XOR operation to obtain X'1. The round key addition operation in this step uses the 32-bit key K0 after the round key expansion operation has been performed.
[0091] Step A4: Perform the S-box replacement operation. For the results X'0 and X'1 obtained in Step A3, perform S-box replacements using either a lookup table or logical operations to obtain X”0 and X”1 respectively. The logical operations and lookup table for the S-box replacement refer to the logical operations and Table 1 for the key S-box replacement described above.
[0092] Step A5: Perform the P2 diffusion layer operation on X”0 and X”1 obtained in Step A4. Specifically, perform a circular left shift of X”1 by 11 bits to obtain X”0. 10 Then, the 32-bit left branch data X”0 and X 10 An XOR operation is performed to obtain X”'0, and finally, a round key addition operation is performed on X”1 to obtain X”'1. The round key addition operation uses the 32-bit key K1 that has undergone the round key expansion operation.
[0093] Step A6: Determine if the current round number is less than 16. If so, assign X”'0 and X”'1 as the data for the new round of input, and then return to step A2. Otherwise, output X”'0 and X”'1 as ciphertext from the most significant bit to the least significant bit.
[0094] The lightweight block cipher implementation method provided by this invention is applicable not only to the encryption process but also to the decryption process. Since the subkeys generated in the 16 rounds of encryption are stored, decryption only requires reusing these 16 subkeys sequentially. That is, in each round of decryption, there is a one-to-one correspondence between the key obtained in rounds 1 through Nr and the key obtained in round Nr through 1 of encryption. The decryption process includes the following steps:
[0095] Step B1: Obtain the 64-bit ciphertext as the data to be decrypted (ciphertext). Based on the high 32 bits and low 32 bits, obtain two branches (left and right) and determine the number of rounds Nr as 16. The grouping process is as follows:
[0096] Let each group be represented by Y. i (i = 0, 1), the high 32 bits are Y0 = y 63 ||y 62 …y 33 ||y 32 The lower 32 bits of data are Y1 = y 31 ||y 30 …y1||y0, where || represents the string concatenation operator;
[0097] Step B2: Obtain the 128-bit encryption key stored during this round, Key = k 127 ||k 126 …k1||k0, and select the high 64 bits of the key as the subkey needed for this round of decryption. Divide this 64-bit key into two parts in order from the high bit to the low bit, i.e. and
[0098] Step B3: Swap the 32-bit plaintext data between the left and right branches, i.e., Y0 = y 31 ||y 30 …y1||y0,Y1=y 63 ||y 62 …y 33 ||y 32 .
[0099] Step B4: Decrypt the data from Step B3 using the PSP structure. The PSP structure transformation includes the P1 diffusion layer, S-box replacement, and the P2 diffusion layer. First, the P1 diffusion layer operation is performed: the 32-bit left branch ciphertext Y0 is first incremented using a round key to obtain Y'0. Then, the data block Y'0 is circularly shifted left by 11 bits to obtain Y'0. 01 Finally, the 32-bit right branch ciphertext Y1 and Y... 01 Perform an XOR operation to obtain Y'1. The round key addition operation uses the 32-bit key from step B2.
[0100] Step B5: Perform the S-box replacement operation. For the results Y'0 and Y'1 obtained in Step B4, perform S-box replacements using either a lookup table or logical operations to obtain Y”0 and Y”1 respectively. The logical operations and lookup tables for the S-box replacement are described above and are consistent with the encryption process.
[0101] Step B6: Perform the P2 diffusion layer operation on Y”0 and Y”1 obtained in step B5. Perform a circular left shift of Y”1 by 11 bits to obtain Y”0. 10 Then, the 32-bit left branch data Y”0 and Y 10 Perform an XOR operation to obtain Y”'0, and finally perform a round key addition operation on Y”1 to obtain Y”'1. The round key addition operation uses the 32-bit key from step B2.
[0102] Step B7: Determine if the current round number is less than 16. If so, assign Y”'0 and Y”'1 as the data for the new round of input, and return to step B2. Otherwise, output Y”'0 and Y”'1 as plaintext from the highest bit to the lowest bit.
[0103] It should be noted that the execution order of the steps in this embodiment is only for illustrative purposes. In other feasible embodiments, the execution order of some steps can be adaptively adjusted based on satisfying the logical relationship between the steps.
[0104] In this embodiment, the algorithm is named LELBC. The algorithm has a block size of 64 bits, a key length of 128 bits, and 16 iteration rounds. The algorithm employs a novel PSP structure, specifically including a P1 diffusion layer, an S-box substitution layer, and a P2 diffusion layer. Key expansion includes key S-box substitution, circular right shift, round constant XOR, and circular right shift operations. The PSP structure and key expansion module are described in detail below.
[0105] like Figure 1 As shown, the PSP structure includes a P1 diffusion layer, an S-box substitution layer, and a P2 diffusion layer. Taking encryption as an example:
[0106] P1 diffusion layer: The 32-bit left branch plaintext X0 is subjected to round key addition to obtain X'0, and then the data block X'0 is circularly shifted left by 11 bits to obtain X. 01 Finally, the 32-bit right branch plaintext X1 is compared with X... 01 XOR operation yields X'1. The round key addition operation uses the 32-bit key K0 after the round key expansion operation has been performed.
[0107] S-box substitution: The results X'0 and X'1 of the P1 diffusion layer are substituted using a lookup table or logical operations to obtain X”0 and X”1 respectively. The logical operations and lookup tables for the S-box substitution are described above.
[0108] P2 diffusion layer: Perform the P2 diffusion layer operation on X”0 and X”1 obtained by replacing the S-box. Perform a circular left shift of X”1 by 11 bits to obtain X. 10 Next, the 32-bit left branch data X”0 and X10 An XOR operation is performed to obtain X”'0. Finally, a round key addition operation is performed on X”1 to obtain X”'1. The round key addition operation uses the 32-bit key K1 that has undergone the round key expansion operation.
[0109] like Figure 2 As shown, round key expansion includes key S-box replacement, circular right shift, round constant XOR, and circular right shift operations.
[0110] Key S-box replacement: The high 8 bits of the 128-bit key are replaced by looking up the key in Table 1 or by using logical operations to obtain Key1; wherein, in this embodiment, the logical operations and lookup table for key S-box replacement are the same as those for S-box replacement in PSP structure transformation, so refer to the logical operations or lookup table 1 above.
[0111] Circular right shift: Circularly shift Key1 to the right by 15 bits to obtain Key2;
[0112] Round constant XOR: The current round number minus 1 is used as the round constant and XORed with the high 4 bits of Key2 to obtain Key3;
[0113] Circular right shift: Circularly shift Key3 5 bits to the right to obtain the new Key.
[0114] In summary, the core idea of this invention is to leverage the high symmetry of the P1 and P2 diffusion layers in the PSP structure to achieve highly consistent encryption and decryption without increasing additional hardware resources. This solves the problem of inconsistent encryption and decryption in the traditional SPN structure, reducing algorithm resource and energy consumption without affecting the diffusion effect and security of the structure. Specifically, the block cipher implementation method provided by this invention includes a PSP structure and round key expansion. The PSP structure includes a P1 diffusion layer, S-box substitution, and a P2 diffusion layer. Round key expansion includes key S-box substitution, circular right shift, round constant XOR, and circular right shift operations. Due to the high symmetry of the P1 and P2 diffusion layers in the PSP structure, a highly consistent encryption and decryption effect can be achieved. Decryption only requires the exchange of data between the left and right branches on top of the encryption process, without consuming additional hardware resources. Furthermore, the designed S-box achieves cryptographic properties, ensuring the security of the algorithm, while not occupying a large amount of resource area. The S-box substitution in key expansion achieves a confusion effect, followed by the shift operation to achieve a diffusion effect, and the round constant XOR eliminates symmetry, ensuring relative key security.
[0115] test:
[0116] The method provided in the embodiments of the present invention was tested, and the cryptographic algorithm data provided by the present invention is shown in Table 2.
[0117] Table 2 Experimental test data
[0118]
[0119]
[0120] The cryptographic algorithm described in this invention is implemented in ASIC hardware using the SMIC 0.18 synthesis library. The algorithm occupies 1859 GE of resources. Table 3 shows the ASIC hardware implementations of various typical lightweight cryptographic algorithms.
[0121] Table 3 ASIC Implementations of Various Lightweight Cryptographic Algorithms (Encryption + Decryption)
[0122]
[0123] The data comparison in Table 3 shows that LELBC has the characteristics of low energy consumption and low resource consumption compared to current lightweight cryptography.
[0124] Example 2:
[0125] This embodiment provides a system based on the aforementioned lightweight cryptographic implementation method, including: an initial key setting module, a round key expansion module, and an encryption / decryption module.
[0126] The initial key setting module is used to set the initial key Key; the acquisition module is used to acquire plaintext or ciphertext and divide it into two branches in sequence; the round key expansion module is used to perform round key expansion operation based on the initial key to obtain the subkey for each round of operation; the encryption and decryption module is used to perform Nr round encryption or decryption operation on the plaintext or ciphertext of the left and right branches based on the subkey corresponding to each round to obtain the corresponding ciphertext or plaintext.
[0127] The encryption / decryption module is divided into the P1 diffusion layer execution unit, the S-box replacement execution unit, and the P2 diffusion layer execution unit.
[0128] In the encryption process, the P1 diffusion layer execution unit performs the P1 diffusion layer encryption operation on the plaintext of the left and right branches, the S-box replacement execution unit performs the S-box replacement operation, and the P2 diffusion layer execution unit performs the P2 diffusion layer encryption operation.
[0129] In the decryption process, the P1 diffusion layer execution unit performs the P1 diffusion layer decryption operation on the left and right branch ciphertexts, the S-box replacement execution unit performs the S-box replacement operation, and the P2 diffusion layer execution unit performs the P2 diffusion layer decryption operation.
[0130] The round key expansion module includes a key S-box replacement execution unit, a circular right shift execution unit, a round constant XOR execution unit, and a circular right shift operation execution unit. These are respectively used to perform key S-box replacement, circular right shift, round constant XOR, and circular right shift operations.
[0131] It should be understood that the implementation process of each module can be referred to the content described in the aforementioned method. The above division of functional modules is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. At the same time, the above-mentioned integrated units can be implemented in the form of hardware or software functional units.
[0132] Example 3:
[0133] This embodiment provides an electronic terminal, comprising at least: one or more processors, and a memory storing one or more computer programs; wherein the processor calls the computer programs to implement: the steps of a lightweight block cipher implementation method based on a novel PSP architecture. Specific execution:
[0134] Set the initial key;
[0135] Obtain the plaintext or ciphertext and divide it into two branches in sequence;
[0136] Based on the initial key, perform round key expansion operations to obtain the subkey for each round of operation, and perform Nr round encryption or decryption operations on the plaintext or ciphertext of the left and right branches based on the subkey for each round to obtain the corresponding ciphertext or plaintext. The encryption or decryption result of the previous round is used as the plaintext or ciphertext of the next round, and the result of the round key expansion operation of the previous round is used as the input of the round key expansion operation of the next round.
[0137] If it is an encryption operation, each round of encryption operation is an encryption operation that transforms the plaintext of the left and right branches into a PSP structure. The PSP structure transformation of the encryption operation includes P1 diffusion layer, S-box substitution, and P2 diffusion layer in sequence.
[0138] If it is a decryption operation, each round of decryption operation first swaps the ciphertext of the left and right branches, and then performs a PSP structure transformation decryption operation on the ciphertext. The PSP structure transformation of the decryption operation includes P1 diffusion layer, S-box replacement, and P2 diffusion layer in sequence.
[0139] Please refer to the explanation of the method above for the specific implementation process of each step.
[0140] The memory may include high-speed RAM, and may also include a non-volatile defibrillator, such as at least one disk storage device.
[0141] If the memory and processor are implemented independently, they can be interconnected via a bus to communicate with each other. This bus can be an industry-standard architecture bus, an external device interconnect bus, or an extended industry-standard architecture bus, etc. The bus can be categorized as an address bus, data bus, control bus, etc.
[0142] Optionally, in a specific implementation, if the memory and processor are integrated on a single chip, the memory and processor can communicate with each other through an internal interface.
[0143] It should be understood that, in the embodiments of the present invention, the processor may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. The memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information.
[0144] Example 4:
[0145] This embodiment provides a readable storage medium storing a computer program that is invoked by a processor to implement the steps of a lightweight block cipher implementation method based on a novel PSP architecture. Specifically, the implementation includes:
[0146] Set the initial key;
[0147] Obtain the plaintext or ciphertext and divide it into two branches in sequence;
[0148] Based on the initial key, perform round key expansion operations to obtain the subkey for each round of operation, and perform Nr round encryption or decryption operations on the plaintext or ciphertext of the left and right branches based on the subkey for each round to obtain the corresponding ciphertext or plaintext. The encryption or decryption result of the previous round is used as the plaintext or ciphertext of the next round, and the result of the round key expansion operation of the previous round is used as the input of the round key expansion operation of the next round.
[0149] If it is an encryption operation, each round of encryption operation is an encryption operation that transforms the plaintext of the left and right branches into a PSP structure. The PSP structure transformation of the encryption operation includes P1 diffusion layer, S-box substitution, and P2 diffusion layer in sequence.
[0150] If it is a decryption operation, each round of decryption operation first swaps the ciphertext of the left and right branches, and then performs a PSP structure transformation decryption operation on the ciphertext. The PSP structure transformation of the decryption operation includes P1 diffusion layer, S-box replacement, and P2 diffusion layer in sequence.
[0151] Please refer to the explanation of the method above for the specific implementation process of each step.
[0152] The readable storage medium is a computer-readable storage medium, which can be an internal storage unit of the controller described in any of the foregoing embodiments, such as the controller's hard drive or memory. The readable storage medium can also be an external storage device of the controller, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the controller. Further, the readable storage medium can include both the controller's internal storage unit and external storage devices. The readable storage medium is used to store the computer program and other programs and data required by the controller. The readable storage medium can also be used to temporarily store data that has been output or will be output.
[0153] Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0154] It should be emphasized that the examples described in this invention are illustrative rather than limiting. Therefore, this invention is not limited to the examples described in the specific embodiments. Any other embodiments derived by those skilled in the art based on the technical solutions of this invention, without departing from the spirit and scope of this invention, whether modifications or substitutions, are also within the protection scope of this invention.
Claims
1. A lightweight block cipher implementation method for a novel PSP structure, characterized in that: Includes the following steps: Set the initial key; Obtain the plaintext or ciphertext and divide it into two branches in sequence; Based on the initial key, perform round key expansion operations to obtain the subkey for each round of operation, and use the subkey for each round to perform Nr rounds of encryption or decryption operations on the plaintext or ciphertext of the left and right branches to obtain the corresponding ciphertext or plaintext. The encryption or decryption result of the previous round is used as the plaintext or ciphertext of the next round, and the result of the round key expansion operation of the previous round is used as the input of the round key expansion operation of the next round. If it is an encryption operation, each round of encryption operation is an encryption operation that transforms the plaintext of the left and right branches into a PSP structure. The PSP structure transformation of the encryption operation includes P1 diffusion layer, S-box substitution, and P2 diffusion layer in sequence. If it is a decryption operation, each round of decryption operation first swaps the ciphertext of the left and right branches, and then performs a decryption operation of PSP structure transformation on the ciphertext. The PSP structure transformation of the decryption operation includes P1 diffusion layer, S-box replacement, and P2 diffusion layer in sequence. Among them, both P1 diffusion layer and P2 diffusion layer are symmetrical structures, and the subkeys in the decryption operation from the first to Nr rounds correspond one-to-one with the subkeys obtained in the encryption operation from the Nr to the first round. The S-box substitution mentioned in encryption and decryption operations is based on substitution rules or logical operations: Replacement rules: x={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} S[x]={C, E, 2, A, 6, F, 4, 7, 9, 8, 3, B, 0, D, 1, 5} Where x is any number from 0 to F in hexadecimal, which corresponds to the data before the S-box is replaced, and S[x] represents the data before and after the key S-box is replaced; The formulas corresponding to the logical operations are as follows: Where a, b, c, and d represent the four bits of a binary number from 0 to 15, from the most significant bit to the least significant bit. Each bit of data is processed according to the corresponding logical operation formula to obtain a', b', c', and d'. The horizontal line "—" represents the NOT operation.
2. The method according to claim 1, characterized in that: If it is an encryption operation, the encryption process of the P1 diffusion layer in the PSP structure transformation is as follows: C1: Perform a round key addition operation on the plaintext X0 of the left branch to obtain X'0, wherein the subkey is divided into data block K0 and data block K1 by bit. The round key used when performing the round key addition operation on the plaintext X0 of the left branch is the data block K0 in the subkey corresponding to the current round operation. The data block K1 participates in the P2 diffusion layer encryption operation. C2: Perform a circular left shift of 11 bits on the result X'0 from step C1 to obtain X. 01 ; C3: Compare the plaintext X1 of the right branch with the result X from step C2. 01 Perform an XOR operation to obtain X'1; Among them, the obtained data X'0 and X'1 are the results of the current round of P1 diffusion layer encryption operation; If it is a decryption operation, the process of the P1 diffusion layer decryption operation in the PSP structure transformation is as follows: c1: Perform a round key addition operation on the left branch ciphertext Y0 to obtain Y'0, wherein the round key used when performing the round key addition operation on the left branch ciphertext Y0 is the data block in the subkey corresponding to the current round operation. The data block The data block K1 is in the same position in its respective subkey; c2: Perform a circular left shift operation of 11 bits on the result Y'0 from step c1 to obtain Y. 01 ; c3: Compare the plaintext Y1 of the right branch with the result Y of step c2. 01 Perform an XOR operation to obtain Y'1; The obtained data Y'0 and Y'1 are the results of the current round of P1 diffusion layer decryption operation.
3. The method according to claim 1, characterized in that: If it is an encryption operation, the encryption process of the P2 diffusion layer in the PSP structure transformation is as follows: D1: Perform a circular left shift of 11 bits on the plaintext X″1 in the right branch to obtain X. 10 ; D2: Compare the plaintext X″0 of the left branch with the result X from step D1. 10 Performing an XOR operation yields X″′0; D3: Perform a round key addition operation on the plaintext X″1 in the right branch to obtain X″′1; wherein, the subkey is divided into data block K0 and data block K1 by bit, and the round key used when performing the round key addition operation is the data block K1 in the subkey corresponding to the current round operation, and the data block K0 participates in the P1 diffusion layer encryption operation; Among them, the obtained data X″′0 and X″′1 are the results of the current round of P2 diffusion layer encryption operation, and the left branch plaintext X″0 and right branch plaintext X″1 are the results of the S-box substitution operation in the PSP structure transformation of the encryption operation. If it is a decryption operation, the process of the P2 diffusion layer decryption operation in the PSP structure transformation is as follows: d1: Perform a circular left shift of 11 bits on the right branch ciphertext Y″1 to obtain Y. 10 ; d2: Compare the ciphertext Y″0 of the left branch with the result Y of step d1. 10 Performing an XOR operation yields Y″′0; d3: Perform a round key addition operation on the right branch ciphertext Y″1 to obtain Y″′1, where the round key used in step d3 is the data block in the subkey corresponding to the current round operation. The data block It has the same position as data block K0 in its respective subkey; The obtained Y″′0 and Y″′1 are the results of the current round of P2 diffusion layer decryption operation; the left branch ciphertext Y″0 and the right branch ciphertext Y″1 are the results of the S-box substitution operation performed in the PSP structure transformation during the decryption operation.
4. The method according to claim 1, characterized in that: The round key expansion operation includes key S-box replacement, circular right shift, round constant XOR, and circular right shift operation in sequence.
5. The method according to claim 4, characterized in that: Each round of key expansion includes the following steps: B1: Replace the high 8 bits of the key in the key before the round key expansion operation with the key S-box, while keeping the data in other positions of the key unchanged; B2: Circularly right-shift the key after step B1 by 15 bits; B3: Subtract 1 from the current round number to obtain the round constant, and perform an XOR operation with the high 4 bits of the result in step B2, while keeping the data in other positions unchanged; B4: Circularly shift the result of step B3 5 bits to the right, which is considered to complete the current round key expansion operation.
6. The method according to claim 1, characterized in that: The initial key is 128 bits long, the plaintext and ciphertext are 64 bits long, and the subkey for each round is 64 bits long. The high 64 bits of the 128-bit key after the round key expansion operation are used as the subkey, and the high 32 bits of the subkey are used in the round key addition operation of the P1 diffusion layer, and the low 32 bits are used in the round key addition operation of the P1 diffusion layer.
7. A system based on the method of any one of claims 1-6, characterized in that: include: The initial key setting module is used to set the initial key; The acquisition module is used to acquire plaintext or ciphertext and is divided into two branches in sequence; The round key expansion module is used to perform round key expansion operations based on the initial key to obtain the subkey for each round of operation; The encryption / decryption module is used to perform Nr rounds of encryption or decryption operations on the plaintext or ciphertext of the left and right branches based on the subkey corresponding to each round to obtain the corresponding ciphertext or plaintext. If it is an encryption operation, each round of encryption operation is an encryption operation that transforms the plaintext of the left and right branches into a PSP structure. The PSP structure transformation of the encryption operation includes P1 diffusion layer, S-box substitution, and P2 diffusion layer in sequence. If it is a decryption operation, each round of decryption operation first swaps the ciphertext of the left and right branches, and then performs a decryption operation of PSP structure transformation on the ciphertext. The PSP structure transformation of the decryption operation includes P1 diffusion layer, S-box replacement, and P2 diffusion layer in sequence. Among them, the P1 diffusion layer and the P2 diffusion layer are symmetrical structures, and the subkeys in the 1→Nr rounds of decryption operation correspond one-to-one with the subkeys obtained in the Nr→1 rounds of encryption operation.
8. An electronic terminal, characterized in that: At least including: One or more processors; And memory that stores one or more computer programs; The processor calls the computer program to implement: The steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that: The computer program is stored and is invoked by the processor to implement: The steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Novel ultra-lightweight QTL (Quasi-Transmission Line) block cipher implementation method
CN104333446A
SP network structure lightweight LBT block cipher realizing method with consistent encryption and decryption
CN107707343A