Data encryption method and device, data decryption method and device, equipment and storage medium

By compressing the target data and generating encryption keys through multiple rounds of iterative expansion, and then performing key verification and encoding, the problem of complex key management in existing technologies is solved. This achieves a self-generating, self-expanding, and self-verifying encryption mechanism, which is suitable for distributed systems and mobile application environments.

CN121462298APending Publication Date: 2026-02-03CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511753703.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Existing data encryption methods rely on external fixed keys or complex key distribution mechanisms in distributed systems and mobile application environments, resulting in complex key management, high deployment costs, and great difficulty in implementation.

Method used

The encryption mechanism achieves self-generation, self-expansion, and self-verification by compressing n target data to be encrypted to generate a first key, expanding the second key through multiple rounds of iteration, encrypting the second key, generating a key verification value for the third key, and finally encoding the third key and the key verification value.

Benefits of technology

It achieves self-generation, self-expansion, and self-verification of keys, reducing the complexity and deployment cost of key management, enhancing encryption strength and resistance to attacks, and is suitable for distributed systems and mobile application environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121462298A_ABST
    Figure CN121462298A_ABST
Patent Text Reader

Abstract

The invention provides a data encryption method and device, a data decryption method and device, equipment and a storage medium, and can be applied to the technical field of data processing. The method comprises the steps of obtaining n pieces of target data to be encrypted, wherein n is a positive integer; compressing the n pieces of to-be-encrypted target data to obtain a first key of the n pieces of to-be-encrypted target data; performing expansion processing on the first key through multiple rounds of iteration to obtain a second key; the byte length of the second key is greater than that of the first key; performing encryption processing on the second key to obtain a third key; generating a secret key verification value of the third secret key; and encoding the third key and the key check value to obtain a target ciphertext.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to a data encryption method, data decryption method, apparatus, device, and storage medium. Background Technology

[0002] With the rapid development of information technology, data security and privacy protection have become critical requirements across various industries. During data transmission and storage, encryption technologies are typically used to protect data and prevent the unauthorized acquisition or alteration of sensitive information.

[0003] Currently, widely used data encryption methods mainly rely on externally provided fixed keys or obtain encryption keys through complex key distribution mechanisms. These methods face the problem of complex key management in practical applications, especially in distributed systems and mobile application environments. Traditional key management methods often require dedicated hardware devices or complex infrastructure, resulting in high deployment costs and difficult implementation. Summary of the Invention

[0004] In view of the above problems, this disclosure provides a data encryption method, a data decryption method, an apparatus, a device, and a storage medium.

[0005] According to a first aspect of this disclosure, a data encryption method is provided, comprising: acquiring n target data to be encrypted, where n is a positive integer; compressing the n target data to be encrypted to obtain a first key for the n target data to be encrypted; expanding the first key through multiple rounds of iteration to obtain a second key; the byte length of the second key is greater than the byte length of the first key; and encrypting the second key to obtain a third key. Generate the key verification value for the third key; The target ciphertext is obtained by encoding the third key and the key verification value.

[0006] According to embodiments of this disclosure, n target data to be encrypted are compressed to obtain a first key for the n target data to be encrypted, including: Concatenate the n target data to be encrypted sequentially to obtain the target data string; Divide the target data string into m data groups of equal byte length, where m is a positive integer; Perform an XOR operation on the data in each data group to obtain the compressed bytes corresponding to each data group; By concatenating the compressed bytes corresponding to each data group in sequence, the first key for n target data to be encrypted is obtained.

[0007] According to embodiments of this disclosure, a second key is obtained by expanding the first key through multiple rounds of iteration, including: The first key is expanded to obtain the expanded key of the first key; The extended key of the first key is iteratively extended to obtain multiple extended keys corresponding to the first key; the termination condition of the iterative extension is that the sum of the byte lengths of the multiple extended keys corresponding to the first key is greater than or equal to a preset length. The second key is obtained by concatenating the first key with at least one extended key corresponding to the first key.

[0008] According to embodiments of this disclosure, the first key is expanded to obtain an expanded key, including: The target location and data segment length are determined based on the value of the first byte in the first key; Starting from the target location, extract the target data segment from the first key in a loop according to the data segment length; Perform an XOR operation on the target data segment to obtain the extended byte corresponding to the first byte; Iterate through each byte in the first key and repeat the above steps to obtain the extended bytes corresponding to each byte; The extended key of the first key is obtained by concatenating the extended bytes corresponding to each byte.

[0009] According to embodiments of this disclosure, generating a key verification value for a third key includes: Divide the third key into a preset number of key groups; Each byte of the third key is used as a different randomization factor; For any randomization factor, when the randomization factor and the byte length of the key group have a common divisor, the randomization factor is adjusted until the randomization factor and the byte length of the key group are coprime, thus obtaining the target randomization factor. Calculate the target position corresponding to each key group based on the target randomization factor and the corresponding sequence number of each key group; Obtain the corresponding verification bytes from the target location of each key group; Perform an XOR operation between each verification byte and the corresponding byte in the first key to obtain the verification result corresponding to each verification byte; By concatenating the verification results in sequence, the key verification value of the third key is obtained.

[0010] According to a second aspect of this disclosure, a data decryption method is provided, comprising: Obtain the target ciphertext; The target ciphertext is decoded to obtain the third key and the key verification value; The second key is obtained by decrypting the third key; The first key is obtained by compressing the second key through multiple rounds of iteration; the byte length of the first key is less than the byte length of the second key. The correctness of the first key is verified based on the key verification value; If the correctness of the first key is verified, the first key is expanded to obtain n target data; n is a positive integer.

[0011] According to embodiments of this disclosure, the first key is obtained by compressing the second key through multiple rounds of iteration, including: The second key is divided into an initial key segment and at least one extended key according to a preset length. At least one extended key is iteratively compressed to obtain a compressed key; the termination condition for iterative compression is that the length of the compressed key in bytes is equal to the length of the initial key segment in bytes. Generate the extended key corresponding to the initial key; The extended key corresponding to the initial key is compared and verified with at least one extended key segment; When the comparison and verification are consistent, the initial key is determined as the first key.

[0012] According to embodiments of this disclosure, iterative compression of at least one extended key includes: The target location and data segment length are determined based on the value of the first byte in the initial key segment; Starting from the target location, extract the target data segment from the initial key segment in a loop according to the data segment length; Perform an XOR operation on the target data segment to obtain the compressed byte corresponding to the first byte; Iterate through each byte in the initial key segment and repeat the above steps to obtain the compressed bytes corresponding to each byte; The compression key is obtained by concatenating the compressed bytes corresponding to each byte.

[0013] According to embodiments of this disclosure, verifying the correctness of the first key based on a key verification value includes: Divide the third key into a preset number of key groups; Use the first byte of the third key as a randomization factor; When the randomization factor and the byte length of the key group have a common factor, the randomization factor is adjusted until the randomization factor and the byte length of the key group are coprime, thus obtaining the target randomization factor. Calculate the target position corresponding to each key group based on the target randomization factor and the corresponding sequence number of each key group; Obtain the corresponding verification bytes from the target location of each key group; Perform an XOR operation between each verification byte and the corresponding byte in the key verification value to obtain the verification result corresponding to each verification byte; The verification results are concatenated sequentially to obtain the verification key; Determine whether the verification key matches the first key to verify the correctness of the first key.

[0014] According to embodiments of this disclosure, the first key is expanded to obtain n target data, including: The first key is divided into m key groups of a preset byte length, where m is a positive integer. Each key group is expanded to obtain the corresponding expanded data group; The extended data groups are concatenated sequentially to obtain the target data string; The target data string is divided into n target data.

[0015] A third aspect of this disclosure provides a data encryption device, comprising: The first acquisition module is used to acquire n target data to be encrypted, where n is a positive integer; The first compression module is used to compress n target data to be encrypted to obtain the first key of the n target data to be encrypted. The first extension module is used to extend the first key through multiple rounds of iteration to obtain the second key; the byte length of the second key is greater than the byte length of the first key; The data encryption module is used to encrypt the second key to obtain the third key; The first verification module is used to generate the key verification value of the third key; The data encoding module is used to encode the third key and the key verification value to obtain the target ciphertext.

[0016] A fourth aspect of this disclosure provides a data decryption apparatus, comprising: The second acquisition module is used to acquire the target ciphertext; The data decoding module is used to decode the target ciphertext to obtain the third key and the key verification value; The data decryption module is used to decrypt the third key to obtain the second key; The second compression module is used to compress the second key through multiple rounds of iteration to obtain the first key; the byte length of the first key is less than the byte length of the second key; The second verification module is used to verify the correctness of the first key based on the key verification value; The second extension module is used to extend the first key to obtain n target data when the correctness verification of the first key is passed; n is a positive integer.

[0017] A fifth aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the methods described above.

[0018] A sixth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the methods described above.

