Data encryption method and device
By encrypting and cyclic cross-splicing of the target values of the model file, the low security problem in model file transmission and storage procedures is solved, and efficient data encryption and integrity protection is achieved.
Patent Information
- Application Number
- CN202510335710.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-07-11
AI Technical Summary
Existing encryption technologies have problems with low security in model file transfer and storage processes, especially file volume expansion, slow transmission speed and low parsing efficiency. At the same time, the encryption process may destroy the data structure and affect cross-platform compatibility.
By determining the target value of the initial data as the integrity verification identifier, the target value is encrypted and converted into the target ciphertext, and a cyclic cross-splicing operation is performed to generate the target encrypted data, and the complexity and security are increased using MD5 values and binary conversion, cyclic left shift and other methods.
It significantly improves the security and integrity protection of model files during transmission and storage, improves the ability to resist reverse analysis, and ensures the confidentiality and availability of data.
Smart Images

Figure CN120296760A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security, and more particularly, to a data encryption method and apparatus. Background Art
[0002] With the acceleration of digital transformation, system simulation model files play a crucial role in many fields such as modern engineering design, data analysis and prediction, and scientific computing. These model files usually contain complex data structures and algorithmic logics and are an important part of an enterprise's core competitiveness. However, during the transmission and storage of model files, security issues have become increasingly prominent and have become the focus of attention in the industry. Traditionally, these files mostly use XML (eXtensible Markup Language) or JSON (JavaScript Object Notation, a lightweight data interchange format) formats that are easy to read. Although they ensure data accessibility and compatibility, they lack built-in security protection mechanisms and are extremely vulnerable to data leakage and malicious tampering.
[0003] Current encryption technologies, such as symmetric encryption, asymmetric encryption, and hash algorithms, although they can provide a certain degree of data security protection, there is a contradiction between their generality and the special requirements of model files when applied to model files. Model files not only have a large amount of data but also have a complex structure. Traditional encryption methods often cause a significant increase in file size, affecting transmission speed and storage efficiency. At the same time, the encryption process may damage the original data structure, reducing the parsing efficiency and cross-platform compatibility of the model.
[0004] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention
[0005] This application provides a data encryption method and apparatus to at least solve the technical problem of low security of model files during transmission and storage in the prior art.
[0006] According to one aspect of this application, a data encryption method is provided, including: determining a target value of initial data, where the target value is used as a verification identifier for the integrity of the initial data; encrypting the target value to obtain an encrypted target value; converting the initial data into a target ciphertext according to the target value; performing a cyclic cross-joining operation on the target ciphertext according to the encrypted target value to obtain target encrypted data, where the cyclic cross-joining operation is used to represent that the encrypted target value and the target ciphertext are cross-joined multiple times according to a preset requirement, and the preset requirement is used to standardize the joining mode of the encrypted target value and the target ciphertext.
[0007] Optionally, encrypting the target value to obtain an encrypted target value includes: encrypting the target value to obtain an encrypted target value, including: performing binary conversion on each string in the target value to obtain a first target value; shifting the binary bits in each byte of the first target value two positions to the left, and transferring the two leftmost shifted binary digits in each byte to the rightmost side of the byte to obtain a second target value; converting the second target value into a string to obtain the encrypted target value.
[0008] Optionally, converting the initial data into a target ciphertext according to the target value includes: converting each character in the target value into a corresponding encoded value, and forming a target array according to the encoded value corresponding to each character; determining the target length of the target array; setting a first variable, where the initial value of the first variable is 0, and the first variable is used to represent the index value of the target array; converting the initial data into the target ciphertext according to the target array, the target length, and the first variable.
[0009] Optionally, converting the initial data into the target ciphertext according to the target array, the target length, and the first variable includes: Step 11, reading the i-th target character from the initial data in the arrangement order of the characters in the initial data, where i is greater than or equal to 1 and less than or equal to the total number of characters in the initial data, and the initial value of i is 1; Step 12, determining whether the first variable is greater than or equal to the target length; Step 13, if the first variable is greater than or equal to the target length, setting the first variable to 0 and jumping to Step 12; Step 14, if the first variable is less than the target length, determining the encrypted value corresponding to the i-th target character according to the target array, the first variable, the i-th target character, and a first preset value; Step 15, converting the encrypted value corresponding to the i-th target character into a string and adding it to the end of the cumulative encryption buffer, and determining whether all the characters in the initial data are encrypted; Step 16, if there are unencrypted characters in the initial data, increasing the first variable by 1 and i by 1, and repeating Steps 11 to 16 until there are no unencrypted characters in the initial data, and determining the target ciphertext according to the cumulative encryption buffer.
[0010] Optionally, in Step 14, if the first variable is less than the target length, determining the encrypted value corresponding to the i-th target character according to the target array, the first variable, the i-th target character, and the first preset value includes: obtaining a first encoded value corresponding to the index value of the first variable, a second encoded value corresponding to the index value of the first variable increased by 1, and a third encoded value corresponding to the index value of the first variable decreased by 1 from the target array; performing an exclusive OR operation on the first encoded value, the second encoded value, and the third encoded value to obtain a first value; performing a modulo operation on the first value to obtain a second value; converting the i-th target character into an unsigned integer type to obtain a third value; determining the encrypted value corresponding to the i-th target character according to the second value, the third value, and the first preset value.
[0011] Optionally, determining the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and the first preset value includes: determining whether the sum of the second numerical value and the third numerical value is greater than the first preset value; if the sum of the second numerical value and the third numerical value is greater than the first preset value, determining the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and the second preset value; if the sum of the second numerical value and the third numerical value is less than or equal to the first preset value, determining the encryption value corresponding to the i-th target character according to the second numerical value and the third numerical value.
[0012] Optionally, after performing cyclic cross splicing on the target ciphertext according to the encryption target value to obtain the target encrypted data, the method further includes: writing the target encrypted data in binary form into the target file for storage.
[0013] Optionally, after writing the target encrypted data in binary form into the target file for storage, the method further includes: obtaining the encryption target value and the ciphertext to be verified from the target file; performing a decryption operation on the encryption target value, and converting the encrypted target value after the decryption operation into a string form to obtain the target value; decrypting the ciphertext to be verified to obtain the first data; determining whether the first data is the initial data according to the target value.
[0014] Optionally, determining whether the first data is the initial data according to the target value includes: determining the third target value of the first data, where the third target value is used as a verification identifier for the integrity of the first data; detecting whether the third target value is the same as the target value; if the third target value is the same as the target value, determining that the first data is the initial data; if the third target value is not the same as the target value, generating a prompt message, where the prompt message is used to prompt that there is an abnormality in the initial data.
[0015] According to another aspect of the present application, there is also provided a data encryption device, including: a determination unit that determines the target value of the initial data, where the target value is used as a verification identifier for the integrity of the initial data; an encryption unit that encrypts the target value to obtain the encryption target value; a conversion unit that converts the initial data into a target ciphertext according to the target value; a processing unit that performs a cyclic cross splicing operation on the target ciphertext according to the encryption target value to obtain the target encrypted data, where the cyclic cross splicing operation is used to represent performing multiple cross splices on the encryption target value and the target ciphertext according to a preset requirement, and the preset requirement is used to standardize the splicing pattern of the encryption target value and the target ciphertext.
[0016] In this application, first, the target value of the initial data is determined. Here, the target value serves as the verification identifier for the integrity of the initial data. Then, the target value is encrypted to obtain the encrypted target value. Next, the initial data is converted into the target ciphertext based on the target value. Finally, a cyclic cross - splicing operation is performed on the target ciphertext according to the encrypted target value to obtain the target encrypted data. Here, the cyclic cross - splicing operation is used to represent multiple cross - splicings of the encrypted target value and the target ciphertext according to preset requirements. The preset requirements are used to standardize the splicing pattern of the encrypted target value and the target ciphertext. That is, by encrypting and interleaving the target value and the initial data, the purpose of improving the anti - reverse analysis ability of the encrypted data is achieved, thereby realizing the technical effect of significantly enhancing the security and integrity protection of the model file during transmission and storage, and further solving the technical problem of low security of the model file during transmission and storage in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:
[0018] Figure 1 is the flowchart of an optional data encryption method according to an embodiment of the present application Figure 1 ;
[0019] Figure 2 is the flowchart of an optional encryption of the MD5 value according to an embodiment of the present application;
[0020] Figure 3 is the flowchart of an optional encryption of the original model data according to an embodiment of the present application;
[0021] Figure 4 is the flowchart of an optional data encryption method according to an embodiment of the present application Figure 2 ;
[0022] Figure 5 is the flowchart of an optional decryption of the encrypted MD5 value according to an embodiment of the present application;
[0023] Figure 6 is the flowchart of an optional decryption of the encrypted model data according to an embodiment of the present application;
[0024] Figure 7 is the flowchart of an optional decryption of the encrypted model file according to an embodiment of the present application;
[0025] Figure 8 is the schematic diagram of an optional data encryption device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] In order to enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0028] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Moreover, the collection, storage, use, processing, transmission, provision, disclosure, application and other processing of relevant data all comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse. For example, an interface is set between this system and relevant users or institutions to provide corresponding operation entrances for users to choose to agree or refuse the results of automated decision-making; if the user chooses to refuse, the expert decision-making process will be entered.
[0029] According to the embodiments of this application, a method embodiment of a data encryption method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from that here.
[0030] It should be noted that a data processing system can be used as the execution subject of the data encryption method in the embodiments of this application. It can be understood that the data encryption method provided in the embodiments of this application can also be executed by other systems or devices as the execution subject, and this application does not make specific limitations in this regard.
[0031] Figure 1 is the flow of an optional data encryption method according to an embodiment of the present application Figure 1 , such as Figure 1 shown, the method includes the following steps:
[0032] Step S101, determine the target value of the initial data.
[0033] In step S101, the target value serves as a verification identifier for the integrity of the initial data.
[0034] Optionally, the initial data refers to the original model data without any encryption processing, such as the content of a simulation model file stored in JSON format.
[0035] Optionally, the target value can be an MD5 (a cryptographic hash function) value, which converts data of any length into a fixed-length digest (usually 128 bits). This digest value is called the target value and can be used to ensure that the data has not been tampered with during data transmission or storage. If the data is modified, even slightly, its MD5 value will change significantly.
[0036] Optionally, the data processing system can create a "fingerprint" for the model data by calculating the MD5 value of the original model data. This fingerprint is compared before and after encrypting the model data to ensure the integrity and untampered nature of the data. This is an important step in the encryption process because after data transmission or storage, the receiving party needs to verify the integrity of the data to ensure that it has not been attacked by a man-in-the-middle or accidentally damaged.
[0037] Step S102, encrypt the target value to obtain an encrypted target value.
[0038] Optionally, the data processing system encrypts through the MD5 value of the original model data to obtain an encrypted MD5 value. This step ensures that even if the target value is intercepted during transmission, it cannot be directly cracked, improving the security of the data.
[0039] Optionally, by encrypting the MD5 value, the data processing system increases the difficulty for an attacker to obtain and utilize the model data integrity identifier, further protecting the security of the original model data.
[0040] Step S103, convert the initial data into a target ciphertext according to the target value.
[0041] Optionally, the data processing system can encrypt the initial data using an encryption algorithm. Here, the encryption process depends on the MD5 value and the key, ensuring the confidentiality of the model data.
[0042] Optionally, this step is the core of encrypting the model data. By using the MD5 value and encryption method, the original JSON data is converted into an unreadable target ciphertext to prevent the data from being illegally accessed and utilized during transmission and storage.
[0043] Step S104: Perform a cyclic cross-joining operation on the target ciphertext according to the encrypted target value to obtain the target encrypted data.
[0044] In step S104, the cyclic cross-joining operation is used to represent performing multiple cross-joinings of the encrypted target value and the target ciphertext according to preset requirements.
[0045] In step S104, the preset requirements are used to standardize the joining pattern of the encrypted target value and the target ciphertext.
[0046] Optionally, the data processing system performs multiple joinings of the encrypted target value and the target ciphertext according to certain rules. These rules define the relative positions and intervals of the encrypted target value and the target ciphertext during joining, as well as the number and method of joinings.
[0047] Optionally, the data processing system combines the encrypted MD5 value and the encrypted model data in a complex way, increasing the cracking difficulty and ensuring the confidentiality and security of the encrypted data. This joining method can also provide additional protection. Even if a part of the data is tampered with, the entire data file cannot be correctly decrypted due to the destruction of the joining pattern, thus protecting the integrity of all data.
[0048] It should be noted that the preset requirements can be dynamically adjusted according to actual needs.
[0049] From the content of steps S101 to S104, it can be seen that in this application, first, the target value of the initial data is determined. The target value is used as the verification identifier for the integrity of the initial data. Then, the target value is encrypted to obtain the encrypted target value. Next, the initial data is converted into the target ciphertext according to the target value. Finally, a cyclic cross-joining operation is performed on the target ciphertext according to the encrypted target value to obtain the target encrypted data. The cyclic cross-joining operation is used to represent performing multiple cross-joinings of the encrypted target value and the target ciphertext according to preset requirements. The preset requirements are used to standardize the joining pattern of the encrypted target value and the target ciphertext, that is, by encrypting and interleaving and combining the target value and the initial data, the purpose of improving the anti-reverse analysis ability of the encrypted data is achieved, thus realizing the technical effect of significantly improving the security and integrity protection of the model file during transmission and storage, and further solving the technical problem of low security of the model file during transmission and storage in the prior art.
[0050] In an alternative embodiment, the data processing system first performs binary conversion on each string in the target value to obtain a first target value. Then, it shifts the binary bits in each byte of the first target value two positions to the left and transfers the two leftmost shifted binary digits in each byte to the rightmost of the byte to obtain a second target value. Finally, it converts the second target value into a string to obtain the encrypted target value.
[0051] Optionally, the data processing system first converts each string in the target value into its corresponding binary representation, that is, each character is converted into a specific binary code. This process converts the MD5 value, a string composed of hexadecimal characters, into a binary sequence consisting of 0s and 1s. For example, the decimal value corresponding to 'E' in the ASCII table is 69, and its binary representation is 01000101. Next, the system operates on each byte in the first target value (i.e., the target value in binary representation). Shifting the binary bits in each byte two positions to the left means that the first and second bits in the original sequence are moved to the last two bits. For example, 01000101 becomes 00010101 after a circular left shift. This operation increases the complexity of the target value and makes it difficult to be restored without the key.
[0052] Optionally, the data processing system converts the second target value after the above processing, that is, the binary sequence after the circular left shift operation on each byte, back into a string form. This conversion process remaps the binary data into hexadecimal characters, thereby obtaining the encrypted target value. The generation of the encrypted target value not only maintains the uniqueness of the original target value but also adds an additional encryption layer, improving the security of the model file data.
[0053] Optionally, Figure 2 is a flowchart of an alternative method for encrypting the MD5 value according to an embodiment of the present application. As Figure 2 shown, first, the MD5 value is represented in binary, converting each character into its corresponding binary form. Then, a circular left shift operation of two positions is performed on the obtained binary data. Finally, the left-shifted binary data is converted back into a string form to obtain the string after the circular left shift operation (the encrypted MD5 value).
[0054] As can be seen from the above, through the above implementation, the data processing system not only increases the confidentiality of model data, but also retains the function of verifying the integrity of the initial data with the target value. The generation of the encrypted target value increases the additional computational complexity, making it difficult for a third party without the correct key to obtain the original model data through reverse engineering, thus effectively protecting the security of the model file. At the same time, the encryption process has a unique way of processing the target value. Through binary conversion, cyclic left shift, and bit recombination, it ensures a close connection between the encrypted target value and the original target value, while increasing the difficulty of decryption. This not only improves the security protection of model data, but also ensures the integrity verification ability of the data during transmission and storage, providing a reliable data access and usage environment for legitimate users, and overall enhancing the security and confidentiality of the system.
[0055] In an alternative embodiment, the data processing system converts each character in the target value into a corresponding encoded value, forms a target array based on the encoded value corresponding to each character, then determines the target length of the target array, and then sets a first variable, where the initial value of the first variable is 0, and the first variable is used to represent the index value of the target array. Finally, the initial data is converted into a target ciphertext according to the target array, the target length, and the first variable.
[0056] Optionally, the data processing system first converts each character in the target value into its corresponding encoded value. In this embodiment, the ASCII code is used (it uses a specified 7-bit or 8-bit binary number combination to represent 128 or 256 possible characters, including English letters, numbers, punctuation marks, and control characters, etc., and is one of the most common character encoding standards in computer systems). For example, the ASCII code value of the character E is 69. After completing the conversion from character to encoded value, the data processing system forms a target array based on the obtained encoded values. The formation of the target array is based on the encoded values of each character in the target value. This step transforms the MD5 digest from a string form into an array form, facilitating the implementation of subsequent encryption operations. Next, the data processing system determines the target length of the target array, that is, the total number of elements in the target array. This length value plays a key role in the subsequent encryption process and is used to control the loops and index operations in the encryption process to ensure the correct execution of the encryption algorithm.
[0057] Optionally, the data processing system sets and initializes a first variable with an initial value of 0. This variable serves as the index value of the target array and is used to track and indicate the element in the target array being currently processed. The introduction of the index value enables the system to traverse each element in the array in an orderly manner and perform encryption operations based on the positional relationship of the index value.
[0058] Optionally, the data processing system encrypts each character of the initial data according to the above determination of the target array, target length, and dynamic changes of the first variable. This encryption process relies on mathematical operations between the current character and the encoded values at indexes first variable, first variable + 1, and first variable - 1 (if the first variable is the first position of the array, take the last position of the array; vice versa) in the target array, including exclusive OR operations and modulo operations. In this way, the data processing system can generate encrypted characters, which further form the target ciphertext.
[0059] As can be seen from the above, through the above embodiments, the data processing system can not only effectively convert the initial data into the target ciphertext, but also make full use of the target value (MD5 digest) as the dynamic key in the encryption process, increasing the complexity and security of encryption. This encryption method combines character encoding values and dynamic indexes in the encryption process, realizing bit-by-bit encryption and decryption of data, enhancing the protection of model file data, making it difficult to be accessed and interpreted without authorization. At the same time, since the encryption process is closely related to the target value, even if a third party can obtain the encrypted file, it is difficult to decrypt the file without the correct target value, thus effectively protecting the model data from illegal access and tampering. This method generally improves the security of the model file and reduces the risk of data leakage.
[0060] In an optional embodiment, the data processing system converts the initial data into the target ciphertext according to the target array, target length, and the first variable, including: Step 11, read the i-th target character from the initial data in the order of the characters in the initial data, where i is greater than or equal to 1 and less than or equal to the total number of characters in the initial data, and the initial value of i is 1; Step 12, determine whether the first variable is greater than or equal to the target length; Step 13, if the first variable is greater than or equal to the target length, set the first variable to 0 and jump to Step 12; Step 14, if the first variable is less than the target length, determine the encryption value corresponding to the i-th target character according to the target array, the first variable, the i-th target character, and the first preset value; Step 15, convert the encryption value corresponding to the i-th target character into a string and add it to the end of the cumulative encryption buffer, and determine whether all the characters in the initial data are encrypted; Step 16, if there are unencrypted characters in the initial data, increase the first variable by 1 and i by 1, and repeat Steps 11 to 16 until there are no unencrypted characters in the initial data, and determine the target ciphertext according to the cumulative encryption buffer.
[0061] Optionally, the data processing system reads the i-th target character from the initial data in the order of character arrangement, where i is an index variable with an initial value of 1, used to identify the current character position being processed. For example, if the initial data is "Hello", the first target character is "H"; then the system determines whether the value of the first variable is greater than or equal to the target length of the target array. Here, the first variable serves as the index of the target array during the encryption process, used to point to the currently processed target array element, and the target length is the total number of elements in the target array, that is, the length after converting the MD5 digest of the target value into an ASCII code array; if the value of the first variable is greater than or equal to the target length, it means that the system has traversed the target array once. At this time, the system resets the first variable to 0 to ensure that processing starts again from the beginning of the array. This loop processing method can ensure that even if the target array is short, all its elements can be used for encryption through multiple loops. If the value of the first variable is less than the target length, the system determines the encryption value corresponding to the i-th target character based on the target array, the first variable, and the i-th target character, combined with the first preset value. The calculation of this encryption value involves the XOR operation and modulo operation of the ASCII code value of the i-th target character, the value at the index position of the first variable in the target array, and the values at the positions of the first variable + 1 and the first variable - 1 (if the first variable is the first digit, take the last digit, and vice versa), ensuring the dynamics and complexity of the encryption process.
[0062] Optionally, the data processing system converts the determined encryption value into a string and then adds it to the end of the cumulative encryption buffer. The cumulative encryption buffer is used to store all encrypted characters for finally forming the complete target ciphertext. At the same time, the data processing system checks whether all characters in the initial data have been encrypted. If the encryption process is not completed, it continues to execute the subsequent steps. If there are still unencrypted characters in the initial data, the system increments both the first variable and i by 1, indicating moving to the next character and the next element of the target array. Subsequently, the system repeats the above steps (i.e., corresponding to step 11 to step 16) until all characters in the initial data have been encrypted.
[0063] Optionally, after all characters in the initial data have been encrypted and added to the cumulative encryption buffer, the system determines the final target ciphertext based on the string in the cumulative encryption buffer. This means that the encrypted model data will be completely stored in the target ciphertext for subsequent secure transmission and storage.
[0064] As can be seen from the above, the data processing system realizes the effective encryption of the initial data by combining the ASCII code values of characters and the elements in the target array through dynamic indexing and loop processing. This encryption process not only uses the target value (MD5 digest) as a dynamic key to increase the complexity of encryption, but also ensures the continuity and integrity of the encryption result through the use of an accumulated encryption buffer. In addition, the loop mechanism of dynamic indexing ensures that even if the length of the target array is short, all its elements can be used through multiple loops, thus avoiding key repetition and the predictability of the encryption pattern. In summary, this embodiment takes into account the dynamics, complexity, and integrity of the data during the encryption process, significantly improving the security and confidentiality of the model file data and reducing the risk of data being illegally obtained and cracked.
[0065] In an alternative embodiment, the data processing system first obtains the first encoded value corresponding to the first variable as the index value from the target array, the second encoded value corresponding to the index value increased by 1 of the first variable, and the third encoded value corresponding to the index value decreased by 1 of the first variable. Then, an exclusive OR operation is performed on the first encoded value, the second encoded value, and the third encoded value to obtain a first numerical value. A modulo operation is performed on the first numerical value to obtain a second numerical value. Then, the i-th target character is converted to an unsigned integer type to obtain a third numerical value. Finally, the encrypted value corresponding to the i-th target character is determined according to the second numerical value, the third numerical value, and a first preset value.
[0066] Optionally, the data processing system selects the encoded values at three specific positions from the target array to participate in the encryption process. These three positions are the first encoded value corresponding to the first variable as the index value, the second encoded value corresponding to the index value increased by 1 of the first variable, and the third encoded value corresponding to the index value decreased by 1 of the first variable. For example, if the value of the first variable is 5, the system will obtain the encoded values at indices 5, 6, and 4 in the target array, and these three encoded values will be used as key participating factors in the encryption process.
[0067] Optionally, the data processing system performs an exclusive OR operation on the selected first encoded value, second encoded value, and third encoded value to obtain a first numerical value. The exclusive OR operation is a bitwise operation that can effectively mix the binary representations of the three encoded values to generate a new binary result. Subsequently, the system performs a modulo operation on the first numerical value to obtain a second numerical value. The modulo operation selects 10 as the divisor and takes the remainder (the second numerical value) after dividing the first numerical value by 10. The purpose of this operation is to generate a random number between 0 and 9, adding additional randomness and complexity to the encryption process. Then the system converts the i-th target character (i.e., the current character in the initial data) from a string type to an unsigned integer type to obtain a third numerical value. This conversion maps the character to its corresponding ASCII code value, enabling this value to perform mathematical operations with other numerical values in subsequent encryption calculations. Finally, the system determines the encrypted value corresponding to the i-th target character based on the second numerical value, the third numerical value, and a first preset value (set to 127 in this embodiment). The calculation of this encrypted value comprehensively considers the ASCII code value of the character, the exclusive OR result of the encoded values in the target array, and the number obtained from the modulo operation. Through mathematical operations such as addition or subtraction combined with the modulo operation, it ensures that the encrypted value varies within a specific range while maintaining a certain relationship with the original character.
[0068] As can be seen from the above, in the encryption process, the data processing system makes full use of the dynamic index of the target array and the ASCII code value of the character, combines the characteristics of the exclusive OR operation and the modulo operation, and realizes the personalized encryption processing of each target character. The innovation of this method lies in generating a first numerical value closely related to the encryption process through the exclusive OR operation of the three encoded values in the target array, and then obtaining a second numerical value after the modulo operation. This numerical value, together with the ASCII code value of the character and the first preset value, jointly determines the final encrypted value. This encryption strategy not only increases the randomness and complexity of the encryption process, improves the cracking difficulty of the ciphertext, but also ensures that the encrypted data can be decrypted back to the original state through reverse operations, maintaining the availability and security of the encrypted data. In summary, this specific embodiment effectively improves the encryption strength of the model file data by comprehensively applying bitwise operations, character encoding, and mathematical operations, providing strong technical support for protecting the confidentiality and integrity of the model data.
[0069] In an optional embodiment, the data processing system first determines whether the sum of the second numerical value and the third numerical value is greater than the first preset value. If the sum of the second numerical value and the third numerical value is greater than the first preset value, it determines the encrypted value corresponding to the i-th target character according to the second numerical value, the third numerical value, and a second preset value. If the sum of the second numerical value and the third numerical value is less than or equal to the first preset value, it determines the encrypted value corresponding to the i-th target character according to the second numerical value and the third numerical value.
[0070] Optionally, the data processing system first performs a conditional judgment, that is, checks whether the sum of the second value (obtained by performing a modulo operation on the XOR result of the encoded values in the target array) and the third value (obtained by converting the i-th target character to an unsigned integer) is greater than the first preset value (127 in this embodiment). This judgment step introduces a dynamic condition in the encryption process, such that the determination of the encrypted value depends not only on the ASCII code value of the target character and the XOR result of the encoded values in the target array, but also additionally considers the relative magnitude of their sum and the preset value. If the sum of the second value and the third value is greater than the first preset value, the system will determine the encrypted value corresponding to the i-th target character based on the second value, the third value, and the second preset value (e.g., 128). For example, the system may choose to perform the following operation: Encrypted value = Second value - (Second preset value - Third value). If the sum of the second value and the third value is less than or equal to the first preset value, the system directly determines the encrypted value of the i-th target character only based on the second value and the third value. This operation may be simplified to a direct addition or subtraction operation, such as Encrypted value = Second value + Third value or Encrypted value = Third value - Second value, ensuring the coherence and effectiveness of the encrypted value generation logic under different conditions.
[0071] Optionally, Figure 3 is a flowchart of an optional method for encrypting original model data according to an embodiment of the present application, as Figure 3 shown. First, convert the MD5 value into the corresponding ASCII code array. Each character corresponds to an ASCII code value. Take out the character ch one by one from the model data to be encrypted. Set a variable i, with its initial value of 0, which is used to represent the index value of the currently processed ASCII code array. Then, determine whether the index i is less than the length of the ASCII code array. If so, continue to the next step. If not, jump to the step of setting the variable, set the variable i to 0, and then continue to the next step. Then, take out the value at index i, the value at index i - 1, and the value at index i + 1 from the ASCII code array. XOR the value at index i with the values at indices i + 1 and i - 1, and let the obtained value be p. Then, take the remainder of p divided by 10 to get the remainder r. At the same time, convert the character ch to an unsigned integer and denote it as chnum. Determine whether the sum of chnum and r is greater than 127 (the first preset value, which can be adjusted according to the actual situation). If so, the encrypted value is r - (128 - chnum). If not, the encrypted value is chnum + r. Subsequently, convert the encrypted value to a character and append it to the end of the encrypted string. Finally, determine whether the entire model data has been traversed. If so, the process ends. If not, continue to take out the next character ch and perform the same processing.
[0072] As can be seen from the above, by introducing conditional branches, the data processing system makes the calculation logic of the encrypted value more dynamic and adaptable. When the sum of the second value and the third value exceeds the first preset value, the encryption process becomes more complex. By introducing the second preset value as a regulatory factor, the uncertainty of the encrypted value is effectively increased, and the cracking difficulty is improved. In the scenario where the sum is less than or equal to the first preset value, the encryption process is relatively simplified, but the effectiveness of encryption can still be maintained. This strategic encryption process effectively balances the encryption strength and algorithm efficiency, providing a more refined and efficient means for the encryption protection of model file data. At the same time, it also introduces the non-linearity of the encryption process through conditional judgment, further enhancing the complexity of the ciphertext, strengthening the protection of model data, avoiding the singularity and predictability of the encryption mode, and providing a solid guarantee for data security.
[0073] In an alternative embodiment, the data processing system writes the target encrypted data into the target file in binary form for storage.
[0074] Optionally, first, the data processing system performs cyclic cross splicing on the encryption target value and the target ciphertext. This operation combines the encrypted MD5 digest and the encrypted model data in a specific pattern to enhance the complexity of the data and prevent simple pattern analysis. The splicing rule can be that the length of the model data spliced each time gradually increases until it reaches 128 bits, and then starts from 1 bit again, while the MD5 digest appears in a cyclic manner, ensuring that the structure of the encrypted data is both complex and orderly. After the cyclic splicing is completed, the encryption target value is added before the entire spliced data to form the final target encrypted data. Then the system converts the obtained target encrypted data into binary format. This conversion transforms the spliced encrypted data from text format into binary form that can be directly read and written by a computer, which can not only reduce the file size, but also help improve the data transmission efficiency and storage security. Binary data is more difficult to be recognized and tampered with by the naked eye. Finally, the data processing system writes the converted target encrypted data into the target file in binary form for storage. This write operation ensures that the encrypted data can be persistently saved. The target file can be any file type that can store binary data, such as.bin or.dat, etc. The binary write during the storage process further enhances the confidentiality and security of the data, because binary data is not easily recognized and tampered with by a common text editor, increasing the difficulty of data recovery and ensuring the confidentiality and integrity of the model file data during storage and transmission.
[0075] Optionally, Figure 4 is the flow of an alternative data encryption method according to an embodiment of the present application Figure 2 , such as Figure 4As shown, first obtain the original model data that is not encrypted, then calculate the MD5 value of the original model data to generate a summary of a fixed length, and then use the encryption algorithm to encrypt the MD5 value to ensure its security, and then encrypt the original model data to convert it into an unreadable ciphertext form, and then cyclically cross-splice the encrypted model data and the encrypted MD5, and each time the spliced model data gradually increases until 128 bits and then restarts from 1, and MD5 appears cyclically (the splicing mode can be adjusted according to actual conditions), and finally write the encrypted data to the file in binary form to ensure persistent storage of the data.
[0076] As can be seen from the above, the data processing system significantly enhances the security of encrypted data through cyclic cross stitching and binary writing. The cyclic cross stitching technology increases the complexity of the data structure, making it difficult to restore the original structure of the data even if the encryption algorithm is cracked. Binary writing further improves the storage security of the data. Due to the particularity of binary data, even if the target file is illegally obtained, it is difficult for a third party to understand its content, and it is even more difficult to effectively tamper with it. This storage strategy effectively protects the model file data from unauthorized access and malicious attacks, and provides a strong guarantee for the secure transmission and persistent storage of data. At the same time, through the use of binary format, it is also possible to optimize the storage space of the data, improve the reading and writing efficiency of the file, and provide convenience for the efficient management of the data. In summary, the encrypted storage method of the present invention combines encryption technology and storage optimization, provides comprehensive security protection for the system simulation model file, and ensures the confidentiality, integrity and availability of the data during storage and transmission.
[0077] In an optional embodiment, the data processing system obtains an encrypted target value and a ciphertext to be verified from a target file, then performs a decryption operation on the encrypted target value, and converts the encrypted target value after the decryption operation into a string to obtain a target value, and then decrypts the ciphertext to be verified to obtain first data, and finally determines whether the first data is initial data based on the target value.
[0078] Optionally, first, the data processing system reads the stored encrypted target value and the ciphertext to be verified from the target file. The encrypted target value is the result of encrypting the MD5 digest of the original model data, and the ciphertext to be verified is the encrypted model data obtained by applying the above encryption method. The encrypted target value is the result of encrypting the MD5 digest of the original model data, and the ciphertext to be verified is the encrypted model data obtained by applying the encryption algorithm of the present invention. Then the system performs a decryption operation on the encrypted target value. This process is the reverse operation of the encryption process. The system restores the encrypted target value to the original MD5 digest form through the inverse operation of operations such as shifting binary bits. The decrypted encrypted target value will be converted into a string form, that is, the target value. This string should be exactly the same as the MD5 digest before encryption in theory.
[0079] Optionally, the data processing system decrypts the ciphertext to be verified. By reversely performing the mathematical operations and character conversions used in the encryption method, the ciphertext is gradually converted back to its initial data state. This process needs to be carried out according to parameters such as the target array (ASCII code array based on the target value), the length of the target array, and the loop index used during encryption to ensure that each encrypted character is correctly inversely operated. Finally, the system compares the first data obtained after decryption with the target value to determine whether the first data is equal to the initial data. This verification process is mainly completed by calculating the MD5 digest of the first data and comparing it with the target value. If the two are consistent, it means that the decryption result of the ciphertext to be verified is correct, that is, the first data is the initial data; if they are inconsistent, it indicates that an error occurred during the decryption process or the ciphertext was tampered with during transmission or storage.
[0080] Optionally, Figure 5 is a flowchart of an optional decryption of the encrypted MD5 value according to an embodiment of the present application. As Figure 5 shown, first, the encrypted MD5 value is converted into the corresponding binary representation form, then a cyclic right shift operation of two bits is performed on the binary, and finally the binary value after the right shift is converted into the corresponding string form.
[0081] Optionally, Figure 6 is a flowchart of an optional decryption of the encrypted model data according to an embodiment of the present application. As Figure 6As shown, first convert the MD5 value into the corresponding ASCII code array. Each character corresponds to an ASCII code value. Take out the character ch one by one from the encrypted model data to be decrypted. Set a variable i with an initial value of 0 to record the index of the currently processed ASCII code array. Determine whether the index value i is less than the length of the ASCII code array. If so, continue to the next step; if not, jump back to the step of setting the variable above, reset the index i to 0, then take out the value at index i, the value at index i - 1, and the value at index i + 1 from the ASCII code array. XOR the value at index i with the values at indices i + 1 and i - 1, and let the obtained value be p. Then take the remainder of p divided by 10 to get the remainder r. At the same time, convert the character ch to an unsigned integer denoted as chnum. Determine whether the sum of chnum minus r is less than 0. If so, the decrypted value is 128 - (r - chnum); if not, the decrypted value is chnum - r. Subsequently, convert the decrypted value to a character and append it to the end of the decrypted string. Finally, determine whether the entire model data has been traversed. If so, the process ends; if not, continue to take out the next character ch and perform the same processing.
[0082] As can be seen from the above, through the above steps, the data processing system can effectively verify the integrity and correctness of the encrypted model file data. The data processing system can not only accurately recover the original MD5 digest from the encrypted target value, but also decrypt the ciphertext to be verified back to the initial data state, and ensure the correctness of the decryption process and the data has not been tampered with through the verification of the MD5 digest. This mechanism provides a strong guarantee for the security and integrity of the model file data, ensuring that legitimate users can reliably access and use the model data, while preventing unauthorized data access and tampering, and maintaining the confidentiality and security of the model file. In summary, this embodiment not only reflects the reversibility of the encryption algorithm, but also further enhances the reliability of data verification through the verification of the MD5 digest, providing a solid technical foundation and security guarantee for the encryption protection of the model file.
[0083] In an alternative embodiment, the data processing system first determines the third target value of the first data, where the third target value is used as a verification identifier for the integrity of the first data. Then, it detects whether the third target value is the same as the target value. If the third target value is the same as the target value, it determines that the first data is the initial data. If the third target value is not the same as the target value, it generates a prompt message, where the prompt message is used to prompt that there is an abnormality in the initial data.
[0084] Optionally, the data processing system first calculates the third target value of the first data after decryption. The third target value here serves as a verification mark of the integrity of the first data. In this embodiment, MD5 is used for calculation. The hash function converts the first data into a summary string of fixed length. By calculating the third target value of the first data, the system can obtain an identifier that can be used for subsequent integrity verification. Then, the system compares the third target value with the target value previously encrypted and stored. If the third target value is the same as the target value, it means that the decryption process is correct and the data has not been tampered with during transmission or storage. The system will determine that the first data is indeed the initial data, that is, the original unencrypted model file data. However, if the third target value is not the same as the target value, the system will generate a prompt message indicating that the decryption process may be wrong, or the first data (decrypted data) has an abnormality during transmission and storage, such as data loss, insertion or change. This prompt message will be used to warn the user that the initial data may have been illegally modified, thereby triggering further security checks or data recovery processes.
[0085] Optionally, Figure 7 is a flowchart of an optional encryption model file decryption according to an embodiment of the present application, such as Figure 7 As shown, first read the encrypted binary file from the file system, then get the stored encrypted MD5 value and encrypted model data from the encrypted file, then decrypt the encrypted MD5 value, decrypt the encrypted model data, and then calculate the MD5 value of the decrypted model data to determine whether the MD5 value of the decrypted model data is consistent with the original MD5 value. If they are consistent, return the decrypted model data as the execution result. If they are inconsistent, report an error.
[0086] From the above content, it can be seen that by calculating the third target value of the first data and comparing it with the stored target value, the data processing system can effectively verify the correctness of the decryption result and the integrity of the model file data during transmission and storage. This mechanism is particularly suitable for detecting errors in the data transmission process, failures of the storage medium, and potential malicious tampering, and provides strong technical support for ensuring the confidentiality and integrity of the model data. In practical applications, this integrity verification function not only enhances the security of the data, but also effectively avoids system function failures or business risks caused by data corruption or tampering, ensures data availability and the stability of system operation, and significantly improves the security and reliability of the model file data during the decryption process.
[0087] The embodiment of the present application also provides a data encryption device. It should be noted that the data encryption device of the embodiment of the present application can be used to execute the data encryption method provided by the embodiment of the present application. The data encryption device provided by the embodiment of the present application is introduced below.
[0088] According to an embodiment of the present application, there is also provided an apparatus for implementing the above data encryption method. Figure 8 It is a schematic diagram of an optional data encryption apparatus according to an embodiment of the present application, as Figure 8 shown. The apparatus includes: a determination unit 801, an encryption unit 802, a conversion unit 803, and a processing unit 804.
[0089] Optionally, the determination unit 801 determines a target value of the initial data, where the target value is used as a verification identifier for the integrity of the initial data; the encryption unit 802 encrypts the target value to obtain an encrypted target value; the conversion unit 803 converts the initial data into a target ciphertext according to the target value; the processing unit 804 performs a cyclic cross splicing operation on the target ciphertext according to the encrypted target value to obtain a target encrypted data, where the cyclic cross splicing operation is used to represent performing multiple cross splicings of the encrypted target value and the target ciphertext according to a preset requirement, and the preset requirement is used to standardize the splicing pattern of the encrypted target value and the target ciphertext.
[0090] Optionally, the encryption unit 802 includes: a first conversion subunit, a first processing subunit, and a second conversion subunit. Among them, the first conversion subunit is used to perform binary conversion on each string in the target value to obtain a first target value; the first processing subunit is used to shift the binary bits in each byte of the first target value two bits to the left, and transfer the two leftmost shifted binary numbers in each byte to the rightmost of the byte to obtain a second target value; the second conversion subunit is used to convert the second target value into a string to obtain an encrypted target value.
[0091] Optionally, the conversion unit 803 includes: a third conversion subunit, a first determination subunit, a first setting subunit, and a fourth conversion subunit. Among them, the third conversion subunit is used to convert each character in the target value into a corresponding encoding value and form a target array according to the encoding value corresponding to each character; the first determination subunit is used to determine the target length of the target array; the first setting subunit is used to set a first variable, where the initial value of the first variable is 0, and the first variable is used to represent the index value of the target array; the fourth conversion subunit is used to convert the initial data into a target ciphertext according to the target array, the target length, and the first variable.
[0092] Optionally, the fourth conversion subunit includes: a first reading module, a first judgment module, a first processing module, a first determination module, a first addition module, and a second processing module. The first reading module, in step 11, reads the i-th target character from the initial data in the arrangement order of the characters in the initial data, where i is greater than or equal to 1 and less than or equal to the total number of characters in the initial data, and the initial value of i is 1; the first judgment module, in step 12, judges whether the first variable is greater than or equal to the target length; the first processing module, in step 13, if the first variable is greater than or equal to the target length, sets the first variable to 0 and jumps to step 12; the first determination module, in step 14, if the first variable is less than the target length, determines the encryption value corresponding to the i-th target character according to the target array, the first variable, the i-th target character, and the first preset value; the first addition module, in step 15, converts the encryption value corresponding to the i-th target character into a string and adds it to the end of the cumulative encryption buffer, and judges whether all the characters in the initial data are encrypted; the second processing module, in step 16, if there are unencrypted characters in the initial data, increments the first variable by 1 and i by 1, and repeats steps 11 to 16 until there are no unencrypted characters in the initial data, and determines the target ciphertext according to the cumulative encryption buffer.
[0093] Optionally, the first determination module includes: a first acquisition sub-module, a first processing sub-module, a first operation sub-module, a first conversion sub-module, and a first determination sub-module. Among them, the first acquisition sub-module is used to acquire the first coding value corresponding to the index value of the first variable, the second coding value corresponding to the index value of the first variable plus 1, and the third coding value corresponding to the index value of the first variable minus 1 from the target array; the first processing sub-module is used to perform an exclusive OR operation on the first coding value, the second coding value, and the third coding value to obtain a first numerical value; the first operation sub-module is used to perform a modulo operation on the first numerical value to obtain a second numerical value; the first conversion sub-module is used to convert the i-th target character into an unsigned integer type to obtain a third numerical value; the first determination sub-module is used to determine the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and the first preset value.
[0094] Optionally, the first determination sub-module includes: a first judgment component, a first determination component, and a second determination component. Among them, the first judgment component is used to judge whether the sum of the second numerical value and the third numerical value is greater than the first preset value; the first determination component is used to, if the sum of the second numerical value and the third numerical value is greater than the first preset value, determine the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and the second preset value; the second determination component is used to, if the sum of the second numerical value and the third numerical value is less than or equal to the first preset value, determine the encryption value corresponding to the i-th target character according to the second numerical value and the third numerical value.
[0095] Optionally, the data encryption device further includes: a storage unit, configured to write the target encrypted data into a target file in binary form for storage.
[0096] Optionally, the data encryption device further includes: a first acquisition unit, a first decryption unit, a second decryption unit, and a first determination unit. The first acquisition unit is configured to acquire an encrypted target value and a ciphertext to be verified from the target file; the first decryption unit is configured to perform a decryption operation on the encrypted target value and convert the encrypted target value after the decryption operation into a string form to obtain a target value; the second decryption unit is configured to decrypt the ciphertext to be verified to obtain first data; the first determination unit is configured to determine whether the first data is initial data according to the target value.
[0097] Optionally, the first determination unit includes: a second determination subunit, a first detection subunit, a third determination subunit, and a first generation unit. The second determination subunit is configured to determine a third target value of the first data, where the third target value is used as a verification identifier for the integrity of the first data; the first detection subunit is configured to detect whether the third target value is the same as the target value; the third determination subunit is configured to determine that the first data is initial data if the third target value is the same as the target value; the first generation unit is configured to generate a prompt message if the third target value is not the same as the target value, where the prompt message is used to prompt that there is an abnormality in the initial data.
[0098] The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.
[0099] In the above embodiments of the present application, the descriptions of the respective embodiments have their own emphases. For parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0100] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units can be a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings or direct couplings or communication connections shown or discussed with each other can be through some interfaces. The indirect couplings or communication connections of units or modules can be in an electrical or other form.
[0101] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0102] In addition, in each embodiment of the present application, each functional unit may be integrated into a processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0103] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks or optical discs that can store program codes.
[0104] The above are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.
Claims
1. A data encryption method, characterized in that, Including: Determine the target value of the initial data, where the target value serves as a verification identifier for the integrity of the initial data; Encrypt the target value to obtain an encrypted target value; Convert the initial data into a target ciphertext according to the target value; Perform a cyclic cross-joining operation on the target ciphertext according to the encrypted target value to obtain target encrypted data, where the cyclic cross-joining operation is used to represent performing multiple cross-joinings of the encrypted target value and the target ciphertext according to a preset requirement, and the preset requirement is used to standardize the joining pattern of the encrypted target value and the target ciphertext.
2. The data encryption method according to claim 1, wherein Encrypt the target value to obtain an encrypted target value, including: Perform binary conversion on each string in the target value to obtain a first target value; Shift the binary bits in each byte of the first target value two bits to the left, and transfer the two leftmost shifted binary numbers in each byte to the rightmost of the byte to obtain a second target value; Convert the second target value into a string to obtain the encrypted target value.
3. The data encryption method according to claim 1, wherein Convert the initial data into a target ciphertext according to the target value, including: Convert each character in the target value into a corresponding encoded value, and form a target array according to the encoded value corresponding to each character; Determine the target length of the target array; Set a first variable, where the initial value of the first variable is 0, and the first variable is used to represent the index value of the target array; Convert the initial data into the target ciphertext according to the target array, the target length, and the first variable.
4. The data encryption method according to claim 3, characterized in that Convert the initial data into the target ciphertext according to the target array, the target length, and the first variable, including: Step 11, read the i-th target character from the initial data in the arrangement order of the characters in the initial data, where i is greater than or equal to 1 and less than or equal to the total number of characters in the initial data, The initial value of i is 1; Step 12, determine whether the first variable is greater than or equal to the target length; Step 13, if the first variable is greater than or equal to the target length, set the first variable to 0 and jump to step 12; Step 14, if the first variable is less than the target length, determine the encrypted value corresponding to the i-th target character according to the target array, the first variable, the i-th target character, and a first preset value; Step 15, convert the encrypted value corresponding to the i-th target character into a string and add it to the end of the cumulative encryption buffer, and determine whether all the characters in the initial data are encrypted; Step 16, if there are unencrypted characters in the initial data, increase the first variable by 1 and i by 1, and repeat steps 11 to 16 until there are no unencrypted characters in the initial data, and determine the target ciphertext according to the cumulative encryption buffer.
5. The data encryption method according to claim 4, wherein Step 14, if the first variable is less than the target length, determining the encryption value corresponding to the i-th target character according to the target array, the first variable, the i-th target character, and a first preset value, includes: Obtaining a first encoded value corresponding to an index value of the first variable in the target array, a second encoded value corresponding to an index value of the first variable plus 1, and a third encoded value corresponding to an index value of the first variable minus 1; Performing an exclusive OR operation on the first encoded value, the second encoded value, and the third encoded value to obtain a first numerical value; Performing a modulo operation on the first numerical value to obtain a second numerical value; Converting the i-th target character to an unsigned integer type to obtain a third numerical value; Determining the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and the first preset value.
6. The data encryption method according to claim 5, wherein Determining the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and the first preset value, includes: Judging whether the sum of the second numerical value and the third numerical value is greater than the first preset value; If the sum of the second numerical value and the third numerical value is greater than the first preset value, determining the encryption value corresponding to the i-th target character according to the second numerical value, the third numerical value, and a second preset value; If the sum of the second numerical value and the third numerical value is less than or equal to the first preset value, determining the encryption value corresponding to the i-th target character according to the second numerical value and the third numerical value.
7. The data encryption method according to claim 1, wherein After circularly cross-stitching the target ciphertext according to the encryption target value to obtain target encrypted data, the method further includes: Writing the target encrypted data in binary form into a target file for storage.
8. The data encryption method according to claim 7, characterized in that After writing the target encrypted data in binary form into a target file for storage, the method further includes: Obtaining the encryption target value and the ciphertext to be verified from the target file; Performing a decryption operation on the encryption target value and converting the encrypted target value after the decryption operation into a string form to obtain the target value; Performing decryption on the ciphertext to be verified to obtain a first data; Determining whether the first data is the initial data according to the target value.
9. The data encryption method according to claim 8, wherein Determining whether the first data is the initial data according to the target value, includes: Determining a third target value of the first data, where the third target value is used as a verification identifier for the integrity of the first data; Detecting whether the third target value is the same as the target value; If the third target value is the same as the target value, determining that the first data is the initial data; If the third target value is different from the target value, generating a prompt message, where the prompt message is used to prompt that there is an abnormality in the initial data.
10. A data encryption device, characterized in that, Includes: A determination unit for determining a target value of the initial data, where the target value is used as a verification identifier for the integrity of the initial data; An encryption unit for encrypting the target value to obtain an encryption target value; A conversion unit for converting the initial data into a target ciphertext according to the target value; A processing unit performs a cyclic cross splicing operation on the target ciphertext according to the encrypted target value to obtain target encrypted data, wherein the cyclic cross splicing operation is used to represent performing multiple cross splices on the encrypted target value and the target ciphertext according to a preset requirement, and the preset requirement is used to standardize the splicing pattern of the encrypted target value and the target ciphertext.
Citation Information
Cited By
Carbon emission acquisition and accounting platform system and method thereof
CN121940155A