Data query method, device, system and data set processing method

By using encrypted data calculations and ordered interval point sets in the data query process, the problem of data leakage in privacy-preserving set intersection calculations is solved, and the privacy and security of data queries are achieved.

CN112328640BActive Publication Date: 2024-10-29HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202011249438.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-10
Publication Date
2024-10-29
Estimated Expiration
2040-11-10

AI Technical Summary

Technical Problem

Privacy-preserving set intersection calculation technology can easily lead to data leakage during the data query process, and cannot guarantee the privacy and security of the query data.

Method used

By sending a data query request, it receives an ordered interval point set, performs encrypted data calculations based on preset prime numbers, determines the data group sequence number, and obtains an encrypted data set to ensure the privacy and security of the query results.

Benefits of technology

It effectively avoids the leakage of the candidate data set in the device to be queried, ensures the privacy and security of the query data, and improves the privacy and security of the data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112328640B_ABST
    Figure CN112328640B_ABST
Patent Text Reader

Abstract

The present application relates to a data query method, device, system and data set processing method. The method includes: sending a data query request to a device to be queried; receiving an ordered interval point set; obtaining the data to be queried, and determining at least one current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; calculating the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, and sending the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains the first encrypted data set and the second encrypted data; receiving the first encrypted data set and the second encrypted data, and calculating the second encrypted data set according to the first encrypted data set and the second preset prime number; determining the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set. The use of this application can ensure the privacy of the query data and thus improve the security of the query data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data query method, apparatus, system, computer equipment and storage medium, and a data set processing method, apparatus, computer equipment and storage medium. Background Art

[0002] Protecting the privacy of data sets is a natural and even necessary requirement in many scenarios. For example, when the set is a user's address book or the genome of a user of a genetic diagnosis service, such input must be protected by cryptographic means. The privacy-preserving set intersection (PSI) calculation technology allows two parties holding their own sets to jointly calculate the intersection of two sets. At the end of the protocol interaction, one or both parties should obtain the correct intersection and will not obtain any information from the other party's set other than the intersection.

[0003] However, the privacy-preserving set intersection calculation technology requires allowing two parties holding their respective sets to jointly calculate the intersection operation of the two sets. This approach is prone to data leakage during the data query process, and the privacy of the query data cannot be guaranteed, making the query data unsafe. Summary of the invention

[0004] Based on this, it is necessary to provide a data query method, device, system, computer equipment and storage medium, as well as a data set processing method, device, computer equipment and storage medium that can ensure the privacy of query data and thus improve the security of query data in response to the above technical problems.

[0005] In a first aspect, an embodiment of the present application provides a data query method, comprising the following steps:

[0006] Send a data query request to the device to be queried;

[0007] Receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;

[0008] Obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;

[0009] Calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate the first encrypted data set according to the third preset prime number, the first preset prime number and the at least one current data, and calculate the second encrypted data according to the first encrypted data and the third preset prime number;

[0010] Receiving a first encrypted data set and a second encrypted data set, and calculating the second encrypted data set according to the first encrypted data set and a second preset prime number;

[0011] A query result corresponding to the data to be queried is determined according to the second encrypted data and the second encrypted data set.

[0012] In a second aspect, an embodiment of the present application further provides a data query device, the device comprising:

[0013] A query request sending module, used for sending a data query request to a device to be queried;

[0014] An ordered interval set receiving module is used to receive an ordered interval point set, wherein the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;

[0015] A data group sequence number determination module is used to obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;

[0016] an encrypted data calculation module, configured to calculate first encrypted data according to a first preset prime number, a second preset prime number and data to be queried, send the first preset prime number, the first encrypted data and a current data group sequence number to a device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate a first encrypted data set according to a third preset prime number, the first preset prime number and at least one current data, and calculate second encrypted data according to the first encrypted data and the third preset prime number;

[0017] an encrypted data processing module, configured to receive a first encrypted data set and a second encrypted data set, and calculate the second encrypted data set according to the first encrypted data set and a second preset prime number; and

[0018] The query result determination module is used to determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0019] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0020] Send a data query request to the device to be queried;

[0021] Receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;

[0022] Obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;

[0023] Calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate the first encrypted data set according to the third preset prime number, the first preset prime number and the at least one current data, and calculate the second encrypted data according to the first encrypted data and the third preset prime number;

[0024] Receiving a first encrypted data set and a second encrypted data set, and calculating the second encrypted data set according to the first encrypted data set and a second preset prime number;

[0025] A query result corresponding to the data to be queried is determined according to the second encrypted data and the second encrypted data set.

[0026] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0027] Send a data query request to the device to be queried;

[0028] Receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request;

[0029] Obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set;

[0030] Calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate the first encrypted data set according to the third preset prime number, the first preset prime number and the at least one current data, and calculate the second encrypted data according to the first encrypted data and the third preset prime number;

[0031] Receiving a first encrypted data set and a second encrypted data set, and calculating the second encrypted data set according to the first encrypted data set and a second preset prime number;

[0032] A query result corresponding to the data to be queried is determined according to the second encrypted data and the second encrypted data set.

[0033] In a fifth aspect, an embodiment of the present application further provides a data query system, the system comprising:

[0034] A query device, used to obtain a data query request and send the data query request to a device to be queried; and

[0035] The device to be queried is used to obtain an ordered interval point set corresponding to the candidate data set according to the data query request, and return the ordered interval point set to the query device, wherein the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set;

[0036] The query device is further used to receive the ordered interval point set, obtain the data to be queried, determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, and send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried;

[0037] The device to be queried is further used to obtain at least one current data corresponding to the current data group sequence number, calculate a first encrypted data set according to a third preset prime number, the first preset prime number and the at least one current data, calculate a second encrypted data set according to the first encrypted data and the third preset prime number, and return the first encrypted data set and the second encrypted data to the query device;

[0038] The query device is also used to receive the first encrypted data set and the second encrypted data, calculate the second encrypted data set according to the first encrypted data set and the second preset prime number, and determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0039] In a sixth aspect, the embodiment of the present application further provides a data set processing method, comprising the following steps:

[0040] Acquire a candidate data set, where the candidate data set includes at least one candidate data;

[0041] Processing at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data;

[0042] The target candidate data set is grouped according to a preset rule to obtain multiple candidate data groups;

[0043] The corresponding data group interval points are determined according to the candidate hash data in each candidate data group, and an ordered data group interval point set is generated according to each data group interval point.

[0044] The above-mentioned data query method, device, system, computer equipment and storage medium, as well as the data set processing method, device, computer equipment and storage medium, the query device sends a data query request to the device to be queried, the data query request includes the data to be queried, receives an ordered interval point set, the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request, determines the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, calculates first encrypted data according to a first preset prime number, a second preset prime number and the data to be queried, sends the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains the current data corresponding to the current data group sequence number, calculates a first encrypted data set according to a third preset prime number, the first preset prime number and the current data, calculates second encrypted data according to the first encrypted data and the third preset prime number, receives the first encrypted data set and the second encrypted data, calculates a second encrypted data set according to the first encrypted data set and the second preset prime number, and determines the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0045] Therefore, since the ordered interval point set sent by the device to be queried to the querying device is not the candidate data set in the device to be queried, the ordered data group interval points in these ordered interval point sets are meaningless, and the candidate data set in the device to be queried is not sent to the querying device, which avoids the leakage of the candidate data set in the device to be queried and ensures the privacy of the query data. Moreover, the data sent by the device to be queried and the querying device to each other are obtained by encryption calculation through a confidential large prime number. Since their own data and exponents are confidential, they cannot infer the real data of the other party, thereby improving the security and privacy of the query data.

[0046] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0048] Figure 1 is an application scenario diagram of a data query method according to an embodiment of the present invention;

[0049] Figure 2is a flow chart of a data query method according to an embodiment of the present invention;

[0050] Figure 3 is a schematic flow chart of a step of determining a sequence number of a current data group according to an embodiment of the present invention;

[0051] Figure 4 is a schematic flow chart of a first encrypted data processing step according to an embodiment of the present invention;

[0052] Figure 5 is a flow chart of a query result determination step according to an embodiment of the present invention;

[0053] Figure 6 is a schematic flow chart of steps for generating an ordered interval point set according to one embodiment of the present invention;

[0054] Figure 7 is a structural block diagram of a data query device according to an embodiment of the present invention;

[0055] Figure 8 is a structural block diagram of a data query system according to an embodiment of the present invention;

[0056] Fig. 9 is a block diagram of a computer device according to one embodiment of the present invention;