[0019] The seventh aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0020] Based on the data encryption method, data decryption method, apparatus, device, medium, and program products provided in this disclosure, a technique for generating encryption keys based on the characteristics of the original data is established by obtaining n target data to be encrypted and compressing them to obtain a first key, thereby avoiding dependence on external fixed keys or complex key distribution mechanisms. This method expands the first key through multiple rounds of iteration to obtain a second key with a larger byte length, achieving effective expansion of the key space and increased complexity. The introduction of nonlinear transformation characteristics through iterative algorithms enhances the key's resistance to attacks. Encrypting the second key yields a third key, further constructing a multi-layered key transformation system, effectively hiding the characteristics of the original key and improving the overall encryption strength. The key verification value for generating the third key provides reliable technical protection for key integrity verification, ensuring the accuracy of key information during transmission and storage. Encoding the third key and the key verification value to obtain the target ciphertext achieves integrated encapsulation of the encryption key and verification information, giving the encryption system self-contained characteristics.

[0021] Compared with existing technologies that rely on dedicated hardware devices or complex infrastructure for key management, the above-mentioned technology achieves self-generation, self-expansion, and self-verification mechanisms for keys, effectively solving the problem of complex key management in traditional encryption methods, reducing deployment costs and implementation complexity, and is suitable for data security protection needs in distributed systems and mobile application environments. Attached Figure Description

[0022] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which: Figure 1 This illustration schematically depicts application scenarios of data encryption methods, data decryption methods, apparatuses, devices, and storage media according to embodiments of the present disclosure. Figure 2 A flowchart illustrating a data encryption method according to an embodiment of the present disclosure is shown schematically; Figure 3 A flowchart illustrating a data decryption method according to an embodiment of the present disclosure is shown schematically. Figure 4 A schematic block diagram of a data encryption device according to an embodiment of the present disclosure is shown. Figure 5 A schematic block diagram of a data decryption apparatus according to an embodiment of the present disclosure is shown. Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a data encryption method and a data decryption method according to embodiments of the present disclosure. Detailed Implementation

[0023] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0025] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0026] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0027] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of data (including but not limited to user personal information) comply with the provisions of relevant laws and regulations, necessary measures have been taken, and they do not violate public order and good morals.

[0028] It should be noted that in the embodiments disclosed herein, certain software, components, models, and other existing solutions in the industry may be mentioned. These should be considered as exemplary and are intended only to illustrate the feasibility of implementing the technical solutions disclosed herein. However, they do not mean that the applicant has used or necessarily used such solutions.

[0029] Embodiments of this disclosure provide a data encryption method, including: Obtain n target data items to be encrypted, where n is a positive integer; Compress n target data to be encrypted to obtain the first key for the n target data to be encrypted; The first key is expanded through multiple rounds of iteration to obtain the second key; the byte length of the second key is greater than the byte length of the first key. The second key is encrypted to obtain the third key; Generate the key verification value for the third key; The target ciphertext is obtained by encoding the third key and the key verification value.

[0030] Figure 1 The illustration shows an application scenario of a data encryption method, data decryption method, apparatus, device, and storage medium according to embodiments of the present disclosure.

[0031] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0032] Users can interact with server 105 via network 104 using at least one of the first terminal device 101, second terminal device 102, and third terminal device 103 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, second terminal device 102, and third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0033] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0034] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0035] It should be noted that the data encryption and decryption methods provided in this disclosure embodiment can generally be executed by server 105. Correspondingly, the data encryption and decryption devices provided in this disclosure embodiment can generally be located in server 105. The data encryption and decryption methods provided in this disclosure embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, second terminal device 102, third terminal device 103, and / or server 105. Correspondingly, the data encryption and decryption devices provided in this disclosure embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, second terminal device 102, third terminal device 103, and / or server 105.

[0036] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0037] The following will be based on Figure 1 The scenario described herein is illustrated in detail with reference to the accompanying drawings, which provide a specific example of the data encryption method used in the disclosed embodiments.

[0038] Figure 2 A flowchart illustrating a data encryption method according to an embodiment of the present disclosure is shown schematically.

[0039] like Figure 2 As shown, the data encryption method of this embodiment includes the following operations.

[0040] Operation S210 obtains n target data to be encrypted, where n is a positive integer; Operation S220 compresses n target data to be encrypted to obtain the first key of the n target data to be encrypted; Operation S230 expands the first key through multiple rounds of iteration to obtain the second key; the byte length of the second key is greater than the byte length of the first key; Operation S240 encrypts the second key to obtain the third key; Operate S250 to generate the key verification value for the third key; Operation S260 encodes the third key and key verification value to obtain the target ciphertext.

[0041] In operation S210, the target data to be encrypted refers to the original data information that needs to be encrypted and protected. In this embodiment, it can be understood as the key component data held by each security administrator in the system.

[0042] For example, the target data includes, but is not limited to, key components, user authentication information, transaction data, sensitive configuration parameters, access control information, digital certificate fragments, etc.

[0043] In one feasible implementation, target data can be obtained through a pre-defined security management process. The system first determines the number of security administrators participating in key generation, which is the value of n. Then, each security administrator inputs their key component in a secure environment. The system sequentially receives and temporarily stores these key components as the target data to be encrypted.

[0044] In another feasible implementation, target data can be obtained in batches from a pre-configured data source. Specifically, the system reads multiple data items from a specified storage location or data interface according to preset data acquisition rules, and determines these data items as target data to be encrypted. At the same time, the number of data items obtained is recorded as the value of parameter n.

[0045] It should be noted that the embodiments of this application do not limit the specific content and acquisition method of the target data. Any data information that needs to be encrypted and protected can be used as target data. The value of n should be determined according to the actual business scenario and security requirements. In general, the value of n is a positive integer between 2 and 10.

[0046] In operation S220, compression processing refers to the data processing process of merging multiple data sources into a single data output through a specific algorithm. In this application embodiment, it can be understood as an operation of feature extraction and information compression on n target data, used to extract key feature information from the original data and generate representative key data.

[0047] The reason for compression is that multiple independent target data may differ in length and structure. Direct use would increase the complexity of key management. Compression can unify data from different sources into a standardized key format. At the same time, information fusion during compression can enhance the randomness and security of the key, ensuring that the final key information cannot be directly derived from any single target data.

[0048] Similarly, the first key refers to the initial key data extracted from the original target data through compression processing. In this embodiment, it can be understood as a compressed key that carries the core feature information of n target data.

[0049] In one feasible implementation, compression can be performed using a grouped XOR method. First, n target data are concatenated and arranged according to a preset rule. Then, the concatenated data sequence is grouped into groups of fixed length. Next, an XOR operation is performed byte by byte on the data within each group to obtain the compression result of each group. Finally, the compression results of each group are combined sequentially to form the first key.

[0050] In another feasible implementation, compression can be performed using a combination of hash functions and bitwise operations. Hash values ​​are calculated for each of the n target data sets, and then these hash values ​​are combined according to specific bitwise operation rules. Multiple hash values ​​are merged into a single key data set through cyclic shifting, XOR operations, and other methods, thus obtaining a first key containing the characteristics of all the target data sets.

[0051] It should be noted that the specific algorithm for compression can be selected and adjusted according to actual security requirements and performance needs. The key is to ensure the irreversibility of the compression process and the uniform distribution of the output results. At the same time, the length of the first key is usually set to a fixed value to facilitate subsequent key expansion processing.

[0052] In operation S230, the extended processing refers to the data generation process of converting a shorter data input into a longer data output through a specific algorithm. In this embodiment, it can be understood as a processing operation that generates a longer key sequence through iterative operation based on the original information of the first key, which is used to increase the complexity and length of the key while maintaining the characteristics of the original key.

[0053] The reason for performing the expansion process is that although the first key contains the core feature information of the target data, its length is relatively limited and cannot meet the key length requirements of high-strength encryption algorithms. The expansion process can increase the entropy and complexity of the key while maintaining the original security characteristics of the key. At the same time, a longer key length can provide stronger resistance to attacks and enhance the security of the entire encryption system.

[0054] Similarly, the second key refers to the enhanced key data derived from the first key through extended processing. In this embodiment, it can be understood as an extended key with a larger byte length generated by multiple rounds of iterative operations based on the first key, used to provide sufficient key material to meet the security strength requirements of subsequent encryption processing.

[0055] In one feasible implementation, key expansion can be performed recursively. Specifically, a first key is used as the initial seed, and a first expanded key segment is obtained by expanding the first key in the first round using a preset expansion algorithm. Then, the combination of the first key and the first expanded key segment is used as input for the second round of expansion. This process is repeated until the total length of the expanded key reaches the preset target length requirement. Finally, all the expanded key segments are combined to form the second key.

[0056] In another feasible implementation, key expansion can be performed using a segmented independent expansion method. Specifically, the first key is segmented into segments of a fixed length, and an independent expansion operation is performed on each key segment. The expansion processes of each key segment are independent of each other and use different expansion parameters. Finally, the expansion results of each segment are concatenated and combined in a predetermined order to form a second key with a byte length greater than that of the first key.

[0057] It should be noted that the number of iterations and the expansion factor in each iteration can be adjusted according to specific security requirements and performance constraints. The key is to ensure the one-way nature of the expansion process and the random distribution of the output results. At the same time, the final length of the second key should match the requirements of the encryption algorithm used subsequently.

[0058] In operation S240, the third key refers to the final key data obtained after performing encryption operations on the second key. In this embodiment, it can be understood as a security key protected by double encryption.

[0059] In one feasible implementation, a symmetric encryption algorithm can be used to encrypt the second key. Specifically, the system first generates a symmetric encryption key according to preset rules. This symmetric encryption key can be obtained through the system's built-in random number generator or derived based on a specific algorithm. Then, the symmetric encryption key is used to encrypt the second key. The encryption algorithm can be Advanced Encryption Standard (AES), Data Encryption Standard (DES), or other symmetric encryption algorithms. The ciphertext data obtained after encryption is the third key.

