Data verification method and device

By mapping data to residual class rings and performing polynomial power operations to generate data summaries, the problem of low operational efficiency of data summary algorithms in the existing technology is solved, and more efficient data verification is achieved.

CN117251884BActive Publication Date: 2025-01-24BEIJING HAITAI FANGYUAN HIGH TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311221782.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-21
Publication Date
2025-01-24
Estimated Expiration
2043-09-21

AI Technical Summary

Technical Problem

In the prior art, the data digest algorithm has low computational efficiency, resulting in low efficiency in verification data.

Method used

By mapping the data to the remaining type of ring, the polynomial is generated, and the polynomial is calculated to generate data to generate data summary, and the polynomial square power computing efficiency is high to improve the generating efficiency of the data abstract.

Benefits of technology

It improves the efficiency of data summary generation and data verification, especially during batch data processing, it can more quickly verify whether the data has been tampered with.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117251884B_ABST
    Figure CN117251884B_ABST
Patent Text Reader

Abstract

The present application discloses a data verification method and device, which includes a first device acquiring first data to be verified, mapping the first data to a residual class ring to obtain a first polynomial. The coefficient of the first polynomial is 0 or 1. The first device can perform an m-th power operation on the first polynomial to obtain a second polynomial, and use some or all of the coefficients of the second polynomial as a summary of the first data, and then verify whether the first data has been tampered with based on the summary of the first data. In other words, the summary of the first data is obtained based on the polynomial corresponding to the first data on the residual class ring. Since the efficiency of polynomial power operation is relatively high, this method can improve the efficiency of generating data summaries, and in the process of batch data processing, it can improve the efficiency of checking whether the data has been tampered with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information security technology, and in particular to a data verification method and device. Background Art

[0002] Data digest is a function that uses data of any length as input to calculate data of a fixed length. Since the process of generating data digest is an irreversible process, data digest is usually used in the fields of data signature, data integrity verification, encryption of sensitive information, etc. Data digest algorithm is also called hash algorithm, hash algorithm or hash algorithm.

[0003] The main feature of the data digest algorithm is that the generated data digest cannot be reverse decrypted. The same data digest is obtained by processing the same data with the same data digest algorithm. In practical applications, different data digests are usually obtained by processing different data with the same data digest algorithm. Therefore, in the field of information security technology, the data digest algorithm can be used to verify whether the data has been tampered with.

[0004] In the current prior art, the scheme for verifying whether data has been tampered with is usually to generate a data summary of the data based on a data summary algorithm. Among them, the scheme for verifying whether data has been tampered with using a data summary algorithm is usually to use the same data summary algorithm to perform two summary calculations on the data respectively. If the two data summaries are the same, it means that the data has not been tampered with. If the two data summaries are different, it means that the data has been tampered with. However, due to the low computational efficiency of the data summary algorithm in the prior art scheme, the efficiency of verifying data is low. Summary of the invention

[0005] The embodiments of the present application provide a data verification method and device to improve the efficiency of generating data summaries, thereby improving the efficiency of verifying data.

[0006] In a first aspect, an embodiment of the present application provides a method for determining a data summary, comprising: obtaining first data. Mapping the first data to a residue class ring to obtain a first polynomial, where each element on the residue class ring is a polynomial, and any polynomial contains coefficients of 0 and / or 1, and the first polynomial is an element on the residue class ring. Raising the first polynomial to the mth power to obtain a second polynomial, where m is a positive integer greater than 1; determining the summary of the first data based on the coefficients of the second polynomial. Verifying whether the first data has been tampered with based on the summary of the first data.

[0007] Using this method, the summary of the first data is obtained based on the polynomial corresponding to the first data on the residual class ring. Since the efficiency of polynomial power operation is relatively high, this method can improve the efficiency of generating data summaries. In the process of batch data processing, it can improve the efficiency of verifying whether the data has been tampered with.

[0008] In one possible design, the summary of the first data includes part or all of the coefficients of the second polynomial.

[0009] By adopting this design, part or all of the coefficients of the second polynomial are used as the summary of the data, which can improve the data operation efficiency while ensuring the complexity of the data summary.

[0010] In a possible design, each element on the residue class ring is determined according to a third polynomial, the degree of the third polynomial is greater than or equal to the length of the first data, and the third polynomial is the product of multiple polynomials.

