Data verification method and terminal
By generating data verification methods of memory bytecode and storing it in the binary tree, the problem of insufficient data security and reversibility in the prior art is solved, and the efficiency and security of data processing are achieved, which is suitable for large-scale data scenarios.
Patent Information
- Application Number
- CN202411208019.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2025-01-14
AI Technical Summary
Existing data encryption technology is not enough to ensure data security when facing modern security threats, and cannot achieve data reversibility and scalability for efficient processing of large-scale data.
Using a data verification method, by generating memory bytecode and substituting it into a preset period function, the encryption result and position data are stored in the binary tree as verification codes, supporting the uniqueness and reductibility of data, improving the Data processing efficiency and security.
It realizes the uniqueness and reducibility of the data verification process, improves the efficiency and security of data processing, and is suitable for data distributed storage scenarios.
Smart Images

Figure CN119312407A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data verification, and in particular to a data verification method and a terminal. Background Art
[0002] With the rapid development of information technology, data security and integrity verification have become an important cornerstone to ensure the stable operation of information systems and information security. In the current technical environment, there are many technical means for data encryption and verification. Each technology has its specific application scenarios and advantages, but also faces certain limitations.
[0003] Although existing encryption technology can provide a certain degree of data protection, some algorithms (such as DES) are no longer sufficient to cope with modern security threats; at the same time, the publicity of encryption technology means that it is no longer the only means of verifying data.
[0004] In addition, existing encryption technologies are irreversible. For example, although hash functions such as MD5 can generate unique fingerprints of data, they cannot restore the original data from the hash value, which is a limitation in situations where data recovery or detailed comparison is required. At the same time, with the rapid growth of data volume and the increase in complexity, the efficiency and scalability of existing technologies in processing large-scale data or complex data structures are also facing challenges.
[0005] In summary, although the current data encryption and verification technology meets the needs of data security and integrity to a certain extent, it still has deficiencies in terms of security, reversibility and scalability. Therefore, it is necessary to explore new technical solutions to overcome these limitations and improve the efficiency and security of data processing. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a data verification method and a terminal, which can improve the efficiency and security of data processing.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] A data verification method comprises the steps of:
[0009] In response to a data processing instruction, data to be processed is obtained, a memory bytecode is generated according to the data to be processed, the memory bytecode is substituted into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function, and the encryption result and position data corresponding to the memory bytecode are stored as a check code in a binary tree;
[0010] In response to the data restoration instruction, a corresponding check code is obtained in the binary tree, and data restoration is performed in combination with the check code and the preset periodic function.
[0011] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0012] A data verification terminal comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the above-mentioned data verification method is implemented.
[0013] The beneficial effects of the present invention are as follows: when a data processing instruction is received, a memory bytecode is generated for the data to be processed, and the memory bytecode is substituted into a preset periodic function to obtain an encryption result and the position data of the memory bytecode in the preset periodic function, and the encryption result and position data corresponding to the memory bytecode are stored in a binary tree as a verification code; and when a data restoration instruction is received, the encryption result can be restored with the help of the preset periodic function and the position data in the verification code. In this way, the uniqueness of the data verification process can be guaranteed, and the restorability of the verification data can also be guaranteed, thereby effectively improving the efficiency and security of data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 A flowchart of a data verification method according to an embodiment of the present invention;
[0015] Figure 2 A schematic diagram of a data verification terminal according to an embodiment of the present invention;
[0016] Figure 3 A schematic diagram of a specific flow chart of data verification according to an embodiment of the present invention;
[0017] Figure 4 This is a schematic diagram of the structure of the binary tree storage corresponding to the check code according to an embodiment of the present invention;
[0018] Description of labels:
[0019] 1. A data verification terminal; 2. A memory; 3. A processor. DETAILED DESCRIPTION
[0020] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0021] Please refer to Figure 1 , an embodiment of the present invention provides a data verification method, comprising the steps of:
[0022] In response to a data processing instruction, data to be processed is obtained, a memory bytecode is generated according to the data to be processed, the memory bytecode is substituted into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function, and the encryption result and position data corresponding to the memory bytecode are stored as a check code in a binary tree;
[0023] In response to the data restoration instruction, a corresponding check code is obtained in the binary tree, and data restoration is performed in combination with the check code and the preset periodic function.
[0024] From the above description, it can be seen that the beneficial effects of the present invention are: when receiving a data processing instruction, a memory bytecode is generated for the data to be processed, and the memory bytecode is substituted into a preset periodic function to obtain an encryption result and the position data of the memory bytecode in the preset periodic function, and the encryption result and position data corresponding to the memory bytecode are stored in a binary tree as a verification code; and when receiving a data restoration instruction, the encryption result can be restored with the help of the preset periodic function and the position data in the verification code. In this way, the uniqueness of the data verification process can be guaranteed, and the restorability of the verification data can also be guaranteed, thereby effectively improving the efficiency and security of data processing.
[0025] Further, the step of obtaining the data to be processed further comprises:
[0026] A periodic function is configured for the data to be processed, and a random function is used to complicate the periodic function to generate a preset periodic function.
[0027] From the above description, it can be seen that on the basis of configuring the periodic function, a random function is used to complicate the periodic function, thereby reducing the possibility of external acquisition of the complicated periodic function and further improving the security of data verification.
[0028] Further, substituting the memory bytecode into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function includes:
[0029] Aligning the memory bytecode in segments according to a preset number of bytes;
[0030] Substituting the segmented bytecodes into the preset periodic function in sequence to calculate the corresponding encryption results, and recording the position data of the segmented bytecodes in the preset periodic function;
[0031] Also includes:
[0032] The relationship coefficient of the encryption result is determined by combining the encryption result and the position data.
[0033] From the above description, it can be seen that after the memory bytecode is segmented, the segmented bytecodes are substituted into the preset periodic function in turn to calculate the corresponding encryption results, and the position data of the segmented bytecodes in the preset periodic function are recorded, and the relationship coefficient of the encryption result is determined by combining the encryption result and the position data. Therefore, the position data, encryption result and its relationship coefficient calculated by the preset periodic function can be combined to accurately restore the data to be processed, thereby ensuring the uniqueness of data verification.
[0034] Furthermore, the encryption result and position data corresponding to the memory bytecode are stored as check codes in a binary tree, including:
[0035] A corresponding binary tree is set for the memory bytecode, an encryption result is stored in a root node of the binary tree, and a relationship coefficient between position data corresponding to the memory bytecode and the encryption result is respectively stored in two leaf nodes of the binary tree;
[0036] The check code of the memory bytecode is obtained from the position data of the memory bytecode, the encryption result and the relationship coefficient thereof.
[0037] From the above description, it can be seen that by storing the position data, encryption results and their relationship coefficients calculated by the preset periodic function in a binary tree, it is convenient to perform data verification and restoration according to the preset periodic function and binary tree information, thereby improving the efficiency of data verification.
[0038] Furthermore, obtaining a corresponding check code in the binary tree and performing data restoration in combination with the check code and the preset periodic function includes:
[0039] Substituting the encryption result in the check code stored in the binary tree into the preset periodic function to obtain corresponding multiple calculation results;
[0040] The restored data is determined from a plurality of calculation results according to the relationship coefficient of the encryption result and the position data.
[0041] From the above description, it can be seen that data verification and restoration based on the preset periodic function and binary tree information can ensure the efficiency and uniqueness of data verification.
[0042] Please refer to Figure 2 Another embodiment of the present invention provides a data verification terminal, including 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 data verification method when executing the computer program.
[0043] The data verification method and terminal described above in the present invention are suitable for improving the efficiency and security of data processing in the application scenario of distributed data storage, and are described below through specific implementation methods:
[0044] Embodiment 1
[0045] Please refer to Figure 1 and Figure 3 , a data verification method, comprising the steps of:
[0046] S1. In response to a data processing instruction, obtain the data to be processed, generate a memory bytecode according to the data to be processed, substitute the memory bytecode into a preset periodic function to obtain an encryption result and the position data of the memory bytecode in the preset periodic function, and store the encryption result and position data corresponding to the memory bytecode as a check code in a binary tree.
[0047] After the data to be processed is obtained, it is also necessary to configure a periodic function for the data to be processed, and use a random function to complicate the periodic function to generate a preset periodic function.
[0048] Specifically, a periodic function is configured for the data to be processed. The periodic function may be a sine function or a cosine function. In the present embodiment, the periodic function may be set to y0=cosx0.
[0049] Use random functions to complicate periodic functions, specifically by establishing the following complicated formula:
[0050] rand0*y0=rand1+rand2*(periodic function)+rand3;
[0051] randn may be a random function or a randomly generated function. In this embodiment, the complicated formula may be: 3y0=1 / 2cosx0+sinx0.
[0052] Furthermore, the memory bytecode is segmented and aligned according to a preset number of bytes; the segmented bytecodes are sequentially substituted into a preset periodic function to calculate the corresponding encryption result, and the position data of the segmented bytecodes in the preset periodic function are recorded; and the relationship coefficient of the encryption result is determined by combining the encryption result and the position data.
[0053] In this embodiment, the data to be processed can be first converted into memory bytecode, specifically, corresponding data memory is allocated according to the data content and data size of the data to be processed, in preparation for the subsequent encryption of the data. At this time, the data encryption is not encrypted on the original basis but the original data is read and put into another memory for encryption, thereby preventing the data from being destroyed due to unexpected events.
[0054] The data to be processed is then divided into n bytes according to the data size. In this embodiment, n={4, 8, 16, 32}. When the data size is 1025 and n=32, 32+1 bytes need to be divided, and the extra part is used to supplement its size, that is, 33*32 (alignment size)-1025 (current size)=31.
[0055] In this embodiment, the data size can be divided by 1024 to obtain memory segments, and the corresponding check code is obtained for each memory segment. The check code is obtained by substituting n bytes of data as x0 into the complex periodic function to obtain the corresponding encryption result y0.
[0056] Afterwards, a corresponding binary tree is set for the memory bytecode, the encryption result is stored in the root node of the binary tree, and the position data corresponding to the memory bytecode and the relationship coefficient of the encryption result are respectively stored in the two leaf nodes of the binary tree; the check code of the memory bytecode is obtained from the position data of the memory bytecode, the encryption result and the relationship coefficient thereof.
[0057] For details, please refer to Figure 4 First, the checksum consists of 2 bits of position, 2 bits of relationship coefficient (multiplier, etc.), and the encryption result obtained in n bytes.
[0058] The values obtained by the periodic function must be within the periodic function, so they have a periodic relationship. Assume that 02 in 0203C0E413F01A5E is the position, indicating the second encrypted result position, and its relationship with C0E413F01A5E is 03. Since the y0 value is C0E413F01A5E, the x0 value is the original data, and 03 means that 03 multiplied by the value of x0 is the data restoration result. Then, C0E413F01A5E is stored in the root node of the binary tree, and 02 and 03 are stored in the two leaf nodes of the binary tree respectively.
[0059] S2. In response to a data restoration instruction, a corresponding check code is obtained from the binary tree, and data restoration is performed in combination with the check code and the preset periodic function.
[0060] Specifically, step S2 specifically includes the following steps:
[0061] Substitute the encryption result in the check code stored in the binary tree into the preset periodic function to obtain corresponding multiple calculation results; determine the restored data from the multiple calculation results according to the relationship coefficient of the encryption result and the position data.
[0062] In this embodiment, the restoration process includes: obtaining a preset periodic function; obtaining the data size and applying for the data memory size; obtaining the binary tree data node, substituting the check value into the preset periodic function, and using the position data and the relationship coefficient, setting y0 = check value to calculate the x0 value.
[0063] Fill the restored data and compare it with the original data: apply for memory for the original data, fill the original memory into the applied memory, obtain the check code alignment, that is, n = {4, 8, 16, 32} for comparison, so that the different data determined are the difference data.
[0064] Embodiment 2
[0065] Please refer to Figure 2 A data verification terminal 1 includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3. When the processor 3 executes the computer program, each step of a data verification method of the first embodiment is implemented.
[0066] In summary, the data verification method and terminal provided by the present invention, when receiving a data processing instruction, generates a memory bytecode for the data to be processed, and substitutes the memory bytecode into a preset periodic function to obtain an encryption result and the position data of the memory bytecode in the preset periodic function, and stores the encryption result and position data corresponding to the memory bytecode as a verification code in a binary tree; and when receiving a data restoration instruction, the encryption result can be restored with the help of the preset periodic function and the position data in the verification code. In this way, the uniqueness of the data verification process can be guaranteed, and the restorability of the verification data can also be guaranteed, thereby effectively improving the efficiency and security of data processing.
[0067] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A data verification method, characterized in that: Includes steps: In response to a data processing instruction, data to be processed is obtained, a memory bytecode is generated according to the data to be processed, the memory bytecode is substituted into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function, and the encryption result and position data corresponding to the memory bytecode are stored as a check code in a binary tree; In response to the data restoration instruction, a corresponding check code is obtained in the binary tree, and data restoration is performed in combination with the check code and the preset periodic function.
2. A data verification method according to claim 1, characterized in that: The obtaining of the data to be processed then comprises: A periodic function is configured for the data to be processed, and a random function is used to complicate the periodic function to generate a preset periodic function.
3. A data verification method according to claim 1, characterized in that: Substituting the memory bytecode into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function, including: Aligning the memory bytecode in segments according to a preset number of bytes; Substituting the segmented bytecodes into the preset periodic function in sequence to calculate the corresponding encryption results, and recording the position data of the segmented bytecodes in the preset periodic function; Also includes: The relationship coefficient of the encryption result is determined by combining the encryption result and the position data.
4. A data verification method according to claim 3, characterized in that: The encryption result and position data corresponding to the memory bytecode are stored as a check code in a binary tree, including: A corresponding binary tree is set for the memory bytecode, an encryption result is stored in a root node of the binary tree, and a relationship coefficient between position data corresponding to the memory bytecode and the encryption result is respectively stored in two leaf nodes of the binary tree; The check code of the memory bytecode is obtained from the position data of the memory bytecode, the encryption result and the relationship coefficient thereof.
5. A data verification method according to claim 4, characterized in that: Obtaining a corresponding check code in the binary tree, and performing data restoration in combination with the check code and the preset periodic function, including: Substituting the encryption result in the check code stored in the binary tree into the preset periodic function to obtain corresponding multiple calculation results; The restored data is determined from a plurality of calculation results according to the relationship coefficient of the encryption result and the position data.
6. A data verification 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, the following steps are implemented: In response to a data processing instruction, data to be processed is obtained, a memory bytecode is generated according to the data to be processed, the memory bytecode is substituted into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function, and the encryption result and position data corresponding to the memory bytecode are stored as a check code in a binary tree; In response to the data restoration instruction, a corresponding check code is obtained in the binary tree, and data restoration is performed in combination with the check code and the preset periodic function.
7. A data verification terminal according to claim 6, characterized in that: The obtaining of the data to be processed then comprises: A periodic function is configured for the data to be processed, and a random function is used to complicate the periodic function to generate a preset periodic function.
8. A data verification terminal according to claim 6, characterized in that: Substituting the memory bytecode into a preset periodic function to obtain an encryption result and position data of the memory bytecode in the preset periodic function, including: Aligning the memory bytecode in segments according to a preset number of bytes; Substituting the segmented bytecodes into the preset periodic function in sequence to calculate the corresponding encryption results, and recording the position data of the segmented bytecodes in the preset periodic function; Also includes: The relationship coefficient of the encryption result is determined by combining the encryption result and the position data.
9. A data verification terminal according to claim 8, characterized in that: The encryption result and position data corresponding to the memory bytecode are stored as a check code in a binary tree, including: A corresponding binary tree is set for the memory bytecode, an encryption result is stored in a root node of the binary tree, and a relationship coefficient between position data corresponding to the memory bytecode and the encryption result is respectively stored in two leaf nodes of the binary tree; The check code of the memory bytecode is obtained from the position data of the memory bytecode, the encryption result and the relationship coefficient thereof.
10. A data verification terminal according to claim 9, characterized in that: Obtaining a corresponding check code in the binary tree, and performing data restoration in combination with the check code and the preset periodic function, including: Substituting the encryption result in the check code stored in the binary tree into the preset periodic function to obtain corresponding multiple calculation results; The restored data is determined from a plurality of calculation results according to the relationship coefficient of the encryption result and the position data.