[0057] Fig.10 is a structural block diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0059] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0060] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0061] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", "fourth", etc. involved in this application are only used to distinguish similar objects and do not represent a specific order for the objects.

[0062] Figure 1 FIG. 1 is an application environment diagram of a data query method in an embodiment. Figure 1 , the data query method is applied to a data query system. The data query system includes a query device 102 and a device to be queried 104. The query device 102 and the device to be queried 104 are connected via a network. The query device 102 can be a desktop terminal or a mobile terminal or a query device to be queried, and the mobile terminal can be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The device to be queried 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0063] Specifically, the query device 102 obtains a data query request to the device to be queried 104. After receiving the data query request, the device to be queried 104 obtains an ordered interval point set corresponding to the candidate data set according to the data query request, and returns the ordered interval point set to the query device 102. The ordered interval point set includes the ordered data group interval points corresponding to the candidate data set. The query device 102 receives the ordered interval point set, obtains the data to be queried, determines the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, calculates the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, sends the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried 104, the device to be queried 104 obtains at least one current data corresponding to the current data group sequence number, calculates the first encrypted data set according to the third preset prime number, the first preset prime number and at least one current data, calculates the second encrypted data according to the first encrypted data and the third preset prime number, and returns the first encrypted data set and the second encrypted data to the query device 102. Further, the query device 102 receives the first encrypted data set and the second encrypted data, calculates the second encrypted data set according to the first encrypted data set and the second preset prime number, and determines the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0064] In one embodiment, Figure 2 As shown, a data query method is provided, which is applied to Figure 1 The query device in is taken as an example to illustrate, including the following steps:

[0065] Step 202: Send a data query request to the device to be queried.

[0066] Among them, the query device can be a device where the data query party is located, which can be but not limited to a query terminal or a query device to be queried, and the device to be queried here can be a device to be queried where the data user party is located, and a candidate data set is stored. The candidate data set includes at least one candidate data, and the candidate data set is processed to obtain a target candidate data set. The target candidate data set is grouped to obtain multiple candidate data groups, and the corresponding data group interval points are determined according to the data in each candidate data group. These data group interval points are sorted to obtain an ordered data group interval point set.

[0067] Among them, the data query request here is used to request the device to be queried to perform data query. The data query request can be generated by triggering an operation on the query device. Specifically, a relevant query application is provided on the query device, and a query button is provided on the relevant interface of the query application. The query button is operated to trigger the generation of the data query request. The operation includes but is not limited to a click operation, a voice operation or a timed event trigger operation.

[0068] Step 204 , receiving an ordered interval point set, where the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request.

[0069] Among them, the ordered interval point set here refers to a set composed of data group interval points in a certain order, and the data group interval point refers to the interval value between candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, the candidate data set includes at least one candidate data, the candidate data set is processed to obtain the target candidate data set, the target candidate data set is grouped to obtain multiple candidate data groups, the corresponding data group interval point is determined according to the data in each candidate data group, these data group interval points are sorted, and an ordered data group interval point set is obtained.

[0070] Among them, the method for determining the corresponding data group interval point based on the data in each candidate data group can be customized. The customization can be to obtain the current candidate data group, obtain the current candidate data corresponding to the current candidate data group, obtain the target candidate data corresponding to the previous candidate data group, calculate the current data group interval point based on the current candidate data and the target candidate data, obtain the next candidate data group, use the next candidate data group as the current candidate data group, return to the step to obtain the current candidate data corresponding to the current candidate data group, until each data group interval point is obtained.

[0071] Among them, the current candidate data can be the first candidate data in the current candidate data group, and the target candidate data can be the last candidate data in the previous candidate data group. Specifically, the device to be queried obtains the current candidate data group, obtains the first candidate data in the current candidate data group, obtains the last candidate data in the previous candidate data group, calculates the current data group interval point according to the first candidate data and the last candidate data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step to obtain the first candidate data in the current candidate data group, until the data group interval point is obtained.

[0072] For example, the current candidate data group is: [317, 553], the previous candidate data group is: [55, 270], the current candidate data is the first candidate data in the current candidate data group: 317, and the target candidate data is the last candidate data in the previous candidate data group: 270. Then the current candidate data group interval point can be calculated based on the first candidate data and the last candidate data: (270+317) / 2=293.5.

[0073] In another embodiment, the method for determining the data group interval point can also be customized by obtaining the current candidate data group, obtaining the current candidate data corresponding to the current candidate data group, obtaining the target candidate data corresponding to the previous candidate data group, and randomly selecting a number between the current candidate data and the target candidate data to determine as the current data group interval point, obtaining the next candidate data group, taking the next candidate data group as the current candidate data group, and returning to the step of obtaining the current candidate data corresponding to the current candidate data group, until each data group interval point is obtained.

[0074] Among them, the current candidate data can be the first candidate data in the current candidate data group, and the target candidate data can be the last candidate data in the previous candidate data group. Specifically, the queried device obtains the current candidate data group, obtains the first candidate data in the current candidate data group, obtains the last candidate data in the previous candidate data group, randomly selects a number between the first candidate data and the last candidate data as the current data group interval point, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step to obtain the current candidate data corresponding to the current candidate data group, until each data group interval point is obtained.

[0075] For example, the current candidate data group is: [317, 553], the previous candidate data group is: [55, 270], the current candidate data is the first candidate data in the current candidate data group: 317, and the target candidate data is the last candidate data in the previous candidate data group: 270. Then the interval point of the current candidate data group can be a number randomly selected between the first candidate data and the last candidate data. For example, 300 can be selected as the interval point of the current candidate data group.

[0076] For example, all candidate data in the candidate data set are processed by the same hash function through the following formula to obtain target candidate data, and the target candidate data constitute the target candidate data set:

[0077]

[0078] Then, the target candidate data are sorted in a certain order, wherein the certain order can be ascending or descending, and grouped in a manner of a fixed size per group to obtain multiple candidate data groups, wherein the fixed size can be predetermined according to business needs, product needs or actual application scenarios. In another embodiment, after the target candidate data are sorted in a certain order, they can also be grouped in a manner of different sizes per group, that is, they can be grouped in a manner of non-fixed sizes per group, and the group size corresponding to each candidate data group can be specifically determined according to business needs, product needs and actual application scenarios. In yet another embodiment, the group sizes corresponding to the candidate data groups may be the same or different, and can be specifically determined according to actual conditions.

[0079] Furthermore, the data group interval points are calculated based on the target candidate data in each candidate data group, and these data group interval points are sorted to obtain the ordered data group interval points. Specifically, when the query device sends a data query request to the device to be queried, the device to be queried obtains the ordered interval point set according to the data query request, and returns the obtained ordered interval point set to the query device.

[0080] Step 206, obtaining the data to be queried, and determining the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set.

[0081] The data to be queried is data waiting to be queried. The data to be queried can be data processed by a hash function. The data to be queried can be obtained by calling from a local database or by obtaining from other devices. The data to be queried can be determined based on business needs, actual application scenarios, and product needs. The current data group sequence number here is the sequence number corresponding to the data group where the data to be queried is located. Specifically, after receiving the ordered interval point set, the current data group sequence number corresponding to the data to be queried can be determined based on the data to be queried and the ordered interval point set. Specifically, the corresponding two adjacent target interval points are obtained from the ordered interval point set according to the data to be queried, and then the current data group sequence number corresponding to the data to be queried is determined based on the two target interval points. If the data to be queried is equal to one of the two adjacent target interval points, or the data to be queried has only one adjacent interval point, it means that the data to be queried is not in the candidate data set, and the data query is terminated.

[0082] For example, the target candidate data set obtained by hash function processing of the candidate data set is: 55, 270, 317, 553, 682, 847. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, and the data group interval point between the second group and the third group is 617.5. If the data to be queried is 583 after hash function processing, since the data to be queried is between 293.5 and 617.5, it can be determined that the current data group sequence number corresponding to the data to be queried is 2, that is, if the data to be queried is to be inserted into the candidate data set, it needs to be inserted into the second group. Among them, the data group interval point between the first group and the second group can be calculated based on the last target candidate data of the first group and the first target candidate data of the second group. For example, the last target candidate data of the first group is 270, and the first target candidate data of the second group is 317. The data group interval point between the first group and the second group can be: (270+317) / 2=293.5. Similarly, the data group interval point between the second group and the third group can be calculated based on the last target candidate data of the second group and the first target candidate data of the third group. For example, the last target candidate data of the second group is 553, and the first target candidate data of the third group is 682. The data group interval point between the second group and the third group can be: (553+682) / 2=617.5.