[0011] With this design, the first device can determine the third polynomial according to the maximum data length of the data to be processed, and then construct a residual class ring according to the third polynomial, so that the polynomials corresponding to the data to be processed are all elements on the residual class ring.

[0012] In a possible design, m is determined according to the order of the residue class ring, and m is a positive integer greater than 1.

[0013] In one possible design, m satisfies:

[0014] m=2 L mod R;

[0015] Where R is the order of the residue class ring, L is any positive integer and 2 L >R.

[0016] With this design, m determined according to the order of the residue class ring can maintain the homomorphism of XOR addition between summary values ​​obtained according to m.

[0017] In a second aspect, an embodiment of the present application provides a data summary determination device, including:

[0018] The communication module is used to obtain first data.

[0019] A processing module is used to map the first data to a residual class ring to obtain a first polynomial, where each element on the residual class ring is a polynomial, and the coefficients contained in any polynomial are 0 and / or 1, and the first polynomial is an element on the residual class ring.

[0020] The processing module is used to perform an m-th power operation on the first polynomial to obtain a second polynomial, where m is a positive integer greater than 1.

[0021] The processing module is further used to determine a summary of the first data according to the coefficients of the second polynomial.

[0022] The processing module is further used to verify whether the first data has been tampered with according to the summary of the first data.

[0023] In one possible design, the summary of the first data includes part or all of the coefficients of the second polynomial.

[0024] In a possible design, each element on the residue class ring is determined according to a third polynomial, the degree of the third polynomial is greater than or equal to the length of the first data, and the third polynomial is the product of multiple polynomials.

[0025] In a possible design, m is determined according to the order of the residue class ring, and m is a positive integer greater than 1.

[0026] In one possible design, m satisfies:

[0027] m=2 L mod R;

[0028] Where R is the order of the residue class ring, L is any positive integer and 2 L >R.

[0029] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of the first aspect and the second aspect and any one of their designs is implemented.

[0030] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the computer program is executed by the processor, the processor implements the first aspect and the second aspect and any one of the designed methods thereof.

[0031] The technical effects brought about by the second to fourth aspects and any one of their designs can refer to the technical effects brought about by the corresponding design in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0033] Figure 1 A flowchart of a data summary determination method provided in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of the structure of a data summary determination device provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be described in detail in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0037] Next, a method for verifying data is introduced in combination with the prior art.

[0038] In the current prior art, in the field of information security technology, the scheme for verifying whether data has been tampered with is usually to verify whether the data has been tampered with based on a data summary algorithm. For example, in order to verify whether the transmitted data has been tampered with, the data sender can generate a data summary of the data based on a data summary algorithm, and send the data and the data summary to the data receiver. After receiving the data, the data receiver can generate a data summary of the data based on the same data summary algorithm. If the calculated data summary is the same as the received data summary, it means that the data has not been tampered with. If the two data summaries are different, it means that the data has been tampered with. Although this method can be used to verify whether the data has been tampered with, in actual applications, it is often necessary to verify a large amount of data, and the operational efficiency of the data summary algorithm in the prior art is low, which leads to low efficiency in verifying data.

[0039] In order to solve the above technical defects, the present application provides a data summary determination method and device. In the method, the first device obtains the first data to be verified, maps the first data to the residual class ring to obtain the first polynomial. Among them, the coefficient of the first polynomial is 0 or 1. The first device can perform m-th power operation on the first polynomial to obtain the second polynomial, and use some or all coefficients of the second polynomial as the summary of the first data, and then verify whether the first data has been tampered with according to the summary of the first data. In other words, the summary of the first data is obtained according to the corresponding polynomial of the first data on the residual class ring. Since the efficiency of the polynomial square power operation is high, the method can improve the efficiency of generating data summaries, and in the process of batch data processing, the efficiency of checking whether the data has been tampered with can be improved. The first data in the present application can be a message, or a data unit exchanged and transmitted in the network, or other data information, which is not specifically limited in the present application. In addition, the first device can be a computer system, or a device in a data device for executing the method shown in the present application, such as a processor or a processing module, which is not specifically limited in the present application.

[0040] Figure 1 A flowchart of a data summary determination method provided by an embodiment of the present invention. Taking the first device as the execution subject as an example, the process may include the following steps:

[0041] S101: A first device obtains first data.

