Method and terminal for data storage encryption
By generating black hole numbers for the data to be encrypted and storing them in binary tree nodes for compression, the problem of efficient encryption of data storage and transmission in distributed networks is solved, achieving the effect of low-capacity storage and high-efficiency encryption.
Patent Information
- Application Number
- CN202411142047.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-08-20
AI Technical Summary
Existing technologies for data storage and transmission in distributed networks suffer from problems such as increased data volume, increased processing time, and increased computing resource requirements after encryption. Furthermore, existing encryption technologies cannot effectively balance data security and availability.
The method involves converting the format of the data to be encrypted to generate black hole numbers, which are then stored in binary tree nodes for compression. The binary tree structure ensures the security and efficiency of data encryption, and the unknown nature of the binary tree storage structure enables efficient encryption and decryption of data.
It enables low-capacity data storage, improves encryption efficiency and flexibility, while ensuring data security and availability and reducing storage space requirements.
Smart Images

Figure CN119249513B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data encryption, and particularly relates to a data storage encryption method and a terminal. BACKGROUND
[0002] With the rapid development of information technology, distributed networks have become the mainstream architecture for data storage and transmission. Distributed networks are widely used in cloud computing, big data processing, Internet of Things and other fields due to their high scalability, flexibility and fault tolerance. However, the diversity and complexity of distributed networks also bring great challenges to data security and privacy protection. In particular, during the process of data storage and transmission, how to ensure the confidentiality, integrity and availability of data has become a key problem to be solved.
[0003] In the prior art, data encryption technology is one of the important means to realize data security. Among them, ADE (Advanced Encryption Standard) and DES (Data Encryption Standard) as classic encryption algorithms are widely used in various data encryption scenarios. These algorithms encrypt the original data through complex mathematical transformations, making it difficult for unauthorized third parties to steal or tamper with the data content. However, although ADE / DES and other encryption algorithms play an important role in ensuring data security, they also have some non-negligible shortcomings.
[0004] Firstly, ADE / DES and other encryption algorithms often lead to a significant increase in the amount of encrypted data when dealing with large-scale data, thereby increasing the burden on storage space. This is undoubtedly a not small challenge for application scenarios with limited storage space or cost sensitivity. In addition, as the amount of data continues to grow, the time and computing resources required for encryption processing will also increase accordingly, affecting the efficiency and real-time performance of data transmission.
[0005] Secondly, ZIP and other compression technologies can reduce the size of encrypted data to some extent, but the compression process itself also increases the processing time and complexity, and the compressed data needs to be decompressed after decryption, further increasing the complexity of data processing. At the same time, compression technology cannot completely solve the problem of increased storage space of encrypted data, especially in cases where the data compression rate is low or the data itself is already relatively compact.
[0006] In addition to technologies such as ADE / DES and ZIP, obfuscated data is also a commonly used data protection means. By changing the form or structure of the data, it is difficult for unauthorized third parties to directly understand or utilize the data content. However, obfuscation technology can usually only be used as an auxiliary means of encryption technology and cannot provide sufficient data security protection alone. In addition, obfuscation technology can also have some impact on the usability of data, such as increasing the complexity of data processing and reducing the efficiency of data processing.
[0007] In summary, although the prior art has achieved certain results in realizing the security protection of data storage and transmission in a distributed network, there are still many deficiencies. Therefore, a more efficient, secure and economical data encryption and storage transmission scheme is needed to meet the development needs of distributed networks. SUMMARY
[0008] The technical problem to be solved by the present application is to provide a data storage encryption method and terminal that can achieve low-capacity data encryption and ensure the efficiency and security of data encryption.
[0009] To solve the above technical problems, the technical scheme adopted by the present application is:
[0010] A data storage encryption method, comprising the steps of:
[0011] In response to a data encryption request, the format of the data to be encrypted is converted, the converted data to be encrypted is generated according to the corresponding black hole number by byte, and the generation process of each black hole number is stored in the node of the binary tree. All generated black hole numbers are compressed to obtain compressed data.
[0012] In response to a data decryption request, the compressed data is decompressed, and the decompressed black hole numbers are restored according to the node data in the binary tree to obtain the original data to be encrypted.
[0013] To solve the above technical problems, another technical scheme adopted by the present application is:
[0014] A data storage encryption terminal, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement each step of the above-mentioned data storage encryption method.
[0015] The application has the beneficial effects that: in response to a data encryption request, corresponding black hole numbers are generated by byte after the to-be-encrypted data is converted, the generation process of each black hole number is stored into a binary tree node, and the generated black hole numbers are compressed, so that the to-be-encrypted data is converted into black hole numbers and then compressed, which not only can save the storage space of data, but also can ensure the encryption efficiency and flexibility. In response to a data decryption request, the compressed data is decompressed, and the black hole numbers are restored according to the node data in the binary tree. Since the data restoration information is stored in the binary tree, the encrypted compressed data does not have readability and the binary tree storage structure is unknown to the outside, so the security of data encryption can be effectively ensured. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 A flowchart of a data storage encryption method according to an embodiment of the application;
[0017] Figure 2 A schematic diagram of a data storage encryption terminal according to an embodiment of the application;
[0018] Figure 3 A schematic diagram of a binary tree storage structure according to an embodiment of the application;
[0019] Figure 4 A flowchart of a data storage encryption method according to an embodiment of the application.
[0020] REFERENCE NUMERALS:
[0021] 1. A data storage encryption terminal; 2. a memory; 3. a processor. DETAILED DESCRIPTION
[0022] To explain the technical content, purposes and effects of the application in detail, the following will be described in combination with the embodiments and the accompanying drawings.
[0023] Glossary:
[0024] Black hole number: also known as trap number, is an integer with special conversion characteristics. Any different integer number will get one or more numbers after finite "rearrangement difference" operation, and these numbers are black hole numbers. "Rearrangement difference" operation is to subtract the minimum number obtained by rearranging the numbers from the maximum number obtained by rearranging the numbers.
[0025] Please refer to Figure 1 The embodiment of the application provides a data storage encryption method, which comprises the following steps:
[0026] In response to the data encryption request, the to-be-encrypted data is format-converted, the to-be-encrypted data in the converted format is used to generate corresponding black hole numbers byte by byte, the generation process of each black hole number is stored in a node of a binary tree, and all the generated black hole numbers are compressed to obtain compressed data.
[0027] In response to the data decryption request, the compressed data is decompressed, and the decompressed black hole numbers are restored according to the node data in the binary tree to obtain the original to-be-encrypted data.
[0028] From the above description, it can be known that the application has the beneficial effects that in response to the data encryption request, the to-be-encrypted data is converted and then used to generate corresponding black hole numbers byte by byte, the generation process of each black hole number is stored in a node of a binary tree, and the generated black hole numbers are compressed, so that after the to-be-encrypted data is converted into black hole numbers and then compressed, the storage space of the data can be saved, and the encryption efficiency and flexibility can be ensured. In response to the data decryption request, the compressed data is decompressed, and the black hole numbers are restored according to the node data in the binary tree. Since the data restoration information is stored in the binary tree, the encrypted compressed data does not have readability and the binary tree storage structure is unknown to the outside, so the security of the data encryption can be effectively ensured.
[0029] Further, the to-be-encrypted data is format-converted, and the to-be-encrypted data in the converted format is used to generate corresponding black hole numbers byte by byte, including:
[0030] The to-be-encrypted data is converted into hexadecimal, and the to-be-encrypted data in the converted format is divided into pages, two bytes are sequentially obtained in the data of each page, and corresponding black hole numbers are generated.
[0031] From the above description, it can be known that by using the page division manner of the to-be-encrypted data, the generation of the black hole numbers for the data of each page can be simultaneously performed by using multiple threads, and the efficiency of the data encryption can be effectively improved.
[0032] Further, the generation process of each black hole number is stored in a node of a binary tree, including:
[0033] When the corresponding black hole numbers are generated from the two bytes, the data corresponding to the two bytes is converted into decimal to obtain calculation data, and the initial position identifier of each bit data in the calculation data is recorded in a first node of the binary tree.
[0034] The calculation data is rearranged and the difference is calculated until the black hole number is calculated, and the rearranged data of each rearrangement and difference and the corresponding round are sequentially recorded in the nodes after the first node.
[0035] As can be known from the above description, two bytes of data are acquired each time to generate the corresponding black hole number, and the initial position identifier of the two bytes of data corresponding to the calculation data, and the rearrangement data and the calculation round of each rearrangement difference are recorded, since the content required for data restoration is additionally stored in the binary tree, and the storage structure of the binary tree is unknown to the outside, thus the encryption security can be ensured, and the subsequent decryption of the black hole number is facilitated.
[0036] Further, the black hole number after decompression is restored according to the node data in the binary tree to obtain the original data to be encrypted, comprising:
[0037] According to the node data in the binary tree, the rearrangement data of each rearrangement difference and the corresponding round are acquired in turn according to the order of the nodes from back to front, so as to restore the rearrangement difference formula of each round;
[0038] When the initial position identifier of the first node is acquired in the binary tree, the rearrangement data of the last restored rearrangement difference formula is restored to the original data to be encrypted according to the initial position identifier.
[0039] As can be known from the above description, the calculation process of the black hole number is gradually restored through the information stored in the binary tree, and the original data to be encrypted can be efficiently restored, so as to ensure the efficiency and reliability of data restoration.
[0040] Further, all the generated black hole numbers are compressed to obtain compressed data, comprising:
[0041] The generation times of each black hole number are counted, and the generation times of each black hole number and the bit number of the decimal black hole number are taken as the compressed data.
[0042] As can be known from the above description, all the black hole numbers are compressed into the generation times of each black hole number and the bit number of the black hole number, which not only saves storage space, but also makes the encrypted data unreadable.
[0043] Please refer to Figure 2 Another embodiment of the present application provides a terminal for data storage encryption, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of the above-mentioned method for data storage encryption when executing the computer program.
[0044] The above-mentioned method and terminal for data storage encryption are suitable for realizing low-capacity data encryption in a distributed network, and ensuring the efficiency and security of data encryption, which will be described below through specific embodiments:
[0045] Embodiment one
[0046] Please refer to Figure 1 ,Figure 3 and Figure 4 A method for data storage encryption, comprising the steps of:
[0047] S1, in response to a data encryption request, format conversion is performed on the data to be encrypted, the converted format of the data to be encrypted is used to generate corresponding black hole numbers by bytes, and the generation process of each black hole number is stored in the nodes of a binary tree. All generated black hole numbers are compressed to obtain compressed data.
[0048] S11, the data to be encrypted is converted into hexadecimal, and the converted format of the data to be encrypted is paginated, two bytes are sequentially obtained in the data of each page, and corresponding black hole numbers are generated.
[0049] Specifically, the data to be encrypted is converted into hexadecimal, and the memory size of the converted format of the data to be encrypted is divided by 1024 to obtain N 1024-size pages, so as to realize data pagination and alignment, and the data in each page is sequentially obtained in a two-byte manner and corresponding black hole numbers are generated.
[0050] Among them, for the data of three digits in decimal, the fixed result of the black hole number is 495, that is, "EF01" in hexadecimal; for the data of four digits in decimal, the fixed result of the black hole number is 6174, that is, "1E18" in hexadecimal.
[0051] Therefore, the data in each page can be converted into data composed of "EF01" and "1E18".
[0052] In this embodiment, only the corresponding black hole numbers of asymmetric data are generated, and if it is symmetric data, it is directly skipped and not processed.
[0053] S12, when generating corresponding black hole numbers according to two bytes, the data corresponding to the two bytes is converted into decimal to obtain calculation data, and the initial position identifier of each bit data in the calculation data is recorded in the first node of the binary tree; the calculation data is rearranged and the difference is calculated until the black hole number is calculated, and the rearranged data and the corresponding round of each rearrangement and difference calculation are sequentially recorded in the nodes after the first node.
[0054] In this embodiment, if the two bytes obtained are "00D5", the corresponding decimal calculation data is 213, so the black hole number generation process of this data is:
[0055] The first round: 321-123=198;
[0056] The second round: 981-189=792;
[0057] The third round: 972-279=693;
[0058] Round 4: 963-369 = 594;
[0059] Round 5: 954-459 = 495.
[0060] At this time, the initial position identifier of the calculation data is recorded, the initial position identifier is generated according to the numerical value from small to large for each digit in the calculation data, and the position identifier corresponding to the numerical value from small to large can be 0, 1, 2, …, and therefore the initial position identifier of the calculation data 213 in this embodiment is 102.
[0061] Further, the initial position identifier 102 is stored in the node 1 of the binary tree, and the round data and the rearrangement data are stored in the nodes after the node 1, that is, the node 2 stores the round 1 and the rearrangement data 123, the node 3 stores the round 2 and the rearrangement data 189, the node 4 stores the round 3 and the rearrangement data 279, the node 5 stores the round 4 and the rearrangement data 369, and the node 6 stores the round 5 and the rearrangement data 459.
[0062] S13, count the generation times of each black hole number, and take the generation times of each black hole number and the number of digits of the decimal black hole number as compression data.
[0063] In this embodiment, if the following results obtained by the above operation in the page are 1E 18 1E 18EF 01EF 01, it means that two decimal three-digit numbers and two decimal four-digit numbers have been calculated for the black hole number, and therefore the above data can be simplified to 2:3 2:4.
[0064] S2, in response to a data decryption request, decompress the compression data, restore the decompressed black hole number according to the node data in the binary tree, to obtain the original data to be encrypted.
[0065] S21, restore the black hole number according to the compression data, for example, restore the compression data 2:3 2:4 to 1E 181E18EF 01EF 01.
[0066] S22, according to the node data in the binary tree, sequentially obtain the rearrangement data and the corresponding round of each rearrangement difference according to the order of the nodes from back to front, to restore the rearrangement difference formula of each round; when the initial position identifier of the first node is obtained in the binary tree, the rearrangement data of the last restored rearrangement difference formula is restored to the original data to be encrypted according to the initial position identifier.
[0067] In this embodiment, the black hole number 495 is known, and according to the storage data in the binary tree node, the rearrangement difference formula of each round can be restored, and for the rearrangement data of the restored round data 1, the original data to be encrypted can be obtained according to the initial position identifier.
[0068] Embodiment two
[0069] Reference is made to Figure 2 A terminal 1 for data storage encryption comprises a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, wherein the processor 3 implements each step of the method for data storage encryption of embodiment one when executing the computer program.
[0070] In summary, the method and terminal for data storage encryption provided by the present application can generate corresponding black hole numbers in bytes after converting the data to be encrypted in response to a data encryption request, and store the generation process of each black hole number in a binary tree node, and compress the generated black hole numbers, so that the data to be encrypted is converted into black hole numbers and then compressed, which not only saves the storage space of the data, but also ensures the encryption efficiency and flexibility. In response to a data decryption request, the compressed data is decompressed, and the black hole numbers are restored according to the node data in the binary tree. Since the data restoration information is stored in the binary tree, the encrypted and compressed data does not have readability and the binary tree storage structure is unknown to the outside, so the security of data encryption can be effectively guaranteed.
[0071] The above description is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent transformation or direct or indirect application in related technical fields based on the content of the specification and drawings of the present application is also included in the patent protection scope of the present application.
Claims
1. A method for encrypting data storage, characterized in that, Including the following steps: In response to a data encryption request, the format of the data to be encrypted is converted. The converted data is then used to generate corresponding black hole numbers byte by byte. The generation process of each black hole number is stored in a node of a binary tree. All generated black hole numbers are then compressed to obtain compressed data. The data to be encrypted is asymmetric data. In response to the data decryption request, the compressed data is decompressed, and the number of black holes after decompression is restored based on the node data in the binary tree to obtain the original data to be encrypted. The data to be encrypted is converted to a new format. The converted data is then used to generate the corresponding number of black holes per byte, including: The data to be encrypted is converted into hexadecimal, and the converted data is paginated. Two bytes are obtained from each page of data and the corresponding number of black holes is generated. The generation process of each black hole number is stored in a node of a binary tree, including: When generating the corresponding black hole number based on two bytes, the data corresponding to the two bytes is converted into decimal to obtain the calculated data, and the initial position identifier of each bit in the calculated data is recorded in the first node of the binary tree. The calculated data is rearranged and subtracted until the number of black holes is calculated, and the rearranged data and the corresponding round are recorded in the nodes after the first node in turn. The decompressed black hole count is restored based on the node data in the binary tree to obtain the original data to be encrypted, including: Based on the node data in the binary tree, the rearranged data and corresponding rounds for each rearrangement and subtraction are obtained sequentially from the back to the front, so as to restore the rearrangement and subtraction formula for each round. When the initial position identifier of the first node is obtained in the binary tree, the rearranged data of the last restored rearranged difference formula is restored to the original data to be encrypted according to the initial position identifier.
2. The data storage encryption method according to claim 1, characterized in that, The generated black hole numbers are compressed to obtain compressed data, including: The number of times each black hole number is generated is counted, and the number of times each black hole number is generated and the number of decimal black hole numbers are used as compressed data.
3. A data storage encryption terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it performs the following steps: In response to a data encryption request, the format of the data to be encrypted is converted. The converted data is then used to generate corresponding black hole numbers byte by byte. The generation process of each black hole number is stored in a node of a binary tree. All generated black hole numbers are then compressed to obtain compressed data. The data to be encrypted is asymmetric data. In response to the data decryption request, the compressed data is decompressed, and the number of black holes after decompression is restored based on the node data in the binary tree to obtain the original data to be encrypted. The data to be encrypted is converted to a new format. The converted data is then used to generate the corresponding number of black holes per byte, including: The data to be encrypted is converted into hexadecimal, and the converted data is paginated. Two bytes are obtained from each page of data and the corresponding number of black holes is generated. The generation process of each black hole number is stored in a node of a binary tree, including: When generating the corresponding black hole number based on two bytes, the data corresponding to the two bytes is converted into decimal to obtain the calculated data, and the initial position identifier of each bit in the calculated data is recorded in the first node of the binary tree. The calculated data is rearranged and subtracted until the number of black holes is calculated, and the rearranged data and the corresponding round are recorded in the nodes after the first node in turn. The decompressed black hole count is restored based on the node data in the binary tree to obtain the original data to be encrypted, including: Based on the node data in the binary tree, the rearranged data and corresponding rounds for each rearrangement and subtraction are obtained sequentially from the back to the front, so as to restore the rearrangement and subtraction formula for each round. When the initial position identifier of the first node is obtained in the binary tree, the rearranged data of the last restored rearranged difference formula is restored to the original data to be encrypted according to the initial position identifier.
4. A data storage encryption terminal according to claim 3, characterized in that, The generated black hole numbers are compressed to obtain compressed data, including: The number of times each black hole number is generated is counted, and the number of times each black hole number is generated and the number of decimal black hole numbers are used as compressed data.
Citation Information
Patent Citations
Sequence number encrypting method and cipher machine generated by sequencing
CN101567781A
Method and system for information secrecy storage by encoding
CN105245315A