[0060] In another feasible implementation, an asymmetric encryption algorithm can be used to encrypt the second key. Specifically, the system pre-configures a public-private key pair and uses the public key to perform encryption operations on the second key. The encryption algorithm can be the Rivest-Shamir-Adleman (RSA) algorithm, the Elliptic Curve Cryptography (ECC) algorithm, or other asymmetric encryption algorithms.

[0061] It should be noted that the purpose of encrypting the second key is to provide an additional layer of security for the key information, preventing the key from being maliciously intercepted or tampered with during system processing. The generation of the third key signifies that the key data has reached a state where it can be securely stored and transmitted. At the same time, the specific algorithms and parameter settings used in the encryption process should be consistent with the overall security strategy of the system.

[0062] In operation S250, a key verification value can be generated by hash operation. Specifically, the system performs a preset hash algorithm operation on the third key. The hash algorithm can be a series of Secure Hash Algorithms (SHA) or message digest algorithms (MD5). The hash operation yields a fixed-length digest data as the verification value of the third key. This verification value has one-way and collision resistance, and can effectively verify whether the third key has changed during transmission or storage.

[0063] In another feasible implementation, a cyclic redundancy check (CRC) method can be used to generate the key verification value. Specifically, the system performs a cyclic redundancy check (CRC) operation on the third key according to a preset generator polynomial. The remainder obtained by polynomial division is used as the verification value. This verification value can detect data errors and tampering in the third key. At the same time, the CRC operation has the advantage of high computational efficiency and is suitable for application scenarios with high real-time requirements.

[0064] In operation S260, a basic encoding algorithm can be used to uniformly encode the third key and the key verification value. Specifically, the system first concatenates and combines the third key and the key verification value according to a preset format to form a data sequence to be encoded. Then, standard encoding algorithms such as base-64 encoding or hexadecimal encoding are executed on the data sequence to convert the binary data into a displayable character format. The string obtained after encoding is the final target ciphertext.

[0065] In another feasible implementation, a custom encoding rule can be used to encode the third key and the key check value. Each byte in the third key and the key check value can be converted into a corresponding encoded character according to a preset encoding mapping table. The encoding mapping table can contain various character types such as numbers, letters, and special symbols. The complexity of the encoding result is enhanced by the custom character mapping rule, and the encoded character sequence is output as the target ciphertext.

[0066] According to the technical solution disclosed herein, a technique for generating encryption keys based on the characteristics of the original data is established by obtaining n target data to be encrypted and compressing them to obtain a first key, thereby avoiding dependence on external fixed keys or complex key distribution mechanisms. This method expands the first key through multiple rounds of iteration to obtain a second key with a larger byte length, achieving effective expansion of the key space and increased complexity. The introduction of nonlinear transformation characteristics through iterative algorithms enhances the key's resistance to attacks. Encrypting the second key yields a third key, further constructing a multi-layered key transformation system that effectively hides the characteristics of the original key and improves the overall encryption strength. The key verification value for generating the third key provides reliable technical protection for key integrity verification, ensuring the accuracy of key information during transmission and storage. Encoding the third key and the key verification value to obtain the target ciphertext achieves integrated encapsulation of the encryption key and verification information, giving the encryption system self-contained characteristics.

[0067] Compared with existing technologies that rely on dedicated hardware devices or complex infrastructure for key management, the above-mentioned technology achieves self-generation, self-expansion, and self-verification mechanisms for keys, effectively solving the problem of complex key management in traditional encryption methods, reducing deployment costs and implementation complexity, and is suitable for data security protection needs in distributed systems and mobile application environments.

[0068] Based on the above embodiments, as an optional embodiment, operation S220 may further include the following operations: Operation S310 concatenates n target data to be encrypted sequentially to obtain the target data string; Operation S320 divides the target data string into m data groups of equal byte length, where m is a positive integer; Operation S330 performs an XOR operation on the data of each data group to obtain the compressed bytes corresponding to each data group; Operation S340 concatenates the compressed bytes corresponding to each data group sequentially to obtain the first key for n target data to be encrypted.

[0069] In operation S310, n target data to be encrypted can be directly concatenated at the byte level in a preset order to form a continuous target data string.

[0070] In one feasible implementation, the length of each target data is 8k bytes, where k is a positive integer, taking the value 1, 2, or 3. The target data is concatenated byte-by-byte according to the input order, maintaining the original byte sequence of each target data during the concatenation process. The total byte length of the target data string is the sum of the lengths of each target data.

[0071] For example, suppose we obtain three target data to be encrypted, each 8 bytes long. The hexadecimal representation of target data 1 is "A1B2C3D4E5F6A7B8", target data 2 is "C9D0E1F2A3B4C5D6", and target data 3 is "E7F8A9B0C1D2E3F4". The system concatenates them sequentially according to their numbers, resulting in a target data string with the hexadecimal representation "A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4", for a total length of 24 bytes.

[0072] In operation S320, the target data string is divided equally to generate a data group of m bytes of equal length.

[0073] For example, the number of groups *m* can be determined according to a preset grouping strategy. Then, the standard byte length of each data group is calculated, and the target data string is sequentially segmented according to this standard length. Continuing with the above embodiment, for a target data string "A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0C1D2E3F4" with a total length of 24 bytes, if the number of groups *m* is set to 8, then the byte length of each data group is 3 bytes. Sequentially segmenting the target data string according to the 3-byte length yields 8 data groups.

[0074] In operation S330, an XOR operation is performed on the data within each data group to achieve information compression and feature extraction.

[0075] For example, for any data group, each byte in the data group is XORed sequentially to obtain a single compressed byte. Continuing with the above embodiment, for data group 1 "A1B2C3", the first byte A1 and the second byte B2 are XORed to obtain an intermediate result 1B, and then the intermediate result 1B is XORed with the third byte C3 to obtain the final compressed byte D8, that is, A1⊕B2⊕C3=D8.

[0076] Similarly, the same XOR operation is performed on the remaining 7 data groups: data group 2 "D4E5F6" yields compressed byte 23, data group 3 "A7B8C9" yields compressed byte 1E, data group 4 "D0E1F2" yields compressed byte 03, data group 5 "A3B4C5" yields compressed byte 16, data group 6 "D6E7F8" yields compressed byte 01, data group 7 "A9B0C1" yields compressed byte 78, and data group 8 "D2E3F4" yields compressed byte 05.

[0077] The XOR operation described above merges multiple bytes of information in each data group into a single compressed byte. The avalanche effect of the XOR operation ensures that even small changes in the input data will lead to changes in the output result.

[0078] In operation S340, the compressed bytes corresponding to each data group are concatenated sequentially according to the original order of the data groups to form the first key.

[0079] For example, the corresponding compressed bytes are arranged and concatenated in the order of the first data group to the m-th data group. The compressed bytes corresponding to the 8 data groups are concatenated in the order of the data group numbers to obtain the hexadecimal representation of the first key as "D8231E03160178O5", with a total length of 8 bytes.

[0080] Through the above splicing process, the first key contains all the feature information of the original target data, and the compression process eliminates the differences in format and structure of the original data.

[0081] By adopting the technical solution disclosed herein, the problem of unified processing of multi-source heterogeneous data is solved by sequentially concatenating n target data to form a target data string. By equally dividing the target data string, m data groups with equal byte lengths are obtained, realizing the balanced allocation of data processing weights and standardized operation. By performing an XOR operation on each data group to obtain compressed bytes, the information characteristics of each data group are fully integrated and the security sensitivity of the result is enhanced. By sequentially concatenating the compressed bytes to obtain the first key, the effective conversion from multiple dispersed data sources to a single standardized key is completed.

[0082] Based on the above embodiments, as an optional embodiment, operation S230 may further include the following operations: Operation S410 expands the first key to obtain an expanded key for the first key; Operation S420 iteratively expands the extended key of the first key to obtain multiple extended keys corresponding to the first key; the termination condition for iterative expansion is that the sum of the byte lengths of the multiple extended keys corresponding to the first key is greater than or equal to a preset length. Operation S430: Concatenate the first key with at least one extended key corresponding to the first key to obtain the second key.

[0083] In operation S410, the operation of expanding the first key may further include the following operations: Operation S510 determines the target location and data segment length based on the value of the first byte in the first key; Operation S520: Starting from the target position, extract the target data segment from the first key in a loop according to the data segment length; Operation S530 performs an XOR operation on the target data segment to obtain the extended byte corresponding to the first byte; Operation S540 iterates through each byte in the first key, repeating the above steps to obtain the extended byte corresponding to each byte; Operation S550 concatenates the extended bytes corresponding to each byte to obtain the extended key of the first key.

[0084] In operation S510, the system calculates and determines the parameters of the target location and data segment length based on the value of the first byte in the first key.

[0085] Optionally, the value of the first byte is moduloed to determine the target position, and the data segment length is extracted through bitwise operations. Continuing with the above embodiment, the first key is "D8231E03160178O5", the first byte is D8, and the corresponding decimal value is 2^16. The system performs a modulo operation on the total byte length of the first key, 2^16, to obtain a target position of 0, indicating that the target position is the starting position of the first key. By extracting the lower 3 bits of the first byte D8, the binary value 000 is obtained, corresponding to the decimal value 0. Adding 1 to this value yields a data segment length of 1.