[0042] Specifically, the first data may be data to be verified whether it has been tampered with. The first device may obtain the first data by receiving the first data from other devices. For example, the present application also includes a data-using device, and the data-using device needs to determine whether the first data has been tampered with before using the first data. The data-using device may send the first data to the first device and send a request to the first device to verify the first data. Accordingly, the first device receives the first data and the request to verify the first data from the data-using device.

[0043] The first data may also be data stored by the first device itself. For example, after receiving the verification request, the first device verifies whether the data stored by itself has been tampered with. It is understandable that the first data is any data in the data stored by the first device itself.

[0044] S102, the first device maps the first data to a residual class ring to obtain a first polynomial, wherein each element on the residual class ring is a polynomial, any polynomial has coefficients of 0 and / or 1, and the first polynomial is an element on the residual class ring.

[0045] Specifically, the first device can map the first data to a polynomial remainder class ring with a characteristic of 2 to obtain a first polynomial. The first device can map the first data to a numerical value a within a limited value range, and convert the numerical value a into a binary number. Alternatively, the first device can directly map the first data to a binary number a within a limited value range. Since each element on the polynomial remainder class ring is a polynomial, and each polynomial contains coefficients of 0 and / or 1, the coefficients of each polynomial can form a binary number, that is, one binary number can correspond to one polynomial. Therefore, the polynomial corresponding to the binary number a can be used as the first polynomial. For example, the first device can map the first data to 5, and convert 5 to the binary number 101 (or, the first device can map the first data to the binary number 101), then the polynomial with a coefficient equal to the binary number 101 is 1*x. 2 +0*x+1*1, that is, the first polynomial is x 2 +1.

[0046] In addition, in order to ensure that the polynomials corresponding to all the values ​​within the limited value range are polynomials on the residual class ring, the limited value range can be determined according to the maximum value of the data length.

[0047] For example, the maximum value of the limited value range can be expressed as M, and the maximum value of the data length can be expressed as N. Then the maximum value of the limited value range and the maximum value of the data length satisfy:

[0048] M=2 N -1;

[0049] If the maximum value of the data length is 20 bits, the maximum value of the limited value range is 1048575. That is, the limited value range is [0,1048575].

[0050] In one or more embodiments, each element on the residue class ring is determined according to a third polynomial, the degree of the third polynomial is greater than or equal to the length of the first data, and the third polynomial is the product of multiple polynomials.

[0051] Specifically, before determining the data summary, the maximum value of the data length can be determined from all the data. In order to ensure that the polynomials corresponding to all the data are elements on the residual class ring, the degree of the third polynomial used to construct the residual class ring is greater than or equal to the maximum value of the bit length of the data to be processed. In addition, in order to ensure the quality of the summary, the third polynomial in this application is the product of multiple polynomials, and the third polynomial cannot be a primitive irreducible polynomial on the GF(2) field.

[0052] Based on this embodiment, the first device can determine the third polynomial according to the maximum value of the bit length of the data to be processed, and then construct a residual class ring according to the third polynomial. The polynomial obtained by multiplying any polynomial on the residual class ring modulo the third polynomial is still a polynomial on the residual class ring. Therefore, the polynomials corresponding to the data to be processed are all elements on the residual class ring.

[0053] Exemplarily, if the maximum value of the data length of the data to be processed is 20 bits, the degree of the polynomial (i.e., the third polynomial) used to construct the residual class ring can be 20, or greater than 20. Taking the polynomial (i.e., the third polynomial) for constructing the residual class ring as an example, the degree is equal to 20, and multiple polynomials can be selected so that the product of the multiple polynomials is the third polynomial. For example, three polynomials whose degrees of the highest degree terms are 5, 7, and 8, respectively, can be selected to determine the third polynomial. That is, the three polynomials can be expressed as:

[0054] f1(x)=x 5 +x 2 +1;

[0055] f2(x)=x 7 +x 6 +1;

[0056] f3(x)=x 8 +x 4 +x 3 +x 2 +1.

[0057] Multiply the three polynomials to obtain the third polynomial. The third polynomial can be expressed as F(x), then the third polynomial is:

[0058] F(x)=x 20 +x 19 +x 17 +x 15 +x 14 +x 13 +x 12 +x 3 +1.

[0059] The first device can construct a remainder class ring according to the third polynomial. The remainder class ring can be expressed as Z2[x] / (F(x)), and the remainder class ring is:

[0060] Z2[x] / (F(x))=Z2[x] / (x 20 +x 19 +x 17 +x 15 +x 14 +x 13 +x 12 +x 3+1).