[0083] Step 208, calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate the first encrypted data set according to the third preset prime number, the first preset prime number and at least one current data, and calculate the second encrypted data according to the first encrypted data and the third preset prime number.

[0084] Among them, the first preset prime number and the second preset prime number are both randomly generated prime numbers large enough. Based on the difficulty of discrete logarithms, it is ensured that the original data cannot be deduced from the encrypted data. Due to the particularity of the encryption algorithm, it can be ensured that the result of the data encrypted multiple times is independent of the encryption order. When randomly generating prime numbers, first randomly select an odd number of a given number of digits, and then use the prime number discrimination method to determine whether it is a prime number. If not, reselect. However, according to the prime number theorem, given a number x, the number of prime numbers less than x is approximately x / lnx, that is, given a number, the probability that it is a prime number is approximately 1 / lnx. Even if the given number is an odd number, its probability can only rise to 2 / lnx. If the prime number requirement is 2048 digits, then randomly select an odd number, and the probability that it can pass the prime number test is approximately 2 / 2048*log(e)=0.22%. In other words, it takes about 500 selections to pass the prime number judgment once. If the digit is large, the number of selections will increase, and the efficiency is low. In the embodiments of the present application, the randomly generated prime numbers are preferably 2048 bits. If the number exceeds 2048 bits, the computing efficiency decreases, and if the number is less than 2048 bits, the security cannot be satisfied. In the past, 1024 bits were used in cryptography, but there have been cases of attacks through exhaustive computing power. The longer the number of bits, the greater the computing power required. Currently, 2048 bits are generally used in important occasions.

[0085] Specifically, the query device randomly generates two prime numbers as a first preset prime number and a second preset prime number, respectively, and calculates the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, wherein the calculation method can be to use the first preset prime number as the modulus of the first encryption, and the second preset prime number as the exponent of the data to be queried, and perform a first encryption calculation on the data to be queried, wherein the first encryption calculation can be a modulus-exponent calculation, thereby obtaining the first encrypted data.

[0086] For example, a 2048-bit first preset prime number N and a second preset prime number P are randomly generated, and the first preset prime number N is used as the encryption modulus, and the second preset prime number P is used as the exponent of the query data B, and the query data B is subjected to modulus exponent calculation to obtain the first encrypted data Bp, which can be specifically shown in the following formula:

[0087] B P =B P modN

[0088] Further, the query device sends the first preset prime number, the first encrypted data and the current group sequence number to the device to be queried. After receiving the first preset prime number, the first encrypted data and the current group sequence number, the device to be queried randomly generates a third preset prime number, which can be a 2048-bit prime number, and at least one current data corresponding to the current group sequence number is obtained according to the current group sequence number. The current data here can refer to the data element in the current group sequence number. The current data can be all the data in the current group sequence number, or the target data in the current group sequence number. The number of target data can be determined according to business requirements and actual application conditions. After the candidate data set is processed, the target candidate data set is obtained, and the target candidate data set is grouped to obtain multiple candidate data groups, each candidate data group includes corresponding target candidate data and corresponding group sequence number. Therefore, all target candidate data in the current group sequence number can be used as current data. Secondly, the third preset prime number can be used as the exponent of the current data, and the first preset prime number can be used as the modulus of the second encryption. The current data is encrypted for the second time, and the second encryption can be a modulus exponent calculation, thereby obtaining the first encrypted data set.

[0089] For example, the current group number is i, and a third preset prime number Q of 2048 bits is randomly generated, and the third preset prime number Q is used as the current data A i The exponent of the first preset prime number N is used as the modulus for the second encryption. i Perform modular exponential calculation to obtain the first encrypted data set The specific formula can be shown as follows:

[0090]

[0091] Furthermore, after the queried device receives the first preset prime number, the first encrypted data and the current group sequence number, it can also use the third preset prime number as the exponent of the first encrypted data to perform a third encryption calculation on the first encrypted data. The third encryption calculation can be a modular exponential calculation to obtain the second encrypted data.

[0092] For example, a 2048-bit first preset prime number N and a second preset prime number P are randomly generated, and the first preset prime number N is used as the encryption modulus, and the second preset prime number P is used as the exponent of the data to be queried B, and the modulus exponent calculation is performed on the query data B to obtain the first encrypted data Bp, which can be specifically shown in the following formula:

[0093] B P =B P modN

[0094] Then randomly generate a third preset prime number Q of 2048 bits, use the third preset prime number Q as the exponent of the first encrypted data, perform modular exponential calculation on the first encrypted data, and obtain the second encrypted data BPQ , which can be specifically expressed as the following formula:

[0095] B PQ =(B P ) Q modN=B PQ modN

[0096] After the device to be queried obtains the first encrypted data set and the second encrypted data by calculation, it needs to return the first encrypted data set and the second encrypted data to the querying device.

[0097] Among them, the device to be queried can first calculate the second encrypted data based on the first encrypted data and the third preset prime number, and then calculate the first encrypted data set based on the third preset prime number, the first preset prime number and at least one current data. There is no particular order between these two steps and they can be interchanged.

[0098] Step 210, receiving a first encrypted data set and a second encrypted data set, and calculating the second encrypted data set according to the first encrypted data set and a second preset prime number.

[0099] After receiving the first encrypted data set and the second encrypted data returned by the device to be queried, the query device may further encrypt the first encrypted data set to obtain the second encrypted data set, wherein the encryption process may be to perform encryption calculation based on the first encrypted data set and the second preset index to obtain the second encrypted data set. Specifically, the second preset index may be used as the index of the first encrypted data set, and the first encrypted data set may be encrypted for the fourth time, and the fourth encryption may be a modulo exponential calculation to obtain the second encrypted data set.

[0100] For example, the current group number is i, and a third preset prime number Q of 2048 bits is randomly generated, and the third preset prime number Q is used as the current data A i The exponent of the first preset prime number N is used as the modulus for the second encryption. i Perform modular exponential calculation to obtain the first encrypted data set The specific formula can be shown as follows:

[0101]

[0102] The querying device receives the first encrypted data set sent by the device to be queried Second encryption data Perform encryption calculation again, and use the second preset prime number P as the first encrypted data set The index of the first encrypted data set Perform modular exponential calculation to obtain the second encrypted data set The specific formula can be shown as follows:

[0103]

[0104] Step 212: Determine a query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0105] After obtaining the second encrypted data and the second encrypted data set, the query device can determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set, which can be specifically, comparing whether the second encrypted data and the second encrypted data set match, wherein if the second encrypted data and the second encrypted data set match, then the query result corresponding to the data to be queried is determined to be the first query result, and the first query result indicates that the data to be queried is in the candidate data set, and if the second encrypted data and the second encrypted data set do not match, then the query result corresponding to the data to be queried is determined to be the second query result, and the second query result indicates that the data to be queried is not in the candidate data set. Whether the second encrypted data and the second encrypted data set match can be comparing whether the second encrypted data and the second encrypted data set are the same, or comparing whether the second encrypted data and the second encrypted data set are equal.

[0106] Among them, since the ordered interval point set sent by the device to be queried to the querying device itself is not the candidate data set in the device to be queried, and due to the characteristics of the hash function, the ordered data group interval points in these ordered interval point sets are meaningless themselves, and the candidate data set in the device to be queried is not sent to the querying device, which avoids the leakage of the candidate data set in the device to be queried and ensures the privacy of the query data. Moreover, the data sent by the device to be queried and the querying device to each other are obtained by encryption calculation through a confidential large prime number. Since their own data and exponents are confidential, they cannot infer the real data of the other party, thereby improving the security and privacy of the query data.

[0107] In the above data query method, the query device sends a data query request to the device to be queried, receives an ordered interval point set, the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request, obtains the data to be queried, determines the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, calculates first encrypted data according to a first preset prime number, a second preset prime number and the data to be queried, sends the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculates a first encrypted data set according to a third preset prime number, the first preset prime number and at least one current data, calculates second encrypted data according to the first encrypted data and the third preset prime number, receives the first encrypted data set and the second encrypted data, calculates a second encrypted data set according to the first encrypted data set and the second preset prime number, and determines the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0108] Therefore, since the ordered interval point set sent by the device to be queried to the querying device is not the candidate data set in the device to be queried, the ordered data group interval points in these ordered interval point sets are meaningless, and the candidate data set in the device to be queried is not sent to the querying device, which avoids the leakage of the candidate data set in the device to be queried and ensures the privacy of the query data. Moreover, the data sent by the device to be queried and the querying device to each other are obtained by encryption calculation through a confidential large prime number. Since their own data and exponents are confidential, they cannot infer the real data of the other party, thereby improving the security and privacy of the query data.