[0086] In operation S520, starting from the determined target location, a cyclic truncation operation is performed on the first key according to the data segment length.

[0087] Optionally, starting from the target position, data segments are sequentially extracted according to their length. When the end of the first key is reached, the extraction automatically returns to the starting position and continues until a number of data segments equal to the length of the first key in bytes are obtained. Continuing with the above embodiment, starting from the target position 0, target data segments are cyclically extracted from the first key "D8231E03160178O5" according to a data segment length of 1. Eight data segments are extracted sequentially: "D8", "23", "1E", "03", "16", "01", "78", and "05".

[0088] In operation S530, each target data segment is XORed to generate the extended byte corresponding to the first byte.

[0089] Optionally, each target data segment is XORed sequentially according to the truncation order to obtain a single extended byte. Continuing with the above embodiment, an XOR operation is performed on the 8 target data segments: D8⊕23⊕1E⊕03⊕16⊕01⊕78⊕05, resulting in the extended byte 8C corresponding to the first byte D8.

[0090] In operation S540, each byte in the first key is traversed, and the processing steps of operations S510 to S530 are repeated for each byte.

[0091] Optionally, the same expansion processing is performed on the second to eighth bytes sequentially according to their position order in the first key. Continuing with the above embodiment, the second byte 23 in the first key "D8231E03160178O5" is processed as follows: the target position is calculated to be 35 mod 8 = 3, the data segment length is 4, and the corresponding data segments are obtained by cyclically extracting data segments of length 4 starting from position 3. After XOR operation, the expanded byte is obtained.

[0092] Similarly, the same processing flow is performed on the third byte 1E, the fourth byte 03, the fifth byte 16, the sixth byte 01, the seventh byte 78, and the eighth byte 05, respectively, to calculate their respective target positions, data segment lengths, extract the corresponding target data segments, and perform XOR operations, ultimately obtaining the extended bytes corresponding to each byte.

[0093] Through the above traversal process, each byte in the first key obtains an extended byte based on its own numerical characteristics and the overall key information.

[0094] In operation S550, the extended bytes corresponding to each byte in the first key are concatenated according to the positional order of the original bytes.

[0095] Optionally, the corresponding extended bytes are concatenated sequentially in the order of the first byte to the eighth byte to form an extended key. Continuing with the above embodiment, the eight extended bytes are concatenated in the original byte order to obtain the extended key of the first key, which is "8CA7B25FC4E93D6A", with a byte length of 8 bytes.

[0096] According to the technical solution disclosed herein, the expansion processing of the first key is achieved through dynamic positioning and cyclic truncation mechanism based on byte values, which solves the problems of single processing method and insufficient security in related key expansion methods. The target position and data segment length are dynamically determined based on the value of each byte in the first key, establishing a direct mapping relationship between byte values ​​and truncation parameters, giving each byte a personalized processing characteristic. By cyclically trunculating the target data segment according to the data segment length starting from the target position, cross-referencing and recombination of internal key information are achieved, ensuring sufficient data segments for processing even with limited key length. An XOR operation is performed on the target data segment to generate extended bytes. The speed of the XOR operation is used to merge multiple data segment information into a single extended byte, achieving high information mixing and enhanced randomness. Finally, the extended bytes corresponding to each byte are concatenated to obtain the extended key, significantly improving the internal complexity and security strength while maintaining the original key length.

[0097] In operation S420, the extended key of the first key is iteratively extended until the cumulative byte length of all extended keys meets the preset length requirement.

[0098] Optionally, the extended key obtained from the first expansion is used as the new input key, and the expansion process in operation S410 is repeated, iterating until the termination condition is met. Continuing with the above embodiment, a preset length of 32 bytes is set. The first expansion key "8CA7B25FC4E93D6A" is used as input for the second expansion, resulting in the second expansion key "F32B6E91A5D8C47F". This key is then used as input for the third expansion, resulting in the third expansion key "2E94B73F618A5DC2". A fourth expansion is then performed, resulting in the fourth expansion key "A6F1829B4C3E7D58". At this point, the sum of the byte lengths of the four expansion keys is 1 byte, satisfying the termination condition of the iterative expansion.

[0099] In operation S430, the first key and the extended key corresponding to the first key are concatenated in a preset order to generate the second key.

[0100] Optionally, the first key, the first extended key, the second extended key, the third extended key, and the fourth extended key are concatenated sequentially. After concatenation, the second key is obtained as "D8231E03160178O58CA7B25FC4E93D6AF32B6E91A5D8C47F2E94B73F618A5DC2A6F1829B4C3E7D58", with a total length of 40 bytes.

[0101] According to the technical solution disclosed herein, a second key is generated by expanding the first key through multiple rounds of iteration, effectively solving the problems of fixed key length and insufficient security strength in key expansion methods of related technologies. An expanded key is obtained by initially expanding the first key, and highly random expanded data is generated by utilizing the interaction of byte information within the key. Subsequently, through an iterative expansion mechanism, the previous round of expanded key is used as the input for the next round of continuous expansion, forming a deep mixture of key information. Each iteration introduces new nonlinear transformation characteristics. By setting the iteration termination condition to the sum of the lengths of the expanded key bytes being greater than or equal to a preset length, precise control of key material generation is achieved, ensuring sufficient key length while avoiding resource waste.

[0102] Based on the above embodiments, as an optional embodiment, operation S250 may further include the following operations: Operation S610 divides the third key into a preset number of key groups; Operation S620 uses each byte of the third key as a different randomization factor; Operation S630: For any randomization factor, when there is a common factor between the randomization factor and the byte length of the key group, the randomization factor is adjusted until the randomization factor and the byte length of the key group are coprime, thus obtaining the target randomization factor. Operation S640 calculates the target position corresponding to each key group based on the target randomization factor and the sequence number corresponding to each key group; Operate S650 to obtain the corresponding verification bytes from the target location of each key group; Operation S660 performs an XOR operation between each verification byte and the corresponding byte in the first key to obtain the verification result corresponding to each verification byte; Operation S670 concatenates the verification results sequentially to obtain the key verification value of the third key.

[0103] In operation S610, the third key is divided equally according to a preset number to form multiple key groups with the same byte length.

[0104] For example, a preset quantity of 8 is set, and the third key is divided into 8 equal parts according to byte order. Continuing with the above embodiment, assuming that the length of the third key obtained after 3DES encryption of the second key is 40 bytes, the third key is divided into 8 equal parts, with each key group having a byte length of 5 bytes.

[0105] In operation S620, each byte of the third key is extracted as an independent randomization factor according to its positional order.

[0106] For example, the values ​​of each byte are extracted sequentially as randomization factors according to the byte sequence of the third key. Continuing with the above embodiment, the third key contains 40 bytes, and the randomization factors extracted sequentially from left to right according to the byte position are: F7, A2, B8, and so on, with randomization factor 40 being A9. Each randomization factor corresponds to its unique position number in the third key, ensuring the independence and positional correlation of the randomization factors.

[0107] In operation S630, the system performs coprime checks and adjustments on each randomization factor to ensure that there is no common factor with the byte length of the key group.

[0108] For example, the randomization factor is processed using an incremental adjustment method. Continuing with the above embodiment, the key group has a byte length of 5. For the value F7 of randomization factor 1, the greatest common divisor of 247 and 5 is calculated to be 1. Since they are coprime, the target randomization factor is 247. For the value A2 of randomization factor 2, the greatest common divisor of 162 and 5 is calculated to be 1. Since they are coprime, the target randomization factor is 162. Assuming the value of a certain randomization factor is FA, the greatest common divisor of 250 and 5 is calculated to be 5. Since they have a common divisor, 250 is incremented by 1 to get 251. The greatest common divisor of 251 and 5 is calculated to be 1. Since they are coprime, the target randomization factor is 251.

[0109] Through the above adjustments, it is ensured that all target randomization factors are coprime to the key group byte length of 5, guaranteeing that the subsequent modulo operation result is not zero, and maintaining the effectiveness of the verification algorithm.

[0110] In operation S640, the target position of each key group is calculated based on the product operation of the target randomization factor and the key group sequence number.

[0111] For example, the target position is determined by product modulo operation. Continuing with the above embodiment, the target randomization factor 1 is 247. For key group 1, 247 × 1 modulo 5 is calculated to obtain the target position as 2. For key group 2, the target position is 4. For key group 3, the target position is 1, and so on.

[0112] In operation of S650, the system extracts the corresponding check bytes from the corresponding key group according to the target location of each key group.

[0113] For example, the byte data in each key group is directly indexed according to the target position. Continuing with the above embodiment, if the target position of key group 1 is 2, the second byte is extracted as check byte 1. If the target position of key group 2 is 4, the fourth byte is extracted as check byte 2. And so on, the check bytes of the remaining key groups are extracted respectively.

[0114] In operation S660, the system performs an XOR operation between each verification byte and the corresponding byte in the first key to generate a verification result.

[0115] For example, XOR operations are performed one by one according to the positional correspondence. Continuing with the above embodiment, the first key is "D8231E03160178O5". The XOR operation is performed between A2 of the verification byte 1 and the byte D8 of the first key at the first position, resulting in verification result 1 as A2⊕D8=7A. And so on, the remaining verification results are calculated.