[0061] The coefficients of the polynomials included in the residue class ring are all 0 or 1, and the degree is less than 20.

[0062] In addition, when the product of any two polynomials on the residue class ring is modulo F(x), the resulting polynomials are all polynomials on the residue class ring. For example, take two polynomials on the residue class ring, polynomial x 14 +1 and polynomial x 8 +x, multiplying these two polynomials gives us the polynomial x 22 +x 15 +x 8 +x, and then apply the polynomial modulo F(x) to obtain the polynomial x 18 +x 14 +x 12 +x 8 +x 5 +x 4 +x 3 +x 2 +1.

[0063] S103: The first device performs an m-th power operation on the first polynomial to obtain a second polynomial, where m is a positive integer greater than 1.

[0064] Specifically, after mapping the first data to the first polynomial, the first device may perform an m-th power operation on the first polynomial to obtain a second polynomial. For example, the first polynomial may be represented by A(x), the second polynomial may be represented by H(x), and the third polynomial is F(x), then the first polynomial and the second polynomial satisfy:

[0065] H(x)=A(x) m mod F(x).

[0066] Among them, mod is the modulo operation.

[0067] Furthermore, if a polynomial on a residue class ring is raised to the power of r and the resulting polynomial is equal to itself modulo F(x), where r is an integer greater than 1, then such a minimum r is called the order of the polynomial on the residue class ring. That is, A(x) = A(x) r The order of a residue class ring is the least common multiple of the orders of all polynomials on the residue class ring.

[0068] In one or more embodiments, m may be determined according to the order of the residual class ring, where m is a positive integer greater than 1.

[0069] In one or more embodiments, if the order of the residual class ring can be expressed as R, then m and the order of the residual class ring satisfy:

[0070] m=2 L mod R.

[0071] Where L is any positive integer and 2 L >R.

[0072] In the present application, m can make the mth power of the sum of any two polynomials on the residue class ring equal to the sum of the mth powers of the two polynomials. For example, any two polynomials on the residue class ring can be expressed as A(x) and B(x), then polynomial A(x) and polynomial B(x) satisfy:

[0073] (A(x)+B(x)) m =A(x) m +B(x) m .

[0074] S104: The first device determines a summary of the first data according to coefficients of the second polynomial.

[0075] Specifically, the first device may use the coefficients of the second polynomial as a summary of the first data.

[0076] In one or more embodiments, the summary of the first data includes some or all of the coefficients of the second polynomial.

[0077] Specifically, the summary of the first data may be partial coefficients of the second polynomial, or the summary of the first data may be all coefficients of the second polynomial. It is understandable that if partial coefficients of the second polynomial are used as the summary of the first data, the rules for obtaining the summary may be set according to one's own needs. For example, the preset rule for obtaining the summary may be to use the first 128 bits of data of the second polynomial as the summary of the first data. Alternatively, use the last 128 bits of data of the second polynomial as the summary of the first data. In addition, the present application may also obtain partial coefficients of the second polynomial in other ways, which will not be described one by one here.

[0078] For example, the summary of the first data is taken as some coefficients of the second polynomial:

[0079] Still taking the above example, the residual class ring is represented by Z2[x] / (F(x)), where F(x)=x 20 +x 19 +x 17 +x 15 +x 14 +x 13 +x 12 +x 3 +1, the order of the remaining class ring is 1003935, then m = 2 20mod1003935=44641. The preset rule for obtaining the summary is to use the first 12 bits of the coefficients of the second polynomial as the summary of the first data. If the first polynomial is represented by x, the second polynomial is:

[0080] x 44641 mod F(x) = x 19 +x 18 +x 16 +x 15 +x 14 +x 12 +x 11 +x 10 +x 9 +x 8 +x 5 +x 4 +x 2 .

[0081] Right now:

[0082] 1*x 19 +1*x 18 +0*x 17 +1*x 16 +1*x 15 +1*x 14 +0*x 13 +1*x 12 +1*x 11 +1*x 10 +1*x 9 +1*x 8 +0*x 7 +0*x 6 +1*x 5 +1*x 4 +0*x 3 +1*x 2 +0*x 1 +0*x 0 .

[0083] The coefficient of the second polynomial is 11011101111100110100. According to the preset rule, the summary of the data is hash(x)=110111011111.