[0109] In one embodiment, Figure 3 As shown, determining the current data group sequence number corresponding to the to-be-queried data and the ordered interval point set according to the to-be-queried data includes:

[0110] Step 302: Acquire two adjacent target interval points corresponding to the data to be queried from the ordered interval point set.

[0111] Step 304: determine the current data group sequence number corresponding to the data to be queried according to the two target interval points.

[0112] Among them, the ordered interval point set here refers to a set composed of data group interval points in a certain order, and the data group interval point refers to the interval value between candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, the candidate data set includes at least one candidate data, the candidate data set is processed to obtain the target candidate data set, the target candidate data set is grouped to obtain multiple candidate data groups, the corresponding data group interval point is determined according to the data in each candidate data group, these data group interval points are sorted, and an ordered data group interval point set is obtained.

[0113] Among them, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, it can be, obtain the current candidate data group, obtain the current candidate hash data corresponding to the current candidate data group, obtain the target candidate hash data corresponding to the previous candidate data group, calculate the current data group interval point according to the current candidate hash data and the target candidate hash data, obtain the next candidate data group, take the next candidate data group as the current candidate data group, return to the step to obtain the current candidate hash data corresponding to the current candidate data group, until each data group interval point is obtained, and sort the data group interval points to obtain an ordered data group interval point set. Among them, the current candidate hash data can be the first candidate hash data of the current candidate data group, and the target candidate hash data can be the last candidate hash data of the previous candidate data group.

[0114] The current data group sequence number here is the sequence number corresponding to the data group where the data to be queried is located. Specifically, after receiving the ordered interval point set, the current data group sequence number corresponding to the data to be queried can be determined according to the data to be queried and the ordered interval point set. Specifically, it can be that the corresponding two adjacent target interval points are obtained from the ordered interval point set according to the data to be queried, and then the current data group sequence number corresponding to the data to be queried is determined according to the two target interval points. If the data to be queried is equal to one of the two adjacent target interval points, or the data to be queried has only one adjacent interval point, it means that the data to be queried is not in the candidate data set, and the data query ends.

[0115] For example, the target candidate data set obtained by hash function processing of the candidate data set is: 55, 270, 317, 553, 682, 847, 987, 1203. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847], [987, 1203]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the data group interval point between the third group and the fourth group is 917. If the data to be queried is 583 after hash function processing, since the data to be queried is between 293.5 and 617.5, it can be determined that the current data group sequence number corresponding to the data to be queried is 2.

[0116] In one embodiment, Figure 4 As shown, first encrypted data is calculated according to a first preset prime number, a second preset prime number and data to be queried, the first preset prime number, the first encrypted data and the current data group sequence number are sent to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, the first encrypted data set is calculated according to a third preset prime number, the first preset prime number and at least one current data, and the second encrypted data is calculated according to the first encrypted data and the third preset prime number, including:

[0117] Step 402: randomly generate a first preset prime number and a second preset prime number.

[0118] Step 404, using the first preset prime number as the modulus of the first encryption, using the second preset prime number as the exponent of the data to be queried, performing modular exponential calculation on the data to be queried, and obtaining the first encrypted data.

[0119] Wherein, the first preset prime number and the second preset prime number are both prime numbers large enough to be randomly generated. When randomly generating a prime number, first randomly select an odd number of a given number of digits, and then use the prime number discrimination method to determine whether it is a prime number. If not, reselect. However, according to the prime number theorem, given a number x, the number of prime numbers less than x is about x / lnx, that is to say, given a number, the probability that it is a prime number is about 1 / lnx. Even if the given number is an odd number, its probability can only rise to 2 / lnx. If the prime number requirement is 2048 digits, then randomly take an odd number, and the probability that it can pass the prime number test is about 2 / 2048*log (e) = 0.22%. In the embodiments of the present application, the randomly generated prime numbers are preferably 2048 bits. If the number exceeds 2048 bits, the computing efficiency decreases, and if the number is less than 2048 bits, the security cannot be satisfied. In the past, 1024 bits were used in cryptography, but there have been cases of attacks through exhaustive computing power. The longer the number of bits, the greater the computing power required. Currently, 2048 bits are generally used in important occasions.

[0120] Specifically, the query device randomly generates two prime numbers as a first preset prime number and a second preset prime number, respectively, and calculates the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, wherein the calculation method can be to use the first preset prime number as the modulus of the first encryption, use the second preset prime number as the exponent of the data to be queried, perform the first modulus-exponentiation calculation on the data to be queried, and thus obtain the first encrypted data.

[0121] For example, a 2048-bit first preset prime number N and a second preset prime number P are randomly generated, and the first preset prime number N is used as the encryption modulus, and the second preset prime number P is used as the exponent of the query data B, and the query data B is subjected to modulus exponent calculation to obtain the first encrypted data Bp, which can be specifically shown in the following formula:

[0122] B P =B P modN

[0123] Step 406, sending the first preset prime number, the first encrypted data and the current data group serial number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group serial number, randomly generates a third preset prime number, uses the third preset prime number as the exponent of the current data, uses the first preset prime number as the modulus of the second encryption, performs modular exponential calculation on at least one current data to obtain a first encrypted data set, uses the third preset prime number as the exponent of the first encrypted data, performs modular exponential calculation on the first encrypted data, and obtains second encrypted data.

[0124] Specifically, the query device sends the first preset prime number, the first encrypted data and the current group sequence number to the device to be queried. After receiving the first preset prime number, the first encrypted data and the current group sequence number, the device to be queried randomly generates a third preset prime number, which can be a 2048-bit prime number. At the same time, the corresponding current data is obtained according to the current group sequence number. The current data here refers to all the data in the current group sequence number. After the candidate data set is processed, the target candidate data set is obtained, and the target candidate data set is grouped to obtain multiple candidate data groups. Each candidate data group includes corresponding target candidate data and corresponding group sequence numbers. Therefore, all target candidate data in the current group sequence number can be used as current data. Secondly, the third preset prime number can be used as the exponent of the current data, and the first preset prime number can be used as the modulus of the second encryption. The current data is subjected to the second modulus exponent calculation, thereby obtaining the first encrypted data set.

[0125] For example, the current group number is i, and a third preset prime number Q of 2048 bits is randomly generated, and the third preset prime number Q is used as the current data A i The exponent of the first preset prime number N is used as the modulus for the second encryption.i Perform modular exponential calculation to obtain the first encrypted data set The specific formula can be shown as follows:

[0126]

[0127] If there are multiple current data in the current group sequence number i, the third preset prime number Q can be used as the current data A i The first preset prime number N is used as the modulus for the second encryption, and a modular exponential calculation is performed on all current data in the current group sequence number i to obtain the corresponding first encrypted data set.

[0128] Furthermore, after the queried device receives the first preset prime number, the first encrypted data and the current group sequence number, it can also use the third preset prime number as the exponent of the first encrypted data to perform a third encryption calculation on the first encrypted data. The third encryption calculation can be a modular exponential calculation to obtain the second encrypted data.

[0129] For example, the query device randomly generates a 2048-bit first preset prime number N and a second preset prime number P, and uses the first preset prime number N as the encryption modulus, and uses the second preset prime number P as the exponent of the data B to be queried, and performs a modulus exponent calculation on the query data B to obtain the first encrypted data Bp, which can be specifically shown in the following formula:

[0130] B P =B P modN

[0131] The query device sends the first encrypted data Bp to the device to be queried. The device to be queried randomly generates a third preset prime number Q of 2048 bits, uses the third preset prime number Q as the exponent of the first encrypted data, performs a modular exponential calculation on the first encrypted data, and obtains the second encrypted data Bp. PQ , which can be specifically expressed as the following formula:

[0132] B PQ =(B P ) Q modN=B PQ modN

[0133] After the device to be queried obtains the first encrypted data set and the second encrypted data by calculation, it needs to return the first encrypted data set and the second encrypted data to the querying device.

[0134] In one embodiment, the second encrypted data set is obtained according to the first encrypted data set and the second preset prime number, including: using the second preset prime number as the exponent of the first encrypted data set, performing modular exponential calculation on the first encrypted data set, and obtaining the second encrypted data set.

[0135] After receiving the first encrypted data set and the second encrypted data returned by the device to be queried, the query device may encrypt the first encrypted data set again to obtain the second encrypted data set, wherein the encryption process may be to perform encryption calculation based on the first encrypted data set and the second preset index to obtain the second encrypted data set. Specifically, the second preset index may be used as the index of the first encrypted data set, and the fourth modular exponential calculation may be performed on the first encrypted data set to obtain the second encrypted data set.

