Lightweight encryption method, decryption method, related equipment and vehicle
By using a lightweight encryption method in the Internet of Vehicles environment and using the substitution function to perform multiple rounds of sequence replacement on the master key, the problem of limited encrypted data length and processing capabilities in the in-vehicle environment is solved, and efficient encryption and decryption are achieved. , ensuring the security of communication data.
Patent Information
- Application Number
- CN202410739174.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-07
AI Technical Summary
In the Internet of Vehicles environment, existing encryption methods are difficult to meet the security needs of in-vehicle environments with small amounts of communication data and limited computing and storage capabilities. In particular, since each frame of data on the CAN bus is 8 bits, the encryption algorithm There is a limit on data length.
A lightweight encryption method is proposed, which performs multiple rounds of sequence replacement of odd and even bits on the master key through a preset replacement function, generates an initialization sequence for encrypting plaintext data, and performs sequence replacement in each round of encryption. , and finally generate ciphertext data and labels, and the receiving end decrypts and verifies the correctness of the ciphertext data.
It achieves efficient encryption and decryption in the in-vehicle environment, ensuring the security of communication data, while adapting to the limitations of data length and processing power, and providing a lightweight encryption solution.
Smart Images

Figure CN118590219A
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of communication security, and in particular, to a lightweight encryption method, a decryption method, related equipment and a vehicle. Background Art
[0002] When communicating in a connected vehicle environment, the amount of communication data is small and the computing and storage capabilities of the vehicle's components are relatively limited. Therefore, the cryptographic algorithm suitable for the vehicle environment needs to pay special attention to lightweight while also ensuring a certain degree of security. In addition, since each frame of data under the CAN bus of the vehicle's network communication is 8 bits, the cryptographic algorithm is also limited in data length. Summary of the invention
[0003] In view of this, the purpose of this application is to propose a lightweight encryption method, decryption method, related equipment and vehicle.
[0004] Based on the above purpose, the present application provides a lightweight encryption method, which is applied to the sending end, and the method includes:
[0005] Using a preset permutation function, multiple rounds of sequence permutation are performed on a sequence consisting of odd-numbered bits and a sequence consisting of even-numbered bits of the master key to obtain a first initialization sequence and a second initialization sequence;
[0006] Divide the plaintext data into multiple plaintext data blocks according to the order of bits, perform multiple rounds of encryption using the first initialization sequence and the second initialization sequence, encrypt one plaintext data block in each round of encryption, and perform a sequence permutation, obtain multiple ciphertext data blocks, the first encryption sequence and the second encryption sequence after the multiple rounds of encryption, and combine the multiple ciphertext data blocks into ciphertext data;
[0007] Using the permutation function, performing multiple rounds of sequence permutation on the first encryption sequence and the second encryption sequence to obtain a first label sequence and a second label sequence, and using the first label sequence and the second label sequence to form a first label;
[0008] The ciphertext data and the first tag are sent to a receiving end.
[0009] Furthermore, multiple rounds of sequence permutations are performed on the sequence of odd-numbered bits and the sequence of even-numbered bits of the master key, including:
[0010] In the first round of permutation, the first multiple bits of the master key are used to construct multiple subkeys of the first round of permutation, and the master key is cyclically shifted once to obtain the displacement key in the next round of permutation. In each non-first round of permutation, the first multiple bits of the displacement key in this round of permutation are used to construct multiple subkeys of this round of permutation, and the displacement key is cyclically shifted once to obtain the displacement key of the next round of permutation.
[0011] In the first round of permutation, the sequence consisting of the odd-numbered bits and the sequence consisting of the even-numbered bits are XORed to obtain the first input sequence of the first round of permutation, and in each non-first round of permutation, the first intermediate sequence and the second intermediate sequence obtained in the previous round of permutation are XORed to obtain the first input sequence of the current round of permutation;
[0012] In each permutation round, the first input sequence and the multiple subkeys are used to perform a composite function operation to obtain a first output sequence of the permutation round, and the first output sequence is used to perform an XOR operation with the first intermediate sequence and the second intermediate sequence of the previous permutation round to obtain the first intermediate sequence and the second intermediate sequence of the permutation round;
[0013] In response to reaching a preset permutation round, the first intermediate sequence and the second intermediate sequence obtained in the last round of permutation are respectively used to determine a first initialization sequence and a second initialization sequence.
[0014] The multiple subkeys replaced in this round include the first subkey, the second subkey and the third subkey;
[0015] Furthermore, the first input sequence and the multiple subkeys are used to perform a composite function operation to obtain a first output sequence of this round of permutation, including:
[0016] dividing the first input sequence into a first input data block, a second input data block, a third input data block and a fourth input data block;
[0017] Performing modular multiplication using the first subkey and the first input data block to obtain a first subsequence, performing modular addition using the second subkey and the second input data block to obtain a second subsequence, performing modular addition using the first subkey and the third input data block to obtain a third subsequence, and performing modular multiplication using the second subkey and the fourth input data block to obtain a fourth subsequence;
[0018] performing an XOR operation on the first subsequence and the third subsequence to obtain a fifth subsequence, performing an XOR operation on the second subsequence and the fourth subsequence to obtain a sixth subsequence, performing modular multiplication on the third subkey and the fifth subsequence to obtain a seventh subsequence, performing modular addition on the sixth subsequence and the seventh subsequence to obtain an eighth subsequence, performing modular multiplication on the third subkey and the eighth subsequence to obtain a ninth subsequence, and performing modular addition on the seventh subsequence and the ninth subsequence to obtain a tenth subsequence;
[0019] Performing an XOR operation on the first subsequence and the ninth subsequence to obtain a first output data block, performing an XOR operation on the second subsequence and the tenth subsequence to obtain a second output data block, performing an XOR operation on the ninth subsequence and the third subsequence to obtain a third output data block, and performing an XOR operation on the tenth subsequence and the fourth subsequence to obtain a fourth output data block;
[0020] The first output data block, the second output data block, the third output data block and the fourth output data block are combined into the first output sequence.
[0021] Furthermore, in each round of encryption, a block of plaintext data is encrypted and a sequence permutation is performed, including:
[0022] In the first round of encryption, the first initialization sequence is XORed with the first plaintext data block to obtain the corresponding ciphertext data block, and the ciphertext data block obtained in this round of encryption is sequence-permuted with the second initialization sequence to obtain the first transition sequence and the second transition sequence of this round of encryption;
[0023] When it is not the first round of encryption, the first transition sequence obtained from the previous round of encryption is XORed with the plaintext data blocks of the corresponding order to obtain the corresponding ciphertext data blocks, and the ciphertext data blocks obtained from the current round of encryption are sequence-permuted with the second transition sequence obtained from the previous round of encryption to obtain the first transition sequence and the second transition sequence of the current round of encryption.
[0024] Based on the same inventive concept, the present application provides a lightweight decryption method, which is applied to a receiving end. The method includes:
[0025] Receiving the ciphertext data and the first tag from the transmitting end, and performing multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of the master key using a preset permutation function to obtain a third initialization sequence and a fourth initialization sequence;
[0026] Dividing the ciphertext data into a plurality of ciphertext data blocks according to the order of bits, performing multiple rounds of decryption using the third initialization sequence and the fourth initialization sequence, decrypting one ciphertext data block in each round of decryption, and performing a sequence permutation, obtaining a plurality of plaintext data blocks, a first decryption sequence, and a second decryption sequence after multiple rounds of decryption, and combining the plurality of plaintext data blocks into plaintext data;
[0027] Using the permutation function, multiple rounds of sequence permutation are performed on the first decryption sequence and the second decryption sequence to obtain a third label sequence and a fourth label sequence, and the third label sequence and the fourth label sequence are used to form a second label. In response to determining that the second label is consistent with the first label, it is determined that the plaintext data is correct.
[0028] Based on the same inventive concept, the present application also provides a lightweight encryption device, including: a first initialization module, an encryption module, a first label generation module and a sending module;
[0029] The first initialization module is configured to perform multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of the master key using a preset permutation function to obtain a first initialization sequence and a second initialization sequence;
[0030] The encryption module is configured to divide the plaintext data into a plurality of plaintext data blocks according to the order of bits, perform multiple rounds of encryption using the first initialization sequence and the second initialization sequence, encrypt a plaintext data block in each round of encryption, and perform a sequence permutation, obtain a plurality of ciphertext data blocks, a first encryption sequence and a second encryption sequence after multiple rounds of encryption, and combine the plurality of ciphertext data blocks into ciphertext data;
[0031] The first label generation module is configured to perform multiple rounds of sequence permutation on the first encryption sequence and the second encryption sequence using the permutation function to obtain a first label sequence and a second label sequence, and use the first label sequence and the second label sequence to form a first label;
[0032] The sending module is configured to send the ciphertext data and the first tag to a receiving end.
[0033] Based on the same inventive concept, the present application also provides a lightweight decryption device, including: a second initialization module, a decryption module, and a second label generation module;
[0034] The second initialization module is configured to receive the ciphertext data and the first tag from the transmitting end, and use a preset permutation function to perform multiple rounds of sequence permutations on a sequence consisting of odd bits and a sequence consisting of even bits of the master key to obtain a third initialization sequence and a fourth initialization sequence;
[0035] The decryption module is configured to divide the ciphertext data into a plurality of ciphertext data blocks according to the order of bits, perform multiple rounds of decryption using the third initialization sequence and the fourth initialization sequence, decrypt one ciphertext data block in each round of decryption, and perform a sequence permutation, obtain a plurality of plaintext data blocks, a first decryption sequence and a second decryption sequence after multiple rounds of decryption, and combine the plurality of plaintext data blocks into plaintext data;
[0036] The second label generation module is configured to use the permutation function to perform multiple rounds of sequence permutations on the first decryption sequence and the second decryption sequence to obtain a third label sequence and a fourth label sequence, and use the third label sequence and the fourth label sequence to form a second label. In response to determining that the second label is consistent with the first label, it is determined that the plaintext data is correct.
[0037] Based on the same inventive concept, the present application also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the lightweight encryption method and the lightweight decryption method as described in any one of the above items are implemented.
[0038] Based on the same inventive concept, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the lightweight encryption method and lightweight decryption method as described above.
[0039] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions, which, when executed on a computer, enables the computer to execute the lightweight encryption method and lightweight decryption method as described in any of the above items.
[0040] Based on the same inventive concept, the present application also provides a vehicle, which includes a lightweight encryption device and / or a lightweight decryption device, and the electronic device executes the lightweight encryption method and / or lightweight decryption method as described in any one of the above.
[0041] From the above, it can be seen that the lightweight encryption method, decryption method, related equipment and vehicle provided by the present application, the sending end divides the master key into two sequences of odd bits and even bits based on the set permutation function, and completes the initialization by performing multiple sequence permutations on the two sequences to obtain a first initialization sequence and a second initialization sequence, by dividing the plaintext data into multiple plaintext data blocks, comprehensively considering that when performing multiple rounds of encryption on the plaintext data, each plaintext data block is encrypted separately, and multiple sequence permutations are performed to obtain multiple encrypted ciphertext data blocks, by combining the various ciphertext data blocks to obtain ciphertext data, and by multiple rounds of sequence permutations to generate a first label corresponding to the ciphertext data, so that after the receiving end decrypts the ciphertext data, it can use the generated second label to verify whether the decrypted plaintext data is correct and valid.
[0042] Furthermore, the receiving end is similar to the sending end. Based on the permutation function, the initialization is completed by performing multiple sequence permutations on the two sequences decomposed from the master key to obtain a first initialization sequence and a second initialization sequence. The ciphertext data is divided into multiple plaintext data blocks, and comprehensive consideration is given to multiple rounds of decryption of the ciphertext data. Each ciphertext data block is decrypted separately, and multiple sequence permutations are performed to obtain multiple decrypted plaintext data blocks. The plaintext data is obtained by combining the various plaintext data blocks, and a second label corresponding to the plaintext data is generated through multiple rounds of sequence permutations. When the second label is consistent with the first label, it is determined that the decrypted plaintext data is correct and valid. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 This is a first flow chart of a lightweight encryption method according to an embodiment of the present application;
[0045] Figure 2 A second flow chart of the lightweight encryption method according to an embodiment of the present application;
[0046] Figure 3 A schematic diagram of cyclic shift according to an embodiment of the present application;
[0047] Figure 4 A schematic diagram of sequence replacement according to an embodiment of the present application;
[0048] Figure 5 A schematic diagram of the operation of a composite function according to an embodiment of the present application;
[0049] Figure 6 This is a first flow chart of a lightweight decryption method according to an embodiment of the present application;
[0050] Figure 7 A second flow chart of the lightweight decryption method according to an embodiment of the present application;
[0051] Figure 8 This is a schematic diagram of the structure of a lightweight encryption device according to an embodiment of the present application;
[0052] Fig. 9 This is a schematic diagram of the structure of a lightweight decryption device according to an embodiment of the present application;
[0053] Fig.10 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0055] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connecting" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0056] As described in the background technology section, the related encryption methods and decryption methods are still difficult to meet the needs of actual use.
[0057] In the process of implementing this application, the applicant discovered that the main problem with the relevant encryption and decryption methods is that when communicating in a vehicle networking environment, due to the small amount of communication data and the limited computing and storage capabilities of the in-vehicle components, the cryptographic algorithm suitable for the in-vehicle environment needs to pay special attention to lightweight while also ensuring a certain degree of security. In addition, since each frame of data under the CAN bus of the in-vehicle network communication is 8 bits, the cryptographic algorithm is also limited in data length.
[0058] Based on this, one or more embodiments in the present application provide a lightweight encryption method and a lightweight decryption method.
[0059] In an embodiment of the present application, a specific application scenario may be that a vehicle encrypts plaintext data and, as a transmitter, sends the encrypted ciphertext data to a cloud platform. The cloud platform, as a receiver of the ciphertext data, decrypts and verifies the received ciphertext data.
[0060] In some other embodiments, the cloud platform may also encrypt the plaintext data and send the encrypted ciphertext data to the vehicle as a transmitter. The vehicle, as a receiver of the ciphertext data, decrypts and verifies the received ciphertext data.
[0061] In other embodiments, one vehicle may encrypt the plaintext data and send the encrypted ciphertext data to another vehicle as a transmitter. The other vehicle, as a receiver of the ciphertext data, decrypts and verifies the received ciphertext data.
[0062] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0063] refer to Figure 1 A lightweight encryption method according to an embodiment of the present application is applied to a sending end and specifically includes the following steps:
[0064] Step S101: Using a preset permutation function, perform multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of a master key to obtain a first initialization sequence and a second initialization sequence.
[0065] In an embodiment of the present application, the vehicle as the transmitting end first initializes the master key using a preset permutation function, thereby obtaining a first initialization sequence and a second initialization sequence for the next encryption step.
[0066] Specifically, Figure 2 As shown, the sending end divides the master key K into two sequences, and uses a permutation function to perform multiple rounds of P permutations (sequence permutations) on the two divided sequences.
[0067] In this embodiment, the master key K is 128 bits. Figure 2 As shown, the odd bits and even bits are extracted respectively according to the bit sequence, and a 64-bit odd bit sequence X0 and a 64-bit even bit sequence X1 are respectively constructed according to the bit sequence.
[0068] Based on this, a permutation function is used to perform multiple rounds of P permutations on odd-numbered bit sequences and even-numbered bit sequences.
[0069] Specifically, in each round of P permutation, the master key in this round of permutation is cyclically shifted once, and a group of subkeys is constructed, wherein the group of subkeys includes a first subkey, a second subkey and a third subkey, a total of three subkeys of equal length.
[0070] In this embodiment, if Figure 2 As shown, the P permutation in the initialization process is 6 rounds and is represented by P 6 .
[0071] Based on this, a cyclic shift needs to be performed in each round of P permutation. Figure 3 As shown, for 6 rounds of P permutation, 5 cyclic shifts are required to obtain 6 groups of subkeys.
[0072] Specifically, Figure 3 As shown, in the first round of P permutation, the first 48 bits of the 128-bit master key are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey, and the three subkeys obtained are used as a group of subkeys for this round of P permutation, that is, Figure 3 The first subkey K1, the second subkey K2 and the third subkey K3 in.
[0073] Furthermore, each bit of the 128-bit master key is cyclically shifted to the left by 25 bits, and the master key after the current cyclic shift is used as the shift key for the next round of P permutation, that is, Figure 3 The displacement key in 1.
[0074] Furthermore, in the next round of permutation, the first 48 bits of the shift key 1 are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey. The three subkeys obtained are used as a group of subkeys for the permutation of this round P, that is, Figure 3 The first subkey K4, the second subkey K5 and the third subkey K6 in.
[0075] Further, each bit of the 128-bit shift key 1 is cyclically shifted to the left by 25 bits to obtain Figure 3 The shift key 2 used for the next round of P permutation is shown.
[0076] Furthermore, in the third round of permutation, the first 48 bits of the shift key 2 are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey. The three subkeys obtained are used as a group of subkeys for the permutation of round P, that is, Figure 3 The first subkey K7, the second subkey K8 and the third subkey K9 in.
[0077] Further, each bit of the 128-bit shift key 2 is cyclically shifted to the left by 25 bits to obtain Figure 3 The shift key 3 used for the next round of P permutation is shown.
[0078] Furthermore, in the fourth round of permutation, the first 48 bits of the shift key 3 are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey, and the three subkeys obtained are used as a group of subkeys for the permutation of round P, that is, Figure 3 The first subkey K10, the second subkey K11 and the third subkey K12 in.
[0079] Further, each bit of the 128-bit shift key 3 is cyclically shifted to the left by 25 bits to obtain Figure 3 The shift key 4 used for the next round of P permutation is shown.
[0080] Furthermore, in the fifth round of permutation, the first 48 bits of the shift key 4 are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey. The three subkeys obtained are used as a group of subkeys for permutation in this round P, that is, Figure 3 The first subkey K13, the second subkey K14 and the third subkey K15 in.
[0081] Further, each bit of the 128-bit shift key 4 is cyclically shifted to the left by 25 bits to obtain Figure 3 The shift key 5 used for the next round of P permutation is shown.
[0082] Furthermore, in the sixth round of permutation, the first 48 bits of the shift key 4 are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey, and the three subkeys obtained are used as a group of subkeys for permutation in this round P, that is, Figure 3 The first subkey K16, the second subkey K17 and the third subkey K18 in.
[0083] Based on this, during the first round of P permutation, the 64-bit odd bit sequence X0 and the 64-bit even bit sequence X1 are XORed to obtain a first input sequence for inputting into a composite function (F function) in the first round of P permutation, and the subkeys K1, K2 and K3 obtained by the corresponding first round of cyclic shift are used to perform F function operations with the first input sequence of this round of P permutation. After completing the F function operation, the first output sequence of the first round of P permutation is output, the first output sequence of the first round of P permutation is XORed with the odd bit sequence X0 to obtain a first intermediate sequence of the first round of P permutation, and the first output sequence of the first round of P permutation is XORed with the even bit sequence X1 to obtain a second intermediate sequence of the first round of P permutation, wherein the first input sequence, the first output sequence, the first intermediate sequence and the second intermediate sequence are all 64 bits.
[0084] Furthermore, in each subsequent non-first round P replacement, if Figure 4 As shown, in the i-th round of P permutation, the first intermediate sequence L obtained by the previous round of P permutation is i-1 and the second intermediate sequence R i-1 XOR is performed to obtain the first input sequence for inputting into the F function in this round of P permutation. After completing the operation of the F function, the first output sequence of this round of P permutation is output, and the first output sequence of this round of P permutation is combined with the first intermediate sequence L of the previous round of P permutation. i-1 XOR is performed to obtain the first intermediate sequence L of this round of P permutation i , and the first output sequence of this round of P permutation is compared with the second intermediate sequence R of the previous round of P permutation i-1 XOR is performed to obtain the second intermediate sequence R of the first round of P permutation i .
[0085] Further, when a preset P permutation round is reached, in this embodiment, when the sixth round of P permutation is performed, the first intermediate sequence obtained by the round of P permutation is used as the first initialization sequence, and the second intermediate sequence is used as the second initialization sequence.
[0086] In some embodiments of the present application, in each round of P permutation, when the first input sequence and the subkey are used to perform the F function operation, such as Figure 5 As shown, the 64-bit first input sequence is divided into four 16-bit input data blocks according to the bit order: a first input data block P1, a second input data block P2, a third input data block P3 and a fourth input data block P4.
[0087] Further, Figure 5 Taking the first round of P permutation as an example, the subkeys K1, K2 and K3 obtained from the first round of P permutation are used to perform F function operations on P4 input data blocks.
[0088] Specifically, Figure 5 As shown, K1 and P1 are subjected to modular multiplication to obtain the first subsequence;
[0089] Perform modular addition on K2 and P2 to obtain the second subsequence;
[0090] Perform modular addition on K1 and P3 to obtain the third subsequence;
[0091] Perform modular multiplication on K2 and P4 to obtain the fourth subsequence;
[0092] Performing XOR operation on the first subsequence and the third subsequence to obtain a fifth subsequence;
[0093] Performing XOR operation on the second subsequence and the fourth subsequence to obtain a sixth subsequence;
[0094] Perform modular multiplication using K3 and the fifth subsequence to obtain the seventh subsequence;
[0095] Performing modular addition on the sixth subsequence and the seventh subsequence to obtain an eighth subsequence;
[0096] Perform modular multiplication using K3 and the eighth subsequence to obtain the ninth subsequence;
[0097] Performing an XOR operation on the first subsequence and the ninth subsequence to obtain a first output data block R1;
[0098] Performing modular addition on the seventh subsequence and the ninth subsequence to obtain a tenth subsequence;
[0099] Performing an XOR operation on the second subsequence and the tenth subsequence to obtain a second output data block R2;
[0100] Performing an XOR operation on the ninth subsequence and the third subsequence to obtain a third output data block R3;
[0101] The tenth subsequence is XORed with the fourth subsequence to obtain a fourth output data block R4.
[0102] Based on this, R1, R2, R3 and R4 form the first output sequence of 64 bits of this round of P permutation.
[0103] Step S102: divide the plaintext data into multiple plaintext data blocks in the order of bits, perform multiple rounds of encryption using the first initialization sequence and the second initialization sequence, encrypt one plaintext data block in each round of encryption, and perform a sequence permutation, and after multiple rounds of encryption, obtain multiple ciphertext data blocks, a first encryption sequence, and a second encryption sequence, and combine the multiple ciphertext data blocks into ciphertext data.
[0104] In this embodiment, in the process of encrypting plaintext data, the first intermediate sequence and the second intermediate sequence obtained in the aforementioned steps are used to perform multiple rounds of encryption on the disassembled plaintext data blocks to obtain multiple ciphertext data blocks, and the ciphertext data blocks are combined into ciphertext data.
[0105] Specifically, the preset plaintext data is divided into a plurality of plaintext data blocks, wherein the plaintext data may be, for example, a sequence of 128 bits, 64 bits or other lengths, and is divided into n plaintext data blocks according to the bit order, with 8 bits as the length of one plaintext data block, and represented as P1, P2, ..., P n-1 , P n .
[0106] Furthermore, in each round of encryption, a plaintext data block is encrypted, and a sequence permutation is performed after the encryption, that is, the number of encryption rounds is the same as the number of plaintext data blocks, that is, when there are n plaintext data blocks, in order to encrypt each plaintext data block, n rounds of encryption are required, but in the last round of encryption, P permutation is not performed, that is, n-1 P permutations are performed.
[0107] Specifically, Figure 2 As shown, in the first round of encryption, the first initialization sequence obtained in the above steps is XORed with the first plaintext data block P1 to obtain the first ciphertext data block C1 corresponding to P1.
[0108] Furthermore, one P permutation is performed using the first initialization sequence and the second initialization sequence.
[0109] Specifically, before this P permutation, similar to the above steps, each bit of the shifted key 5 after 6 rounds of P permutation is cyclically shifted to the left by 25 bits to obtain the shifted key 6 used for this P permutation.
[0110] Furthermore, in this P permutation, the first 48 bits of the shift key 5 are extracted and divided into three 16-bit sequences in bit order. Each 16-bit sequence is used as a subkey, and the obtained three subkeys are used as a group of subkeys for this P permutation.
[0111] Furthermore, the first initialization sequence and the second initialization sequence are XORed to obtain the first input sequence of this P permutation, the first input sequence of this P permutation and each subkey obtained in this round of encryption are input into the F function, and the operation is performed in the manner of the above steps to obtain the first transition sequence and the second transition sequence of this round of encryption.
[0112] Furthermore, in the non-first round of encryption, the first transition sequence obtained in the above step is XORed with the plaintext data block corresponding to the encryption round. For example, in the n-1th round of encryption, the first transition sequence obtained in the n-2th round of encryption is XORed with the n-1th plaintext data block P n-1 XOR, get the corresponding P n-1 The ciphertext data block C n-1 , in the nth round of encryption, the first transition sequence obtained by the n-1th round of encryption and the nth plaintext data block P n XOR, get the corresponding P n The ciphertext data block C n .
[0113] Furthermore, a P permutation is performed once using the first transition sequence and the second transition sequence obtained in the previous round of encryption.
[0114] Specifically, before this P replacement, similar to the above steps, each bit of the displacement key after P replacement in the previous round of encryption is cyclically shifted to the left by 25 bits to obtain the displacement key used for this P replacement.
[0115] Furthermore, in this P permutation, the first 48 bits of the shift key are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey, and the obtained three subkeys are used as a group of subkeys for this P permutation.
[0116] Furthermore, the first transition sequence and the second transition sequence obtained in the previous round of encryption are XORed to obtain the first input sequence of this P permutation, the first input sequence of this P permutation and each subkey obtained in this round of encryption are input into the F function, and the operation is performed in the manner of the above steps to obtain the first transition sequence and the second transition sequence of this round of encryption.
[0117] Furthermore, if Figure 2 As shown, in the last round of encryption, that is, in the nth round of encryption, after obtaining C n Then, construct the first parameter sequence.
[0118] Among them, the first 63 bits of the first parameter sequence are 0, and the 64th bit is 1.
[0119] Furthermore, the second transition sequence obtained by the n-1th round of encryption is XORed with the first parameter sequence to obtain a second encrypted sequence for generating the first label, and the first transition sequence obtained by the n-1th round of encryption is used as the first encrypted sequence for generating the first label.
[0120] Based on this, the ciphertext data blocks obtained in each round of encryption are combined into ciphertext data.
[0121] Step S103: using the permutation function, perform multiple rounds of sequence permutation on the first encryption sequence and the second encryption sequence to obtain a first label sequence and a second label sequence, and use the first label sequence and the second label sequence to form a first label.
[0122] In this embodiment, based on the first encryption sequence and the second encryption sequence determined in the aforementioned steps, a label corresponding to the ciphertext data can be generated by performing multiple rounds of sequence permutation.
[0123] Specifically, Figure 2 As shown, in each round of P permutation, the displacement key in this round of permutation is cyclically shifted once, and a set of subkeys is constructed.
[0124] In this embodiment, if Figure 2 As shown, the P permutation in the label generation process is 6 rounds and is represented by P 6 .
[0125] Based on this, a cyclic shift needs to be performed in each round of P permutation to obtain a set of subkeys for this round of P permutation.
[0126] In this embodiment, during the first round of P permutation in the process of generating labels, the first encryption sequence and the second encryption sequence are XORed to obtain the first input sequence, and the three subkeys corresponding to the first round of P permutation are used to perform F function operation on the first input sequence of the first round of P permutation. After completing the operation of the F function, the first output sequence of the first round of P permutation is output, the first output sequence of the first round of P permutation is XORed with the first encryption sequence to obtain the first intermediate sequence of the first round of P permutation, and the first output sequence of the first round of P permutation is XORed with the second encryption sequence to obtain the second intermediate sequence of the first round of P permutation.
[0127] Furthermore, in each subsequent non-first round of P permutation, the first intermediate sequence and the second intermediate sequence obtained in the previous round of P permutation are XORed to obtain a first input sequence for inputting into the F function in this round of P permutation; after completing the operation of the F function, the first output sequence of this round of P permutation is output; the first output sequence of this round of P permutation is XORed with the first intermediate sequence of the previous round of P permutation to obtain the first intermediate sequence of this round of P permutation; and the first output sequence of this round of P permutation is XORed with the second intermediate sequence of the previous round of P permutation to obtain the second intermediate sequence of the first round of P permutation.
[0128] Further, when the preset P permutation round is reached, in this embodiment, when the sixth round of P permutation is performed, the first intermediate sequence obtained by the round of P permutation is used as the first label sequence T1, and the second intermediate sequence is used as the second label sequence T2.
[0129] Based on this, the obtained first tag sequence and the second tag sequence are synthesized into a first tag T1.
[0130] Step S104: Send the ciphertext data and the first tag to a receiving end.
[0131] In this embodiment, the ciphertext data and the first tag obtained in the above steps are sent to the receiving end at the same time, so that the receiving end can use the first tag to verify whether the ciphertext data is correct.
[0132] It can be seen that in the lightweight decryption method of the embodiment of the present application, the sender divides the master key into two sequences of odd bits and even bits based on the set permutation function, and completes the initialization by performing multiple sequence permutations on the two sequences to obtain a first initialization sequence and a second initialization sequence, and divides the plaintext data into multiple plaintext data blocks, comprehensively considering that when performing multiple rounds of encryption on the plaintext data, each plaintext data block is encrypted separately, and multiple sequence permutations are performed to obtain multiple encrypted ciphertext data blocks, and ciphertext data is obtained by combining the various ciphertext data blocks, and a first label corresponding to the ciphertext data is generated through multiple rounds of sequence permutations, so that after the receiving end decrypts the ciphertext data, it can use the generated second label to verify whether the decrypted plaintext data is correct and valid.
[0133] refer to Figure 6 A lightweight decryption method according to an embodiment of the present application is applied to a receiving end and specifically includes the following steps:
[0134] Step S601: receiving ciphertext data and a first tag from the transmitting end, and performing multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of a master key using a preset permutation function to obtain a third initialization sequence and a fourth initialization sequence.
[0135] In this embodiment, the cloud platform as the receiving end receives the ciphertext data P and the first tag T1 sent by the vehicle, and Figure 7 As shown, in the same manner as step S101, the master key is initialized using a preset permutation function, thereby obtaining a third initialization sequence X2 and a fourth initialization sequence X3 for the next decryption step.
[0136] Step S602: divide the ciphertext data into multiple ciphertext data blocks in the order of bits, perform multiple rounds of decryption using the third initialization sequence and the fourth initialization sequence, decrypt one ciphertext data block in each round of decryption, and perform a sequence permutation, and obtain multiple plaintext data blocks, a first decryption sequence, and a second decryption sequence after multiple rounds of decryption, and combine the multiple plaintext data blocks into plaintext data.
[0137] In this embodiment, based on the first initialization sequence and the second initialization sequence obtained in the aforementioned steps, multiple rounds of decryption are performed on the disassembled ciphertext data blocks to obtain multiple plaintext data blocks, and the plaintext data blocks are combined into plaintext data.
[0138] Specifically, the received ciphertext data is divided into a plurality of ciphertext data blocks, which are divided into n ciphertext data blocks according to the bit order, with 8 bits as the length of one ciphertext data block, and are represented as C1, C2, ..., C n-1 , Cn .
[0139] Furthermore, in each round of decryption, one ciphertext data block is decrypted, and a sequence permutation is performed after decryption, that is, the number of decryption rounds is the same as the number of ciphertext data blocks, that is, when there are n ciphertext data blocks, n rounds of decryption are required to decrypt each ciphertext data block, but in the last round of decryption, P permutation is not performed, that is, n-1 P permutations are performed.
[0140] Specifically, Figure 7 As shown, in the first round of decryption, the third initialization sequence obtained in the above steps is XORed with the first ciphertext data block C1 to obtain the first plaintext data block P1 corresponding to C1.
[0141] Furthermore, one P permutation is performed using the third initialization sequence and the fourth initialization sequence.
[0142] Specifically, before this P permutation, similar to the above steps, each bit of the shifted key 5 after 6 rounds of P permutation is cyclically shifted to the left by 25 bits to obtain the shifted key 6 used for this P permutation.
[0143] Furthermore, in this P permutation, the first 48 bits of the shift key 5 are extracted and divided into three 16-bit sequences in bit order. Each 16-bit sequence is used as a subkey, and the obtained three subkeys are used as a group of subkeys for this P permutation.
[0144] Furthermore, the third initialization sequence and the fourth initialization sequence are XORed to obtain the second input sequence of this P permutation, the second input sequence of this P permutation and each sub-key obtained in this round of decryption are input into the F function, and the operation is performed in the manner of the above steps to obtain the third transition sequence and the fourth transition sequence of this round of decryption.
[0145] Furthermore, in a non-first round of decryption, the third transition sequence obtained in the above steps is XORed with the ciphertext data block corresponding to the decryption round. For example, in the n-1th round of decryption, the third transition sequence obtained in the n-2th round of decryption is XORed with the n-1th ciphertext data block C n-1 XOR, get the corresponding C n-1 The plaintext data block P n-1 , in the nth round of decryption, the n-1th round of decryption obtains the third transition sequence and the nth ciphertext data block C n XOR, get the corresponding C n The plaintext data block P n .
[0146] Furthermore, one P permutation is performed using the third transition sequence and the fourth transition sequence obtained in the previous round of decryption.
[0147] Specifically, before this P replacement, similar to the above steps, each bit of the displacement key after P replacement in the previous round of decryption is cyclically shifted to the left by 25 bits to obtain the displacement key used for this P replacement.
[0148] Furthermore, in this P permutation, the first 48 bits of the shift key are extracted and divided into three 16-bit sequences according to the bit order. Each 16-bit sequence is used as a subkey, and the obtained three subkeys are used as a group of subkeys for this P permutation.
[0149] Furthermore, the third transition sequence and the fourth transition sequence obtained in the previous round of decryption are XORed to obtain the second input sequence of this P permutation, the second input sequence of this P permutation and each subkey obtained in this round of decryption are input into the F function, and the operation is performed in the manner of the above steps to obtain the third transition sequence and the fourth transition sequence of this round of decryption.
[0150] Furthermore, if Figure 7 As shown, in the last round of decryption, that is, in the nth round of decryption, after obtaining P n Then, construct the second parameter sequence.
[0151] Among them, the first 63 bits of the second parameter sequence are 0, and the 64th bit is 1.
[0152] Furthermore, the fourth transition sequence obtained by the n-1th round of decryption is XORed with the second parameter sequence to obtain a first decryption sequence for generating the second label, and the third transition sequence obtained by the n-1th round of decryption is used as the second decryption sequence for generating the first label.
[0153] Based on this, the plaintext data blocks obtained in each round of decryption are combined into plaintext data P.
[0154] Step S603: Use the permutation function to perform multiple rounds of sequence permutation on the first decryption sequence and the second decryption sequence to obtain a third label sequence and a fourth label sequence, and use the third label sequence and the fourth label sequence to form a second label. In response to determining that the second label is consistent with the first label, the plaintext data is determined to be authentic.
[0155] In this embodiment, based on the first decryption sequence and the second decryption sequence determined in the above steps, a label corresponding to the plaintext data can be generated by performing multiple rounds of sequence permutation.
[0156] Specifically, Figure 7 As shown, in each round of P permutation, the displacement key in this round of permutation is cyclically shifted once, and a set of subkeys is constructed.
[0157] In this embodiment, if Figure 7 As shown, the label generation process is similar to the aforementioned step S103, where P is replaced by 6 rounds and is represented as P 6 .
[0158] In this embodiment, during the first round of P permutation in the process of generating labels, the first decryption sequence and the second decryption sequence are XORed to obtain the first input sequence, and the three subkeys corresponding to the first round of P permutation are used to perform F function operation on the first input sequence of the first round of P permutation. After completing the operation of the F function, the first output sequence of the first round of P permutation is output, the first output sequence of the first round of P permutation is XORed with the first decryption sequence to obtain the first intermediate sequence of the first round of P permutation, and the first output sequence of the first round of P permutation is XORed with the second decryption sequence to obtain the second intermediate sequence of the first round of P permutation.
[0159] Furthermore, in each subsequent non-first round of P permutation, the first intermediate sequence and the second intermediate sequence obtained in the previous round of P permutation are XORed to obtain a first input sequence for inputting into the F function in this round of P permutation; after completing the operation of the F function, the first output sequence of this round of P permutation is output; the first output sequence of this round of P permutation is XORed with the first intermediate sequence of the previous round of P permutation to obtain the first intermediate sequence of this round of P permutation; and the first output sequence of this round of P permutation is XORed with the second intermediate sequence of the previous round of P permutation to obtain the second intermediate sequence of the first round of P permutation.
[0160] Further, when the preset P permutation round is reached, in this embodiment, when the sixth round of P permutation is performed, the first intermediate sequence obtained by the round of P permutation is used as the third label sequence, and the second intermediate sequence is used as the fourth label sequence.
[0161] Based on this, the obtained third tag sequence and the fourth tag sequence are combined into a second tag.
[0162] Furthermore, the first label and the second label are compared to see if they are consistent. If they are consistent, it is considered that the current plaintext data is correct. If they are inconsistent, it is considered that the current plaintext data is incorrect and may have been tampered with.
[0163] It can be seen that the lightweight decryption method of the embodiment of the present application is similar to that of the sending end. Based on the permutation function, the initialization is completed by performing multiple sequence permutations on the two sequences decomposed from the master key to obtain a first initialization sequence and a second initialization sequence. The ciphertext data is divided into multiple plaintext data blocks, and comprehensive consideration is given to performing multiple rounds of decryption on the ciphertext data. Each ciphertext data block is decrypted separately, and multiple sequence permutations are performed to obtain multiple plaintext data blocks after decryption. The plaintext data is obtained by combining the various plaintext data blocks, and a second label corresponding to the plaintext data is generated through multiple rounds of sequence permutations. When the second label is consistent with the first label, it is determined that the decrypted plaintext data is correct and valid.
[0164] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0165] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0166] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the embodiment of the present application also provides a lightweight encryption device.
[0167] refer to Figure 8 , the lightweight encryption device comprises: a first initialization module 801, an encryption module 802, a first label generation module 803 and a sending module 804;
[0168] The first initialization module 801 is configured to perform multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of the master key using a preset permutation function to obtain a first initialization sequence and a second initialization sequence;
[0169] The encryption module 802 is configured to divide the plaintext data into a plurality of plaintext data blocks according to the order of bits, perform multiple rounds of encryption using the first initialization sequence and the second initialization sequence, encrypt a plaintext data block in each round of encryption, and perform a sequence permutation, obtain a plurality of ciphertext data blocks, a first encryption sequence and a second encryption sequence after multiple rounds of encryption, and combine the plurality of ciphertext data blocks into ciphertext data;
[0170] The first label generation module 803 is configured to perform multiple rounds of sequence permutation on the first encryption sequence and the second encryption sequence using the permutation function to obtain a first label sequence and a second label sequence, and use the first label sequence and the second label sequence to form a first label;
[0171] The sending module 804 is configured to send the ciphertext data and the first tag to a receiving end.
[0172] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the embodiment of the present application also provides a lightweight decryption device.
[0173] refer to Fig. 9 , the lightweight decryption device comprises: a second initialization module 901, a decryption module 902, and a second label generation module 903;
[0174] The second initialization module 901 is configured to receive the ciphertext data and the first tag from the transmitting end, and perform multiple rounds of sequence permutation on the sequence composed of odd bits and the sequence composed of even bits of the master key using a preset permutation function to obtain a third initialization sequence and a fourth initialization sequence;
[0175] The decryption module 902 is configured to divide the ciphertext data into a plurality of ciphertext data blocks according to the order of bits, perform multiple rounds of decryption using the third initialization sequence and the fourth initialization sequence, decrypt one ciphertext data block in each round of decryption, and perform a sequence permutation, obtain a plurality of plaintext data blocks, a first decryption sequence and a second decryption sequence after multiple rounds of decryption, and combine the plurality of plaintext data blocks into plaintext data;
[0176] The second label generation module 903 is configured to use the permutation function to perform multiple rounds of sequence permutations on the first decryption sequence and the second decryption sequence to obtain a third label sequence and a fourth label sequence, and use the third label sequence and the fourth label sequence to form a second label. In response to determining that the second label is consistent with the first label, it is determined that the plaintext data is correct.
[0177] For the convenience of description, the above devices are described in terms of functions and are divided into various modules. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0178] The device of the above embodiment is used to implement the corresponding lightweight encryption method and lightweight decryption method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0179] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, an embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the lightweight encryption method and the lightweight decryption method as described in any of the above embodiments are implemented.
[0180] Fig.10 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0181] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0182] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solution provided in the embodiment of the present application is implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0183] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0184] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0185] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0186] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiment of the present application, and does not necessarily include all the components shown in the figure.
[0187] The device of the above embodiment is used to implement the corresponding lightweight encryption method and lightweight decryption method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0188] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a vehicle, which includes a lightweight encryption device and / or a lightweight decryption device.
[0189] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the lightweight encryption method and lightweight decryption method described in any of the above embodiments.
[0190] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0191] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the lightweight encryption method and lightweight decryption method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0192] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the lightweight encryption method and lightweight decryption method as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0193] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0194] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0195] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0196] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the present application.
Claims
1. A lightweight encryption method, characterized in that: Applied to the sending end; The method comprises: Using a preset permutation function, multiple rounds of sequence permutation are performed on a sequence consisting of odd-numbered bits and a sequence consisting of even-numbered bits of the master key to obtain a first initialization sequence and a second initialization sequence; Divide the plaintext data into multiple plaintext data blocks according to the order of bits, perform multiple rounds of encryption using the first initialization sequence and the second initialization sequence, encrypt one plaintext data block in each round of encryption, and perform a sequence permutation, obtain multiple ciphertext data blocks, the first encryption sequence and the second encryption sequence after the multiple rounds of encryption, and combine the multiple ciphertext data blocks into ciphertext data; Using the permutation function, performing multiple rounds of sequence permutation on the first encryption sequence and the second encryption sequence to obtain a first label sequence and a second label sequence, and using the first label sequence and the second label sequence to form a first label; The ciphertext data and the first tag are sent to a receiving end.
2. The method according to claim 1, characterized in that: The performing multiple rounds of sequence permutation on a sequence consisting of odd-numbered bits and a sequence consisting of even-numbered bits of the master key comprises: In the first round of permutation, the first multiple bits of the master key are used to construct multiple subkeys of the first round of permutation, and the master key is cyclically shifted once to obtain the displacement key in the next round of permutation. In each non-first round of permutation, the first multiple bits of the displacement key in this round of permutation are used to construct multiple subkeys of this round of permutation, and the displacement key is cyclically shifted once to obtain the displacement key of the next round of permutation. In the first round of permutation, the sequence consisting of the odd-numbered bits and the sequence consisting of the even-numbered bits are XORed to obtain the first input sequence of the first round of permutation, and in each non-first round of permutation, the first intermediate sequence and the second intermediate sequence obtained in the previous round of permutation are XORed to obtain the first input sequence of the current round of permutation; In each permutation round, the first input sequence and the multiple subkeys are used to perform a composite function operation to obtain a first output sequence of the permutation round, and the first output sequence is used to perform an XOR operation with the first intermediate sequence and the second intermediate sequence of the previous permutation round to obtain the first intermediate sequence and the second intermediate sequence of the permutation round; In response to reaching a preset permutation round, the first intermediate sequence and the second intermediate sequence obtained in the last round of permutation are respectively used to determine a first initialization sequence and a second initialization sequence.
3. The method according to claim 2, characterized in that The multiple subkeys replaced in this round include the first subkey, the second subkey and the third subkey; The using the first input sequence and the multiple subkeys to perform a composite function operation to obtain a first output sequence of this round of permutation includes: dividing the first input sequence into a first input data block, a second input data block, a third input data block and a fourth input data block; Performing modular multiplication using the first subkey and the first input data block to obtain a first subsequence, performing modular addition using the second subkey and the second input data block to obtain a second subsequence, performing modular addition using the first subkey and the third input data block to obtain a third subsequence, and performing modular multiplication using the second subkey and the fourth input data block to obtain a fourth subsequence; performing an XOR operation on the first subsequence and the third subsequence to obtain a fifth subsequence, performing an XOR operation on the second subsequence and the fourth subsequence to obtain a sixth subsequence, performing modular multiplication on the third subkey and the fifth subsequence to obtain a seventh subsequence, performing modular addition on the sixth subsequence and the seventh subsequence to obtain an eighth subsequence, performing modular multiplication on the third subkey and the eighth subsequence to obtain a ninth subsequence, and performing modular addition on the seventh subsequence and the ninth subsequence to obtain a tenth subsequence; Performing an XOR operation on the first subsequence and the ninth subsequence to obtain a first output data block, performing an XOR operation on the second subsequence and the tenth subsequence to obtain a second output data block, performing an XOR operation on the ninth subsequence and the third subsequence to obtain a third output data block, and performing an XOR operation on the tenth subsequence and the fourth subsequence to obtain a fourth output data block; The first output data block, the second output data block, the third output data block and the fourth output data block are combined into the first output sequence.
4. The method according to claim 1, characterized in that The process of encrypting a plaintext data block in each round of encryption and performing a sequence permutation includes: In the first round of encryption, the first initialization sequence is XORed with the first plaintext data block to obtain the corresponding ciphertext data block, and the ciphertext data block obtained in this round of encryption is sequence-permuted with the second initialization sequence to obtain the first transition sequence and the second transition sequence of this round of encryption; When it is not the first round of encryption, the first transition sequence obtained from the previous round of encryption is XORed with the plaintext data blocks of the corresponding order to obtain the corresponding ciphertext data blocks, and the ciphertext data blocks obtained from the current round of encryption are sequence-permuted with the second transition sequence obtained from the previous round of encryption to obtain the first transition sequence and the second transition sequence of the current round of encryption.
5. A lightweight decryption method, characterized in that: Applied to the receiving end; The method comprises: Receiving the ciphertext data and the first tag from the transmitting end, and performing multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of the master key using a preset permutation function to obtain a third initialization sequence and a fourth initialization sequence; Dividing the ciphertext data into a plurality of ciphertext data blocks according to the order of bits, performing multiple rounds of decryption using the third initialization sequence and the fourth initialization sequence, decrypting one ciphertext data block in each round of decryption, and performing a sequence permutation, obtaining a plurality of plaintext data blocks, a first decryption sequence, and a second decryption sequence after multiple rounds of decryption, and combining the plurality of plaintext data blocks into plaintext data; Using the permutation function, multiple rounds of sequence permutation are performed on the first decryption sequence and the second decryption sequence to obtain a third label sequence and a fourth label sequence, and the third label sequence and the fourth label sequence are used to form a second label. In response to determining that the second label is consistent with the first label, it is determined that the plaintext data is correct.
6. A lightweight encryption device, characterized in that: include: A first initialization module, an encryption module, a first label generation module and a sending module; The first initialization module is configured to perform multiple rounds of sequence permutation on a sequence consisting of odd bits and a sequence consisting of even bits of the master key using a preset permutation function to obtain a first initialization sequence and a second initialization sequence; The encryption module is configured to divide the plaintext data into a plurality of plaintext data blocks according to the order of bits, perform multiple rounds of encryption using the first initialization sequence and the second initialization sequence, encrypt a plaintext data block in each round of encryption, and perform a sequence permutation, obtain a plurality of ciphertext data blocks, a first encryption sequence and a second encryption sequence after multiple rounds of encryption, and combine the plurality of ciphertext data blocks into ciphertext data; The first label generation module is configured to perform multiple rounds of sequence permutation on the first encryption sequence and the second encryption sequence using the permutation function to obtain a first label sequence and a second label sequence, and use the first label sequence and the second label sequence to form a first label; The sending module is configured to send the ciphertext data and the first tag to a receiving end.
7. A lightweight decryption device, characterized in that: include: a second initialization module, a decryption module, and a second label generation module; The second initialization module is configured to receive the ciphertext data and the first tag from the transmitting end, and use a preset permutation function to perform multiple rounds of sequence permutations on a sequence consisting of odd bits and a sequence consisting of even bits of the master key to obtain a third initialization sequence and a fourth initialization sequence; The decryption module is configured to divide the ciphertext data into a plurality of ciphertext data blocks according to the order of bits, perform multiple rounds of decryption using the third initialization sequence and the fourth initialization sequence, decrypt one ciphertext data block in each round of decryption, and perform a sequence permutation, obtain a plurality of plaintext data blocks, a first decryption sequence and a second decryption sequence after multiple rounds of decryption, and combine the plurality of plaintext data blocks into plaintext data; The second label generation module is configured to use the permutation function to perform multiple rounds of sequence permutations on the first decryption sequence and the second decryption sequence to obtain a third label sequence and a fourth label sequence, and use the third label sequence and the fourth label sequence to form a second label. In response to determining that the second label is consistent with the first label, it is determined that the plaintext data is correct.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
9. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 5.
10. A vehicle, characterized in that: It comprises the lightweight encryption device as claimed in claim 6 and / or the lightweight decryption device as claimed in claim 7.
Citation Information
Patent Citations
Implementation method of a lightweight block cipher algorithm Wheel
CN109768854A
Symmetric key encryption algorithm
CN112118097A
Method and system for quickly encrypting mass data
CN114826558A
Cited By
Data processing method and device for data management in iron and steel industry
CN120281588A
Data processing method and device for data governance in the steel industry
CN120281588B