[0084] For example, if the first polynomial is x 5 +1, then the second polynomial is:

[0085] (x 5 +1) 44641 mod F(x) = x 18 +x 17 +x 16 +x 14 +x11 +x 8 +x 7 +x 6 +x 5 +x+1.

[0086] Right now:

[0087] 0*x 19 +1*x 18 +1*x 17 +1*x 16 +0*x 15 +1*x 14 +0*x 13 +0*x 12 +1*x 11 +0*x 10 +0*x 9 +1*x 8 +1*x 7 +1*x 6 +1*x 5 +0*x 4 +0*x 3 +0*x 2 +1*x 1 +1*x 0 .

[0088] The coefficient of the second polynomial is 01110100100111100011. According to the preset rules, the summary of the data is hash(x 5 +1)=011101001001.

[0089] If the first polynomial is x 5 +x+1, then the second polynomial is:

[0090] (x 5 +x+1) 44641 mod F(x) = x 19 +x 17 +x 15 +x 12 +x 10 +x 9 +x 7 +x 6 +x 4 +x 2 +x+1.

[0091] Right now:

[0092] 1*x 19 +0*x 18 +1*x 17 +0*x 16 +1*x 15+0*x 14 +0*x 13 +1*x 12 +0*x 11 +1*x 10 +0*x 9 +0*x 8 +1*x 7 +1*x 6 +0*x 5 +1*x 4 +0*x 3 +1*x 2 +1*x 1 +1*x 0 .

[0093] The coefficient of the second polynomial is 10101001011011010111. According to the preset rules, the summary of the data is hash(x 5 +x+1)=101010010110.

[0094] It is easy to verify that 110111011111⊕011101001001=101010010110;

[0095] And x⊕(x 5 +1) = x 5 +x+1.

[0096] It is confirmed that (x⊕(x 5 +1)) 44641 =(x 5 +x+1) 44641 =x 44641 ⊕(x 5 +1) 44641 , that is, Hash(x)⊕Hash(x 5 +1)=Hash(x 5 +x+1).

[0097] It can be understood that in this application, multiple copies of data are mapped to the residual class ring, and some coefficients of the corresponding second polynomial after calculating the power are used as the summary of the data, and the summary values ​​of the data maintain the homomorphism of XOR addition. For example, the polynomial corresponding to data 1 can be expressed as A(x), and the polynomial corresponding to data 2 can be expressed as B(x), then hash(A(x)⊕B(x))=hash(A(x))⊕hash(B(x)).

[0098] For example, the summary of the first data is all the coefficients of the second polynomial:

[0099] When the first polynomial is x, the coefficient of the second polynomial corresponding to the data is 11011101111100110100, then the summary of the data is

[0100] hash(x)=11011101111100110100;

[0101] When the first polynomial is x 5 +1, the coefficient of the second polynomial corresponding to the data is 01110100100111100011, then the summary of the data is

[0102] hash(x 5 +1)=01110100100111100011;

[0103] When the first polynomial is x 5 +x+1, the coefficient of the second polynomial corresponding to the data is 10101001011011010111, then the summary of the data is

[0104] hash(x 5 +x+1)=10101001011011010111.

[0105] because

[0106] 11011101111100110100⊕01110100100111100011=1010100101101010111,

[0107] And x⊕(x 5 +1) = x 5 +x+1.

[0108] This shows that when outputting all coefficients of the second polynomial, (x⊕(x 5 +1)) 44641 =(x 5 +x+1) 44641 =x 44641 ⊕(x 5 +1) 44641 , and Hash(x)⊕Hash(x 5 +1)=Hash(x 5 +x+1).

[0109] It can be understood that in the present application, multiple copies of data are mapped to the residual class ring, and all coefficients of the corresponding second polynomial after calculating the square power are used as the summary of the data, and the summary values ​​of the data still maintain the homomorphism of XOR addition.

[0110] S105: The first device verifies whether the first data has been tampered with according to the digest of the first data.

[0111] Specifically, before verifying whether the first data has been tampered with, the first device can obtain a standard summary of the first data. The method for obtaining the standard summary is the same as the method for obtaining the summary of the first data, that is, the first data is obtained by processing the same method. The standard summary can be a summary received by the first device from other devices. For example, the present application also includes a second device, and while the second device sends the first data to the first device, it also sends a standard summary to the first device for verifying whether the first data has been tampered with. Accordingly, the first device accepts the first data and the standard summary from the second device. The standard summary can also be a summary generated by the first device before generating the summary of the first data. For example, when the first device obtains the first data for the first time, it can generate a standard summary based on the first data.