[0136] For example, the current group number is i, and a third preset prime number Q of 2048 bits is randomly generated, and the third preset prime number Q is used as the current data A i The exponent of the first preset prime number N is used as the modulus for the second encryption. i Perform modular exponential calculation to obtain the first encrypted data set The specific formula can be shown as follows:

[0137]

[0138] The querying device receives the first encrypted data set sent by the device to be queried Second encryption data Perform encryption calculation again, and use the second preset prime number P as the first encrypted data set The index of the first encrypted data set Perform modular exponential calculation to obtain the second encrypted data set The specific formula can be shown as follows:

[0139]

[0140] In one embodiment, Figure 5 As shown, determining the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set includes:

[0141] Step 502, when the second encrypted data is identical to an element of the second encrypted data set, it is determined that the query result corresponding to the to-be-queried data is the first query result, and the first query result is that the to-be-queried data is in the candidate data set.

[0142] Step 504, when any element of the second encrypted data is different from that of the second encrypted data set, it is determined that the query result corresponding to the to-be-queried data is the second query result, and the second query result is that the to-be-queried data is not in the candidate data set.

[0143] Specifically, after obtaining the second encrypted data and the second encrypted data set, the query device can determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set, which can be specifically, comparing whether the second encrypted data and the second encrypted data set match, wherein if a certain element of the second encrypted data and the second encrypted data set matches, then the query result corresponding to the data to be queried is determined to be the first query result, and the first query result indicates that the data to be queried is in the candidate data set, and if any element of the second encrypted data and the second encrypted data set does not match, then the query result corresponding to the data to be queried is determined to be the second query result, and the second query result indicates that the data to be queried is not in the candidate data set. Wherein, whether the second encrypted data and the second encrypted data set match can be comparing whether a certain element of the second encrypted data and the second encrypted data set is the same, or comparing whether any element of the second encrypted data and the second encrypted data set is equal.

[0144] Among them, if there are multiple data to be queried and there are multiple data in the current group sequence number, then there are multiple second encrypted data and multiple second encrypted data sets. Each second encrypted data is compared with each second encrypted data set. If any second encrypted data is the same or equal to any second encrypted data set, it can be determined that the query result corresponding to the data to be queried is the first query result, indicating that the data to be queried is in the candidate data set. If no second encrypted data is the same or equal to any second encrypted data set, it can be determined that the query result corresponding to the data to be queried is the second query result, indicating that the data to be queried is not in the candidate data set.

[0145] In one embodiment, Figure 6 As shown, the steps for generating an ordered interval point set include:

[0146] Step 602: The device to be queried obtains a candidate data set, where the candidate data set includes at least one candidate data.

[0147] Step 604: the device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data.

[0148] Among them, the device to be queried here can be the device to be queried where the data user is located, storing a candidate data set, the candidate data set includes at least one candidate data, processing the candidate data set to obtain a target candidate data set, grouping the target candidate data set to obtain multiple candidate data groups, determining the corresponding data group interval points based on the data in each candidate data group, sorting these data group interval points to obtain an ordered data group interval point set.

[0149] Among them, the ordered interval point set here refers to a set of data group interval points in a certain order, and the data group interval point refers to the interval value between the candidate data groups corresponding to the candidate data set, and the candidate data set is pre-stored on the device to be queried, and the candidate data set includes at least one candidate data. The candidate data set is processed to obtain the target candidate data set.

[0150] Among them, the candidate data set is processed to obtain the target candidate data set, which can be specifically, obtaining a preset hash function, hashing each candidate data in the candidate data set through the preset hash function to obtain corresponding candidate hash data, and the target candidate data set is composed of each candidate hash data.

[0151] For example, all candidate data in the candidate data set are processed by the same hash function through the following formula to obtain candidate hash data, and the candidate hash data constitute the target candidate data set:

[0152]

[0153] Step 606: the device to be queried groups the target candidate data set according to a preset rule to obtain a plurality of candidate data groups.

[0154] Step 608: The device to be queried determines the corresponding data group interval points according to the candidate hash data in each candidate data group, and generates an ordered data group interval point set according to each data group interval point.

[0155] Specifically, after obtaining the target candidate data set, which includes at least one candidate hash data, the device to be queried groups the target candidate data set to obtain multiple candidate data groups, determines the corresponding data group interval points according to the data in each candidate data group, and sorts these data group interval points to obtain an ordered data group interval point set. Specifically, the device to be queried groups the target candidate data set according to a preset rule to obtain multiple candidate data groups, wherein the preset rule can be sorting the candidate hash data in the target candidate data set, and the sorting can be in ascending or descending order to obtain a sorted target candidate data set, and then groups the sorted target candidate data set according to a preset grouping size to obtain multiple candidate data groups.

[0156] Specifically, the candidate hash data in the target candidate data set can be sorted according to the ascending rule, or the candidate hash data in the target candidate data set can be descended according to the descending rule to obtain the sorted target candidate data set, and then the preset grouping size is obtained. The so-called grouping size refers to the maximum bearing capacity corresponding to the corresponding group. The preset grouping size can be determined according to business needs, application scenarios or product needs. The sorted target candidate data set is grouped according to the preset grouping size to obtain each candidate data group after grouping. Further, the corresponding data group interval point is determined according to the data in each candidate data group. Specifically, the current candidate data group is obtained, the current candidate hash data corresponding to the current candidate data group is obtained, the target candidate hash data corresponding to the previous candidate data group is obtained, the current data group interval point is calculated according to the current candidate hash data and the target candidate hash data, the next candidate data group is obtained, the next candidate data group is used as the current candidate data group, and the step of returning to obtain the current candidate hash data corresponding to the current candidate data group is returned until each data group interval point is obtained, and each data group interval point is sorted to obtain an ordered data group interval point set. The current candidate hash data may be the first candidate hash data of the current candidate data group, and the target candidate hash data may be the last candidate hash data of the previous candidate data group.

[0157] For example, the target candidate data set obtained by hash function processing the candidate data set is: 55, 270, 317, 553, 682, 847, 987, 1203. The target candidate data set is grouped to obtain: [55, 270], [317, 553], [682, 847], [987, 1203]. The ordered interval point set is: the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the data group interval point between the third group and the fourth group is 917. The ordered data group interval point set is: {293.5, 617.5, 917}. Among them, the data group interval point between the first group and the second group can be calculated based on the last candidate hash data of the first group and the first candidate hash data of the second group. For example, the last candidate hash data of the first group is 270, and the first candidate hash data of the second group is 317. The data group interval point between the first group and the second group can be: (270+317) / 2=293.5. Similarly, the data group interval point between the second group and the third group can be calculated based on the last candidate hash data of the second group and the first candidate hash data of the third group. For example, the last candidate hash data of the second group is 553, and the first candidate hash data of the third group is 682. The data group interval point between the second group and the third group can be: (553+682) / 2=617.5. By analogy, the data group interval point between the third group and the fourth group can be calculated based on the last candidate hash data of the third group and the first candidate hash data of the fourth group. For example, the last candidate hash data of the third group is 847, and the first candidate hash data of the fourth group is 987. The data group interval point between the third group and the fourth group can be: (847+987) / 2=917.

[0158] In one embodiment, the device to be queried determines the corresponding data group interval point based on the candidate hash data in each candidate data group, including: the device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.

[0159] Specifically, the corresponding data group interval points are determined according to the data in each candidate data group. Specifically, the current candidate data group is obtained, the current candidate hash data corresponding to the current candidate data group is obtained, the target candidate hash data corresponding to the previous candidate data group is obtained, the current data group interval points are calculated according to the current candidate hash data and the target candidate hash data, the next candidate data group is obtained, the next candidate data group is used as the current candidate data group, and the step of returning to obtain the current candidate hash data corresponding to the current candidate data group is returned until each data group interval point is obtained, and each data group interval point is sorted to obtain an ordered data group interval point set. Among them, the current candidate data group can be randomly selected from each candidate data group as the current candidate data group, or the candidate data groups can be determined as the current candidate data group in sequence.

[0160] In another embodiment, the current candidate hash data may be the first candidate hash data in the current candidate data group, and the target candidate hash data may be the last candidate hash data in the previous candidate data group. Specifically, the device to be queried obtains the current candidate data group, obtains the first candidate hash data in the current candidate data group, obtains the last candidate hash data in the previous candidate data group, calculates the current data group interval point based on the first candidate hash data and the last candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the first candidate hash data in the current candidate data group, until the data group interval point is obtained.