[0116] In operation S670, the verification results are concatenated in sequence to form the complete key verification value of the third key.

[0117] Following the above embodiment, the eight verification results 7A, 96, C6, E1, A7, C5, A0, and F4 are concatenated in sequence to obtain the key verification value of the third key as "7A96C6E1A7C5A0F4".

[0118] By adopting the technical solution disclosed herein, the third key is divided into a preset number of key groups, with each byte serving as a randomization factor. This achieves structured and randomized processing of the key verification process, effectively avoiding the regularity vulnerabilities present in traditional verification methods. The adjustment mechanism when the randomization factor and the key group byte length have a common divisor ensures a coprime relationship between the target randomization factor and the key group byte length. This guarantees that the target position calculation based on modulo operations will not produce zero or duplicate values, eliminating blind spots and overlaps in the selection of verification bytes.

[0119] Figure 3 A flowchart illustrating a data decryption method according to an embodiment of the present disclosure is shown schematically.

[0120] like Figure 3 As shown, the data decryption method in this embodiment includes the following operations: Operate the S710 to obtain the target ciphertext; Operate S720 to decode the target ciphertext and obtain the third key and key verification value; Operate S730 to decrypt the third key to obtain the second key; The S740 is operated to compress the second key through multiple rounds of iteration to obtain the first key; the byte length of the first key is less than the byte length of the second key; Operate S750 to verify the correctness of the first key based on the key verification value; Operation S760, if the correctness verification of the first key passes, expands the first key to obtain n target data; n is a positive integer.

[0121] In operating the S710, the system first obtains the target ciphertext, which is a key data carrier that has undergone complete encryption and encoding.

[0122] For example, the system can obtain the target ciphertext by reading a pre-stored key file. The key file is typically stored in text format in a specified storage path, and its content is a visible string encoded in Base64. The file content is obtained through a file reading interface, and the read string data is identified as the target ciphertext.

[0123] In operating the S720, the system first performs Base64 decoding on the target ciphertext, converting the ciphertext in visible character format into binary data. Then, it parses and separates the decoded binary data according to a preset data structure format.

[0124] Specifically, the decoded data is organized according to a fixed format: the first part contains the number of key components, the middle part contains the encrypted third key data, and the last part contains the key verification value used for integrity verification. The system segments the decoded data according to this format rule to extract the third key and the key verification value.

[0125] In operating the S730, the system first determines the generation method of the decryption key according to a preset decryption strategy. This decryption key is typically derived from the characteristic information of the third key itself through a specific algorithm, ensuring the self-containment and security of the decryption process. Then, the system uses this decryption key to perform a symmetric decryption operation on the third key. The decryption algorithm adopts the same technical standard as the encryption process, such as symmetric encryption algorithms like 3DES or AES. Through reverse cryptographic transformation, the encrypted third key is restored to the original second key data. After decryption, the system performs format verification and length checks on the decryption result to ensure that the obtained second key meets the expected data structure requirements.

[0126] In operating the S740, the system first performs structured parsing of the second key according to preset segmentation rules, dividing the second key into segments of fixed byte length to obtain an initial key segment and several extended key segments. Then, the system performs reverse compression operations on each extended key segment, verifying the consistency between each extended key segment and the initial key segment through a reverse processing flow corresponding to the expansion algorithm. When the verification passes, the system identifies the initial key segment as the recovered first key, completing the compression conversion process from the second key to the first key.

[0127] In operating the S750, the system first recalculates the verification key using the recovered first and third keys based on the key verification value generation algorithm. This calculation process employs the same algorithm and parameter settings as when the verification value was generated. Then, the system compares the calculated verification key byte-by-byte with the recovered first key. If they are completely identical, it indicates that the correctness verification of the first key has passed. If there is a difference, it indicates that an error occurred during the key recovery process, and the system needs to re-execute the relevant operations or report a verification failure.

[0128] In operation S760, the extended processing refers to the decomposition operation of restoring the compressed data to the original multiple data sources through the reverse algorithm. In the embodiment of this application, it can be understood as reconstructing the original n target data based on the compressed feature information of the first key through reverse operation.

[0129] The reason for performing extended processing is that the first key is an integrated information obtained by compressing n target data. Although it contains the core features of all target data, it has lost the independent structure of each target data. Through extended processing, the independent target data can be reconstructed from the integrated first key according to the reverse rules of the compression algorithm, thus completing the complete recovery process from the key to the original data.

[0130] Specifically, the system first performs a structured decomposition of the first key according to preset expansion rules, grouping the first key into data groups of fixed byte lengths to obtain a data group structure corresponding to the compression process. Then, the system performs expansion operations on each data group, using reverse XOR operations and data reassembly techniques to convert each compressed data group into its corresponding original data segment. Finally, the system combines and separates each data segment according to preset segmentation rules, reconstructing n independent target data items and restoring the original format and content structure of the data.

[0131] According to the technical solution disclosed herein, a third key and a key verification value are obtained by acquiring the target ciphertext and performing decoding processing, establishing the data input foundation for the key recovery process and ensuring the data integrity and format correctness of subsequent processing operations. A second key is obtained by decrypting the third key, achieving a secure conversion of key data from encrypted to plaintext state and eliminating security protection layers during key transmission and storage. A first key is obtained by compressing the second key through multiple rounds of iteration, effectively restoring the core characteristic information of the key and removing redundant data added during the expansion process. Verifying the correctness of the first key based on the key verification value provides a reliability guarantee mechanism for the key recovery process, promptly detecting and eliminating data processing errors. After successful verification, the first key is expanded to obtain n target data, completing the entire recovery chain from the integrated key to the original data and achieving closed-loop processing of key management.

[0132] Based on the above embodiments, as an optional implementation, operation S740 may further include the following operations: Operation S810 divides the second key into segments of a preset length to obtain an initial key segment and at least one extended key.

[0133] Specifically, the system performs segmentation processing on the second key according to a preset length to separate the initial key segment and the extended key segment. Segmentation processing refers to the operation of dividing and grouping a continuous data sequence according to a fixed byte length. In this embodiment, it can be understood as decomposing the second key into an original key part and an extended key part based on its internal structural characteristics.

[0134] For example, the system performs segmentation based on the standard byte length of the first key as a preset length. Continuing with the above embodiment, the second key is "D8231E03160178O58CA7B25FC4E93D6AF32B6E91A5D8C47F2E94B73F618A5DC2A6F1829B4C3E7D58", with a total byte length of 40 bytes and a preset length of 8 bytes. The system sequentially segments the second key according to the 8-byte length. First, it extracts the first 8 bytes "D8231E03160178O5" as the initial key segment, and then continues to segment the remaining 32 bytes according to the 8-byte length to obtain 4 extended key segments.

[0135] Operation S820 iteratively compresses at least one extended key to obtain a compressed key; the termination condition for iterative compression is that the length of the compressed key in bytes is equal to the length of the initial key segment in bytes. Based on the above embodiments, as an optional implementation, operation S820 may further include the following operations: Operation S910 determines the target location and data segment length based on the value of the first byte in the initial key segment.

[0136] Specifically, the system determines the target position and data segment length parameters based on the value of the first byte in the initial key segment through mathematical operations. This operation refers to using specific bit information of the byte value and modulo operation rules to generate the position and length parameters required for subsequent data truncation. In this embodiment, it can be understood as a mapping process that converts byte values ​​into algorithm control parameters.

[0137] For example, the system uses a combination of modulo arithmetic and bit extraction to calculate the target position and data segment length. Continuing with the above embodiment, the initial key segment is "D8231E03160178O5", the first byte is D8, and the corresponding decimal value is 2^16. The system performs a modulo operation on 2^16 and the byte length 8 of the initial key segment to obtain the target position as 2^16 mod 8 = 0, indicating that the truncation operation starts from the 0th byte position of the initial key segment. At the same time, the system extracts the lower 3 bits of byte D8, which is 000, corresponding to the decimal value 0. Adding 1 to this value gives a data segment length of 1, indicating that 1 byte of data is truncated each time.

[0138] Through the above calculations, the system determined the truncation parameters for the first byte D8: the target position is 0 and the data segment length is 1, providing precise control parameters for subsequent cyclic truncation operations.

[0139] Operation S920 uses the target position as the starting position and cyclically extracts the target data segment from the initial key segment according to the data segment length.

[0140] Specifically, starting from a defined target location, a cyclic truncation operation is performed on the initial key segment according to the data segment length to obtain the target data segment. Cyclic truncation refers to a repetitive process of extracting data sequentially from a specified position according to a fixed length, and automatically returning to the starting position to continue truncation when the end of the data is reached.

[0141] For example, the system sequentially extracts data segments from the target position according to the data segment length, with the number of segments extracted equal to the byte length of the initial key segment. Continuing with the above embodiment, starting from the target position 0, the system cyclically extracts target data segments from the initial key segment "D8231E03160178O5" according to a data segment length of 1. The system sequentially extracts 8 data segments.

[0142] Operation S930 performs an XOR operation on the target data segment to obtain the compressed byte corresponding to the first byte; For example, the system performs sequential XOR operations on all target data segments. Continuing with the above embodiment, XOR operations are performed on the eight target data segments "D8", "23", "1E", "03", "16", "01", "78", and "05". The system first converts these hexadecimal data segments into binary format, and then performs bitwise XOR operations: D8⊕23⊕1E⊕03⊕16⊕01⊕78⊕05.