[0112] The first device can verify whether the first data has been tampered with by determining whether the digest of the first data is the same as the standard digest. If the digest of the first data is the same as the standard digest, it means that the first data has not been tampered with; if the digest of the first data is different from the standard digest, it means that the first data has been tampered with.

[0113] According to step S103, the data summaries obtained by the method provided by the present application maintain the homomorphism of XOR addition. Therefore, when it is necessary to verify whether a large amount of data has been tampered with, it can be quickly verified whether a large amount of data has been tampered with based on the homomorphism of XOR addition between the data summaries.

[0114] For example, it is necessary to verify whether data 1, data 2, data 3, and data 4 have been tampered with. Among them, the polynomial corresponding to data 1 is A, and the standard summary of data 1 is hash(A); the polynomial corresponding to data 2 is B, and the standard summary of data 2 is hash(B); the polynomial corresponding to data 3 is C, and the standard summary of data 3 is hash(C); the polynomial corresponding to data 4 is D, and the standard summary of data 4 is hash(D). Since the data summaries maintain the homomorphism of XOR addition, the first device only needs to calculate the summary of XOR data 1, data 2, data 3, and data 4, that is, hash(A⊕B⊕C⊕D), and verify whether data 1, data 2, data 3, and data 4 have been tampered with by comparing whether hash(A⊕B⊕C⊕D) is the same as hash(A)⊕hash(B)⊕hash(C)⊕hash(D). If hash(A⊕B⊕C⊕D) is the same as hash(A)⊕hash(B)⊕hash(C)⊕hash(D), it means that data 1, data 2, and data 3 have not been tampered with. If hash(A⊕B⊕C⊕D) is different from hash(A)⊕hash(B)⊕hash(C)⊕hash(D), it means that at least one of data 1, data 2, and data 3 has been tampered with.

[0115] In addition, if at least one of the multiple data is tampered with, the tampered data can be determined by reducing the XOR data. Taking the above case as an example, if hash(A⊕B⊕C⊕D) is different from hash(A)⊕hash(B)⊕hash(C)⊕hash(D), the summary of XOR data 1 and data 2 (i.e. hash(A⊕B)) can be calculated, and the summary of XOR data 3 and data 4 (i.e. hash(C⊕D)) can be calculated. By comparing hash(A⊕B)) with hash(A)⊕hash(B), it is verified whether data 1 and data 2 have been tampered with. By comparing hash(C⊕D)) with hash(C)⊕hash(D), it is verified whether data 3 and data 4 have been tampered with. If hash(A⊕B) is different from hash(A)⊕hash(B), it means that at least one of data 1 and data 2 has been tampered with. Then, the digest of data 1 and the digest of data 2 can be calculated respectively and compared with the corresponding standard digests to determine the tampered data.

[0116] It is understandable that the amount of computation required to calculate the XOR of multiple data is less than the amount of computation required to calculate multiple data digests, and this method of verifying whether multiple data have been tampered with can reduce the number of times the data digests are calculated. Therefore, this method can improve the efficiency of verifying whether multiple data have been tampered with.

[0117] Based on the above content and the same concept, the present application provides a data query device. Figure 2 A schematic diagram of a modular structure of a device for determining data intersection provided in an embodiment of the present application. The device includes a processing module 201 and a communication module 202.

[0118] The communication module 202 is used to obtain first data.

[0119] Processing module 201 is used to map the first data to a residual class ring to obtain a first polynomial, where each element on the residual class ring is a polynomial, and any polynomial contains coefficients of 0 and / or 1, and the first polynomial is an element on the residual class ring. Processing module 201 is used to perform an m-th power operation on the first polynomial to obtain a second polynomial, where m is a positive integer greater than 1. Processing module 201 is also used to determine a summary of the first data based on the coefficients of the second polynomial. Processing module 201 is also used to verify whether the first data has been tampered with based on the summary of the first data.

[0120] In one possible design, the summary of the first data includes part or all of the coefficients of the second polynomial.

[0121] In a possible design, each element on the residue class ring is determined according to a third polynomial, the degree of the third polynomial is greater than or equal to the length of the first data, and the third polynomial is the product of multiple polynomials.