[0161] In one embodiment, the data query method also includes: sending a current ordered interval point set version number query request to the device to be queried, the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, if they are consistent, then determine them as the first version number information, if they are inconsistent, then determine them as the second version number information, and return, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, receives the first version number information returned by the device to be queried, obtains the historical ordered interval point set, then uses the historical ordered interval point set as the ordered interval point set, and enters the step of obtaining the data to be queried, or; receives the second version number information returned by the device to be queried, then enters the step of sending a data query request to the device to be queried.

[0162] Among them, the current ordered interval point set version number query request here is used to request the query of the current ordered interval point set version number. The current ordered interval point set version number is the version identification number corresponding to the current ordered interval point set. Each time the current ordered interval point set sent by the device to be queried includes the corresponding current ordered interval point set version number, when the query device sends the ordered interval point set version number query request to the device to be queried for the first time, it will save the ordered interval point set version number returned by the device to be queried. In subsequent queries, when the query device carries the current ordered interval point set version number query request to query the device to be queried, the device to be queried compares the current ordered interval point set version number with the locally stored candidate interval point set version number to see if they are consistent. If they are consistent, it is determined as the first version number information. If they are inconsistent, it is determined as the second version number information and returned, where the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, and the first version number information or the second version number information is returned to the query device.

[0163] Furthermore, the query device receives the first version number information, indicating that the current ordered interval point set version number is consistent with the candidate interval point set version number stored locally in the device to be queried. Then, the ordered interval points cached by the query device itself can be determined as the ordered interval point set. Specifically, the historical ordered interval point set can be obtained. The so-called historical ordered interval point set is the ordered interval point set cached locally in the query device. The historical ordered interval point set is used as the ordered interval point set, and the step of obtaining the data to be queried is entered.

[0164] Among them, if the query device receives the second version number information, it means that the current ordered interval point set version number is inconsistent with the candidate interval point set version number stored locally in the device to be queried, then enter the step of sending a data query request to the device to be queried, and replace the historical ordered interval point set stored locally in the query device with the subsequently received ordered interval point set, that is, update the locally stored historical ordered interval point set according to the subsequently received ordered interval point set.

[0165] In a specific embodiment, a data query method is provided, which specifically includes the following steps:

[0166] 1. The device to be queried obtains a candidate data set, where the candidate data set includes at least one candidate data.

[0167] 2. The device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, where the target candidate data set includes at least one candidate hash data.

[0168] 3. The device to be queried groups the target candidate data set according to preset rules to obtain multiple candidate data groups.

[0169] 4. The device to be queried determines the corresponding data group interval points according to the candidate hash data in each candidate data group, and generates an ordered data group interval point set according to each data group interval point.

[0170] 4-1. The device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to step to obtain the current candidate hash data in the current candidate data group, until the data group interval point is obtained.

[0171] 5. Send a query request for the current ordered interval point set version number to the device to be queried. The query request for the current ordered interval point set version number includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, and compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent. If they are consistent, they are determined as the first version number information. If they are inconsistent, they are determined as the second version number information and returned, where the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried.

[0172] 6. Receive the first version number information returned by the device to be queried, obtain the historical ordered interval point set, and use the historical ordered interval point set as the ordered interval point set, and proceed to step 10.

[0173] 7. Receive the second version number information returned by the device to be queried, and then proceed to step 8.

[0174] 8. Send a data query request to the device to be queried.

[0175] 9. Receive an ordered interval point set, where the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request.

[0176] 10. Obtain the data to be queried, and determine the current data group number corresponding to the data to be queried based on the data to be queried and the ordered interval point set.

[0177] 10-1. Obtain two adjacent target interval points corresponding to the data to be queried from the ordered interval point set.

[0178] 10-2. Determine the current data group number corresponding to the data to be queried based on the two target interval points.

[0179] 11. Calculate first encrypted data according to a first preset prime number, a second preset prime number and data to be queried, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate a first encrypted data set according to a third preset prime number, the first preset prime number and at least one current data, and calculate second encrypted data according to the first encrypted data and the third preset prime number.

[0180] 11-1. Randomly generate a first preset prime number and a second preset prime number.

[0181] 11-2. Using the first preset prime number as the modulus for the first encryption and the second preset prime number as the exponent of the data to be queried, performing modular exponential calculation on the data to be queried to obtain the first encrypted data.

[0182] 11-3. Send the first preset prime number, the first encrypted data and the current data group number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group number, randomly generates a third preset prime number, uses the third preset prime number as the exponent of the current data, uses the first preset prime number as the modulus of the second encryption, performs modular exponential calculation on at least one current data to obtain a first encrypted data set, uses the third preset prime number as the exponent of the first encrypted data, performs modular exponential calculation on the first encrypted data, and obtains second encrypted data.

[0183] 12. Receive a first encrypted data set and a second encrypted data set, and calculate the second encrypted data set according to the first encrypted data set and a second preset prime number.

[0184] 12-1. Use the second preset prime number as the exponent of the first encrypted data set, perform modular exponential calculation on the first encrypted data set, and obtain a second encrypted data set.

[0185] 13. Determine a query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0186] 13-1. When the second encrypted data is identical to an element of the second encrypted data set, it is determined that the query result corresponding to the to-be-queried data is the first query result, and the first query result is that the to-be-queried data is in the candidate data set.

[0187] 13-2. When any element of the second encrypted data is different from that of the second encrypted data set, it is determined that the query result corresponding to the to-be-queried data is the second query result, and the second query result is that the to-be-queried data is not in the candidate data set.

[0188] In one embodiment, a data set processing method is provided, comprising the following steps: obtaining a candidate data set, the candidate data set including at least one candidate data, processing at least one candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, the target candidate data set including at least one candidate hash data, grouping the target candidate data set according to preset rules to obtain multiple candidate data groups, determining corresponding data group interval points according to the candidate hash data in each candidate data group, and generating an ordered data group interval point set according to each data group interval point.

[0189] In one embodiment, the corresponding data group interval point is determined according to the candidate hash data in each candidate data group, including: obtaining the current candidate data group, obtaining the current candidate hash data in the current candidate data group, obtaining the target candidate hash data in the previous candidate data group, calculating the current data group interval point according to the current candidate hash data and the target candidate hash data, obtaining the next candidate data group, taking the next candidate data group as the current candidate data group, returning to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.

[0190] In one embodiment, the data set processing method also includes: receiving newly added candidate hash data, inserting the newly added candidate hash data into its corresponding first data group, determining whether the amount of data in the first data group exceeds a set range, and if so, redetermining the data group interval points from the first data group, and updating the ordered data group interval point set according to each data group interval point.

[0191] Among them, the first data group here refers to the data group into which the newly added candidate hash data needs to be inserted. The first data group corresponding to the newly added candidate hash data can be determined based on the interval points of each data group, and then whether the number of data in the first data group exceeds the set range. If so, the data group interval points are redetermined from the first data group, and the ordered data group interval point set is updated according to each data group interval point. For example, the data group interval point between the first group and the second group is 293.5, the data group interval point between the second group and the third group is 617.5, and the newly added candidate hash data is 530, then the newly added candidate hash data is determined to be the second group as the first data group, and then it is determined whether the number of data in the first data group exceeds the set range. If so, the data group interval points are redetermined from the first data group, and the ordered data group interval point set is updated according to each data group interval point.

[0192] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0193] In one embodiment, Figure 7 As shown, a data query device 700 is provided, comprising: a query request sending module 702, an ordered interval set receiving module 704, a data group sequence number determination module 706, an encrypted data calculation module 708, an encrypted data processing module 710 and a query result determination module 712, wherein:

[0194] The query request sending module 702 is used to send a data query request to the device to be queried.

[0195] The ordered interval set receiving module 704 is used to receive an ordered interval point set, where the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request.

[0196] The data group sequence number determination module 706 is used to obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set.

[0197] The encrypted data calculation module 708 is used to calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculate the first encrypted data set according to the third preset prime number, the first preset prime number and at least one current data, and calculate the second encrypted data according to the first encrypted data and the third preset prime number.

[0198] The encrypted data processing module 710 is used to receive the first encrypted data set and the second encrypted data set, and calculate the second encrypted data set according to the first encrypted data set and the second preset prime number.

[0199] The query result determination module 712 is used to determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0200] In one embodiment, the data group sequence number determination module 706 is further used to obtain two adjacent target interval points corresponding to the data to be queried from the ordered interval point set, and determine the current data group sequence number corresponding to the data to be queried according to the two target interval points.

