A DES encryption method
Through the multi-layer encryption and decryption process, combining HMAC-SHA512 and hash algorithm to generate multiple keys, the problem of insufficient security of existing DES encryption algorithms is solved, and the encryption security and attack resistance are significantly improved.
Patent Information
- Application Number
- CN202410278224.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-03-12
AI Technical Summary
Due to the small key space and simple algorithm structure, the existing DES encryption algorithm is easily attacked by brute force cracking and differential linear cryptographic analysis, and the key generation depends on the hierarchical results, resulting in insufficient encryption security.
Using a multi-layer encryption and decryption process, the key string is generated by extracting multiple DES keys from a longer key string and using the HMAC-SHA512 algorithm and hash algorithm, combining the user salt value and global salt value, Iterative computing is used to generate multiple keys, enhancing the randomness and security of the keys.
It significantly improves the security of DES encryption, increases the difficulty of fighting exhaustive cracking and attacks, enhances the system's ability to resist man-in-the-middle attacks, prevents rainbow table attacks, and ensures data integrity and security.
Smart Images

Figure CN117978365B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a DES encryption method. Background Art
[0002] With the development of the Internet, data security issues have received increasing attention. Data is at risk of being stolen and leaked during network transmission and terminal storage. How to reliably encrypt important data has become a key technical problem. For all types of data, symmetric encryption algorithms with strong encryption strength are needed to protect data security. The DES algorithm has a relatively simple algorithm structure and a 56-bit key length that is insufficient today with the increased computing power of computers. It can no longer meet the security requirements of data encryption. How to enhance the security strength of the DES algorithm while maintaining algorithm efficiency is one of the current research hotspots.
[0003] The DES algorithm uses a 56-bit key and encrypts 64-bit packet data through 16 rounds of Feistel network iterations. Due to the small key space, it is easy to obtain the key through brute force. In addition, simple Feistel structures and linear transformations are also vulnerable to differential and linear cryptanalysis attacks.
[0004] In the related art, for example, Chinese patent document CN117407906A provides a software development data security encryption method based on the DES algorithm, including: obtaining software development data, preprocessing the data, block preprocessing of the data, achieving encryption level mixing of the data, generating a key according to the encrypted data after the level mixing, and further ensuring the security of data encryption by ensuring the security of key generation, and encrypting data according to the key. However, the generation of the key of this scheme only depends on the grading result of the encrypted data, which is easy to be predicted, so the encryption security needs to be further improved. Summary of the invention
[0005] 1. Technical issues to be solved
[0006] In view of the problem of low security of DES encryption in the prior art, the present application provides a DES encryption method, which improves the security of DES encryption through multi-layer encryption and decryption.
[0007] 2. Technical solution
[0008] The purpose of this application is achieved through the following technical solutions.
[0009] The embodiment of the present specification provides a DES encryption method, including: obtaining data to be encrypted; obtaining a binary bit string with a length of N bits as a key string; extracting a key string of M1 bits from bits N1 to N2 of the generated key string as a first DES key; extracting a key string of M2 bits from bits N3 to N4 of the generated key string as a second DES key; extracting a key string of M3 bits from bits N5 to N6 of the generated key string as a third DES key; using the first DES key to perform DES algorithm encryption on the data to be encrypted to obtain first-stage encrypted data; using the second DES key to perform DES algorithm decryption on the first-stage encrypted data to obtain second-stage decrypted data; using the third DES key to perform DES algorithm encryption on the second-stage decrypted data to obtain final encrypted data.
[0010] Among them, the key string refers to a string of binary bit data required by the data encryption algorithm for encryption / decryption. The string is usually composed of 0 and 1, and the length is the key length required by the algorithm. In this application, the key string is the binary key required by the DES algorithm. Its length N is 56 bits, which is equivalent to the key length of the DES algorithm. The key string will be used in subsequent DES algorithm encryption and decryption calculations. The acquisition of the key string can be achieved in a variety of ways, such as user input, random generation, derivation based on passwords and salt values, etc. In this solution, a 56-bit key string is generated by HMAC iteration based on the user password and salt value. The key string exists in the form of a binary bit stream. In actual use, it can be converted into a common hexadecimal representation. For example, a 56-bit key can be represented as 14 hexadecimal characters.
[0011] Specifically, a long key string is divided into several segments and extracted as keys used in different stages of the DES algorithm. The starting and ending bits of each key segment and the length to be extracted are defined respectively. The first key is from N1 to N2 bits and has a length of M1 bits. The positions and lengths of the second and third keys are defined in the same way. The first DES key is used for initial encryption, the second DES key is used for intermediate decryption, and the third DES key is used for re-encryption. The three keys play different roles in different stages of the algorithm. Using different keys for multiple rounds of encryption and decryption can effectively improve the security strength against exhaustive cracking. The length parameter of each key can be adjusted as needed to increase the difficulty of cryptanalysis. The number of keys can also be increased to perform more rounds of encryption and decryption. More specifically, N1 to N6 represent the starting and ending bits of each key fragment in the entire key string. The total length of the key string is N bits, for example, it can be set to 512 bits. According to the structure of triple DES, three 56-bit DES keys need to be determined. To provide a certain security margin, each subkey can be set to 64 bits, that is, M1, M2, and M3 are 64. Then a feasible value scheme for N1 to N6 is: N1 = 1, N2 = 64, extract the 1st to 64th bits as the first 64-bit key, N3 = 129, N4 = 192, extract the 129th to 192th bits as the second 64-bit key, N5 = 257, N6 = 320, extract the 257th to 320th bits as the third 64-bit key, and there is a certain interval between the key fragments to increase the difficulty of parsing. The three key fragments do not overlap and can completely cover the original key.
[0012] Among them, the DES key is a set of binary bit strings used by the Data Encryption Standard (DES) algorithm, which is one of the important input parameters of the DES algorithm. In this application, "key" means that this group of bits is used to control the encryption / decryption calculation process and results of the DES algorithm. "DES" means that it is a key dedicated to the DES algorithm. The first DES key is a bit string extracted from the generated key string, which will be used as the input key of the DES algorithm to perform preliminary DES encryption on the data and output the encryption result of the first stage. The DES key length is fixed to 64 bits, usually represented by 16 characters in hexadecimal. The first DES key in this scheme is the extracted 64-bit string. The first DES key determines the result of the initial DES encryption operation and is an important part of ensuring the overall multi-round encryption security.
[0013] Specifically, a triple DES structure is adopted, and three rounds of encryption and decryption operations are performed. Each round uses a different DES key, namely the first DES key, the second DES key, and the third DES key. The first round uses the first key for encryption, the second round uses the second key for decryption, and the third round uses the third key for encryption. The input data of each round is the output data of the previous round. The input of the first round is the original data to be encrypted, the input of the second round is the encrypted data of the first round, and the input of the third round is the decrypted data of the second round. After three rounds of calculation, the encrypted data of the third round is output as the final encryption result. The application of multiple rounds of calculations and different keys can effectively resist exhaustive cracking and enhance the algorithm's anti-attack ability.
[0014] Furthermore, a key string is generated, including: setting a user salt value and a global salt value, the user salt value represents a unique user identifier; the global salt value is used for system encryption; the user salt value and the global salt value are combined in series to serve as a combined salt value; the HMAC-SHA512 algorithm is used as a pseudo-random function; and according to the combined salt value and the pseudo-random function, an N-bit binary bit string is iteratively calculated to generate the key string.
[0015] Among them, the user salt value is a random bit string that represents the unique identification of each user, which is used for salting the user password. The global salt value is a random bit string generated by the system, which is used for salting all user passwords. In this application, the user salt value and the global salt value are first connected, and then together with the user-entered password, a key for encryption / decryption is generated. The user salt value is used to generate a user-specific key; the global salt value improves the randomness and global uniqueness of the key. The user salt value can be generated using the user ID and a random number; the global salt value is generated on the server side using a cryptographically secure pseudo-random number generator. The user salt value and the global salt value are equal in length, which is half the length of the key string, such as 256 bits.
[0016] Specifically, serial combination refers to directly concatenating two strings together to generate a new string. Assume that the user salt value is UV and the global salt value is GV, and both are n bits long. Then the steps to concatenate them to generate the combined salt value CV are: convert UV and GV into bit strings, and get: UV = uv1uv2...uvn, GV = gv1gv2...gvn, directly concatenate the above two bit strings: CV = uv1uv2...uvngv1gv2...gvn, and the length of the combined salt value CV is 2n bits. Serial concatenation can combine user information and global information to generate a bit string input for key derivation. The serial operation is simple and efficient, and it also includes user-defined data and global random number components.
[0017] Among them, the HMAC-SHA512 algorithm, which is a hash message authentication code algorithm, is constructed based on the SHA-512 hash function and a shared key, and can generate a 512-bit MAC authentication tag. A pseudo-random function is a type of function that generates a seemingly random output based on a specific input by determining an algorithm. It can be used to generate a seemingly random bit sequence. In this application, the HMAC-SHA512 algorithm is used as a pseudo-random function, and a longer random bit string is iteratively calculated based on the input combined salt value as the key of the DES algorithm. Each iteration uses the last output and the combined salt value as new inputs, and outputs a new result after HMAC-SHA512 calculation, and finally generates a random key string of the required length. The HMAC-SHA512 algorithm has a simple and efficient structure, and as a pseudo-random function, it can quickly generate high-quality random numbers.
[0018] Specifically, a combined salt value and a pseudo-random function are used to iteratively generate an N-bit key string, and a cyclic iteration method is used to repeatedly call a pseudo-random function to generate a key string. The input of each iteration is the previous output result and the combined salt value. The first round of iteration input is only the combined salt value, and the output is the initial key. HMAC-SHA512 is used as the iterative pseudo-random function. The previous round key and the combined salt value are used as input, HMAC-SHA512 is run, and a new key is output. The number of rounds is determined according to the required key string length, and the output length of each round is fixed. After a set number of iterations, the output of each round is concatenated to generate the final N-bit key string. Iterative calculation can use simple functions to generate longer complex keys and improve randomness.
[0019] Furthermore, the length of the user salt value and the global salt value are equal, which is half the length of the key string; the lengths of M1, M2 and M3 are equal. Specifically, the two salt values are made equal in length, each accounting for half of the key string, so that they have the same influence in the final generated key string. If the proportion of a salt value is too large, more information of that part will be leaked, reducing security. The two parts are of equal length, and the randomness of each part can be fully utilized, complementing each other to produce a more random key. Equal length can simplify the splicing process of the two, without the need for complex interleaving combinations. Equal length can improve the speed and efficiency of concatenation and subsequent operations.
[0020] Specifically, the master key is divided into multiple segments with equal lengths to make the division clear and facilitate subsequent grouping and combination. The data is divided into multiple groups with the same length for easy processing and correspondence. The data and key lengths of each group are the same, which can match computing resources and improve computing efficiency. The lengths of different key groups are consistent, which can increase the degree of confusion that is difficult to analyze. Symmetrical and consistent processing between groups is conducive to algorithm debugging and verifying data flow. Multiple keys are grouped with equal lengths to enhance the algorithm's ability to resist differential analysis.
[0021] Further, the SHA3 algorithm is used to perform a hash operation on the encrypted data to obtain a hash value H1; the SM3 algorithm is used to perform a hash operation on the encrypted data to obtain a hash value H2; the hash value H1 and the hash value H2 are combined in series to serve as the encrypted data to be encrypted.
[0022] Among them, SHA3 is a secure hash algorithm, released by NIST in 2015. It is the successor of the SHA-2 algorithm family and provides stronger resistance to exhaustive cracking. SHA stands for Secure Hash Algorithm, and 3 indicates that this is the third version of the SHA algorithm. The SHA3 algorithm uses permutation and absorption operations to iteratively compress the input message and generate a fixed-length summary as output. In this application, the SHA3 algorithm is used to perform a hash operation on the encrypted data and output a secure hash value H1. The hash operation is used to enhance data integrity protection and generate input for subsequent key derivation.
[0023] Among them, the SM3 algorithm is a hash algorithm independently developed by China, with an output hash value length of 256 bits and strong anti-exhaustive cracking ability. SM3 stands for National Secret Algorithm No. 3, which is a hash algorithm in the standard system of China's national secret algorithm. SM3 uses the iterative operation structure of compression function and modulo 32 operation to generate a message digest. In this application, the SM3 algorithm is used to perform a hash operation on the encrypted data and output a 256-bit hash value H2. Combined with the hash value of SHA3, data integrity protection is enhanced, and input is generated for subsequent key derivation.
[0024] Furthermore, according to the combined salt value and the pseudo-random function, an N-bit binary bit string is iteratively calculated to generate a key string, including: concatenating the combined salt value and the encrypted data to be encrypted to generate a bit string P0; taking the bit string P0 as input and using the HMAC-SHA512 algorithm to generate a binary bit string O0; obtaining the first N bits in O0 as the initial key K0.
[0025] Specifically, the encrypted data refers to the data to be encrypted after the double hash operation of SHA3 and SM3. The combined salt value and the encrypted data are directly concatenated into a new bit string. Assume that the length of the combined salt value is n bits and the length of the encrypted data is m bits. Then: convert the combined salt value into a bit string S with a length of n bits. Convert the encrypted data into a bit string D with a length of m bits. Concatenate the two bit strings, P0=S||D. The final combined bit string P0 is n+m bits long. P0 is used as the input of the pseudo-random function for subsequent iterative key generation. The concatenation operation is simple and efficient, combining a fixed salt value with changing data to improve the randomness of the generated key.
[0026] Specifically, input the bit string P0, which is the concatenated bit string of the combined salt value and the encrypted data generated in the previous step. Use HMAC-SHA512 as the pseudo-random function. The HMAC structure provides the introduction of the key, and SHA512 generates strong random numbers. Initialize a 512-bit key K. Calculate HMAC-SHA512 (K, P0) with P0 and K as input. Extract 512 bits from the output HMAC value as the bit string O0. The length of O0 is fixed to 512 bits and will be used as part of the input for the next round of iterations. Use the cryptographic security properties of HMAC-SHA512 to generate high-strength random numbers.
[0027] Specifically, O0 is a 512-bit random binary bit string generated by the HMAC-SHA512 algorithm. Take the first N bits from the beginning of O0 as the initial key K0. N can be the key length of the AES algorithm, such as 128, 192 or 256 bits. For example, when N=256, take the first 256 bits of O0 as K0. K0 will be used as the initial value when the complete key is generated in subsequent iterations. Extracting a substring from the high-strength random number O0 as the key seed can obtain better key randomness.
[0028] Further, according to the combined salt value, the pseudo-random function and the data to be encrypted, iterative calculation is performed to generate an N-bit binary bit string as the key string, which also includes: taking the initial key K0 as input; in the i-th iteration, the N-bit key E generated in the i-1-th iteration is used as the key string. i-1 As input; concatenate the key Ei-1 and the combined salt value to generate the bit string E i ; Transform the bit string E i As input, use the HMAC-SHA512 algorithm to generate a binary bit string O i ; Get O i The first N bits in are used as the key K for the i-th time. i ; Repeat the iterative calculation until the preset number of iterations is reached to generate the final N-bit key string.
[0029] Specifically, the initial input is the N-bit initial key K0 obtained earlier as the input for the first iteration. The loop iteration is repeated for multiple rounds, and the input for each round is the output key and the combined salt value of the previous round. In the first round, the input is the initial key K0 and the combined salt value, which are concatenated to generate the bit string E1. In the intermediate rounds, the input for the i-th round is the output key E of the i-1th round. i-1 and the combined salt value, and concatenate to generate the bit string E i . In series mode, you can directly splice or splice the bits of the combined salt value at intervals. Output the key. The output of each round of iteration is an N-bit key with the same length. Termination condition. When the predetermined number of iterations is reached, the key of the last round is output as the final key.
[0030] Specifically, input bit string E i The input of each iteration is the concatenated bit string E of the previous round's N-bit key and the combined salt value. i . HMAC-SHA512 calculation, E i As input, run the HMAC-SHA512 algorithm to generate a 512-bit random binary bit string O i . Get the substring from O i Extract the first N bits as the output key K of this round i Repeat the iteration and change the K i And the combined salt value is connected in series to generate a new round of input E i+1 Repeat the above steps to calculate the next round of K i+1 The number of iterations is repeated until the preset number of iterations is reached, for example, 1000 rounds. The N-bit key generated in the last round is the final output key string. Iteration and key concatenation operations can generate keys with higher randomness.
[0031] Further, generating the first stage encrypted data includes: dividing the encrypted data to be encrypted into P groups; setting an initial vector IV of F bits; performing an XOR operation on the first group of encrypted data P1 and the initial vector IV to obtain a first group of input data D1; performing a DES encryption operation on the first group of input data D1 using a first DES key to obtain a first group of ciphertext C1; and performing an XOR operation on the i-th group of encrypted data Pi and the i-1-th group of ciphertext C i-1 Perform XOR operation to obtain the i-th group of input data D i ; Use the first DES key to the i-th group of input data D i Perform DES encryption operation to obtain the i-th group of ciphertext C i ; Change password C1 to C i Sequential combination as the first stage of encrypted data.
[0032] Specifically, the entire data to be encrypted is divided into several groups, each with the same length. The P value is determined based on the total length of the data and the length of a single group. For example, if the data length is L bits and the length of a single group is n bits, then the number of groups P = L / n. The data can be divided into multiple groups according to bytes, each containing a fixed number of bytes. It can also be divided by bits. If there is excess data that is not included after division, it can be formed as the last group alone. Or padding can be used to fill the data to make it divisible. Each group of data can be framed independently and stored in the storage space, or it can be stored continuously in sequence. After that, each group of data is encrypted separately or in association using a cryptographic algorithm.
[0033] Preferably, the FBKDF2 algorithm is used to generate an F-bit initial vector IV, wherein the FBKDF2 algorithm is a key derivation function that can derive a key or other bit string of the required length from the initial key material. FB stands for FeedBack, which means feedback. In the symmetric encryption algorithm, the initial vector IV is a random number string used to encrypt the first block of data. It enhances the security of the algorithm. In this application, the FBKDF2 algorithm is used to generate an F-bit random bit string according to the input password as the initial vector IV of the symmetric encryption algorithm. FBKDF2 uses HMAC iterative calculation and adds a feedback mechanism, which can effectively resist exhaustive attacks. Generate a high-intensity random IV to enhance the comprehensive security of the encryption system.
[0034] Among them, the XOR operation is a logical operation that operates on two binary numbers bit by bit. When the two corresponding binary bits are different, the result is 1, otherwise it is 0. The XOR operation is usually represented by the symbol "⊕". In this application, the first group of encrypted data P1 and the initial vector IV are XORed to obtain the first group of input data D1. If the bits corresponding to P1 and IV are different, the corresponding bit of D1 is 1, and if they are the same, it is 0. The XOR operation can hide the original data and enhance the obfuscation of encryption. At the same time, it also meets the requirements of stream ciphers.
[0035] Specifically, the first DES key refers to the first segment in the final N-bit key string generated using the above method, which is used to encrypt the first group of data. The classic DES symmetric encryption algorithm is used, including initial permutation, Feistel network, inverse permutation and other operations. The first group of input data D1 is used as the plaintext input of the DES algorithm. The first DES key is used as the key input of the DES algorithm. Run the DES encryption algorithm to obtain the ciphertext output C1. The first group of ciphertext C1 is recorded and stored as the data ciphertext of the first group. Then, more groups are encrypted using the corresponding DES keys.
[0036] Specifically, the i-th group of encrypted data P i , after the original data are grouped, P i represents the i-th group of data to be encrypted. The i-1th group of ciphertexts Ci-1, in this scheme, each group of ciphertexts is input as part of the next group. C i-1 is the DES encryption result of the previous group of data. XOR operation, P i and C i-1 Perform bitwise XOR operation to generate the i-th group of input data D i The i-th DES key corresponds to the i-th DES key generated by the scheme for the i-th group of data. DES encryption operation uses the i-th DES key to encrypt the input data D i Perform DES encryption to generate the i-th group of ciphertext C i. Iterate the loop and repeatedly encrypt each group of data with the corresponding key to form a circular encryption chain.
[0037] Specifically, the password sequence is from C1 to C according to the generation order. i , a total of i groups of passwords. The combination method can be simple sequential splicing or interlaced in a certain pattern. For example, if there are 5 groups of passwords C1, C2, C3, C4, C5, the combination method can be: C1||C2||C3||C4||C5 or C1||C3||C5||C2||C4. The storage format can store each group of ciphertext separately or combine them into one file. In the next stage, the combination result can be used as the input data of the next encryption stage.
[0038] Furthermore, the second DES key is used to perform DES algorithm decryption on the first-stage encrypted data to obtain second-stage decrypted data, including: dividing the second DES key into four segments to obtain 4 groups of sub-passwords, each of which is of equal length and marked as MK1, MK2, MK3 and MK4; dividing the first-stage encrypted data into four groups to obtain four groups of sub-encrypted data, each of which is of equal length; using MK1 to perform DES algorithm decryption on the first group of sub-encrypted data to obtain decrypted data IP1; using MK2 to perform DES algorithm decryption on the second group of sub-encrypted data to obtain decrypted data IP2; using MK3 to perform DES algorithm decryption on the third group of sub-encrypted data to obtain decrypted data IP3; using MK4 to perform DES algorithm decryption on the fourth group of sub-encrypted data to obtain decrypted data IP4; the decrypted data IP1, IP2, IP3 and IP4 are combined in series as the second-stage decrypted data IP.
[0039] Specifically, the second DES key refers to the second segment in the final N-bit key string generated using the above method, which is used for the second stage of encryption. Number of segments: Here, the second DES key is divided into 4 segments, or it can be divided into other numbers as needed. Equal length: The length of each sub-password is the same. Assuming that the length of the second DES key is L, the length of each segment is L / 4. Segmentation method: It can be segmented sequentially from the beginning of the key, or it can be segmented crosswise. Marking: Mark the obtained 4 sub-passwords as MK1, MK2, MK3 and MK4. Storage: The 4 sub-passwords can be stored separately or sequentially. These 4 sub-passwords will play different roles in the second stage of encryption.
[0040] Specifically, the first stage of encrypted data refers to all the group passwords C1 to C iThe result of sequential combination. Number of groups: here the data of the first stage is divided into 4 groups. It can also be divided into other numbers of groups as needed. Equal length: each group of sub-encrypted data has the same length. Assuming the length of the first stage data is L, the length of each group is L / 4. Grouping method: you can group sequentially from the beginning of the data, or you can use the cross-slicing method. Marking: mark the 4 groups of sub-data after segmentation as D1, D2, D3, and D4. Storage: you can store the 4 groups of sub-data independently or sequentially. These 4 groups of sub-data will participate in the second stage encryption operation.
[0041] Specifically, four groups of subkeys, the second DES key is divided into four subkeys MK1, MK2, MK3 and MK4. Four groups of sub-data, the first stage data is divided into four groups of sub-encrypted data D1, D2, D3, D4. DES decryption, using different subkeys to perform decryption operations of the DES algorithm on the corresponding sub-data. Decryption results, use MK1 to decrypt D1, get IP1; use MK2 to decrypt D2, get IP2; use MK3 to decrypt D3, get IP3; use MK4 to decrypt D4, get IP4. Series combination, all decryption results IP1, IP2, IP3, IP4 are simply spliced to generate the second stage decryption data IP.
[0042] Further, the third DES key is used to perform DES algorithm encryption on the second-stage decrypted data to obtain the final encrypted data, including: dividing the third DES key into four groups of sub-keys, marked as MK5, MK6, MK7 and MK8; using MK5 to perform DES encryption on the decrypted data IP, and outputting vector OP1; using MK6 to perform DES encryption on vector OP1, and outputting vector OP2; using MK7 to perform DES encryption on vector OP2, and outputting vector OP3; using MK8 to perform DES encryption on vector OP3, and outputting vector OP4; using MK5 to perform DES encryption on vector OP4, and outputting vector OP5; using MK6 to perform DES encryption on vector OP5, and outputting vector OP6; using MK7 to perform DES encryption on vector OP6, and outputting vector OP7; using MK8 to perform DES encryption on vector OP7, and outputting vector OP8; and using vector OP8 as the final encrypted data.
[0043] Specifically, the third DES key refers to the third segment in the final N-bit key string generated using the above method, which is used for the third stage of encryption. Number of groups: here the third DES key is equally divided into 4 groups of subkeys, or it can be divided into other numbers as needed. Equal length: each group of subkeys has the same length. Assuming that the length of the third DES key is L, the length of each group of subkeys is L / 4. Grouping method: grouping can be done sequentially from the beginning of the key, or cross-grouping can be used. Marking: mark the 4 groups of subkeys as MK5, MK6, MK7 and MK8. Storage: the 4 groups of subkeys can be stored separately or sequentially. These 4 groups of subkeys will participate in encryption in different combinations in the third stage.
[0044] Specifically, four groups of subkeys, the third DES key is equally divided into four groups of subkeys MK5, MK6, MK7 and MK8. The second stage of decrypted data IP. Use different subkeys to encrypt 8 rounds in a loop, and the input of each round is the output of the previous round: MK5 encrypts IP, outputs OP1, MK6 encrypts OP1, outputs OP2, MK7 encrypts OP2, outputs OP3, MK8 encrypts OP3, outputs OP4, MK5 encrypts OP4, outputs OP5, MK6 encrypts OP5, outputs OP6, MK7 encrypts OP6, outputs OP7, MK8 encrypts OP7, outputs OP8. The output of the eighth round is OP8 as the final encrypted data. Multiple rounds and multiple keys can produce a strong obfuscation effect.
[0045] Further, an initial vector IV of F bits is set, including: using the HMAC-SHA512 algorithm to set an initial key SK with a length of LK1 bits; selecting a random number nonce with a length of LK2 bits; performing a bit-level XOR operation on the initial key SK and the random number nonce to generate a bit string S1 with a length of LK1+LK2; using the SHA3-256 hash algorithm based on the bit string S1 to generate a hash value SH1; performing a bit-level XOR operation on the hash value SH1 and the bit string S1 to generate a bit string S2; using the SHA3-256 hash algorithm based on the bit string S2 to generate a hash value SH2; repeating the above operation for r iterations to generate a bit string S r ; Get the bit string S r The first F bits of are used as the initial vector IV.
[0046] Specifically, use the HMAC-SHA512 algorithm to set the initial key SK, and select a key MK with a length of m bits. Select a random number nonce with a length of n bits. Concatenate the key MK and the random number nonce into a seed sequence seed with a length of m+n bits. Define the number of iterations i=1. In the first round of iteration: use the seed as the input key of HMAC-SHA512, combine it with a constant c1 as input data, and calculate the HMAC value h1. Extract the first LK1 bits of h1 as the initial key SK. In the i-th round of iteration: replace the h1 of the previous round with the first LK1 bits of h1. i-1 As a key, combined with a constant c i As input data, calculate the HMAC value h i . From h i The first LK1 bits of the ciphertext are extracted as the initial key SK. Repeat until the number of iterations reaches the preset r rounds. The SK of the last round is the final initial key. Through HMAC iterative calculation, a high-entropy, unpredictable initial key SK can be obtained. The parameters such as m, n, r, and LK1 can be configured as needed.
[0047] Specifically, the length of the random number nonce is set to LK2 bits. Generate a true random bit sequence rand_bits with a length of 128 bits. True random numbers can be generated by a hardware random number generator. Perform a SHA3-256 hash operation on rand_bits to obtain a 256-bit hash value hash. Extract the first LK2 bits from the hash as the random number nonce. Perform a randomness test on the extracted LK2-bit random number nonce, such as using multiple tests in the NIST SP 800-22 statistical test suite to verify its randomness. If the randomness test passes, it is confirmed that the nonce can be used directly. If it does not pass, the nonce is repeatedly regenerated. The LK2-bit random number nonce that passes the test is output. Through true random number seeds and hash extraction, a nonce with good randomness can be obtained, and the length is configurable. Statistical tests can verify its randomness.
[0048] Specifically, according to the above steps, generate an initial key SK of length LK1 bits and a random number nonce of length LK2 bits respectively. Define an empty bit string S1, whose length is initialized to LK1+LK2 bits. Use a logical XOR gate to perform XOR operations on the initial key SK and the random number nonce bit by bit: XOR the first bit of SK with the first bit of nonce, and the result is the first bit of S1, the second bit of SK with the second bit of nonce, and the result is the second bit of S1, ..., the LK1th bit of SK with the LK1th bit of nonce, and the result is the LK1th bit of S1, the LK1th bit of SK 1+1bit and nonce LK 1+1 The result is the LK of S1. 1+1 bits, ..., until the LK1th bit and LK2th bit at the end of SK and nonce, respectively. Finally, a bit string S1 with a length of LK1+LK2 bits is obtained. By using bit-by-bit XOR, the randomness of SK and nonce can be brought into play to generate a more random bit string S1.
[0049] Specifically, a bit string S1 with a length of LK1+LK2 bits has been obtained. Input the bit string S1 into the SHA3-256 hash algorithm. SHA3-256 hash algorithm process: S1 is padded to the bit length that meets the algorithm input requirements, the padded bit string is divided into blocks of fixed size, absorption operations, mixing operations, compression operations, etc. are iterated on each block, and finally a hash value with a length of 256 bits is output. From the 256-bit output of the SHA3-256 algorithm, the first b bits are extracted as the hash value SH1. b can be set as needed. SH1 is output for use in subsequent steps. Through SHA3-256 hashing, the obfuscation of the input bit string S1 can be enhanced to generate a more random hash output.
[0050] Specifically, a hash value SH1 with a length of b bits and a bit string S1 with a length of LK1+LK2 bits have been obtained. Using a logical XOR gate, SH1 and S1 are XORed bit by bit to generate a bit string S2 with a length of b bits. The bit string S2 is used as input and input into the SHA3-256 hash algorithm again to generate a hash value SH2 with a length of b bits. Repeat the iteration for r consecutive rounds: the input of the i-th round is the bit string S of the previous round. i-1 , SHA3-256(Si-1) generates the hash value SH i , S.H. i XOR S i-1 Generate bit string S i After r rounds of iteration, a bit string S with a length of b bits is obtained. r Extract the first F bits (F≤b) from the bit string Sr as the initial vector IV. Through iterative hashing and XOR, a vector IV with higher entropy can be generated. Parameters r, b, and F are all configurable.
[0051] Specifically, a bit string S with a length of b bits has been obtained r , is the result after r rounds of iterations. Define the length of the initial vector IV as F bits. Where F is a positive integer less than or equal to b. r Extract the continuous F bits starting from the 1st bit. Specific extraction process: Get S r The first bit of S is used as the first bit of IV. rThe second digit of , as the second digit of IV, ..., to obtain S r The Fth bit of is used as the Fth bit of IV, and the F-bit binary sequence is used as the initial vector IV generated by this method. The length F of IV can be configured according to actual needs, and different lengths can be selected. By extracting some bits from a longer bit string, a more random initial vector IV can be obtained.
[0052] 3. Beneficial effects
[0053] Compared with the prior art, the advantages of this application are:
[0054] (1) By adopting a multi-layer DES encryption and decryption process and a multiple key generation strategy, encryption security is significantly enhanced. An attacker needs to crack multiple different DES keys to obtain data, which improves the security of the system;
[0055] (2) The hash algorithm is used to process the encrypted data, and the key is generated by combining salt value and iterative calculation, which effectively improves the security of the password and reduces the possibility of password cracking;
[0056] (3) By introducing salt values and using hash algorithms, rainbow table attacks are effectively prevented, and the system's resistance to password cracking is enhanced;
[0057] (4) A multiple key generation strategy is adopted. The user unique identifier and global salt value are introduced in the key generation process, which increases the difficulty for attackers to obtain the key, thereby improving the system's ability to resist man-in-the-middle attacks;
[0058] (5) Use the FBKDF2 algorithm instead of randomly generating the initial vector, which increases the complexity of IV generation and improves security;
[0059] (6) By adopting the HMAC-SHA512 algorithm as a pseudo-random function and introducing the user's unique identifier and global salt value in the key generation process, the integrity of the data is effectively protected and the data is prevented from being tampered with or forged. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:
[0061] Figure 1 is an exemplary flow chart of a DES encryption method according to some embodiments of this specification;
[0062] Figure 2 is an exemplary flow chart of generating a key string according to some embodiments of this specification;
[0063] Figure 3 is an exemplary flow chart of generating first-stage encrypted data according to some embodiments of this specification;
[0064] Figure 4 is an exemplary flow chart of generating second-stage decryption data according to some embodiments of this specification;
[0065] Figure 5 This is an exemplary flow chart of generating final encrypted data according to some embodiments of the present specification. DETAILED DESCRIPTION
[0066] The method and system provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0067] Figure 1 This is an exemplary flow chart of a DES encryption method shown in some embodiments of the present specification, obtaining data to be encrypted; obtaining a binary bit string with a length of N bits as a key string; extracting a key string of M1 bits from bits N1 to N2 of the generated key string as a first DES key; extracting a key string of M2 bits from bits N3 to N4 of the generated key string as a second DES key; extracting a key string of M3 bits from bits N5 to N6 of the generated key string as a third DES key; using the first DES key to perform DES algorithm encryption on the data to be encrypted to obtain first-stage encrypted data; using the second DES key to perform DES algorithm decryption on the first-stage encrypted data to obtain second-stage decrypted data; using the third DES key to perform DES algorithm encryption on the second-stage decrypted data to obtain final encrypted data.
[0068] Specifically, the data to be encrypted: original_data = "Hello World". Generate a 256-bit key string: key = "00112233445566778899aabbccddeeff00112233445566778899aabbccdd". Extract subkeys: K1 (first DES key) = key[0:64] = "00112233445566778899aabbccddeeff". K2 (second DES key) = key[64:128] = "00112233445566778899aabbccdd", K3 (third DES key) = key[128:192] = "00112233445566778899aabbcc". Three rounds of encryption: C1 = DES_encrypt(original_data, K1), C2 = DES_decrypt(C1, K2), C3 = DES_encrypt(C2, K3), output C3 as the final encrypted data.
[0069] Preprocess the original data and perform double hash operations on the original data to be encrypted to enhance randomness and differentiation. Use SHA3 and SM3 hash algorithms to calculate hash values respectively, and connect the two hash values as the modified original data. Generate a key string, including: setting the user salt value and the global salt value, the user salt value represents the user's unique identifier; the global salt value is used for system encryption; the user salt value and the global salt value are combined in series as a combined salt value; the HMAC-SHA512 algorithm is used as a pseudo-random function; according to the combined salt value and the pseudo-random function, iterative calculation is performed to generate an N-bit binary bit string as the key string. The length of the user salt value and the global salt value is equal, which is half the length of the key string. Specifically, the original data is a text: "The quickbrown foxjumps overthe lazy dog". Calculate the SHA3 hash value: SHA3("The quickbrown foxjumps overthe lazy dog") = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f". Calculate the SM3 hash value: SM3("The quickbrown foxjumpsover the lazy dog") = "4142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f". Concatenate the two hash values to get the modified original data:
[0070] "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1 f4142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f". Generate a key string, user salt value: "87654321", global salt value: "abcdefgh", combined salt value: "87654321abcdefgh", use HMAC-SHA512 as the pseudo-random function, set the number of iterations to 1000, and generate a 256-bit (32-byte) key string, "d7f2d9071d9de30d5b5e220a2ab3ec0543e0a11bb5417b7bc0e5f2769d90ef7e".
[0071] Figure 2 This is an exemplary flow chart for generating a key string according to some embodiments of this specification, dynamic key generation, dynamically generating a binary bit string with configurable length according to the user ID and global system parameters as the key of the DES algorithm. The key generation process uses HMAC-SHA512 and salt value, and obtains strong randomness through iterative calculation. The SHA3 algorithm is used to perform a hash operation on the encrypted data to obtain a hash value H1; the SM3 algorithm is used to perform a hash operation on the encrypted data to obtain a hash value H2; the hash value H1 and the hash value H2 are combined in series as the encrypted data to be encrypted, and input into the PBKDF2 algorithm. According to the combined salt value and the pseudo-random function, iterative calculation is performed to generate an N-bit binary bit string as a key string, including: concatenating the combined salt value and the encrypted data to be encrypted to generate a bit string P0; taking the bit string P0 as input, using the HMAC-SHA512 algorithm to generate a binary bit string O0; obtaining the first N bits in O0 as the initial key K0; according to the combined salt value, the pseudo-random function and the data to be encrypted, iterative calculation is performed to generate an N-bit binary bit string as a key string, and also includes: taking the initial key K0 as input; in the i-th iteration, taking the N-bit key Ei-1 generated in the i-1-th iteration as input; concatenating the key Ei-1 and the combined salt value to generate a bit string Ei; taking the bit string Ei as input, using the HMAC-SHA512 algorithm to generate a binary bit string Oi; obtaining the first N bits in Oi as the i-th key Ki; repeating the iterative calculation until a preset number of iterations, to generate a final N-bit key string.
[0072] Specifically, the original data is: "The quickbrown foxjumps over the lazy dog". SHA3 hash: H1 = SHA3 (original data) = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f". SM3 hash: H2 = SM3 (original data) = "4142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f". Connection hash value: H1||H2 = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f4142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f". User salt value: 87654321, global salt value: abcdefgh, combined salt value: Salt = 87654321abcdefgh. Generate a 256-bit key: P0=Salt||H1||H2, O0=HMAC-SHA512(P0), K0=the first 256 bits of O0, for i=1 to 1000: Ei=Ki-1||Salt, Oi=HMAC-SHA512(Ei), Ki=the first 256 bits of Oi, final 256-bit key: K1000.
[0073] Figure 3 It is an exemplary flow chart for generating the first stage encrypted data according to some embodiments of this specification, and multiple rounds of configurable encryption and decryption process are used to encrypt and decrypt the modified original data using multiple rounds of DES operation. The number of encryption and decryption rounds and the length of the subkey used in each round can be configured according to security requirements. The typical process is three rounds, and the keys in each round can be used in groups. The first DES key is used to encrypt the encrypted data by the DES algorithm to obtain the first stage encrypted data. The data to be encrypted is divided into P groups; the FBKDF2 algorithm is used to generate an initial vector IV of F bits; the first group of encrypted data P1 and the initial vector IV are XORed to obtain the first group of input data D1; the first DES key is used to perform DES encryption operation on the first group of input data D1 to obtain the first group of ciphertext C1; the i-th group of encrypted data Pi is XORed with the i-1-th group of ciphertext Ci-1 to obtain the i-th group of input data Di; the first DES key is used to perform DES encryption operation on the i-th group of input data Di to obtain the i-th group of ciphertext Ci; the passwords C1 to Ci are sequentially combined as the first stage encrypted data.
[0074] Specifically, the original data: "hello world". Grouping: Divide the data into 2 groups, each with 6 bytes: P1 = "hello w", P2 = "orld". Generate the initial vector: IV = the first 64 bits of FBKDF2 (key, salt value). The first round of encryption: D1 = P1⊕IV, C1 = DES (D1, key 1). D2 = P2⊕C1, C2 = DES (D2, key 1), the first stage output: C = C1||C2, = "459ef95d214c5881275e7"|| "abcdefgh38945236".
[0075] Figure 4 This is an exemplary flow chart for generating second-stage decrypted data according to some embodiments of the present specification, wherein the second DES key is used to perform DES algorithm decryption on the first-stage encrypted data to obtain the second-stage decrypted data, including: dividing the second DES key into four segments to obtain 4 groups of sub-ciphers, each of which is of equal length and marked as MK1, MK2, MK3 and MK4; dividing the first-stage encrypted data into four groups to obtain four groups of sub-encrypted data, each of which is of equal length; using MK1 to perform DES algorithm decryption on the first group of sub-encrypted data to obtain decrypted data IP1; using MK2 to perform DES algorithm decryption on the second group of sub-encrypted data to obtain decrypted data IP2; using MK3 to perform DES algorithm decryption on the third group of sub-encrypted data to obtain decrypted data IP3; using MK4 to perform DES algorithm decryption on the fourth group of sub-encrypted data to obtain decrypted data IP4; and combining the decrypted data IP1, IP2, IP3 and IP4 in series as the second-stage decrypted data IP.
[0076] Specifically, the second DES key: ABCDEF12345566FFFFFF. Divided into 4 sub-keys: MK1 = ABCDEF12, MK2 = 345566FF, MK3 = FFFFABCD, MK4 = EF123455. The first stage data: 459ef95d214c5881275e7abcdefgh38945236. Divided into 4 groups of data:
[0077] D1=459ef95d214c5881275e7,D2=abcdefgh,D3=38945236,D4=FFFFABCD。Decryption: IP1=DES(MK1,D1)=hello wo,IP2=DES(MK2,D2)=rld,IP3=DES(MK3,D3)=1234,IP4=DES(MK4,D4)=5678。Second stage data: IP=IP1||IP2||IP3||IP4="hello wo"||"rld"||"1234"||"5678".
[0078] Figure 5 This is an exemplary flow chart for generating final encrypted data according to some embodiments of this specification, using the third DES key to perform DES algorithm encryption on the second-stage decrypted data to obtain the final encrypted data, including: dividing the third DES key into four groups of subkeys, marked as MK5, MK6, MK7 and MK8; using MK5 to perform DES encryption on the decrypted data IP, and outputting OP1; using MK6 to perform DES encryption on OP1, and outputting OP2; using MK7 to perform DES encryption on OP2, and outputting OP3; using MK8 to perform DES encryption on OP3, and outputting OP4; using MK5 to perform DES encryption on OP4, and outputting OP5; using MK6 to perform DES encryption on OP5, and outputting OP6; using MK7 to perform DES encryption on OP6, and outputting OP7; using MK8 to perform DES encryption on OP7, and outputting OP8; using OP8 as the final encrypted data. The lengths of M1, M2 and M3 are equal.
[0079] Specifically, the third DES key: AABBCCDDEEFF001122334455667788. Divided into 4 sub-keys: MK5=AABBCCDD, MK6=EEFF0011, MK7=22334455, MK8=667788AA. Second stage data: IP=hellowo12345678. Multi-round encryption: OP1=DES(MK5, IP), OP2=DES(MK6, OP1), OP3=DES(MK7, OP2), OP4=DES(MK8, OP3), OP5=DES(MK5, OP4), OP6=DES(MK6, OP5), OP7=DES(MK7, OP6), OP8=DES(MK8, OP7). Final output: OP8=bbaa1122ddcc7788 (hexadecimal).
[0080] The group transmission mechanism supports the group transmission of original data and intermediate data in the encryption and decryption process. Each group is recursively calculated with the previous group of ciphertext using the XOR method to improve randomness.
[0081] Specifically, the original data: "The quickbrown foxjumps over the lazy dog". Grouping: Divided into 4 groups, each with 12 bytes: D1: "The quickbr", D2: "own foxjump", D3: "s over the l", D4: "azydog". Transmission encryption: C0 = IV#initialization vector, C1 = DES (D1⊕C0), C2 = DES (D2⊕C1), C3 = DES (D3⊕C2), C4 = DES (D4⊕C3). Group transmission: Transmit the encrypted data in 4 batches: Batch1: C1, Batch2: C2, Batch3: C3, Batch4: C4. After receiving, the receiving end connects in order and decrypts. In this way, through group transmission and XOR recursion, the randomness and obfuscation of data can be improved.
[0082] The invention of the present application and its implementation methods are described schematically above. The description is not restrictive. Without departing from the spirit or basic features of the present application, the present application can be implemented in other specific forms. What is shown in the accompanying drawings is only one of the implementation methods of the invention of the present application. The actual structure is not limited to this, and any figure mark in the claims should not limit the claims involved. Therefore, if ordinary technicians in this field are inspired by it, without departing from the purpose of the present invention, they can creatively design structural methods and embodiments similar to the technical solution, which should all belong to the scope of protection of the present application. In addition, the word "including" does not exclude other elements or steps, and the word "one" before the element does not exclude the inclusion of "multiple" elements. The multiple elements stated in the product claim can also be implemented by one element through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
Claims
1. A DES encryption method, comprising: Obtain the data to be encrypted; Obtain a binary bit string with a length of N bits as the key string; Extract the key string of M1 bits from bits N1 to N2 of the generated key string as the first DES key; Extract the key string of M2 bits from bits N3 to N4 of the generated key string as the second DES key; Extract the key string of M3 bits from bits N5 to N6 of the generated key string as the third DES key; The first DES key is used to encrypt the data to be encrypted using the DES algorithm to obtain the first-stage encrypted data; Use the second DES key to perform DES algorithm decryption on the first stage encrypted data to obtain the second stage decrypted data; The third DES key is used to encrypt the second-stage decrypted data using the DES algorithm to obtain the final encrypted data; Generate the first stage of encrypted data, including: Divide the encrypted data to be encrypted into P groups; Set the initial vector IV of F bits; Perform an XOR operation on the first set of encrypted data P1 and the initial vector IV to obtain a first set of input data D1; Using the first DES key to perform DES encryption operation on the first group of input data D1, to obtain a first group of ciphertext C1; The i-th group of encrypted data P i and the i-1th group of ciphertext C i-1 Perform XOR operation to obtain the i-th group of input data D i ; Use the first DES key to encrypt the i-th group of input data D i Perform DES encryption operation to obtain the i-th group of ciphertext C i ; Change password C1 to C i Sequential combination as the first stage of encrypted data; Set the initial vector IV of the F bit, including: Set the initial key as the input key for the FBKDF2 algorithm; Use the HMAC function as the pseudo-random function of the FBKDF2 algorithm, take the initial key and salt value as input, and derive a bit string of length F bits through iterative calculation; Use the F-bit string as the initial vector IV of the symmetric encryption algorithm; Among them, the FBKDF2 algorithm introduces a feedback mechanism in the iterative calculation, using the output of the previous iteration as the input of the next iteration to enhance the randomness and security of the derived key; The second DES key is used to perform DES algorithm decryption on the first-stage encrypted data to obtain the second-stage decrypted data, including: Divide the second DES key into four segments, and obtain four groups of sub-ciphers, each of which is of equal length and is labeled MK1, MK2, MK3, and MK4; Divide the first-stage encrypted data into four groups, and obtain four groups of sub-encrypted data, each with the same length; Use MK1 to perform DES algorithm decryption on the first group of sub-encrypted data to obtain decrypted data IP1; Use MK2 to perform DES algorithm decryption on the second group of sub-encrypted data to obtain decrypted data IP2; Use MK3 to perform DES algorithm decryption on the third group of sub-encrypted data to obtain decrypted data IP3; Use MK4 to perform DES algorithm decryption on the fourth group of sub-encrypted data to obtain decrypted data IP4; The decrypted data IP1, IP2, IP3 and IP4 are combined in series to serve as the second-stage decrypted data IP; The third DES key is used to encrypt the second-stage decrypted data using the DES algorithm to obtain the final encrypted data, including: Divide the third DES key into four equal subkeys, labeled MK5, MK6, MK7, and MK8; Use MK5 to perform DES encryption on the decrypted data IP and output vector OP1; Use MK6 to perform DES encryption on vector OP1 and output vector OP2; Use MK7 to perform DES encryption on vector OP2 and output vector OP3; Use MK8 to perform DES encryption on vector OP3 and output vector OP4; Use MK5 to perform DES encryption on vector OP4 and output vector OP5; Use MK6 to perform DES encryption on vector OP5 and output vector OP6; Use MK7 to perform DES encryption on vector OP6 and output vector OP7; Use MK8 to perform DES encryption on vector OP7 and output vector OP8; The vector OP8 is used as the final encrypted data.
2. The DES encryption method according to claim 1, characterized in that: Generate a key string, including: Set the user salt value and the global salt value. The user salt value represents the unique identification of the user; the global salt value is used for system encryption; The user salt value and the global salt value are combined in series to form a combined salt value. Use HMAC-SHA512 algorithm as pseudo-random function; According to the combined salt value and pseudo-random function, iterative calculation is performed to generate an N-bit binary bit string as the key string.
3. The DES encryption method according to claim 2, characterized in that: The length of the user salt value and the global salt value is equal, which is half the length of the key string; The lengths of M1, M2 and M3 are equal.
4. The DES encryption method according to claim 3, characterized in that: Also includes: Use the SHA3 algorithm to perform hash operation on the encrypted data to obtain a hash value H1; Use the SM3 algorithm to perform hash operation on the encrypted data to obtain a hash value H2; The hash value H1 and the hash value H2 are combined in series to serve as the encrypted data to be encrypted.
5. The DES encryption method according to claim 4, characterized in that: According to the combined salt value and pseudo-random function, iterative calculation is performed to generate an N-bit binary bit string as the key string, including: Concatenate the combined salt value and the encrypted data to be encrypted to generate a bit string P0; Take the bit string P0 as input and use the HMAC-SHA512 algorithm to generate the binary bit string O0; Get N bits in O0 as the initial key K0.
6. The DES encryption method according to claim 5, characterized in that: Generate a key string, also include: Take the initial key K0 as input; In the i-th iteration, the N-bit key E generated in the i-1-th iteration is i-1 As input; The key E i-1 Concatenate with the combined salt value to generate the bit string E i ; The bit string E i As input, use the HMAC-SHA512 algorithm to generate a binary bit string O i ; Get O i The first N bits in are used as the key K for the i-th time. i ; The iterative calculation is repeated until the preset number of iterations is reached to generate the final N-bit key string.
