A data processing method and related apparatus
By adjusting the order of operations of the synthetic permutation operation T in SM4 data processing and constructing an input-output mapping table, the problem of cumbersome operations was solved, and efficient data processing was achieved.
Patent Information
- Application Number
- CN202111124495.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2041-09-24
AI Technical Summary
In the existing SM4-based data processing, the synthetic permutation operation T requires first executing four parallel S-box operations in the nonlinear transformation operation τ, and then executing the circular left shift operation and XOR operation in the linear transformation operation L, resulting in cumbersome and inefficient operations.
The order of operations in the composition permutation operation T is adjusted, with the S-box operation placed first and the XOR operation placed last. An input-output mapping table is constructed, and the output value is obtained by looking up the mapping table, avoiding the need to directly execute the cumbersome calculation process.
The process of the synthetic permutation operation T is simplified, reducing computation time and resource consumption, and improving data processing efficiency.
Smart Images

Figure CN115865309B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cryptography, and in particular to a data processing method and related apparatus. Background Technology
[0002] In data processing scenarios involving communication data, target cryptographic algorithms for block ciphers are typically used. These target cryptographic algorithms can be, for example, SM4 or SM4-based cryptographic algorithms. SM4 is a block cipher standard issued by the State Cryptography Administration. Data processing based on SM4 involves 32 rounds of nonlinear iterative operations; the structure of these 32 rounds of nonlinear iterative operations is identical for both data encryption and decryption, only the order of the round keys is reversed.
[0003] Nonlinear iterative operations mainly include the synthetic permutation operation T, which is obtained by combining the nonlinear transformation operation τ and the linear transformation operation L. The nonlinear transformation operation τ is based on 8 bits and consists of 4 parallel S-box operations, while the linear transformation operation L is based on 32 bits and consists of a circular left shift operation and an XOR operation.
[0004] However, implementing the synthetic permutation operation T requires first executing four parallel S-box operations in the nonlinear transformation operation τ, and then executing the circular left shift operation and XOR operation in the linear transformation operation L. The operation is cumbersome and complex, resulting in low efficiency of data processing based on the target cryptographic algorithm. Summary of the Invention
[0005] To address the aforementioned technical problems, embodiments of this application provide a data processing method that reduces computation time and resource consumption, efficiently implements the synthetic permutation operation T, thereby improving the efficiency of data processing based on the target cryptographic algorithm.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] On one hand, embodiments of this application provide a data processing method, the method comprising:
[0008] For the first nonlinear iterative operation performed on data processing based on the target cryptographic algorithm, a first expression for the synthetic permutation operation T in the first nonlinear iterative operation is obtained; the target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation, the nonlinear transformation operation τ includes S-box operation, the linear transformation operation L includes circular left shift operation and XOR operation, and the first expression represents the first operation order of the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L;
[0009] Determine the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the composition permutation operation T;
[0010] Based on the first equivalent operation order, the first operation order is adjusted to obtain a second expression representing the second operation order, in which the S-box operation is in the first position and the XOR operation is in the last position;
[0011] Based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation, a first input-output mapping table is constructed;
[0012] In the data processing of the data to be processed based on the target cryptographic algorithm, the first input value of the S-box operation is determined;
[0013] Based on the first input value, look up the first input-output mapping table to obtain the first output value corresponding to the first input value;
[0014] The data processing result of the data to be processed is determined based on the first output value.
[0015] On one hand, embodiments of this application provide a data processing apparatus, the apparatus comprising an acquisition unit, a determination unit, a obtaining unit, and a construction unit:
[0016] The acquisition unit is used to acquire a first expression of the synthetic permutation operation T in the first nonlinear iterative operation performed on the data processing based on the target cryptographic algorithm; the target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation, the nonlinear transformation operation τ includes the S-box operation, the linear transformation operation L includes the circular left shift operation and the XOR operation, and the first expression represents the first operation order of the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L;
[0017] The determining unit is used to determine the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the synthetic permutation operation T;
[0018] The obtaining unit is used to adjust the first operation order based on the first equivalent operation order to obtain a second expression representing the second operation order, wherein the S-box operation is in the first position and the XOR operation is in the last position in the second operation order.
[0019] The construction unit is used to construct a first input-output mapping table based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation;
[0020] The determining unit is further configured to determine the first input value of the S-box operation during the data processing of the data to be processed based on the target cryptographic algorithm;
[0021] The obtaining unit is further configured to look up the first input-output mapping table based on the first input value to obtain the first output value corresponding to the first input value;
[0022] The determining unit is further configured to determine the data processing result of the data to be processed based on the first output value.
[0023] On one hand, embodiments of this application provide a computer device, the device including a processor and a memory:
[0024] The memory is used to store program code and transmit the program code to the processor;
[0025] The processor is used to execute the above data processing method according to the instructions in the program code.
[0026] On one hand, embodiments of this application provide a computer-readable storage medium for storing a computer program for executing the above-described data processing method.
[0027] On one hand, embodiments of this application provide a computer program product, including a computer program or instructions; when the computer program or instructions are executed by a processor, the above-described data processing method is performed.
[0028] As can be seen from the above technical solution, for the first nonlinear iterative operation performed on the data processing based on the target cryptographic algorithm, a first expression representing the first operation order is obtained. The target cryptographic algorithm includes a synthetic permutation operation T obtained by combining a nonlinear transformation operation τ and a linear transformation operation L in the first nonlinear iterative operation. The nonlinear transformation operation τ includes an S-box operation, and the linear transformation operation L includes a circular left shift operation and an XOR operation. The first operation order refers to the S-box operation, the circular left shift operation, the XOR operation, and the linear transformation operation L. The first equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L is determined in the synthetic permutation operation T. The first operation order is adjusted using the first equivalent operation order to obtain a second expression representing the second operation order. In the second operation order, the S-box operation is in the first position and the XOR operation is in the last position. A first input-output mapping table is constructed using the first operation function formed by the S-box operation and the linear transformation operation L in the second expression, and the set of input values for the S-box operation. This method obtains the second expression by adjusting the order of operations of the circular left shift operation, XOR operation, and linear transformation operation L in the first expression of the synthetic permutation operation T, simplifying the operation from the S-box operation to the linear transformation operation L in the synthetic permutation operation T into the first input-output mapping table.
[0029] In the data processing of the data to be processed based on the target cryptographic algorithm, after determining the first input value of the S-box operation, it is not necessary to perform the operation from the S-box operation to the linear transformation operation L in the second expression of the synthetic permutation operation T. Instead, the first input value is used to look up a pre-constructed first input-output mapping table to obtain the corresponding first output value, and the data processing result of the data to be processed is determined by the first output value. Based on this, the lookup method is simpler and more convenient than the operation method, reducing the consumption of operation time and resources, and efficiently implementing the synthetic permutation operation T, thereby improving the efficiency of data processing based on the target cryptographic algorithm. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 A flowchart illustrating SM4-based data encryption is provided as an embodiment of this application.
[0032] Figure 2 A flowchart of the first nonlinear iterative operation in the (i+1)th round of data encryption based on SM4 is provided in this application embodiment;
[0033] Figure 3 A flowchart of SM4-based data decryption is provided for embodiments of this application;
[0034] Figure 4 A flowchart of the first nonlinear iterative operation in the (i+1)th round of data decryption based on SM4 is provided in this application embodiment;
[0035] Figure 5 A schematic diagram illustrating a data processing method in a practical application scenario provided by an embodiment of this application;
[0036] Figure 6 A flowchart illustrating a data processing method provided in an embodiment of this application;
[0037] Figure 7 A flowchart of the first nonlinear iterative operation in the (i+1)th round of SM4-based data encryption, provided as an embodiment of this application;
[0038] Figure 8 A flowchart of the first nonlinear iterative operation in the (i+1)th round of data decryption based on SM4, provided as an embodiment of this application;
[0039] Figure 9 A flowchart of the first nonlinear iterative operation in the (i+1)th round of SM4-based data encryption, provided as an embodiment of this application;
[0040] Figure 10 A flowchart of the first nonlinear iterative operation in the (i+1)th round of data decryption based on SM4, provided in an embodiment of this application;
[0041] Figure 11 A flowchart illustrating a key extension based on SM4 provided in this application embodiment;
[0042] Figure 12 A flowchart illustrating the (i+1)th round of nonlinear iterative computation in a key expansion based on SM4, provided as an embodiment of this application;
[0043] Figure 13 A flowchart illustrating a key expansion method based on a target cryptographic algorithm, provided as an embodiment of this application;
[0044] Figure 14 A flowchart of the second nonlinear iterative operation in the (i+1)th round of SM4-based key expansion provided in this application embodiment;
[0045] Figure 15 A flowchart illustrating the second nonlinear iterative operation in the (i+1)th round of SM4-based key expansion, as provided in this application embodiment;
[0046] Figure 16 A structural block diagram of a data processing apparatus provided in an embodiment of this application;
[0047] Figure 17 A structural diagram of a computer device provided in an embodiment of this application;
[0048] Figure 18 This is a structural diagram of a server provided in an embodiment of this application. Detailed Implementation
[0049] The embodiments of this application will now be described with reference to the accompanying drawings.
[0050] In related technologies, when the target cryptographic algorithm is SM4, data encryption in SM4-based data processing refers to performing 32 rounds of the first nonlinear iterative operation on the input 128-bit plaintext X, and finally reversing the order to output the 128-bit ciphertext Y, as shown below. Figure 1 The diagram shows a flowchart of a data encryption method based on SM4. In each round, the first nonlinear iteration operation is performed in 32-bit units, and the input to the (i+1)th (0≤i≤31)th round of the first nonlinear iteration operation is the round key rk. i and variable X i X i+1 X i+2 X i+3 The output of the first nonlinear iteration in the (i+1)th round is X. i+4 X i+4 The calculation formula is: The expression `T` represents the XOR operation, and `T` represents the composition permutation operation. The composition permutation operation `T` is obtained by combining the nonlinear transformation operation `τ` and the linear transformation operation `L`, i.e., `T(.) = L(τ(.))`. The nonlinear transformation operation `τ` is performed in 8-bit units and consists of four parallel S-box operations, denoted as `sbox(.)`. The linear transformation operation `L` is performed in 32-bit units and consists of a circular left shift operation and an XOR operation, i.e., ... B is a 32-bit number, and <<< indicates a circular left shift, such as... Figure 2 The flowchart shown is a process for the first nonlinear iterative operation in the (i+1)th round of data encryption based on SM4.
[0051] In SM4-based data processing, data decryption involves reversing the input 128-bit ciphertext Y, performing 32 rounds of the first nonlinear iterative operation, and outputting 128-bit plaintext X, such as... Figure 3The diagram shows a flowchart of data decryption based on SM4. The structure of the 32 rounds of the first nonlinear iterative operation performed in data decryption is the same as that performed in data encryption, except that the order of the round keys is reversed. That is, the input to the (i+1)th (0≤i≤31)th round of the first nonlinear iterative operation is the round key rk. 31-i and variable Y i Y i+1 Y i+2 Y i+3 The output of the first nonlinear iteration in the (i+1)th round is Y. i+4 Y i+4 The calculation formula is: like Figure 4 The flowchart shown is a process for the first nonlinear iterative operation in the (i+1)th round of data decryption based on SM4.
[0052] However, based on the above content, Figure 2 and Figure 4 The flowchart shown reveals that in the data processing of data to be processed based on SM4, each round of the first nonlinear iteration operation to realize the synthetic permutation operation T requires first executing four parallel S-box operations in the nonlinear transformation operation τ, and then executing the circular left shift operation and XOR operation in the linear transformation operation L. The operation is cumbersome and complex, resulting in low efficiency of data processing based on the target cryptographic algorithm.
[0053] To address the aforementioned technical problems, this application provides a data processing method. By adjusting the order of the circular left shift operation, XOR operation, and linear transformation operation L in the first expression of the synthetic permutation operation T, a second expression is obtained. This simplifies the operations from the S-box operation to the linear transformation operation L in the synthetic permutation operation T into a first input-output mapping table. In the data processing of the data to be processed based on the target cryptographic algorithm, after determining the first input value of the S-box operation, the first input value is used to look up the pre-constructed first input-output mapping table to obtain the corresponding first output value. The data processing result of the data to be processed is then determined using the first output value. Therefore, the lookup method is simpler and more convenient than the operation method, reducing computation time and resource consumption, and efficiently implementing the synthetic permutation operation T, thereby improving the efficiency of data processing based on the target cryptographic algorithm.
[0054] It is understood that this method can be applied to processing devices with data processing capabilities, such as terminal devices and servers. This method can be applied to network scenarios where terminal devices and servers communicate, operating in cooperation. Specifically, terminal devices can be smartphones, computers, personal digital assistants (PDAs), tablets, etc., but are not limited to these. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing cloud computing services. Terminal devices and servers can be connected directly or indirectly via wired or wireless communication, and this application does not impose any restrictions on this connection.
[0055] The data processing method provided in this application embodiment may also involve blockchain, wherein data such as the first expression, the second expression, and the first input-output mapping table can be stored on the blockchain.
[0056] To facilitate understanding of the technical solutions provided in the embodiments of this application, a data processing method provided in the embodiments of this application will be introduced next in conjunction with a practical application scenario.
[0057] See Figure 5 , Figure 5 This is a schematic diagram illustrating a data processing method in a practical application scenario provided by an embodiment of this application. In this practical application scenario, the processing device is a terminal device 500, which serves as the aforementioned processing device with data processing capabilities.
[0058] For the first nonlinear iterative operation performed on data processing based on the target cryptographic algorithm, the terminal device 500 needs to obtain the first expression of the synthetic permutation operation T in the first nonlinear iterative operation. The target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation. The nonlinear transformation operation τ includes the S-box operation, and the linear transformation operation L includes the circular left shift operation and the XOR operation. The first expression represents the first operational order from the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L. Specifically, the first expression is: A is a 32-bit number.
[0059] Terminal device 500 needs to determine the first equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L in the composite permutation operation T. For example, the first equivalent operation order includes performing the XOR operation first and then the linear transformation operation L in the composite permutation operation T, which is equivalent to performing the linear transformation operation L first and then the XOR operation; or, based on this, the first equivalent operation order also includes performing the circular left shift operation first and then the linear transformation operation L in the composite permutation operation T, which is equivalent to performing the linear transformation operation L first and then the circular left shift operation.
[0060] Terminal device 500 adjusts the first operation order based on the first equivalent operation order to obtain a second expression representing the second operation order, wherein the S-box operation is in the first position and the XOR operation is in the last position in the second operation order. Corresponding to the first expression, the second expression is: or,
[0061] Terminal device 500 constructs a first input-output mapping table based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values for the S-box operation. From the above, it can be seen that... When the first operation function includes L(Sbox(a)), L(Sbox(a)<<<8), L(Sbox(a)<<<16) and L(Sbox(a)<<<24), the input value set of the S-box operation is each input value from 0 to 255. Substituting them into L(Sbox(a)), L(Sbox(a)<<<8), L(Sbox(a)<<<16) and L(Sbox(a)<<<24) respectively, we get four input-output mapping tables T1, T2, T3 and T4 as the first input-output mapping table.
[0062] When the first operation function includes L(Sbox(a)), the various input values from 0 to 255 are substituted into L(Sbox(a)) to obtain an input-output mapping table T1 as the first input-output mapping table.
[0063] In the data processing process of the terminal device 500 based on the target cryptographic algorithm, the first input value of the S-box operation is determined; based on the first input value, the first input-output mapping table is looked up to obtain the first output value corresponding to the first input value; and based on the first output value, the data processing result of the data to be processed is determined. For example, if the first input value of the S-box operation is the value of a0, a1, a2, and a3, as mentioned above, when the first input-output mapping table is T1, T2, T3, and T4, looking up the first input-output mapping table yields the first output values T4(a0), T3(a1), T2(a2), and T1(a3), which are then substituted into the second expression to obtain... When the first input-output mapping table is T1, the first output values obtained by looking up the first input-output mapping table are T1(a0), T1(a1), T1(a2), and T1(a3). Substituting these values into the second expression yields... To determine the data processing result of the data to be processed.
[0064] Therefore, the terminal device 500 obtains the second expression by adjusting the order of the circular left shift operation, XOR operation, and linear transformation operation L in the first expression of the synthetic permutation operation T. This simplifies the operations from the S-box operation to the linear transformation operation L in the synthetic permutation operation T into a first input-output mapping table. During the data processing of the data to be processed based on the target cryptographic algorithm, after determining the first input value of the S-box operation, the terminal device 500 uses this first input value to search the pre-constructed first input-output mapping table to obtain the corresponding first output value. The data processing result of the data to be processed is then determined using this first output value. Based on this, the search method is simpler and more convenient than the operation method, reducing computation time and resource consumption, and efficiently implementing the synthetic permutation operation T, thereby improving the efficiency of the terminal device 500's data processing based on the target cryptographic algorithm.
[0065] Next, with reference to the accompanying drawings, a data processing method provided by an embodiment of this application will be described.
[0066] See Figure 6 , Figure 6 A flowchart of a data processing method provided in this application embodiment, the method including:
[0067] S601: For the first nonlinear iterative operation performed on the data processing based on the target cryptographic algorithm, obtain the first expression of the synthetic permutation operation T in the first nonlinear iterative operation; the target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation, the nonlinear transformation operation τ includes the S-box operation, the linear transformation operation L includes the circular left shift operation and the XOR operation, and the first expression represents the first operation order from the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L.
[0068] Taking SM4 as the target cryptographic algorithm as an example, since in the data processing of data to be processed based on SM4, if according to Figure 2 and Figure 4 As shown in the flowchart, each round of the first nonlinear iteration operation to implement the synthetic permutation operation T requires first executing four parallel S-box operations in the nonlinear transformation operation τ, and then executing the circular left shift operation and XOR operation in the linear transformation operation L. This operation is cumbersome and complex, consuming a significant amount of computation time and resources, resulting in low efficiency in SM4-based data processing. Therefore, this application studies the synthetic permutation operation T to adjust the implementation method of T, avoiding the cumbersome and complex operation, reducing computation time and resources, and improving the efficiency of SM4-based data processing. The first step is to obtain the general expression of the synthetic permutation operation T, i.e., the first expression of the synthetic permutation operation T.
[0069] For the synthetic permutation operation T in the first nonlinear iterative operation required for SM4-based data processing, combined with Figure 2 and Figure 4 The flowchart shown is in or Next, the input to the nonlinear transformation τ in the synthetic permutation operation T is obtained, a 32-bit number A. A is then divided into four 8-bit inputs a0, a1, a2, and a3, which are the inputs for four parallel S-box operations. The four parallel S-box operations in the nonlinear transformation τ are performed on a0, a1, a2, and a3 respectively. The outputs of the four parallel S-box operations are then circularly left-shifted by 24, 16, 8, and 0 respectively, and an XOR operation is performed to obtain the input to the linear transformation operation L, a 32-bit number B. The linear transformation operation L includes a circular left shift operation and an XOR operation.
[0070] From the above explanation, the first expression for the compositional permutation operation T is: The first expression represents the order of operations from the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L. The first expression is obtained from the following:
[0071]
[0072] in, Substitution We know that performing an XOR operation on Sbox(a0) <<< 24, Sbox(a1) <<< 16, Sbox(a2) <<< 8, and Sbox(a3) yields B; performing an XOR operation on Sbox(a0) <<< 24, Sbox(a1) <<< 16, Sbox(a2) <<< 8, and Sbox(a3) followed by a left circular shift by 2 yields B <<< 2; performing an XOR operation on Sbox(a0) <<< 24, Sbox(a1) <<< 16, Sbox(a2) <<< 8, and Sbox(a3) followed by a left circular shift by 10 yields B <<< 2. We get B << < 10; we first perform an XOR operation on Sbox(a0) << < 24, Sbox(a1) << < 16, Sbox(a2) << < 8 and Sbox(a3), then perform a circular left shift operation of 18 to get B << < 18; we first perform an XOR operation on Sbox(a0) << < 24, Sbox(a1) << < 16, Sbox(a2) << < 8 and Sbox(a3), then perform a circular left shift operation of 24 to get B << < 24; we perform an XOR operation on B, B << < 2, B << < 10, B << < 18 and B << < 24 to get T(A).
[0073] S602: Determine the first equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L in the composition permutation operation T.
[0074] In this application, based on the fact that the first expression of the synthetic permutation operation T indicates that the first operation order of the synthetic permutation operation T is S-box operation, circular left shift operation, XOR operation to linear transformation operation L, in order to simplify the subsequent operation from S-box operation to linear transformation operation L in the synthetic permutation operation T, the transformation of the operation order of circular left shift operation, XOR operation and linear transformation operation L in the synthetic permutation operation T after S-box operation can be analyzed to determine the first equivalent operation order of circular left shift operation, XOR operation and linear transformation operation L in the synthetic permutation operation T.
[0075] because Based on the explanation of substituting T(A) into L(B) in S601, we can first analyze the transformation of the order of operations of XOR and cyclic left shift in the linear transformation operation L, and determine the second equivalent order of operations of XOR and cyclic left shift in the linear transformation operation L; then, based on this second equivalent order of operations, we can analyze the transformation of the order of operations of cyclic left shift, XOR, and linear transformation operation L in the composite permutation operation T after the S-box operation, and determine the first equivalent order of operations of cyclic left shift, XOR, and linear transformation operation L in the composite permutation operation T. Therefore, this application provides a possible implementation, and S602 may include, for example, the following S6021-S6022:
[0076] S6021: Determine the second equivalent order of operations for the XOR operation and the circular left shift operation in the linear transformation operation L.
[0077] For ease of analysis, 32-bit numbers B1 and B2 are constructed as follows:
[0078]
[0079]
[0080] For 32-bit numbers B1 and B2, first perform an XOR operation, then perform a circular left shift. The following derivation can be used to obtain the results of the operation: This means that when T(A) is substituted into L(B), the second equivalent operation order includes performing an XOR operation on the two numbers and then performing a circular left shift operation on the two numbers, which is equivalent to performing a circular left shift operation on each number and then performing an XOR operation.
[0081]
[0082] For the 32-bit number B1, first perform a circular left shift. The following derivation can be made to perform the circular left shift by k operation: This means that when T(A) is substituted into L(B), the second equivalent order of operations also includes the order in which a number performs multiple circular left shift operations in the linear transformation operation L, regardless of the order in which the multiple circular left shift operations are arranged.
[0083]
[0084] (1) If k is less than or equal to Right now Less than or equal to 32
[0085]
[0086] (2) If k is greater than Right now Greater than 32
[0087]
[0088] According to (1) and (2), we have Similarly, but
[0089] S6022: Based on the second equivalent operation order, determine the first equivalent operation order of the cyclic left shift operation, XOR operation, and linear transformation operation L in the composition permutation operation T.
[0090] In the second equivalent operation order, where performing an XOR operation on two numbers before performing a circular left shift operation in the linear transformation operation L is equivalent to performing a circular left shift operation on each number before performing an XOR operation, the following derivation can be made for the case where 32-bit numbers B1 and B2 perform an XOR operation before performing the linear transformation operation L: This means that when T(A) is substituted into L(B), the first equivalent operation order can include the following: in the composition permutation operation T, the two numbers are first XORed and then the linear transformation operation L is performed, which is equivalent to the two numbers being first linearly transformed and then XORed.
[0091]
[0092] The second equivalent order of operations also includes the case where, in the linear transformation operation L, the order of multiple circular left shift operations on a number is independent of the order in which the multiple circular left shift operations are performed. For the 32-bit number B1, the circular left shift operation is performed first, followed by the linear transformation operation L. The following derivation can be made: This means that when T(A) is substituted into L(B), the first equivalent operation order also includes performing a circular left shift operation on the two numbers in the composition permutation operation T, followed by a linear transformation operation L, which is equivalent to performing a linear transformation operation L on the two numbers respectively, followed by a circular left shift operation.
[0093]
[0094] S603: Adjust the first operation order based on the first equivalent operation order to obtain a second expression representing the second operation order, in which the S-box operation is in the first position and the XOR operation is in the last position.
[0095] In this application, after S602 determines the first equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L in the synthetic permutation operation T, the first equivalent operation order is used to adjust the first operation order to obtain a second operation order in which the S-box operation is in the first position and the XOR operation is in the last position. Based on the first expression, a second expression representing the second operation order can be obtained.
[0096] In the first equivalent operation order, where the two numbers in the composition permutation operation T are first XORed and then the linear transformation operation L is performed, and the two numbers are first each linear transformation operation L and then XORed, adjusting the first operation order yields the second operation order: S-box operation, circular left shift operation, linear transformation operation L, and then XOR operation. This leads to the second expression representing the second operation order:
[0097] In the specific implementation, the first expression pass The transformation yields the second expression mentioned above.
[0098] In the first equivalent operation order, which includes performing an XOR operation on two numbers before performing a linear transformation operation L in the compositional permutation operation T, or performing a linear transformation operation L on each number before performing an XOR operation, and also includes performing a circular left shift operation on two numbers before performing a linear transformation operation L in the compositional permutation operation T, or performing a circular left shift operation on each number before performing a circular left shift operation, adjusting the first operation order yields the second operation order as S-box operation, linear transformation operation L, circular left shift operation to XOR operation. Therefore, the second expression representing the second operation order is:
[0099] In the specific implementation, the first expression pass The transformation can yield the following: Based on this, further, through The transformation yields the second expression mentioned above.
[0100] S604: Based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation, construct the first input-output mapping table.
[0101] In this application, after obtaining the second expression of the synthetic permutation operation T in S603, the operation from the S-box operation to the linear transformation operation L in the second expression satisfies the condition that one input corresponds to one output. In order to avoid the subsequent implementation of the synthetic permutation operation T, which is cumbersome and complex and consumes a lot of computation time and resources, it is advisable to determine an operation function through the S-box operation to the linear transformation operation L in the second expression, and use it as the first operation function. Then, substitute the set of input values of the S-box operation into the first operation function and pre-construct an input-output mapping table as the first input-output mapping table.
[0102] S603 yields the second operation order as S-box operation, circular left shift operation, linear transformation operation L followed by XOR operation, and the second expression is: The second expression represents the second operational order of the S-box operation, the circular left shift operation, the linear transformation operation L, and the XOR operation. Then, through the S-box operation, the circular left shift operation, and the linear transformation operation L in the second expression, an operation function is determined as the first operation function. The set of input values for the S-box operation is substituted into the first operation function, and an input-output mapping table is pre-constructed as the first input-output mapping table. Therefore, this application provides a possible implementation method where the second expression represents the second operational order of the S-box operation, the circular left shift operation, the linear transformation operation L, and the XOR operation; then S604 may include, for example, the following S6041-S6042:
[0103] S6041: Determine the first operation function based on the S-box operation, circular left shift operation, and linear transformation operation L in the second expression.
[0104] S6042: Construct a first input-output mapping table based on the first operation function and the set of input values of the S-box operation.
[0105] Specifically, the second expression is When the first operation function includes L(Sbox(a)), L(Sbox(a)<<<8), L(Sbox(a)<<<16) and L(Sbox(a)<<<24), the input value set of the S-box operation is each input value from 0 to 255. Substituting them into L(Sbox(a)), L(Sbox(a)<<<8), L(Sbox(a)<<<16) and L(Sbox(a)<<<24) respectively, we get four input-output mapping tables T1, T2, T3 and T4 as the first input-output mapping table.
[0106] The second operation order obtained in S603 is S-box operation, linear transformation operation L, circular left shift operation to XOR operation, and the second expression is: In this case, the second expression represents the second operational order of the S-box operation, the linear transformation operation L, the circular left shift operation, and the XOR operation. Then, through the S-box operation and the linear transformation operation L in the second expression, an operation function is determined as the first operation function. The set of input values for the S-box operation is substituted into the first operation function, and an input-output mapping table is pre-constructed as the first input-output mapping table. Therefore, this application provides a possible implementation method, and S604 may include, for example, the following S6043-S6044:
[0107] S6043: Determine the first operation function based on the S-box operation and the linear transformation operation L in the second expression.
[0108] S6044: Construct a first input-output mapping table based on the first operation function and the set of input values of the S-box operation.
[0109] Specifically, the second expression is When the first operation function includes L(Sbox(a)), the input value set of the S-box operation is each input value from 0 to 255. Substituting into L(Sbox(a)), we get an input-output mapping table T1 as the first input-output mapping table.
[0110] S605: In the data processing process of the data to be processed based on the target cryptographic algorithm, determine the first input value of the S-box operation.
[0111] In this application, during the data processing of the data to be processed based on SM4, the data processing includes data encryption and data decryption. For the (i+1)th round of the first nonlinear iterative operation, the data encryption is based on obtaining the round key rk from the data to be processed. i and variable X i X i+1 X i+2 X i+3 Substitute Data decryption is based on obtaining the round key rk from the data to be processed. 31-i and variable Y i Y i+1 Y i+2 Y i+3 Substitute the value of into Based on this, the input to the nonlinear transformation τ in the synthetic permutation operation T is obtained, which is a 32-bit number A. A is divided into four 8-bit inputs in sequence to obtain the first input values of the S-box operation, namely a0, a1, a2 and a3.
[0112] S606: Based on the first input value, look up the first input-output mapping table to obtain the first output value corresponding to the first input value.
[0113] In this application, after constructing the first input-output mapping table in S604, during the data processing of the data to be processed based on SM4, after determining the first input value of the S-box operation, it is not necessary to perform the operation from the S-box operation to the linear transformation operation L in the second expression of the synthesis permutation operation T. Instead, the first input value is used to look up the pre-constructed first input-output mapping table to obtain the corresponding first output value.
[0114] As an example, when the first input values of the S-box operation are a0, a1, a2, and a3, and the first input-output mapping tables are T1, T2, T3, and T4, the first output values are obtained by looking up the values of a0, a1, a2, and a3 in the first input-output mapping tables T1, T2, T3, and T4 respectively, resulting in T4(a0), T3(a1), T1(a2), and T1(a3). Figure 2 Based on this, the second expression of the composition permutation operation T is replaced by the first input-output mapping tables T1, T2, T3, and T4. The operations on L(Sbox(a)), L(Sbox(a) << < 8), L(Sbox(a) << < 16), and L(Sbox(a) << < 24) yield the following results: Figure 7 The flowchart shown is for the first nonlinear iterative operation in the (i+1)th round of another SM4-based data encryption.
[0115] Similarly, it can be concluded that in Figure 4 Based on this, the second expression of the composition permutation operation T is replaced by the first input-output mapping tables T1, T2, T3, and T4. The operations on L(Sbox(a)), L(Sbox(a) << < 8), L(Sbox(a) << < 16), and L(Sbox(a) << < 24) yield the following results: Figure 8 The flowchart shown is for the first nonlinear iterative operation in the (i+1)th round of another SM4-based data decryption process.
[0116] As another example, when the first input-output mapping table is T1, based on the values of a0, a1, a2, and a3, the first output values are found in the first input-output mapping table T1, resulting in T1(a0), T1(a1), T1(a2), and T1(a3). Figure 2 Based on this, the second expression of the synthesis permutation operation T is replaced by the first input-output mapping table T1. The operation of L(Sbox(a)) yields the following result: Figure 9 The flowchart shown is for the first nonlinear iterative operation in the (i+1)th round of another type of SM4-based data encryption.
[0117] Similarly, it can be concluded that in Figure 4 Based on this, the second expression of the synthesis permutation operation T is replaced by the first input-output mapping table T1. The operation of L(Sbox(a)) yields the following result: Figure 10 The flowchart shown is for the first nonlinear iterative operation in the (i+1)th round of another type of data decryption based on SM4.
[0118] Furthermore, in this application, in order to enable the lookup of the first input-output mapping table based on the first input value, it is necessary to satisfy the condition that the remaining storage resources in the data processing execution environment can store the first input-output mapping table; that is, the remaining storage resources in the data processing execution environment are greater than or equal to the data size of the first input-output mapping table. Therefore, this application provides a possible implementation method, and S606 may include, for example, if the remaining storage resources in the data processing execution environment are greater than or equal to a first threshold, looking up the first input-output mapping table based on the first input value to obtain the first output value corresponding to the first input value, where the first threshold is the data size of the first input-output mapping table.
[0119] S607: Determine the data processing result of the data to be processed based on the first output value.
[0120] In this application, after obtaining the first output value corresponding to the first input value in S606, the data processing result of the data to be processed can be determined according to the subsequent process.
[0121] As an example, the first output values are T4(a0), T3(a1), T2(a2), and T1(a3). Substituting these values into the second expression yields the result. Furthermore, through or To determine the data processing result of the data to be processed.
[0122] As another example, when the first output values are T1(a0), T1(a1), T1(a2), and T1(a3), substituting them into the second expression will yield the result. Furthermore, through or To determine the data processing result of the data to be processed.
[0123] This data processing method is applicable to scenarios such as communication data processing or specific data processing. For example, it's used in data processing scenarios involving the protection of sensitive payment data and the integration of financial risk control systems with business operations, employing targeted cryptographic algorithms. Another example is when users log in to their accounts, enter amounts, or redeem coupon codes in the mini-program M, the mini-program M's secure keyboard is activated. The secure keyboard uses the aforementioned data processing method to process the key information entered by the user.
[0124] The data processing method provided in this application embodiment, for the first nonlinear iterative operation performed on data processing based on the target cryptographic algorithm, obtains a first expression representing the first operation order of the synthetic permutation operation T. The target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation. The nonlinear transformation operation τ includes the S-box operation, and the linear transformation operation L includes the circular left shift operation and the XOR operation. The first operation order refers to the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L. The first equivalent operation order of the circular left shift operation, the XOR operation and the linear transformation operation L is determined in the synthetic permutation operation T. The first operation order is adjusted using the first equivalent operation order to obtain a second expression representing the second operation order. In the second operation order, the S-box operation is in the first position and the XOR operation is in the last position. A first input-output mapping table is constructed using the first operation function composed of the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation. This method obtains the second expression by adjusting the order of operations of the circular left shift operation, XOR operation, and linear transformation operation L in the first expression of the synthetic permutation operation T, simplifying the operation from the S-box operation to the linear transformation operation L in the synthetic permutation operation T into the first input-output mapping table.
[0125] In the data processing of the data to be processed based on the target cryptographic algorithm, after determining the first input value of the S-box operation, it is not necessary to perform the operation from the S-box operation to the linear transformation operation L in the second expression of the synthetic permutation operation T. Instead, the first input value is used to look up a pre-constructed first input-output mapping table to obtain the corresponding first output value, and the data processing result of the data to be processed is determined by the first output value. Based on this, the lookup method is simpler and more convenient than the operation method, reducing the consumption of operation time and resources, and efficiently implementing the synthetic permutation operation T, thereby improving the efficiency of data processing based on the target cryptographic algorithm.
[0126] Furthermore, in related technologies, when the target cryptographic algorithm is SM4, corresponding to SM4-based data encryption and SM4-based data decryption, the SM4-based key expansion refers to first performing an XOR operation between the input 128-bit key MK and the constant FK, and then performing 32 rounds of second nonlinear iterative operations to output the round key rk. i (0≤i≤31), such as Figure 11 The diagram shows a flowchart of a key expansion based on SM4. The input to the (i+1)th (0≤i≤31)th round of the second nonlinear iterative operation is the constant CK. i and variable K i K i+1 K i+2 K i+3 The output of the (i+1)th round of the second nonlinear iteration is K. i+4 K i+4 The calculation formula is: T′ represents the composition permutation operation. The composition permutation operation T′ is obtained by combining the nonlinear transformation operation τ and the linear transformation operation L′, that is, T′(.)=L′(τ(.)). The linear transformation operation L′ is in 32-bit units and consists of a circular left shift operation and an XOR operation, i.e., like Figure 12 The flowchart shown is a process for the second nonlinear iterative operation in the (i+1)th round of a key expansion based on SM4.
[0127] Based on the above content, Figure 12 The process shown in the study found that in the key expansion process of the key to be processed based on SM4, each round of nonlinear iterative operation to realize the synthetic permutation operation T′ requires first executing four parallel S-box operations in the nonlinear transformation operation τ, and then executing the circular left shift operation and XOR operation in the linear transformation operation L′. The operation is also quite cumbersome and complex, resulting in low efficiency of key expansion based on SM4.
[0128] To address the aforementioned technical problems, this application also provides a key expansion method based on a target cryptographic algorithm. Referring to the aforementioned data processing method based on a target cryptographic algorithm, the synthetic permutation operation T is replaced with a synthetic permutation operation T′, and the linear transformation operation L is replaced with a linear transformation operation L′. Based on this, the data processing method based on the target cryptographic algorithm is adaptively adjusted to obtain the key expansion method based on the target cryptographic algorithm.
[0129] Next, with reference to the accompanying drawings, a key expansion method based on a target cryptographic algorithm provided in an embodiment of this application will be described. See also Figure 13 , Figure 13 A flowchart of a key expansion method based on a target cryptographic algorithm provided in this application embodiment is included. The method includes:
[0130] S1301: For the second nonlinear iterative operation performed on the key expansion based on the target cryptographic algorithm, obtain the third expression of the synthetic permutation operation T′ in the second nonlinear iterative operation; the target cryptographic algorithm includes the synthetic permutation operation T′ obtained by combining the nonlinear transformation operation τ and the linear transformation operation L′ in the second nonlinear iterative operation, the nonlinear transformation operation τ includes the S-box operation, the linear transformation operation L′ includes the circular left shift operation and the XOR operation, and the third expression represents the third operation order from the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L′.
[0131] When the target cryptographic algorithm is SM4, referring to S601 above, the third expression for the synthesis permutation operation T′ is: The third expression represents the third order of operations from the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L′. The third expression is obtained from the following:
[0132]
[0133] S1302: Determine the third equivalent operation order of the circular left shift operation, XOR operation, and linear transformation operation L′ in the composition permutation operation T′.
[0134] This application provides a possible implementation, and S1302 may include, for example, the following steps: determining the fourth equivalent operation order of XOR operation and circular left shift operation in linear transformation operation L′; and based on the fourth equivalent operation order, determining the third equivalent operation order of circular left shift operation, XOR operation and linear transformation operation L′ in composite permutation operation T′.
[0135] in, It also means that when T′(A) is substituted into L′(B), the fourth equivalent operation order includes performing an XOR operation on the two numbers and then performing a circular left shift operation on the two numbers, which is equivalent to performing a circular left shift operation on the two numbers and then performing an XOR operation on the two numbers. This means that when T′(A) is substituted into L′(B), the fourth equivalent order of operations also includes the order of operations in which a number performs multiple circular left shift operations in the linear transformation operation L′, regardless of the order in which the multiple circular left shift operations are arranged.
[0136] Correspondingly, the derivation yields... This means that when T′(A) is substituted into L′(B), the third equivalent operation order can include performing an XOR operation on the two numbers followed by a linear transformation operation L′ in the composition permutation operation T′. This is equivalent to performing a linear transformation operation L′ on each number separately before performing an XOR operation. Furthermore, it can be derived that: This means that when T′(A) is substituted into L′(B), the third equivalent operation order also includes performing a circular left shift operation on the two numbers in the composition permutation operation T′, followed by a linear transformation operation L′, which is equivalent to performing a linear transformation operation L′ on the two numbers respectively, followed by a circular left shift operation.
[0137] S1303: Adjust the third operation order based on the third equivalent operation order to obtain a fourth expression representing the fourth operation order, in which the S-box operation is in the first position and the XOR operation is in the last position.
[0138] The fourth expression, representing the fourth order of operations, is:
[0139] In the specific implementation, the third expression pass The transformation yields the fourth expression mentioned above.
[0140] The fourth expression, representing the fourth order of operations, is:
[0141] In the specific implementation, the third expression pass The transformation yields Furthermore, through The transformation yields the fourth expression mentioned above.
[0142] S1304: Construct a second input-output mapping table based on the second operation function formed by the S-box operation to the linear transformation operation L′ in the fourth expression and the set of input values for the S-box operation.
[0143] This application provides a possible implementation method, where the fourth expression represents the fourth order of operations from S-box operation, circular left shift operation, linear transformation operation L′ to XOR operation; then S1304 may include, for example, the following steps: determining the second operation function based on the S-box operation, circular left shift operation and linear transformation operation L′ in the fourth expression; and constructing the second input-output mapping table based on the second operation function and the set of input values of the S-box operation.
[0144] Specifically, the fourth expression is When the second operation function includes L′(Sbox(a)), L′(Sbox(a)<<<8), L′Sbox(a)<<<16) and L′(Sbox(a)<<<24), the input value set of the S-box operation is each input value from 0 to 255. Substituting them into L′(Sbox(a)), L′(Sbox(a)<<<8), L′Sbox(a)<<<16) and L′(Sbox(a)<<<24) respectively, we get four input-output mapping tables K1, K2, K3 and K4 as the second input-output mapping tables.
[0145] This application provides a possible implementation method. The fourth expression represents the fourth operation order of S-box operation, linear transformation operation L′, circular left shift operation to XOR operation. Then S1304 may include the following steps: determining the second operation function based on the S-box operation and linear transformation operation L′ in the fourth expression; constructing the second input-output mapping table based on the second operation function and the input value set of the S-box operation.
[0146] Specifically, the fourth expression is When the second operation function includes L′(Sbox(a)), the input value set of the S-box operation is each input value from 0 to 255. Substituting into L′(Sbox(a)), we get an input-output mapping table K1 as the second input-output mapping table.
[0147] S1305: In the key expansion process of the key to be processed based on the target cryptographic algorithm, determine the second input value of the S-box operation.
[0148] S1306: Based on the second input value, look up the second input-output mapping table to obtain the second output value corresponding to the second input value.
[0149] As an example, when the second input values of the S-box operation are a0, a1, a2, and a3, and the second input-output mapping table is K1, K2, K3, and K4, the second output values are obtained by looking up the values of a0, a1, a2, and a3 in the second input-output mapping tables K1, K2, K3, and K4 respectively, resulting in K4(a0), K3(a1), K2(a2), and K1(a3). Figure 12 Based on this, the fourth expression of the composition permutation operation T′ is replaced by the second input-output mapping tables K1, K2, K3, and K4. The operations on L′(Sbox(a)), L′(Sbox(a) << < 8), L′Sbox(a) << < 16), and L′(Sbox(a) << < 24) yield the following results: Figure 14The flowchart shown is for the second nonlinear iterative operation in the (i+1)th round of another SM4-based key expansion.
[0150] As another example, when the second input-output mapping table is K1, based on the values of a0, a1, a2, and a3, the second input-output mapping table K1 is looked up to obtain the second output values as K1(a0), K1(a1), K1(a2), and K1(a3). Figure 12 Based on this, the fourth expression of the above-mentioned synthetic permutation operation T′ can be replaced by using the second input-output mapping table K1. The operation of L′(Sbox(a)) yields the following result: Figure 15 The flowchart shown is for the second nonlinear iterative operation in the (i+1)th round of another SM4-based key expansion.
[0151] Furthermore, in this application, in order to realize the lookup of the second input-output mapping table based on the second input value, it is necessary to satisfy both the condition that the remaining storage resources in the key expansion execution environment can store the first input-output mapping table and the condition that the second input-output mapping table can be stored; that is, the remaining storage resources in the key expansion execution environment are greater than or equal to the data size of the first input-output mapping table and the second input-output mapping table. Therefore, this application provides a possible implementation method, and S1306 may include, for example, if the remaining storage resources in the key expansion execution environment are greater than or equal to a second threshold, looking up the second input-output mapping table based on the second input value to obtain the second output value corresponding to the second input value; the second threshold is the data size of the first input-output mapping table and the second input-output mapping table.
[0152] S1307: Determine the key expansion result of the key to be processed based on the second output value.
[0153] In this application, after obtaining the second output value corresponding to the second input value in S1306, the key expansion result of the key to be processed can be determined according to the subsequent process.
[0154] The key expansion method based on the target cryptographic algorithm provided in this application, for the second nonlinear iterative operation performed on the key expansion based on the target cryptographic algorithm, obtains a third expression representing the third operation order of the synthetic permutation operation T′, where the third operation order refers to the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L′; determines the third equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L′ in the synthetic permutation operation T′; adjusts the third operation order using the third equivalent operation order to obtain a fourth expression representing the fourth operation order, where the S-box operation is in the first position and the XOR operation is in the last position; constructs a second input-output mapping table using the second operation function formed by the S-box operation to the linear transformation operation L′ in the fourth expression, and the set of input values for the S-box operation. This method simplifies the operation of the S-box operation to the linear transformation operation L′ in the fourth expression of the synthetic permutation operation T′ by adjusting the operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L′ in the third expression of the synthetic permutation operation T′, so as to transform the operation into a second input-output mapping table.
[0155] In the key expansion process of the key to be processed based on the target cryptographic algorithm, after determining the second input value of the S-box operation, it is not necessary to perform the operation from the S-box operation to the linear transformation operation L' in the third expression of the synthetic permutation operation T'. Instead, the second input value is used to look up a pre-constructed second input-output mapping table to obtain the corresponding second output value, and the key expansion result of the key to be processed is determined by the second output value. Based on this, the lookup method is simpler and more convenient than the operation method, reducing the consumption of operation time and resources, and efficiently implementing the synthetic permutation operation T', thereby improving the efficiency of key expansion based on the target cryptographic algorithm.
[0156] Based on the data processing method provided in the above embodiments, this application also provides a data processing apparatus, see [link to relevant documentation]. Figure 16 , Figure 16 This application provides a structural block diagram of a data processing apparatus 1600, which includes an acquisition unit 1601, a determination unit 1602, a obtaining unit 1603, and a construction unit 1604.
[0157] The acquisition unit 1601 is used to acquire the first expression of the synthetic permutation operation T in the first nonlinear iterative operation performed on the data processing based on the target cryptographic algorithm. The target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation. The nonlinear transformation operation τ includes the S-box operation, and the linear transformation operation L includes the circular left shift operation and the XOR operation. The first expression represents the first operation order from the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L.
[0158] Determining unit 1602 is used to determine the first equivalent operation order of cyclic left shift operation, XOR operation and linear transformation operation L in the composition permutation operation T;
[0159] The unit 1603 is used to adjust the first operation order based on the first equivalent operation order to obtain a second expression representing the second operation order, in which the S-box operation is in the first position and the XOR operation is in the last position.
[0160] Construction unit 1604 is used to construct a first input-output mapping table based on the first operation function composed of the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation;
[0161] The determining unit 1602 is also used to determine the first input value of the S-box operation during the data processing of the data to be processed based on the target cryptographic algorithm;
[0162] The obtaining unit 1603 is also used to look up the first input-output mapping table based on the first input value to obtain the first output value corresponding to the first input value;
[0163] The determining unit 1602 is also used to determine the data processing result of the data to be processed based on the first output value.
[0164] In one possible implementation, the determining unit 1602 is used for:
[0165] Determine the second equivalent order of operations for the XOR operation and the circular left shift operation in the linear transformation operation L;
[0166] Based on the second equivalent operation order, the first equivalent operation order of the cyclic left shift operation, XOR operation, and linear transformation operation L in the composition permutation operation T is determined.
[0167] In one possible implementation, the second expression represents the second operational order of the S-box operation, the linear transformation operation L, the circular left shift operation, and the XOR operation; construction unit 1604 is used for:
[0168] Based on the S-box operation and linear transformation operation L in the second expression, determine the first operation function;
[0169] Based on the first operation function and the set of input values for the S-box operation, a first input-output mapping table is constructed.
[0170] In one possible implementation, the second expression represents the second operational order of the S-box operation, the circular left shift operation, the linear transformation operation L, and the XOR operation; construction unit 1604 is used for:
[0171] Based on the S-box operation, circular left shift operation, and linear transformation operation L in the second expression, determine the first operation function;
[0172] Based on the first operation function and the set of input values for the S-box operation, a first input-output mapping table is constructed.
[0173] In one possible implementation, unit 1603 is used for:
[0174] If the remaining storage resources in the data processing execution environment are greater than or equal to the first threshold, the first input-output mapping table is looked up based on the first input value to obtain the first output value corresponding to the first input value. The first threshold is the data size of the first input-output mapping table.
[0175] In one possible implementation, the target cryptographic algorithm further includes a synthetic permutation operation T′ obtained by combining a nonlinear transformation operation τ and a linear transformation operation L′ in the second nonlinear iterative operation, wherein the linear transformation operation L′ includes a circular left shift operation and an XOR operation; the acquisition unit 1601 is also used for:
[0176] For the second nonlinear iterative operation performed on the key expansion based on the target cryptographic algorithm, obtain the third expression of the synthetic permutation operation T′ in the second nonlinear iterative operation; the third expression represents the third order of operations from S-box operation, circular left shift operation, XOR operation to linear transformation operation L′;
[0177] Unit 1602 is also used for:
[0178] Determine the third equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L′ in the composition permutation operation T′;
[0179] Unit 1603 is also used for:
[0180] Based on the third order of operations, the third order of operations is adjusted to obtain a fourth expression representing the fourth order of operations, in which the S-box operation is in the first position and the XOR operation is in the last position;
[0181] Constructor unit 1604 is also used for:
[0182] Based on the second operation function formed by the S-box operation to the linear transformation operation L′ in the fourth expression and the set of input values for the S-box operation, a second input-output mapping table is constructed.
[0183] Unit 1602 is also used for:
[0184] In the key expansion process of the key to be processed based on the target cryptographic algorithm, the second input value of the S-box operation is determined;
[0185] Unit 1603 is also used for:
[0186] The second input value is obtained by looking up the second input-output mapping table based on the second input value.
[0187] Unit 1602 is also used for:
[0188] The key expansion result of the key to be processed is determined based on the second output value.
[0189] In one possible implementation, obtaining unit 1603 is also used for:
[0190] If the remaining storage resources in the key expansion execution environment are greater than or equal to the second threshold, the second input-output mapping table is looked up based on the second input value to obtain the second output value corresponding to the second input value; the second threshold is the data size of the first input-output mapping table and the second input-output mapping table.
[0191] The data processing apparatus provided in this application provides a first nonlinear iterative operation performed on data processing based on a target cryptographic algorithm. It obtains a first expression representing a first operation order of the synthetic permutation operation T, where the first operation order refers to the S-box operation, circular left shift operation, XOR operation, and linear transformation operation L. It determines a first equivalent operation order of the circular left shift operation, XOR operation, and linear transformation operation L in the synthetic permutation operation T. It adjusts the first operation order using the first equivalent operation order to obtain a second expression representing a second operation order, where the S-box operation is in the first position and the XOR operation is in the last position. It constructs a first input-output mapping table using a first operation function formed by the S-box operation and the linear transformation operation L in the second expression, and the set of input values for the S-box operation. This method simplifies the operation from the S-box operation to the linear transformation operation L in the synthetic permutation operation T to form the first input-output mapping table by adjusting the operation order of the circular left shift operation, XOR operation, and linear transformation operation L in the first expression of the synthetic permutation operation T.
[0192] In the data processing of the data to be processed based on the target cryptographic algorithm, after determining the first input value of the S-box operation, it is not necessary to perform the operation from the S-box operation to the linear transformation operation L in the second expression of the synthetic permutation operation T. Instead, the first input value is used to look up a pre-constructed first input-output mapping table to obtain the corresponding first output value, and the data processing result of the data to be processed is determined by the first output value. Based on this, the lookup method is simpler and more convenient than the operation method, reducing the consumption of operation time and resources, and efficiently implementing the synthetic permutation operation T, thereby improving the efficiency of data processing based on the target cryptographic algorithm.
[0193] This application also provides a computer device, which will be described below with reference to the accompanying drawings. Please refer to... Figure 17 As shown in the illustration, this application provides a device, which can also be a terminal device. This terminal device can be any smart terminal, including mobile phones, tablets, PDAs, point-of-sale (POS) terminals, and in-vehicle computers. Taking a mobile phone as an example:
[0194] Figure 17 This diagram illustrates a partial structural representation of a mobile phone related to the terminal device provided in this embodiment. (Reference) Figure 17 The mobile phone includes components such as a radio frequency (RF) circuit 1710, a memory 1720, an input unit 1730, a display unit 1740, a sensor 1750, an audio circuit 1760, a wireless Fidelity (WiFi) module 1770, a processor 1780, and a power supply 1790. Those skilled in the art will understand that... Figure 17 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0195] The following is combined with Figure 17 A detailed introduction to each component of a mobile phone:
[0196] RF circuit 1710 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 1780; additionally, it transmits uplink data to the base station. Typically, RF circuit 1710 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 1710 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0197] The memory 1720 can be used to store software programs and modules. The processor 1780 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1720. The memory 1720 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0198] The input unit 1730 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1730 may include a touch panel 1731 and other input devices 1732. The touch panel 1731, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1731), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1731 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1780, and can also receive and execute commands sent by the processor 1780. In addition, the touch panel 1731 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1731, the input unit 1730 may also include other input devices 1732. Specifically, other input devices 1732 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0199] Display unit 1740 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. Display unit 1740 may include display panel 1741, optionally configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1741. Further, touch panel 1731 may cover display panel 1741. When touch panel 1731 detects a touch operation on or near it, it transmits the information to processor 1780 to determine the type of touch event. Subsequently, processor 1780 provides corresponding visual output on display panel 1741 based on the type of touch event. Although in Figure 17 In this embodiment, the touch panel 1731 and the display panel 1741 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1731 and the display panel 1741 can be integrated to realize the input and output functions of the mobile phone.
[0200] The mobile phone may also include at least one sensor 1750, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1741 according to the ambient light level, and the proximity sensor can turn off the display panel 1741 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0201] Audio circuit 1760, speaker 1761, and microphone 1762 provide an audio interface between the user and the mobile phone. Audio circuit 1760 converts received audio data into electrical signals and transmits them to speaker 1761, where speaker 1761 converts them into sound signals for output. On the other hand, microphone 1762 converts collected sound signals into electrical signals, which are received by audio circuit 1760, converted into audio data, and then processed by processor 1780 before being transmitted via RF circuit 1715 to, for example, another mobile phone, or the audio data can be output to memory 1720 for further processing.
[0202] WiFi is a short-range wireless transmission technology. Mobile phones using the WiFi module 1770 can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 17 WiFi module 1770 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0203] The processor 1780 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 1720 and calling data stored in the memory 1720. Optionally, the processor 1780 may include one or more processing units; preferably, the processor 1780 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1780.
[0204] The mobile phone also includes a power supply 1790 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1780 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0205] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0206] In this embodiment, the processor 1780 included in the terminal device also has the following functions:
[0207] For the first nonlinear iterative operation performed on the data processing based on the target cryptographic algorithm, the first expression of the synthetic permutation operation T in the first nonlinear iterative operation is obtained; the target cryptographic algorithm includes the synthetic permutation operation T obtained by the combination of nonlinear transformation operation τ and linear transformation operation L in the first nonlinear iterative operation, the nonlinear transformation operation τ includes S-box operation, the linear transformation operation L includes circular left shift operation and XOR operation, and the first expression represents the first operation order from S-box operation, circular left shift operation, XOR operation to linear transformation operation L;
[0208] Determine the first equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L in the composition permutation operation T;
[0209] Based on the first equivalent operation order, the first operation order is adjusted to obtain a second expression representing the second operation order, in which the S-box operation is in the first position and the XOR operation is in the last position.
[0210] Based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values for the S-box operation, a first input-output mapping table is constructed.
[0211] In the data processing of data to be processed based on the target cryptographic algorithm, the first input value of the S-box operation is determined;
[0212] Based on the first input value, look up the first input-output mapping table to obtain the first output value corresponding to the first input value;
[0213] The data processing result is determined based on the first output value.
[0214] This application also provides a server; please refer to [link / reference]. Figure 18 As shown, Figure 18 The diagram illustrates the structure of a server 1800 provided in this embodiment. The server 1800 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 1822 (e.g., one or more processors) and a memory 1832, and one or more storage media 1830 (e.g., one or more mass storage devices) for storing application programs 1842 or data 1844. The memory 1832 and storage media 1830 may be temporary or persistent storage. The program stored in the storage media 1830 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the server. Furthermore, the CPU 1822 may be configured to communicate with the storage media 1830 and execute the series of instruction operations stored in the storage media 1830 on the server 1800.
[0215] Server 1800 may also include one or more power supplies 1826, one or more wired or wireless network interfaces 1850, one or more input / output interfaces 1858, and / or one or more operating systems 1841, such as Windows Server. TM Mac OS X TM Unix TM Linux™, FreeBSD TM etc.
[0216] The steps performed by the server in the above embodiments can be based on Figure 18 The server structure shown.
[0217] This application also provides a computer-readable storage medium for storing a computer program that executes any one of the data processing methods described in the foregoing embodiments.
[0218] This application also provides a computer program product, including a computer program or instructions; when the computer program or instructions are executed by a processor, any one of the data processing methods described in the foregoing embodiments is executed.
[0219] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, etc., and other media capable of storing program code.
[0220] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0221] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data processing method, characterized in that, The method includes: For the first nonlinear iterative operation performed on data processing based on the target cryptographic algorithm, a first expression for the synthetic permutation operation T in the first nonlinear iterative operation is obtained; the target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation, the nonlinear transformation operation τ includes S-box operation, the linear transformation operation L includes circular left shift operation and XOR operation, and the first expression represents the first operation order of the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L; Determine the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the composition permutation operation T; Based on the first equivalent operation order, the first operation order is adjusted to obtain a second expression representing the second operation order, in which the S-box operation is in the first position and the XOR operation is in the last position; Based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation, a first input-output mapping table is constructed; In the data processing of the data to be processed based on the target cryptographic algorithm, the first input value of the S-box operation is determined; Based on the first input value, look up the first input-output mapping table to obtain the first output value corresponding to the first input value; The data processing result of the data to be processed is determined based on the first output value.
2. The method according to claim 1, characterized in that, Determining the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the composition permutation operation T includes: Determine the second equivalent operation order of the XOR operation and the circular left shift operation in the linear transformation operation L; Based on the second equivalent operation order, the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the synthetic permutation operation T is determined.
3. The method according to claim 1, characterized in that, The second expression represents the second operational order of the S-box operation, the linear transformation operation L, the circular left shift operation, and the XOR operation; the construction of the first input-output mapping table based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the input value set of the S-box operation includes: Based on the S-box operation and the linear transformation operation L in the second expression, the first operation function is determined; Based on the first operation function and the set of input values for the S-box operation, the first input-output mapping table is constructed.
4. The method according to claim 1, characterized in that, The second expression represents the second operational order of the S-box operation, the circular left shift operation, the linear transformation operation L, and the XOR operation; the construction of the first input-output mapping table based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the input value set of the S-box operation includes: Based on the S-box operation, the circular left shift operation, and the linear transformation operation L in the second expression, the first operation function is determined; Based on the first operation function and the set of input values for the S-box operation, the first input-output mapping table is constructed.
5. The method according to claim 1, characterized in that, The step of looking up the first input-output mapping table based on the first input value to obtain the first output value corresponding to the first input value includes: If the remaining storage resources in the data processing execution environment are greater than or equal to the first threshold, the first input-output mapping table is searched based on the first input value to obtain the first output value corresponding to the first input value. The first threshold is the data size of the first input-output mapping table.
6. The method according to any one of claims 1-5, characterized in that, The target cryptographic algorithm further includes a synthetic permutation operation T′ obtained by combining the nonlinear transformation operation τ and the linear transformation operation L′ in the second nonlinear iterative operation, wherein the linear transformation operation L′ includes the circular left shift operation and the XOR operation; the method further includes: For the second nonlinear iterative operation performed on the key expansion based on the target cryptographic algorithm, a third expression for the synthetic permutation operation T′ in the second nonlinear iterative operation is obtained; the third expression represents the third operational order of the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L′; Determine the third equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L′ in the synthetic permutation operation T′; Based on the third equivalent operation order, the third operation order is adjusted to obtain a fourth expression representing the fourth operation order, in which the S-box operation is in the first position and the XOR operation is in the last position; Based on the second operation function formed by the S-box operation to the linear transformation operation L′ in the fourth expression and the set of input values of the S-box operation, a second input-output mapping table is constructed; In the key expansion process of the key to be processed based on the target cryptographic algorithm, the second input value of the S-box operation is determined; Based on the second input value, look up the second input-output mapping table to obtain the second output value corresponding to the second input value; The key expansion result of the key to be processed is determined based on the second output value.
7. The method according to claim 6, characterized in that, The step of looking up the second input-output mapping table based on the second input value to obtain the second output value corresponding to the second input value includes: If the remaining storage resources in the key expansion execution environment are greater than or equal to the second threshold, the second input-output mapping table is searched based on the second input value to obtain the second output value corresponding to the second input value; the second threshold is the data size of the first input-output mapping table and the second input-output mapping table.
8. A data processing apparatus, characterized in that, The device includes an acquisition unit, a determination unit, a obtaining unit, and a construction unit: The acquisition unit is used to acquire a first expression of the synthetic permutation operation T in the first nonlinear iterative operation performed on the data processing based on the target cryptographic algorithm; the target cryptographic algorithm includes the synthetic permutation operation T obtained by combining the nonlinear transformation operation τ and the linear transformation operation L in the first nonlinear iterative operation, the nonlinear transformation operation τ includes the S-box operation, the linear transformation operation L includes the circular left shift operation and the XOR operation, and the first expression represents the first operation order of the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L; The determining unit is used to determine the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the synthetic permutation operation T; The obtaining unit is used to adjust the first operation order based on the first equivalent operation order to obtain a second expression representing the second operation order, wherein the S-box operation is in the first position and the XOR operation is in the last position in the second operation order. The construction unit is used to construct a first input-output mapping table based on the first operation function formed by the S-box operation to the linear transformation operation L in the second expression and the set of input values of the S-box operation; The determining unit is further configured to determine the first input value of the S-box operation during the data processing of the data to be processed based on the target cryptographic algorithm; The obtaining unit is further configured to look up the first input-output mapping table based on the first input value to obtain the first output value corresponding to the first input value; The determining unit is further configured to determine the data processing result of the data to be processed based on the first output value.
9. The apparatus according to claim 8, characterized in that, The determining unit is used for: Determine the second equivalent operation order of the XOR operation and the circular left shift operation in the linear transformation operation L; Based on the second equivalent operation order, the first equivalent operation order of the cyclic left shift operation, the XOR operation, and the linear transformation operation L in the synthetic permutation operation T is determined.
10. The apparatus according to claim 8, characterized in that, The second expression represents the second operational order of the S-box operation, the linear transformation operation L, the circular left shift operation, and the XOR operation; the construction unit is used for: Based on the S-box operation and the linear transformation operation L in the second expression, the first operation function is determined; Based on the first operation function and the set of input values for the S-box operation, the first input-output mapping table is constructed.
11. The apparatus according to claim 8, characterized in that, The second expression represents the second operational order of the S-box operation, the circular left shift operation, the linear transformation operation L, and the XOR operation; the construction unit is used for: Based on the S-box operation, the circular left shift operation, and the linear transformation operation L in the second expression, the first operation function is determined; Based on the first operation function and the set of input values for the S-box operation, the first input-output mapping table is constructed.
12. The apparatus according to claim 8, characterized in that, The obtaining unit is used for: If the remaining storage resources in the data processing execution environment are greater than or equal to the first threshold, the first input-output mapping table is searched based on the first input value to obtain the first output value corresponding to the first input value. The first threshold is the data size of the first input-output mapping table.
13. The apparatus according to any one of claims 8-12, characterized in that, The target cryptographic algorithm further includes a synthetic permutation operation T′ obtained by combining the nonlinear transformation operation τ and the linear transformation operation L′ in the second nonlinear iterative operation, wherein the linear transformation operation L′ includes the circular left shift operation and the XOR operation; the acquisition unit is further configured to: For the second nonlinear iterative operation performed on the key expansion based on the target cryptographic algorithm, a third expression for the synthetic permutation operation T′ in the second nonlinear iterative operation is obtained; the third expression represents the third operational order of the S-box operation, the circular left shift operation, the XOR operation to the linear transformation operation L′; The determining unit is further configured to: Determine the third equivalent operation order of the circular left shift operation, the XOR operation, and the linear transformation operation L′ in the synthetic permutation operation T′; The obtaining unit is further configured to: Based on the third equivalent operation order, the third operation order is adjusted to obtain a fourth expression representing the fourth operation order, in which the S-box operation is in the first position and the XOR operation is in the last position; The construction unit is also used for: Based on the second operation function formed by the S-box operation to the linear transformation operation L′ in the fourth expression and the set of input values of the S-box operation, a second input-output mapping table is constructed; The determining unit is further configured to: In the key expansion process of the key to be processed based on the target cryptographic algorithm, the second input value of the S-box operation is determined; The obtaining unit is further configured to: Based on the second input value, look up the second input-output mapping table to obtain the second output value corresponding to the second input value; The determining unit is further configured to: The key expansion result of the key to be processed is determined based on the second output value.
14. The apparatus according to claim 13, characterized in that, The unit is also used for: If the remaining storage resources in the key expansion execution environment are greater than or equal to the second threshold, the second input-output mapping table is looked up based on the second input value to obtain the second output value corresponding to the second input value; The second threshold is the data size of the first input / output mapping table and the second input / output mapping table.
15. A computer device, characterized in that, The device includes a processor and a memory: The memory is used to store program code; The processor is configured to execute the data processing method according to any one of claims 1-7 according to the instructions in the program code.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, which is loaded and executed by a processor to implement the data processing method as described in any one of claims 1-7.
17. A computer program product, characterized in that, It includes a computer program or instructions; when the computer program or instructions are executed by a processor, the data processing method according to any one of claims 1-7 is performed.
Citation Information
Patent Citations
Method for realizing Magpie encryption and decryption
CN103746795A
SM4 parallel computing method and device based on SIMD instruction and readable storage medium
CN111736902A