[0201] In one embodiment, the data query device 700 is also used to send a current ordered interval point set version number query request to the device to be queried, and the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, if they are consistent, then it is determined as the first version number information, if they are inconsistent, then it is determined as the second version number information and returned, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, receives the first version number information returned by the device to be queried, obtains the historical ordered interval point set, then uses the historical ordered interval point set as the ordered interval point set, enters the data group sequence number determination module 706 for obtaining the data to be queried, or, receives the second version number information returned by the device to be queried, then enters the query request sending module 702 for sending a data query request to the device to be queried.

[0202] In one embodiment, the encrypted data calculation module 708 is also used to randomly generate a first preset prime number and a second preset prime number, use the first preset prime number as the modulus for the first encryption, use the second preset prime number as the exponent of the data to be queried, perform modular exponential calculation on the data to be queried to obtain first encrypted data, send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one corresponding current data according to the current data group sequence number, randomly generate a third preset prime number, use the third preset prime number as the exponent of the current data, use the first preset prime number as the modulus for the second encryption, perform modular exponential calculation on at least one current data to obtain a first encrypted data set, use the third preset prime number as the exponent of the first encrypted data, perform modular exponential calculation on the first encrypted data, and obtain second encrypted data.

[0203] In one embodiment, the encrypted data processing module 710 is further configured to use the second preset prime number as an exponent of the first encrypted data set, perform modular exponential calculation on the first encrypted data set, and obtain a second encrypted data set.

[0204] In one embodiment, the query result determination module 712 is also used to determine that the query result corresponding to the data to be queried is a first query result when the second encrypted data is the same as an element of the second encrypted data set, and the first query result is that the data to be queried is in the candidate data set; when the second encrypted data is not the same as any element of the second encrypted data set, determine that the query result corresponding to the data to be queried is a second query result, and the second query result is that the data to be queried is not in the candidate data set.

[0205] For the specific definition of the data query device, please refer to the definition of the data query method above, which will not be repeated here. Each module in the above-mentioned data query device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0206] In one embodiment, Figure 8 As shown, a data query system 800 is provided, the system comprising:

[0207] The query device 802 is used to obtain a data query request and send the data query request to the device to be queried.

[0208] The device to be queried 804 is used to obtain an ordered interval point set corresponding to the candidate data set according to the data query request, and return the ordered interval point set to the query device, wherein the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set.

[0209] The query device 802 is also used to receive an ordered interval point set, obtain the data to be queried, determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, calculate the first encrypted data according to the first preset prime number, the second preset prime number and the data to be queried, and send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried.

[0210] The device to be queried 804 is also used to obtain at least one current data corresponding to the current data group sequence number, calculate a first encrypted data set based on a third preset prime number, a first preset prime number and at least one current data, calculate second encrypted data based on the first encrypted data and the third preset prime number, and return the first encrypted data set and the second encrypted data to the query device.

[0211] The query device 802 is further used to receive the first encrypted data set and the second encrypted data, calculate the second encrypted data set according to the first encrypted data set and the second preset prime number, and determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0212] In one embodiment, a computer device is provided. The computer device may be a query device, and the query device may be a server. The internal structure diagram thereof may be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store ordered interval point sets and query results. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data query method is implemented.

[0213] In one embodiment, a computer device is provided. The computer device may be a query device, and the query device may be a terminal. The internal structure diagram thereof may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data query method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0214] Those skilled in the art will understand that Fig. 9 or Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0215] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: sending a data query request to a device to be queried; receiving an ordered interval point set, the ordered interval point set comprising ordered data group interval points corresponding to a candidate data set obtained by the device to be queried according to the data query request; obtaining the data to be queried, and determining a current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; calculating first encrypted data according to a first preset prime number, a second preset prime number, and the data to be queried, sending the first preset prime number, the first encrypted data, and the current data group sequence number to the device to be queried so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculating a first encrypted data set according to a third preset prime number, the first preset prime number, and at least one current data, and calculating a second encrypted data set according to the first encrypted data and the third preset prime number; receiving the first encrypted data set and the second encrypted data, and calculating the second encrypted data set according to the first encrypted data set and the second preset prime number; and determining a query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0216] In one embodiment, when the processor executes the computer program, the following steps are also implemented: acquiring two adjacent target interval points corresponding to the data to be queried from the ordered interval point set; and determining the current data group sequence number corresponding to the data to be queried based on the two target interval points.

[0217] In one embodiment, when the processor executes the computer program, the following steps are also implemented: sending a current ordered interval point set version number query request to the device to be queried, the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, if they are consistent, then determine them as the first version number information, if they are inconsistent, then determine them as the second version number information, and return them, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, receives the first version number information returned by the device to be queried, obtains the historical ordered interval point set, then uses the historical ordered interval point set as the ordered interval point set, enters the step of obtaining the data to be queried, receives the second version number information returned by the device to be queried, then enters the step of sending a data query request to the device to be queried. In one embodiment, when the processor executes the computer program, the following steps are also implemented: randomly generating a first preset prime number and a second preset prime number; using the first preset prime number as the modulus for the first encryption and the second preset prime number as the exponent of the data to be queried, performing modular exponential calculation on the data to be queried to obtain first encrypted data; sending the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one corresponding current data according to the current data group sequence number, randomly generating a third preset prime number, using the third preset prime number as the exponent of the current data, using the first preset prime number as the modulus for the second encryption, performing modular exponential calculation on the current data to obtain a first encrypted data set, using the third preset prime number as the exponent of the first encrypted data, performing modular exponential calculation on the first encrypted data to obtain second encrypted data.

[0218] In one embodiment, when the processor executes the computer program, the following steps are further implemented: using the second preset prime number as the exponent of the first encrypted data set, performing modular exponential calculation on the first encrypted data set, and obtaining a second encrypted data set.

[0219] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the second encrypted data is the same as an element of the second encrypted data set, the query result corresponding to the data to be queried is determined to be a first query result, and the first query result is that the data to be queried is in the candidate data set; when the second encrypted data is not the same as any element of the second encrypted data set, the query result corresponding to the data to be queried is determined to be a second query result, and the second query result is that the data to be queried is not in the candidate data set.

[0220] In one embodiment, the processor also implements the following steps when executing the computer program: the device to be queried obtains a candidate data set, the candidate data set includes at least one candidate data; the device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, the target candidate data set includes at least one candidate hash data; the device to be queried groups the target candidate data set according to at least one candidate hash data to obtain multiple candidate data groups; the device to be queried determines the corresponding data group interval point according to the candidate hash data in each candidate data group, and generates an ordered data group interval point set according to each data group interval point.

[0221] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, uses the next candidate data group as the current candidate data group, returns to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.

[0222] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: sending a data query request to a device to be queried; receiving an ordered interval point set, the ordered interval point set including ordered data group interval points corresponding to a candidate data set obtained by the device to be queried according to the data query request; obtaining the data to be queried, and determining a current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; calculating first encrypted data according to a first preset prime number, a second preset prime number and the data to be queried, sending the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, calculating a first encrypted data set according to a third preset prime number, the first preset prime number and at least one current data, and calculating a second encrypted data set according to the first encrypted data and the third preset prime number; receiving the first encrypted data set and the second encrypted data, and calculating the second encrypted data set according to the first encrypted data set and the second preset prime number; determining a query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

[0223] In one embodiment, when the processor executes the computer program, the following steps are also implemented: sending a query request for the current ordered interval point set version number to the device to be queried, the query request for the current ordered interval point set version number includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, comparing the current ordered interval point set version number and the candidate ordered interval point set version number to see if they are consistent, if they are consistent, then determining them as the first version number information, if they are inconsistent, then determining them as the second version number information, and returning them, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried, receiving the first version number information returned by the device to be queried, obtaining the historical ordered interval point set, then using the historical ordered interval point set as the ordered interval point set, entering the step of obtaining the data to be queried, receiving the second version number information returned by the device to be queried, and then entering the step of sending a data query request to the device to be queried. In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining two adjacent target interval points corresponding to the data to be queried from the ordered interval point set; determining the current data group sequence number corresponding to the data to be queried according to the two target interval points.

[0224] In one embodiment, when the processor executes the computer program, the following steps are also implemented: randomly generating a first preset prime number and a second preset prime number; using the first preset prime number as the modulus for the first encryption and the second preset prime number as the exponent of the data to be queried, performing modular exponential calculation on the data to be queried to obtain first encrypted data; sending the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one corresponding current data according to the current data group sequence number, randomly generating a third preset prime number, using the third preset prime number as the exponent of the current data, using the first preset prime number as the modulus for the second encryption, performing modular exponential calculation on at least one current data to obtain a first encrypted data set, using the third preset prime number as the exponent of the first encrypted data, performing modular exponential calculation on the first encrypted data to obtain second encrypted data.