[0143] Through the above XOR operation, the system obtains the compressed byte corresponding to the first byte D8 as 8C. This compressed byte integrates the feature information of all bytes in the initial key segment.

[0144] Operation S940 iterates through each byte in the initial key segment, repeating the above steps to obtain the compressed byte corresponding to each byte.

[0145] For example, the system processes each byte in the initial key segment sequentially according to its byte position. Continuing with the above embodiment, the initial key segment "D8231E03160178O5" contains 8 bytes. The system processes the 2nd byte 23, the 3rd byte 1E, up to the 8th byte 05 sequentially. For the 2nd byte 23, the system calculates the target position as 23 mod 8 = 7, and the data segment length is 4. Starting from position 7, it cyclically extracts 4 bytes of data and performs an XOR operation to obtain compressed bytes. The system processes the remaining bytes in the same way, finally obtaining 8 compressed bytes.

[0146] Operate S950 to concatenate the compressed bytes corresponding to each byte to obtain the compression key.

[0147] For example, the system concatenates the corresponding compressed bytes sequentially according to the original position order of the bytes in the initial key segment. Continuing with the above embodiment, the 8 bytes in the initial key segment "D8231E03160178O5" are compressed to obtain the corresponding compressed bytes, and finally the compressed key "8CA7B4F26ED93AC1" is obtained.

[0148] Operate S830 to generate the extended key corresponding to the initial key.

[0149] For example, following the above embodiment, the initial key is "A1B2C3D4E5F60708", and the system uses this 16-byte key as input for key expansion. The system first divides the initial key into four 32-bit words, W0 to W3. The system generates subsequent key words using round functions: W4 is obtained by XORing W0 with W3 after a circular left shift, S-box substitution, and round constant XOR; W5 is obtained by XORing W4 with W1, and so on. After 10 rounds of expansion operations, the system generates an expanded key sequence containing 44 32-bit words, with a total length of 176 bytes.

[0150] Operation S840 compares and verifies the extended key corresponding to the initial key with at least one extended key segment; For example, a specific segment of the extended key is selected and precisely matched with a pre-stored extended key segment for verification. Continuing with the above embodiment, the total length of the extended key is 176 bytes, and the system selects a 16-byte data segment from byte 32 to byte 47 as the verification segment. Assuming the content of this verification segment is "2F8A9C1D4E6B7A93", the system compares it byte by byte with the preset extended key segment "2F8A9C1D4E6B7A93". The system compares each byte sequentially: byte 1, 2F, matches with 2F; byte 2, 8A, matches with 8A; and so on, until byte 16, 93, matches with 93. When all bytes are completely identical, the system confirms that the verification is successful and the extended key is valid.

[0151] When the S850 is operated and the verification matches, the initial key is determined as the first key.

[0152] Specifically, the system determines the initial key as the first key if the comparison and verification results are consistent. Consistent comparison and verification refers to the state where specific parts of the compressed key and the extended key match after comparison and calculation. In this embodiment, it can be understood as a verification process confirming that the initial key meets the encryption requirements after key quality checks.

[0153] For example, the system performs a key determination operation when the last 8 bytes of the compressed key and the extended key match exactly. Continuing with the above embodiment, the compressed key is "8CA7B4F26ED93AC1", and the last 8 bytes of the extended key are also "8CA7B4F26ED93AC1". The system performs a byte-by-byte comparison and finds that they are completely identical. Based on the successful comparison verification, the system determines the initial key "A1B2C3D4E5F60708" as the first key.

[0154] By employing the technical solution disclosed herein, the compression conversion from a second key to a first key is achieved. The system structurally segments the second key according to a preset length, decomposing the complex key data into an initial key segment and at least one extended key, thus establishing a clear data processing framework for subsequent precise compression operations. Through multiple rounds of iterative compression processing on at least one extended key, the byte length of the key data can be gradually reduced. The iteration process automatically stops when the compressed key length reaches a preset condition equal to the initial key segment, ensuring precise control and standardized output of key compression.

[0155] Based on the above embodiments, as an optional embodiment, operation S750 may further include the following operations: Operate S910 to divide the third key into a preset number of key groups; Specifically, the third key can be divided equally according to a preset number to form multiple key groups. Equal division processing refers to the division operation of continuous data into segments of equal length. In the embodiments of this application, it can be understood as the grouping process of decomposing a complete key sequence into several sub-key units of equal length.

[0156] For example, the system equally divides the third key into four key groups according to a preset number. Continuing with the above embodiment, the third key is "8CA7B4F26ED93AC1", with a total length of 16 bytes. The system divides it into four key groups, each containing 4 bytes. The specific division results are: the first key group is "8CA7", the second key group is "B4F2", the third key group is "6ED9", and the fourth key group is "3AC1". The system assigns a corresponding sequence number to each key group, namely group number 0, 1, 2, and 3, to facilitate subsequent position calculation and data indexing operations.

[0157] Operation S920 uses the first byte of the third key as a randomization factor; Specifically, the system extracts the first byte of the third key as a randomization factor. The randomization factor refers to a parameter value used to introduce randomness and enhance security; in this embodiment, it can be understood as selecting a specific byte from the key sequence as the randomization parameter for subsequent calculations.

[0158] For example, the byte data at the beginning of the third key is directly extracted as the randomization factor. Continuing with the above embodiment, the third key is "8CA7B4F26ED93AC1", and the system extracts the first byte "8C" of this key sequence as the randomization factor. The system converts the byte value "8C" into the decimal value 140 and stores it as the randomization factor parameter.

[0159] Operation S930: When the randomization factor and the byte length of the key group have a common divisor, the randomization factor is adjusted until the randomization factor and the byte length of the key group are coprime, thus obtaining the target randomization factor. For example, an incremental adjustment method can be used to handle the coprime relationship between the randomization factor and the key group byte length. Continuing with the above embodiment, the randomization factor is 140, the key group byte length is 4, and the system calculates that their greatest common divisor is 4. Since a common divisor exists, the system performs an incremental adjustment on the randomization factor: increasing 140 by 1 to obtain 141, and calculating the greatest common divisor of 141 and 4, which is 1, satisfying the coprime condition. The system determines 141 as the target randomization factor and stores it for subsequent target position calculation operations.

[0160] Operation S940 calculates the target position corresponding to each key group based on the target randomization factor and the sequence number corresponding to each key group; For example, the target position of each key group can be calculated using a modulo operation. Continuing with the above embodiment, the target randomization factor is 141, and the key group byte length is 4. The system performs position calculation for each key group: the first key group has an index of 0, and its target position is (141 × 0) mod 4 = 0, and so on. The system extracts the index of the check byte of each key group corresponding to the calculated target positions 0, 1, 2, and 3.

[0161] Operate S950 to obtain the corresponding verification bytes from the target location of each key group; For example, the verification bytes can be extracted sequentially from each key group according to the target position index. Continuing with the above embodiment, the key groups and their target positions are as follows: the first key group "8CA7" corresponds to target position 0, and the byte "8C" at position 0 is extracted; the second key group "B4F2" corresponds to target position 1, and the byte "4F" at position 1 is extracted; the third key group "6ED9" corresponds to target position 2, and the byte "D9" at position 2 is extracted; the fourth key group "3AC1" corresponds to target position 3, and the byte "C1" at position 3 is extracted. The system arranges and stores the extracted verification bytes "8C", "4F", "D9", and "C1" in the order of the key group number.

[0162] Operation S960 performs an XOR operation between each verification byte and the corresponding byte in the key verification value to obtain the verification result corresponding to each verification byte; For example, the system performs an XOR operation between the verification byte and the key verification value according to their positional correspondence. Continuing with the above embodiment, the verification byte sequence is "8C4FD9C1", and the key verification value is "8C4FD9C1". The system performs XOR calculation byte by byte: the first verification byte "8C" is XORed with the first byte of the key verification value "8C" to obtain "00"; the second verification byte "4F" is XORed with the second byte of the key verification value "4F" to obtain "00"; the third verification byte "D9" is XORed with the third byte of the key verification value "D9" to obtain "00"; the fourth verification byte "C1" is XORed with the fourth byte of the key verification value "C1" to obtain "00". The system stores each verification result "00", "00", "00", "00" as a verification result sequence.

[0163] In the above embodiments, the phenomenon that the key is all "0" is due to a special numerical setting used for simplification during the illustration process. In the actual key generation and processing process, the key data is usually a non-zero random numerical sequence generated by a random number generation algorithm or a specific key derivation function.

[0164] It should be noted that in the illustrative example of this embodiment, the first key "00000000" is a simplified value chosen for ease of demonstrating the processing logic of each operation step. When the first key is "00000000", each key group obtained after being cut into 2-byte lengths is "00", and the target data generated after expansion, concatenation, and cutting also retains the numerical characteristic of "00". In the subsequent verification process, since the values ​​of each verification byte and the key verification value are exactly the same when XORed, the XOR result must be "00", and the final concatenated verification key is also "000000000".

[0165] In practical applications, key data should possess sufficient randomness and complexity to ensure encryption security. Key values ​​should not be all zeros or other predictable simple numerical patterns. The "00000000" in the above embodiments is only used for logical demonstration of the technical solution and is not a recommended key format for actual encryption systems.