[0122] In a possible design, m is determined according to the order of the residue class ring, and m is a positive integer greater than 1.

[0123] In one possible design, m satisfies:

[0124] m=2 L mod R;

[0125] Where R is the order of the residue class ring, L is any positive integer and 2 L >R.

[0126] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown.

[0127] The electronic device in the embodiment of the present application may include a processor 301. The processor 301 is the control center of the device, and various interfaces and lines can be used to connect various parts of the device, by running or executing instructions stored in the memory 303 and calling data stored in the memory 303. Optionally, the processor 301 may include one or more processing units, and the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 301. In some embodiments, the processor 301 and the memory 303 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0128] The processor 301 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The method steps disclosed in the embodiments of the present application may be directly executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0129] In the embodiment of the present application, the memory 303 stores instructions that can be executed by at least one processor 301. The at least one processor 301 can be used to execute the method steps disclosed in the embodiment of the present application by executing the instructions stored in the memory 303.

[0130] The memory 303 is a non-volatile computer-readable storage medium, which can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 303 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 303 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 303 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0131] In the embodiment of the present application, the device may further include a communication interface 302 , through which the electronic device may transmit data.

[0132] Optional, can be Figure 3 The processor 301 (or the processor 301 and the communication interface 302) implements Figure 2 The processing module 201 and / or the communication module 202 shown, that is, the actions of the processing module 201 and / or the communication module 202 can be executed by the processor 301 (or the processor 301 and the communication interface 302).

[0133] Based on the same inventive concept, the embodiment of the present application also provides a computer-readable storage medium, which may store instructions. When the instructions are executed on a computer, the computer executes the operation steps provided in the above method embodiment. The computer-readable storage medium may be Figure 3 The memory 303 is shown.

[0134] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0135] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0136] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0138] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data verification method, characterized in that: The method comprises: Acquire first data; Determine a first polynomial on a residue class ring according to the value corresponding to the first data, wherein each element on the residue class ring is a polynomial, coefficients of any polynomial are 0 and / or 1, and the coefficients of the first polynomial correspond to the binary number of the value; Performing an m-th power operation on the first polynomial to obtain a second polynomial, where m is a positive integer greater than 1; The m is determined according to the order of the residual class ring, and the m satisfies: m=2 L mod R; Wherein, R is the order of the residue class ring, L is any positive integer and 2 L >R; determining a summary of the first data based on coefficients of the second polynomial; Verify whether the first data has been tampered with according to the digest of the first data.

2. The method according to claim 1, characterized in that The summary of the first data includes part or all of the coefficients of the second polynomial.

3. The method according to claim 1 or 2, characterized in that The residue class ring is determined according to a third polynomial, the degree of the third polynomial is greater than or equal to the length of the first data, and the third polynomial is the product of multiple polynomials.

4. A data verification device, characterized in that: The device comprises: A communication module, used for acquiring first data; A processing module, configured to determine a first polynomial on a residue class ring according to a numerical value corresponding to the first data, wherein each element on the residue class ring is a polynomial, coefficients of any polynomial are 0 and / or 1, and the coefficients of the first polynomial correspond to the binary number of the numerical value; The processing module is further used to perform an m-th power operation on the first polynomial to obtain a second polynomial, where m is a positive integer greater than 1; The m is determined according to the order of the residual class ring, and the m satisfies: m=2 L mod R; Wherein, R is the order of the residue class ring, L is any positive integer and 2 L >R; The processing module is further used to determine a summary of the first data according to coefficients of the second polynomial; The processing module is further used to verify whether the first data has been tampered with according to the summary of the first data.

5. The device according to claim 4, characterized in that The summary of the first data includes part or all of the coefficients of the second polynomial.

6. The device according to claim 4 or 5, characterized in that Each element on the residue class ring is determined according to a third polynomial, the degree of the third polynomial is greater than or equal to the length of the first data, and the third polynomial is the product of multiple polynomials.

7. An electronic device, characterized in that: The electronic device comprises a processor, and the processor is used to implement the steps of any one of the methods as claimed in claims 1 to 3 when executing a computer program stored in a memory.

8. A computer-readable storage medium, characterized in that: The device stores a computer program, which implements the steps of the method according to any one of claims 1 to 3 when executed by a processor.

Citation Information

Patent Citations

  • Homomorphic encryption-based block chain supervisible zero-knowledge proof verification method

    CN116502266A