[0225] In one embodiment, when the processor executes the computer program, the following steps are further implemented: using the second preset prime number as the exponent of the first encrypted data set, performing modular exponential calculation on the first encrypted data set, and obtaining a second encrypted data set.

[0226] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the second encrypted data is the same as an element of the second encrypted data set, the query result corresponding to the data to be queried is determined to be a first query result, and the first query result is that the data to be queried is in the candidate data set; when the second encrypted data is not the same as any element of the second encrypted data set, the query result corresponding to the data to be queried is determined to be a second query result, and the second query result is that the data to be queried is not in the candidate data set.

[0227] In one embodiment, the processor also implements the following steps when executing the computer program: the device to be queried obtains a candidate data set, the candidate data set includes at least one candidate data; the device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, the target candidate data set includes at least one candidate hash data; the device to be queried groups the target candidate data set according to at least one candidate hash data to obtain multiple candidate data groups; the device to be queried determines the corresponding data group interval point according to the candidate hash data in each candidate data group, and generates an ordered data group interval point set according to each data group interval point.

[0228] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, uses the next candidate data group as the current candidate data group, returns to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.

[0229] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0230] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0231] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A data query method, characterized in that: The method comprises: Send a data query request to the device to be queried; Receiving an ordered interval point set, the ordered interval point set comprising ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request; Acquire the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; Randomly generate a first preset prime number and a second preset prime number; Using the first preset prime number as a modulus for the first encryption, using the second preset prime number as an exponent of the data to be queried, performing a modular exponential operation on the data to be queried, and obtaining first encrypted data; Sending the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, randomly generates a third preset prime number, uses the third preset prime number as the exponent of the current data, uses the first preset prime number as the modulus of the second encryption, performs a modulus-exponentiation calculation on the at least one current data to obtain a first encrypted data set, uses the third preset prime number as the exponent of the first encrypted data, performs a modulus-exponentiation calculation on the first encrypted data, and obtains a second encrypted data; Using the second preset prime number as an exponent of the first encrypted data set, performing modular exponential calculation on the first encrypted data set to obtain a second encrypted data set; A query result corresponding to the data to be queried is determined according to the second encrypted data and the second encrypted data set.

2. The method according to claim 1, characterized in that The determining the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set comprises: Acquire two adjacent target interval points corresponding to the data to be queried from the ordered interval point set; The current data group sequence number corresponding to the data to be queried is determined according to the two target interval points.

3. The method according to claim 1, characterized in that The method further comprises: Send a current ordered interval point set version number query request to the device to be queried, wherein the current ordered interval point set version number query request includes the current ordered interval point set version number, so that the device to be queried obtains the candidate ordered interval point set version number, compares whether the current ordered interval point set version number and the candidate ordered interval point set version number are consistent, and if they are consistent, determines them as the first version number information, and if they are inconsistent, determines them as the second version number information, and returns, wherein the candidate ordered interval point set version number is the version number corresponding to the current ordered interval point set in the device to be queried; Receive the first version number information returned by the device to be queried, obtain a historical ordered interval point set, use the historical ordered interval point set as an ordered interval point set, and proceed to the step of obtaining the data to be queried, or; After receiving the second version number information returned by the device to be queried, the step of sending a data query request to the device to be queried is entered.

4. The method according to claim 1, characterized in that The determining, according to the second encrypted data and the second encrypted data set, a query result corresponding to the to-be-queried data includes: When the second encrypted data is identical to an element of the second encrypted data set, determining that the query result corresponding to the to-be-queried data is a first query result, the first query result being that the to-be-queried data is in the candidate data set; When the second encrypted data is not identical to any element of the second encrypted data set, it is determined that the query result corresponding to the to-be-queried data is the second query result, and the second query result is that the to-be-queried data is not in the candidate data set.

5. The method according to claim 1, characterized in that The step of generating the ordered interval point set comprises: The device to be queried obtains a candidate data set, where the candidate data set includes at least one candidate data; The device to be queried processes the candidate data in the candidate data set according to a preset hash function to obtain a target candidate data set, wherein the target candidate data set includes at least one candidate hash data; The device to be queried groups the target candidate data set according to a preset rule to obtain a plurality of candidate data groups; The device to be queried determines the corresponding data group interval point according to the candidate hash data in each of the candidate data groups, and generates an ordered data group interval point set according to each of the data group interval points.

6. The method according to claim 5, characterized in that The device to be queried determines the corresponding data group interval point according to the candidate hash data in each of the candidate data groups, including: The device to be queried obtains the current candidate data group, obtains the current candidate hash data in the current candidate data group, obtains the target candidate hash data in the previous candidate data group, calculates the current data group interval point based on the current candidate hash data and the target candidate hash data, obtains the next candidate data group, takes the next candidate data group as the current candidate data group, returns to the step of obtaining the current candidate hash data in the current candidate data group, until the data group interval point is obtained.

7. The method according to claim 5 or 6, characterized in that: The method further comprises: Receiving newly added candidate hash data, and inserting the newly added candidate hash data into the corresponding first data group; Determine whether the amount of data in the first data group exceeds a set range: If so, redetermine the data group interval points from the first data group, and update the ordered data group interval point set according to each data group interval point.

8. A data query device, characterized in that: The device comprises: A query request sending module, used for sending a data query request to a device to be queried; An ordered interval set receiving module, used for receiving an ordered interval point set, wherein the ordered interval point set includes ordered data group interval points corresponding to the candidate data set obtained by the device to be queried according to the data query request; A data group sequence number determination module, used to obtain the data to be queried, and determine the current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set; An encrypted data calculation module, used for randomly generating a first preset prime number and a second preset prime number; Using the first preset prime number as a modulus for the first encryption, using the second preset prime number as an exponent of the data to be queried, performing a modular exponential operation on the data to be queried, and obtaining first encrypted data; Sending the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried, so that the device to be queried obtains at least one current data corresponding to the current data group sequence number, randomly generates a third preset prime number, uses the third preset prime number as the exponent of the current data, uses the first preset prime number as the modulus of the second encryption, performs a modulus-exponentiation calculation on the at least one current data to obtain a first encrypted data set, uses the third preset prime number as the exponent of the first encrypted data, performs a modulus-exponentiation calculation on the first encrypted data, and obtains a second encrypted data; an encrypted data processing module, configured to use the second preset prime number as an exponent of the first encrypted data set, perform modular exponential calculation on the first encrypted data set, and obtain a second encrypted data set; and A query result determination module is used to determine a query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

9. A data query system, characterized in that: The system comprises: A query device, used to obtain a data query request and send the data query request to a device to be queried; and The device to be queried is used to obtain an ordered interval point set corresponding to the candidate data set according to the data query request, and return the ordered interval point set to the query device, wherein the ordered interval point set includes the ordered data group interval points corresponding to the candidate data set; The query device is further used to receive an ordered interval point set, obtain data to be queried, determine a current data group sequence number corresponding to the data to be queried according to the data to be queried and the ordered interval point set, use a first preset prime number as a modulus for the first encryption, use a second preset prime number as an exponent of the data to be queried, perform a modular exponential operation on the data to be queried to obtain first encrypted data, and send the first preset prime number, the first encrypted data and the current data group sequence number to the device to be queried; The device to be queried is further used to obtain at least one current data corresponding to the current data group sequence number, use a third preset prime number as an exponent of the current data, use the first preset prime number as a modulus for a second encryption, perform a modulus-exponential calculation on the at least one current data to obtain a first encrypted data set, use the third preset prime number as an exponent of the first encrypted data, perform a modulus-exponential calculation on the first encrypted data to obtain second encrypted data, and return the first encrypted data set and the second encrypted data to the querying device; The query device is further used to receive the first encrypted data set and the second encrypted data, use the second preset prime number as the exponent of the first encrypted data set, perform modular exponential calculation on the first encrypted data set to obtain the second encrypted data set, and determine the query result corresponding to the data to be queried according to the second encrypted data and the second encrypted data set.

10. A computer device 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 steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Web page information processing method and device

    CN104794237A

  • Cipher data operation-supporting method for processing security outsourcing data of relational databases

    CN106934301A

  • Data encryption method and device, computer device and storage medium

    CN109246130A

  • Data query method and device

    CN110096899A

  • Information encryption processing method, server, terminal, equipment and storage medium

    CN111191255A