[0166] Operate S970 to concatenate the verification results sequentially to obtain the verification key; For example, the system performs byte concatenation operations according to the generation order of the verification results. Continuing with the above embodiment, the verification results are "00", "00", "00", and "00". The system takes the first verification result "00" as the concatenation start and sequentially concatenates the second, third, and fourth verification results "00" to form the complete verification key "00000000". The system stores this verification key as the base data for key validity determination.

[0167] Operate S980 to determine whether the verification key is consistent with the first key, in order to verify the correctness of the first key.

[0168] For example, the system performs a byte-level comparison operation between the verification key and the first key. Continuing with the above embodiment, the verification key is "00000000" and the first key is "00000000". The system performs a byte-by-byte numerical comparison: the 8 bytes of data of the verification key are completely consistent with the 8 bytes of data of the first key. The system determines that the verification key and the first key match successfully, confirms the correctness of the first key as valid, and outputs a result identifier indicating that the key verification has passed.

[0169] By adopting the technical solution disclosed herein, the third key is evenly divided into a preset number of key groups, establishing a structured data organization method and providing a clear grouping basis for randomized verification. By using the first byte of the third key as a randomization factor, a key content-driven dynamic parameter mechanism is constructed, enabling the verification process to have adaptive characteristics. The system detects the common divisor relationship between the randomization factor and the byte length of the key groups. When a common divisor exists, adjustment processing is performed until they are coprime to obtain the target randomization factor, ensuring the effectiveness of the randomization process. Based on the target randomization factor and the key group sequence number, the target position is calculated, establishing a randomized position selection mechanism, enhancing the unpredictability of the verification byte extraction. The verification byte is obtained from the target position of each key group, avoiding the security vulnerability of extraction from a fixed position.

[0170] Based on the above embodiments, as an optional embodiment, operation S760 may further include the following operations: Operation S1010 divides the first key into m key groups according to a preset byte length, where m is a positive integer.

[0171] Specifically, the system divides the first key into m key groups according to a preset byte length. Key group division refers to the segmentation operation of processing the complete key data into segments according to a fixed number of bytes. In this embodiment, it can be understood as the process of dividing a continuous key byte sequence into multiple data blocks of equal length according to a predetermined length.

[0172] For example, the system uses a 2-byte length as the preset byte length to evenly divide the first key. Continuing with the above embodiment, the first key is "00000000". The system divides it into 2-byte segments: starting from the beginning, the first two bytes "00" are extracted as the first key group, the next two bytes "00" are extracted as the second key group, the next two bytes "00" are extracted as the third key group, and the last two bytes "00" are extracted as the fourth key group. The system obtains 4 key groups, i.e., m=4, and the key groups are "00", "00", "00", and "00" respectively.

[0173] Operation S1020 performs expansion processing on each key group to obtain the expanded data group corresponding to each key group.

[0174] For example, the system uses a cyclic copying method to expand each key group. Continuing with the above embodiment, the key groups are "8CA7", "B4F2", "6ED9", and "3AC1". The system generates expanded data groups for each key group four times: the first key group "8CA7" is expanded to "8CA78CA78CA78CA7"; the second key group "B4F2" is expanded to "B4F2B4F2B4F2B4F2"; the third key group "6ED9" is expanded to "6ED96ED96ED96ED9"; and the fourth key group "3AC1" is expanded to "3AC13AC13AC13AC1". The system stores each expanded data group in the order of the original key groups.

[0175] Operation S1030 concatenates each extended data group sequentially to obtain the target data string.

[0176] For example, the system performs sequential join operations according to the order in which the extended data groups are generated. Following the above embodiments, the extended data groups are "8CA78CA78CA78CA7", "B4F2B4F2B4F2B4F2", "6ED96ED96ED96ED9", and "3AC13AC13AC13AC1". The system uses the first extended data group "8CA78CA78CA78CA7" as the connection start, and sequentially connects the second extended data group "B4F2B4F2B4F2B4F2", the third extended data group "6ED96ED96ED96ED9", and the fourth extended data group "3AC13AC13AC13AC1", forming the complete target data string "8CA78CA78CA78CA7B4F2B4F2B4F2B4F26ED96ED96ED96ED93AC13AC13AC13AC1".

[0177] Operation S1040 divides the target data string into n target data segments.

[0178] For example, the system uses a 4-byte length as the segmentation standard to evenly divide the target data string. Continuing with the above embodiment, the target data string is "8CA78CA78CA78CA7B4F2B4F2B4F2B4F26ED96ED96ED96ED93AC13AC13AC13AC1". The system segments it according to a 4-byte length: starting from the beginning, it extracts "8CA7", "8CA7", "8CA7", "8CA7", "B4F2", "B4F2", "B4F2", "B4F2", "6ED9", "6ED9", "6ED9", "6ED9", "3AC1", "3AC1", "3AC1", "3AC1", "3AC1", resulting in 16 target data items, i.e., n=16. The system then numbers and stores each target data item according to the segmentation order.

[0179] By adopting the technical solution disclosed herein, and performing expansion processing on each key group to obtain corresponding expanded data groups, the system effectively amplifies the key data, enhancing the complexity and security strength of the keys. The system sequentially concatenates each expanded data group to form a target data string, completing the integration process from scattered to overall data, ensuring the continuity and integrity of the expanded key data. By dividing the target data string into n target data according to preset rules, the system establishes a standardized data output format.

[0180] Based on the above data encryption method, this disclosure also provides a data encryption device. The following will be combined with... Figure 4 The device is described.

[0181] Figure 4 A schematic block diagram of a data encryption device according to an embodiment of the present disclosure is shown.

[0182] like Figure 4 As shown, the data encryption device 400 includes: The first acquisition module 410 is used to acquire n target data to be encrypted, where n is a positive integer; The first compression module 420 is used to compress n target data to be encrypted to obtain the first key of the n target data to be encrypted. The first extension module 430 is used to extend the first key through multiple rounds of iteration to obtain the second key; the byte length of the second key is greater than the byte length of the first key; The data encryption module 440 is used to encrypt the second key to obtain the third key; The first verification module 450 is used to generate the key verification value of the third key; The data encoding module 460 is used to encode the third key and the key verification value to obtain the target ciphertext.

[0183] According to an embodiment of this disclosure, the first compression module 420 is further configured to concatenate n target data to be encrypted sequentially to obtain a target data string; divide the target data string into m data groups of equal byte length, where m is a positive integer; perform an XOR operation on the data of each data group to obtain the compressed bytes corresponding to each data group; and concatenate the compressed bytes corresponding to each data group sequentially to obtain the first key for the n target data to be encrypted.

[0184] According to an embodiment of this disclosure, the first extension module 430 is further configured to extend the first key to obtain an extended key of the first key; iteratively extend the extended key of the first key to obtain multiple extended keys corresponding to the first key; the termination condition of the iterative extension is that the sum of the byte lengths of the multiple extended keys corresponding to the first key is greater than or equal to a preset length; and concatenate the first key with at least one extended key corresponding to the first key to obtain a second key.

[0185] According to an embodiment of this disclosure, the first extension module 430 is further configured to determine the target position and data segment length based on the value of the first byte in the first key; take the target position as the starting position and cyclically extract the target data segment from the first key according to the data segment length; perform an XOR operation on the target data segment to obtain the extension byte corresponding to the first byte; traverse each byte in the first key and repeat the above steps to obtain the extension byte corresponding to each byte; and concatenate the extension bytes corresponding to each byte to obtain the extension key of the first key.

[0186] According to embodiments of this disclosure, the first verification module 450 is further configured to: divide the third key into a preset number of key groups; use each byte of the third key as a different randomization factor; for any randomization factor, when the randomization factor and the byte length of the key group have a common divisor, adjust the randomization factor until the randomization factor and the byte length of the key group are coprime, thus obtaining a target randomization factor; calculate the target position corresponding to each key group based on the target randomization factor and the sequence number corresponding to each key group; obtain the corresponding verification byte from the target position of each key group; perform an XOR operation between each verification byte and the byte at the corresponding position in the first key to obtain the verification result corresponding to each verification byte; and concatenate the verification results sequentially to obtain the key verification value of the third key.

[0187] Based on the above data decryption method, this disclosure also provides a data decryption apparatus. The following will be combined with... Figure 5 The device is described.

[0188] Figure 5 A schematic block diagram of a data decryption apparatus according to an embodiment of the present disclosure is shown.

[0189] like Figure 5 As shown, the data decryption device 500 includes: The second acquisition module 510 is used to acquire the target ciphertext; The data decoding module 520 is used to decode the target ciphertext to obtain the third key and the key verification value; The data decryption module 530 is used to decrypt the third key to obtain the second key; The second compression module 540 is used to compress the second key through multiple rounds of iteration to obtain the first key; the byte length of the first key is less than the byte length of the second key; The second verification module 550 is used to verify the correctness of the first key based on the key verification value; The second extension module 560 is used to extend the first key to obtain n target data when the correctness verification of the first key is passed; n is a positive integer.

[0190] According to an embodiment of this disclosure, the second compression module 540 is further configured to divide the second key into an initial key segment and at least one extended key according to a preset length; perform iterative compression on the at least one extended key to obtain a compressed key; the termination condition for iterative compression is that the length of the compressed key bytes is equal to the length of the initial key segment bytes; generate an extended key corresponding to the initial key; compare and verify the extended key corresponding to the initial key with at least one extended key segment; when the comparison and verification are consistent, determine the initial key as the first key.

[0191] According to an embodiment of this disclosure, the second compression module 540 is further configured to determine the target position and data segment length based on the value of the first byte in the initial key segment; take the target position as the starting position and cyclically extract the target data segment from the initial key segment according to the data segment length; perform an XOR operation on the target data segment to obtain the compressed byte corresponding to the first byte; traverse each byte in the initial key segment and repeat the above steps to obtain the compressed byte corresponding to each byte; and concatenate the compressed bytes corresponding to each byte to obtain the compression key.

[0192] According to embodiments of this disclosure, the second verification module 550 is further configured to: divide the third key into a preset number of key groups; use the first byte of the third key as a randomization factor; when the randomization factor and the byte length of the key group have a common divisor, adjust the randomization factor until the randomization factor and the byte length of the key group are coprime, thus obtaining a target randomization factor; calculate the target position corresponding to each key group based on the target randomization factor and the sequence number corresponding to each key group; obtain the corresponding verification byte from the target position of each key group; perform an XOR operation between each verification byte and the byte at the corresponding position in the key verification value to obtain the verification result corresponding to each verification byte; concatenate the verification results sequentially to obtain a verification key; and determine whether the verification key is consistent with the first key to verify the correctness of the first key.

[0193] According to an embodiment of this disclosure, the second extension module 560 is further configured to divide the first key into m key groups according to a preset byte length, where m is a positive integer; perform extension processing on each key group to obtain an extended data group corresponding to each key group; concatenate each extended data group in sequence to obtain a target data string; and divide the target data string into n target data groups.

[0194] Figure 6 A block diagram schematically illustrates an electronic device suitable for implementing a data encryption method and a data decryption method according to embodiments of the present disclosure.

[0195] like Figure 6 As shown, an electronic device 600 according to an embodiment of this disclosure includes a display screen (not shown) and a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a memory 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.

[0196] RAM 603 stores various programs and data required for the operation of electronic device 600. Processor 601, ROM 602, and RAM 603 are interconnected via bus 604. Processor 601 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 602 and / or RAM 603. It should be noted that the programs may also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0197] According to embodiments of this disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to a bus 604. The system 600 may also include one or more of the following components connected to the input / output (I / O) interface 605: an input device 606 including a keyboard, mouse, etc.; an output device 607 including a cathode ray tube (CRT), liquid crystal display (LCD), display screen, etc., and a speaker, etc.; a memory 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 610 as needed so that computer programs read from it can be installed into the memory 608 as needed.

[0198] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611. When the computer program is executed by processor 601, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0199] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0200] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0201] For example, according to embodiments of this disclosure, a computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than ROM 602 and RAM 603.

[0202] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this disclosure. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the methods provided in the embodiments of this disclosure.

[0203] When the computer program is executed by the processor 601, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0204] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0205] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0206] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0207] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0208] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A data encryption method, characterized in that, include: Obtain n target data items to be encrypted, where n is a positive integer; The n target data to be encrypted are compressed to obtain the first key of the n target data to be encrypted; The first key is expanded through multiple rounds of iteration to obtain the second key; the byte length of the second key is greater than the byte length of the first key. The second key is encrypted to obtain the third key; Generate the key verification value of the third key; The target ciphertext is obtained by encoding the third key and the key verification value.

2. The method according to claim 1, characterized in that, The step of compressing the n target data to be encrypted to obtain the first key for the n target data to be encrypted includes: The n target data to be encrypted are concatenated sequentially to obtain the target data string; The target data string is divided into m data groups of equal byte length, where m is a positive integer; Perform an XOR operation on the data of each data group to obtain the compressed bytes corresponding to each data group; By concatenating the compressed bytes corresponding to each of the data groups in sequence, the first key of the n target data to be encrypted is obtained.

3. The method according to claim 1, characterized in that, The process of expanding the first key through multiple rounds of iteration to obtain the second key includes: The first key is expanded to obtain an expanded key for the first key; The extended key of the first key is iteratively extended to obtain multiple extended keys corresponding to the first key; the termination condition of the iterative extension is that the sum of the byte lengths of the multiple extended keys corresponding to the first key is greater than or equal to a preset length. The second key is obtained by concatenating the first key with at least one extended key corresponding to the first key.

4. The method according to claim 3, characterized in that, The step of expanding the first key to obtain an expanded key for the first key includes: The target location and data segment length are determined based on the value of the first byte in the first key; Starting from the target position, target data segments are cyclically extracted from the first key according to the data segment length; Perform an XOR operation on the target data segment to obtain the extended byte corresponding to the first byte; Traverse each byte in the first key and repeat the above steps to obtain the extended bytes corresponding to each byte. The extended key of the first key is obtained by concatenating the extended bytes corresponding to each of the bytes.

5. The method according to claim 1, characterized in that, The key verification value for generating the third key includes: The third key is divided into a predetermined number of key groups; Each byte of the third key is used as a different randomization factor; For any of the randomization factors, when the randomization factor and the byte length of the key group have a common divisor, the randomization factor is adjusted until the randomization factor and the byte length of the key group are coprime, thus obtaining the target randomization factor; Calculate the target position corresponding to each key group based on the target randomization factor and the sequence number corresponding to each key group; Obtain the corresponding verification byte from the target position of each key group; Perform an XOR operation between each of the verification bytes and the corresponding byte in the first key to obtain the verification result corresponding to each of the verification bytes; The verification results are concatenated sequentially to obtain the key verification value of the third key.

6. A data decryption method, characterized in that, include: Obtain the target ciphertext; The target ciphertext is decoded to obtain a third key and a key verification value; The second key is obtained by decrypting the third key; The second key is compressed through multiple rounds of iteration to obtain the first key; the byte length of the first key is less than the byte length of the second key; The correctness of the first key is verified based on the key verification value; If the correctness verification of the first key passes, the first key is expanded to obtain n target data; n is a positive integer.

7. The method according to claim 6, characterized in that, The step of compressing the second key through multiple rounds of iteration to obtain the first key includes: The second key is divided into an initial key segment and at least one extended key according to a preset length. The at least one extended key is iteratively compressed to obtain a compressed key; the termination condition for the iterative compression is that the length of the compressed key in bytes is equal to the length of the initial key segment in bytes. Generate the extended key corresponding to the initial key; The extended key corresponding to the initial key is compared and verified with the at least one extended key segment; When the comparison and verification are consistent, the initial key is determined as the first key.

8. The method according to claim 7, characterized in that, The iterative compression of the at least one extended key includes: The target location and data segment length are determined based on the value of the first byte in the initial key segment; Starting from the target position, target data segments are cyclically extracted from the initial key segment according to the data segment length; Perform an XOR operation on the target data segment to obtain the compressed byte corresponding to the first byte; Traverse each byte in the initial key segment and repeat the above steps to obtain the compressed bytes corresponding to each byte; The compression key is obtained by concatenating the compressed bytes corresponding to each byte.

9. The method according to claim 6, characterized in that, The step of verifying the correctness of the first key based on the key verification value includes: The third key is divided into a predetermined number of key groups; Use the first byte of the third key as a randomization factor; When the randomization factor and the byte length of the key group have a common divisor, the randomization factor is adjusted until the randomization factor and the byte length of the key group are coprime, thus obtaining the target randomization factor; Calculate the target position corresponding to each key group based on the target randomization factor and the sequence number corresponding to each key group; Obtain the corresponding verification byte from the target position of each key group; Perform an XOR operation between each of the verification bytes and the corresponding byte in the key verification value to obtain the verification result corresponding to each of the verification bytes; The verification results are concatenated sequentially to obtain the verification key; Determine whether the verification key is consistent with the first key to verify the correctness of the first key.

10. The method according to claim 6, characterized in that, The expansion process of the first key yields n target data, including: The first key is divided into m key groups according to a preset byte length, where m is a positive integer; Each of the key groups is expanded to obtain the expanded data group corresponding to each key group; The extended data groups are concatenated sequentially to obtain the target data string; The target data string is divided into n target data segments.

11. A data encryption device, characterized in that, include: The first acquisition module is used to acquire n target data to be encrypted, where n is a positive integer; The first compression module is used to compress the n target data to be encrypted to obtain the first key of the n target data to be encrypted; The first extension module is used to extend the first key through multiple rounds of iteration to obtain a second key; the byte length of the second key is greater than the byte length of the first key; The data encryption module is used to encrypt the second key to obtain the third key; The first verification module is used to generate the key verification value of the third key; The data encoding module is used to encode the third key and the key verification value to obtain the target ciphertext.

12. A data decryption device, characterized in that, include: The second acquisition module is used to acquire the target ciphertext; The data decoding module is used to decode the target ciphertext to obtain the third key and the key verification value; The data decryption module is used to decrypt the third key to obtain the second key; The second compression module is used to compress the second key through multiple rounds of iteration to obtain the first key; the byte length of the first key is less than the byte length of the second key; The second verification module is used to verify the correctness of the first key based on the key verification value; The second extension module is used to extend the first key to obtain n target data if the correctness verification of the first key passes, where n is a positive integer.

13. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 10.

14. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 10.

15. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 10.