Intersection determination method and related apparatus
By changing the position and shuffling the secondary encrypted data at the data end, the problem of low security in intersection calculations for data ends with a small number of data elements is solved, and effective data protection is achieved.
Patent Information
- Application Number
- CN202411781074.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-12-04
AI Technical Summary
When calculating the intersection of data sets with a small number of data elements, data security is low, and all data can be easily exposed.
By altering the position of the secondary encrypted data at the data end and shuffling the positions during the intersection calculation, the intersection contains non-real sub-intersections, thereby preventing the data end from exposing all data.
It improves data security for data ends with fewer data elements, preventing them from exposing all data during intersection calculations.
Smart Images

Figure CN119628922B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a method for determining an intersection and related devices. Background Art
[0002] Privacy set intersection refers to the process of obtaining the intersection data between its own data set and the data sets of other data terminals without leaking its own data.
[0003] For example, data terminal A generates a private key d A , data terminal B generates private key d B Data terminal A encrypts its own data once and sends it to data terminal B. Data terminal B encrypts its own data for the first time and sends it to data terminal A. Data terminal A encrypts the once-encrypted data sent by data terminal B twice, and data terminal B encrypts the once-encrypted data sent by data terminal A twice and returns it to data terminal A. Data terminal A compares the twice-encrypted data of both parties, obtains the intersection and sends it to data terminal B.
[0004] After both parties calculate the intersection, if the number of data elements in the intersection is close to the number of data elements in the set of a certain data party, it is equivalent to the data end with a small number of data elements directly exposing all data to the data end with a large number of data elements, resulting in the data privacy of the data end with a small number of data elements being effectively protected, that is, the data security of the data end with a small number of data elements is lower. Summary of the Invention
[0005] The present application provides an intersection determination method and related devices, which solve the problem of low data security at a data terminal with a small number of data elements.
[0006] In a first aspect, the present application provides a method for determining an intersection, applied to a first data terminal, the method comprising:
[0007] Obtaining a first set and a first private key, and encrypting each data element in the first set according to the first private key to obtain a second set;
[0008] Sending the second set to a second data end, and receiving a third set sent by the second data end, where the data elements in the third set are obtained by encrypting the data elements in the fourth set by the second data end using the second private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set;
[0009] Encrypting the data elements in the third set according to the first private key to obtain a fifth set, and performing a permutation operation on the data elements in the fifth set to obtain a sixth set, wherein the permutation operation is used to change positions of the data elements in the fifth set;
[0010] sending the sixth set to the second data end, and receiving a seventh set fed back by the second data end, wherein the seventh set is obtained by the second data end performing a permutation operation on data elements in the eighth set based on the sixth set, where the permutation operation is used to replace the data elements, and the eighth set is obtained by the second data end encrypting the data elements in the second set using the second private key;
[0011] An intersection between the fifth set and the seventh set is determined.
[0012] In some embodiments, obtaining the first set includes:
[0013] Obtaining an initial set of the first data terminals;
[0014] Each data in the initial set is converted into a corresponding hash value to obtain the first set.
[0015] In a second aspect, the present application provides a method for determining an intersection, which is applied to a second data terminal. The method for determining an intersection includes:
[0016] receiving a second set sent by the first data end, and obtaining a fourth set and a second private key, wherein the second set is obtained by the first data end encrypting the data elements in the first set based on the first private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set;
[0017] encrypting the data elements in the fourth set according to the second private key to obtain a third set, and sending the third set to the first data terminal;
[0018] Encrypting the second set using the second private key to obtain an eighth set, and receiving a sixth set sent by the first data end, wherein the sixth set is obtained by the first data end performing a permutation operation on the fifth set, and the fifth set is obtained by the first data end encrypting data elements in the third set using the first private key;
[0019] According to the sixth set, a permutation operation is performed on the data elements in the eighth set to obtain a seventh set, and the seventh set is sent to the first data end so that the first data end determines the intersection between the seventh set and the fifth set.
[0020] In some embodiments, performing a permutation operation on the data elements in the eighth set according to the sixth set includes:
[0021] determining a target intersection between the sixth set and the eighth set;
[0022] Determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining a degree of confusion between the first data end and the second data end;
[0023] A comparison result between the ratio and a preset threshold is obtained, and a replacement operation is performed on the data elements in the eighth set according to the comparison result and the confusion degree.
[0024] In some embodiments, performing a permutation operation on the data elements in the eighth set according to the comparison result and the confusion degree includes:
[0025] In response to the comparison result indicating that the ratio is less than or equal to a preset threshold, obtaining a first difference between an upper limit value of the ratio and the ratio;
[0026] In response to the first difference being greater than or equal to the confusion degree, determining a first permutation quantity according to the confusion degree, the ratio, and a first mapping relationship;
[0027] A first number of data elements in the eighth set is permuted, the first number being equal to the first permuted number.
[0028] In some embodiments, after obtaining the first difference between the upper limit of the ratio and the ratio, the method further includes:
[0029] In response to the first difference being less than the confusion degree, determining a first replacement quantity according to the confusion degree, the ratio, and a second mapping relationship;
[0030] generating corresponding first replacement elements for a second number of data elements in the eighth set, and replacing the data elements in the eighth set with the corresponding first replacement elements to perform a replacement operation, the second number being equal to the first replacement number;
[0031] Perform a permutation operation on the eighth set after the replacement operation.
[0032] In some embodiments, performing a permutation operation on the data elements in the eighth set according to the comparison result and the confusion degree includes:
[0033] In response to the comparison result indicating that the ratio is greater than a preset threshold, determining a second replacement quantity according to the ratio and the preset threshold;
[0034] Generating corresponding second replacement elements for a third number of data elements in the eighth set, and replacing the data elements in the eighth set with the corresponding second replacement elements to obtain an intermediate set to perform a replacement operation, wherein the third number is equal to the second replacement number;
[0035] A second difference between the upper threshold value and the preset threshold is obtained, and a permutation operation is performed on the intermediate set according to the second difference and the confusion degree.
[0036] In some embodiments, performing a permutation operation on the intermediate set according to the second difference and the confusion degree includes:
[0037] In response to the second difference being greater than or equal to the confusion degree, determining a second permutation quantity according to the preset threshold, the confusion degree, and a third mapping relationship;
[0038] A fourth number of data elements in the intermediate set is permuted, the fourth number being equal to the second permuted number.
[0039] In some embodiments, performing a permutation operation on the intermediate set according to the second difference and the confusion degree includes:
[0040] In response to the second difference being less than the confusion degree, determining a third replacement quantity according to the preset threshold, the confusion degree, and a fourth mapping relationship;
[0041] generating corresponding third replacement elements for a fifth number of data elements in the intermediate set, the fifth number being equal to the third replacement number;
[0042] Replacing the data elements in the intermediate set with corresponding third replacement elements to perform a replacement operation;
[0043] Perform a permutation operation on the intermediate set after the replacement operation.
[0044] In some embodiments, obtaining the fourth set includes:
[0045] Obtaining an initial set of the second data end;
[0046] Each data in the initial set is converted into a corresponding hash value to obtain the fourth set.
[0047] In a fifth aspect, the present application provides a first data terminal, including:
[0048] an acquisition module, configured to acquire a first set and a first private key, and encrypt each data element in the first set according to the first private key to obtain a second set;
[0049] a first sending module, configured to send the second set to a second data end, and receive a third set sent by the second data end, where the data elements in the third set are obtained by encrypting the data elements in the fourth set by the second data end using the second private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set;
[0050] a first encryption module, configured to encrypt, using the first private key, the data elements in the third set to obtain a fifth set, and perform a permutation operation on the data elements in the fifth set to obtain a sixth set, wherein the permutation operation is configured to change positions of the data elements in the fifth set;
[0051] a second sending module, configured to send the sixth set to the second data end, and receive a seventh set fed back by the second data end, wherein the seventh set is obtained by the second data end performing a replacement operation on data elements in the eighth set based on the sixth set, the replacement operation being used to replace the data elements, and the eighth set is obtained by the second data end encrypting the data elements in the second set using a second private key;
[0052] A determination module is configured to determine an intersection between the fifth set and the seventh set.
[0053] In a fifth aspect, the present application provides a second data terminal, including:
[0054] a receiving module, configured to receive a second set sent by the first data end, and obtain a fourth set and a second private key, wherein the second set is obtained by the first data end encrypting the data elements in the first set based on the first private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set;
[0055] a second encryption module, configured to encrypt the data elements in the fourth set according to the second private key to obtain a third set, and send the third set to the first data end;
[0056] a third encryption module, configured to encrypt the second set using the second private key to obtain an eighth set, and receive a sixth set sent by the first data end, wherein the sixth set is obtained by the first data end performing a permutation operation on the fifth set, and the fifth set is obtained by the first data end encrypting data elements in the third set using the first private key;
[0057] A processing module is used to perform a permutation operation on the data elements in the eighth set according to the sixth set to obtain a seventh set, and send the seventh set to the first data end so that the first data end can determine the intersection between the seventh set and the fifth set.
[0058] In a fifth aspect, the present application provides an electronic device, comprising: a processor, and a memory and a communication interface communicatively connected to the processor;
[0059] The communication interface is used to communicate with other communication devices;
[0060] The memory is used to store computer-executable instructions;
[0061] The processor is configured to execute the computer-executable instructions stored in the memory to implement the intersection determination method provided in the first aspect or the second aspect.
[0062] In a sixth aspect, the present application provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are executed by a processor, the intersection determination method provided in the first aspect or the second aspect is implemented.
[0063] In a seventh aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the intersection determination method provided in the first aspect or the second aspect.
[0064] The intersection determination method and related equipment provided by the present application are as follows: the first data end changes the position of the secondary encrypted data of the second data end and sends it to the second data end, so that the second data end changes the position of the secondary encrypted data of the first data end based on the secondary encrypted data after the position change and sends it to the first data end; the number of data elements in the first data end is less than the number of data elements in the second data end, and the first data end determines the intersection based on the secondary encrypted data at both ends; the positions of the secondary encrypted data at both ends are disrupted, so that the intersection determined by the first data end contains non-real sub-intersections, so that the first data end will not expose all data to the second data end, thereby improving the data security of the data end with a small number of data elements. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0066] Figure 1 Schematic diagram of the steps of the intersection determination method on the first data end side provided by this application Figure 1 ;
[0067] Figure 2 This is a schematic diagram of the interaction between the first data terminal and the second data terminal of this application;
[0068] Figure 3 Schematic diagram of the steps of the intersection determination method on the second data end side provided by this application Figure 1 ;
[0069] Figure 4 Schematic diagram of the steps of the intersection determination method on the second data end side provided by this application Figure 2 ;
[0070] Figure 5 Schematic diagram of the steps of the intersection determination method on the second data end side provided by this application Figure 3 ;
[0071] Figure 6 Schematic diagram of the steps of the intersection determination method on the second data end side provided by this application Figure 4 ;
[0072] Figure 7 A schematic diagram of a program module of a first data terminal provided in an embodiment of the present application;
[0073] Figure 8 A schematic diagram of a program module of a second data terminal provided in an embodiment of the present application;
[0074] Figure 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0075] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0076] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application. In addition, although the disclosure in this application is introduced according to one or several exemplary examples, it should be understood that each aspect of these disclosures can also constitute a complete implementation method separately.
[0077] It should be noted that the brief descriptions of terms in this application are only for the purpose of facilitating the understanding of the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their ordinary and usual meanings.
[0078] In addition, the terms "comprises" and "comprising" and any variations thereof are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to those components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0079] The term "module" used in the embodiments of this application refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or combination of hardware and / or software code that can perform the functions associated with the component.
[0080] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0081] Privacy set intersection refers to the process of obtaining the intersection data between its own data set and the data sets of other data terminals without leaking its own data.
[0082] For example, data terminal A generates a private key d A , data terminal B generates private key d B Data terminal A encrypts its own data once and sends it to data terminal B. Data terminal B encrypts its own data for the first time and sends it to data terminal A. Data terminal A encrypts the once-encrypted data sent by data terminal B twice, and data terminal B encrypts the once-encrypted data sent by data terminal A twice and returns it to data terminal A. Data terminal A compares the twice-encrypted data of both parties, obtains the intersection and sends it to data terminal B.
[0083] The inventors of this application discovered that after both parties calculate the intersection, if the number of data elements in the intersection is close to the number of data elements in the set of a certain data party, it is equivalent to the data end with a small number of data elements directly exposing all data to the data end with a large number of data elements, resulting in the data privacy of the data end with a small number of data elements being effectively protected, that is, the data security of the data end with a small number of data elements is lower.
[0084] The inventors of the present application therefore conceived that the first data end changes the position of the secondary encrypted data of the second data end and sends it to the second data end, so that the second data end can change the position of the secondary encrypted data of the first data end based on the secondary encrypted data after the position change and send it to the first data end. The number of data elements in the first data end is less than the number of data elements in the second data end, and the first data end determines the intersection based on the secondary encrypted data at both ends; the positions of the secondary encrypted data at both ends are disrupted, so that the intersection determined by the first data end contains non-real sub-intersections, so that the first data end will not expose all data to the second data end, thereby improving the data security of the data end with a small number of data elements.
[0085] The technical solutions shown in this application are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be repeated in different embodiments.
[0086] Reference Figure 1 , Figure 1 Schematic diagram of the process of determining the intersection of the first data end side provided by this application Figure 1 , the intersection determination methods include:
[0087] Step S101: Obtain a first set and a first private key, and encrypt each data element in the first set according to the first private key to obtain a second set.
[0088] In this embodiment, the execution subject is the first data end, which performs a private set intersection with the second data end, that is, obtains the intersection of the data at both ends.
[0089] The first data end includes multiple data elements, each of which constitutes a first set. The number of data elements in the first set X is n(X)=n1, and the first set X is expressed as
[0090] The second data end includes multiple data elements, each of which constitutes a fourth set. The number of data elements in the fourth set Y is n(X)=n2, and the fourth set Y is expressed as
[0091] The first and second data terminals send the number of their respective data elements to each other, thereby determining a small and large set of data. The small set refers to the first data terminal with fewer data elements, and the large set refers to the second data terminal with more data elements. The first data terminal determines the intersection of the re-encrypted data from both terminals.
[0092] The first data terminal obtains a first set X. In one example, each data element in the first set is the original data in the first data terminal. In another example, each data element in the first set is a hash value of the original data to further improve the privacy of the data in the first data terminal. That is, the first data terminal obtains the initial set and converts each data in the initial set into a corresponding hash value to obtain the first set.
[0093] The first data end generates a first private key α, and the first data end encrypts the data elements in the first set X using the first private key to obtain a second set αHX.
[0094] Step S102: Send the second set to the second data end, and receive the third set sent by the second data end. The data elements in the third set are obtained by encrypting the data elements in the fourth set by the second data end based on the second private key. The number of data elements in the fourth set is greater than the number of data elements in the first set.
[0095] After obtaining the second set, the first data end sends the second set αHX to the second data end.
[0096] The second data end generates a second private key β and encrypts the data elements in the fourth set Y using the second private key to obtain a third set βHY. After obtaining the third set, the second data end sends the third set βHY to the second data end. It can be understood that the data elements in the third set βHY are obtained by encrypting the data elements in the fourth set Y using the second private key β by the second data end, and the number of data elements in the fourth set Y is greater than the number of data elements in the first set X.
[0097] It should be noted that if the data elements in the first set are the original data in the first data end, then the data elements in the fourth set are also the original data in the second data end. If the data elements in the first set are the hash values of the original data in the first data end, then the data elements in the fourth set are also the hash values of the original data in the second data end.
[0098] Step S103: Encrypt the data elements in the third set according to the first private key to obtain a fifth set, and perform a permutation operation on the data elements in the fifth set to obtain a sixth set, where the permutation operation is used to change the position of the data elements in the fifth set.
[0099] After obtaining the third set βHY, the first data end encrypts the data elements in the third set βHY for a second time using the first private key α, thereby obtaining the fifth set αβHY. After obtaining the fifth set αβHY, the first data end performs a permutation operation on the fifth set to obtain the sixth set παβHY. Each data element in the fifth set has a corresponding serial number, which refers to the position of the data element in the fifth set. For example, the data element with serial number 2 in the fifth set refers to the data element in the second position in the fifth set. The permutation operation can change the position of the data elements in the fifth set, that is, the permutation operation is used to change the position of the data elements in the set.
[0100] Step S104: Send the sixth set to the second data end, and receive the seventh set fed back by the second data end, wherein the seventh set is obtained by the second data end performing a replacement operation on the data elements in the eighth set based on the sixth set, and the replacement operation is used to replace the data elements, and the eighth set is obtained by the second data end encrypting the data elements in the second set based on the second private key.
[0101] The first data end sends the sixth set παβHY to the second data end. After receiving the second set αHX, the second data end encrypts each data element in the second set using the second private key β to obtain an eighth set αβHX.
[0102] The second data end performs a permutation operation on the data elements in the eighth set αβHX based on the received sixth set παβHY to obtain the seventh set παβHX.
[0103] Exemplarily, the second data end determines the number of intersections of the same data elements in the sixth set παβHY and the eighth set αβHX. Since the first data end scrambles the positions of the data elements in the fifth set, the serial number correspondence between each secondary encrypted data element in the fifth set and each unencrypted data element in the fourth set is also scrambled, and the second data end is a large set with more data elements. Due to the scrambled serial number correspondence, the second data end, as a large set, obtains more data elements in the non-real sub-intersection of the intersection, which cannot be used as the final intersection of the two ends. The second data end determines the strategy for performing a permutation operation on the eighth set based on the number of intersections. For example, when the number of intersections is greater than the ratio between the preset thresholds, it is necessary to replace some of the data elements in the eighth set and then scramble the positions to increase the number of data elements in the non-real intersection of the intersection obtained in the first data end, so as to ensure that the data of the first data end will not be completely exposed.
[0104] Step S105: determine the intersection between the fifth set and the seventh set.
[0105] The second data end sends the seventh set παβHX to the first data end. The first data end determines the fifth set αβHY and the seventh set παβHX. Because the data elements in the seventh set παβHX are shuffled, the intersection obtained by the first data end contains a non-true intersection. The first data end feeds the intersection back to the second data end. The presence of a non-true intersection in the intersection fed back by the first data end prevents the first data end from exposing all data to the second data end. For example, if the first data end and the second data end share four identical data elements, u1, u2, u3, and u4, the data intersection between the first and second data ends will contain a maximum of four identical data elements. However, because the data elements in the seventh set παβHX are shuffled, the intersection obtained by the first data end contains four identical data elements, u1, u2, u3', and u4'. However, u3' and u4' are not truly identical data elements. Therefore, the first data end only exposes two identical data elements to the second data end, avoiding exposing all data to the second data end.
[0106] Reference Figure 2 , the interaction between the first data end and the second data end is briefly described as follows:
[0107] 201. A first data terminal generates a first private key α;
[0108] 202. The second data terminal generates a second private key β;
[0109] 203. The first data terminal encrypts the first set X based on the first private key α to obtain a second set αHX;
[0110] 204. The second data end encrypts the fourth set Y based on the second private key β to obtain a third set βHY;
[0111] 205. The first data end sends the second set αβHX to the second data end;
[0112] 206. The second data end sends the third set βHY to the first data end;
[0113] 207. The first data end encrypts the third set βHY based on the first private key α to obtain a fifth set αβHY;
[0114] 208. The first data end scrambles all data elements in the fifth set αβHY to obtain a sixth set παβHY, that is, performs a permutation operation on the fifth set αβHY.
[0115] 209. The first data end sends the sixth set παβHY to the second data end;
[0116] 210. The second data terminal encrypts the second set αHX based on the second private key β to obtain an eighth set αβHX;
[0117] 211. The second data end shuffles the data elements in the eighth set αβHX based on the six sets παβHY to obtain a seventh set παβHX, that is, performs a permutation operation on the eighth set αβHX.
[0118] 212. The second data end sends the seventh set παβHX to the first data end;
[0119] 213. The first data end determines the intersection between the fifth set αβHY and the seventh set παβHX.
[0120] In this embodiment, the first data end changes the position of the secondary encrypted data of the second data end and sends it to the second data end, so that the second data end changes the position of the secondary encrypted data of the first data end based on the secondary encrypted data after the position change and sends it to the first data end. The number of data elements in the first data end is less than the number of data elements in the second data end, and the first data end determines the intersection based on the secondary encrypted data at both ends; the positions of the secondary encrypted data at both ends are disrupted, so that the intersection determined by the first data end contains non-real sub-intersections, so that the first data end will not expose all data to the second data end, thereby improving the data security of the data end with a small number of data elements.
[0121] Reference Figure 3 , Figure 3 Schematic diagram of the process of determining the intersection of the second data end side provided by this application Figure 1 , the intersection determination methods include:
[0122] Step S301: Receive the second set sent by the first data end, and obtain the fourth set and the second private key, wherein the second set is obtained by the first data end encrypting the data elements in the first set based on the first private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set.
[0123] In this embodiment, the execution subject is the second data end, which performs a private set intersection with the first data end, that is, obtains the intersection of the data at both ends.
[0124] The first data end includes multiple data elements, each of which constitutes a first set. The number of data elements in the first set X is n(X)=n1, and the first set X is represented by (a1, a2, a3, ..., a n1 ).
[0125] The second data end includes a plurality of data elements, each of which constitutes a fourth set. The number of data elements in the fourth set Y is n(X)=n2, and the fourth set Y is represented by (b1, b2, b3, ..., bn1).
[0126] The first and second data terminals send the number of their respective data elements to each other, thereby determining a small and large set of data. The small set refers to the first data terminal with fewer data elements, and the large set refers to the second data terminal with more data elements. The first data terminal determines the intersection of the re-encrypted data from both terminals.
[0127] The first data terminal obtains a first set X. In one example, each data element in the first set is the original data in the first data terminal. In another example, each data element in the first set is a hash value of the original data to further improve the privacy of the data in the first data terminal. That is, the first data terminal obtains the initial set and converts each data in the initial set into a corresponding hash value to obtain the first set.
[0128] The first data end generates a first private key α, and uses the first private key to encrypt the data elements in the first set X to obtain a second set αHX. After obtaining the second set, the first data end sends the second set αHX to the second data end.
[0129] The second data end generates a second private key β and obtains a fourth set and the second private key. In one example, each data element in the fourth set is the original data in the second data end. In another example, each data element in the fourth set is a hash value of the original data to further enhance the privacy of the data in the second data end. Specifically, the second data end obtains the initial set and converts each data element in the initial set into a corresponding hash value to obtain the fourth set.
[0130] Step S302: Encrypt the data elements in the fourth set according to the second private key to obtain a third set, and send the third set to the first data end.
[0131] The second data end generates a second private key β, and uses the second private key to encrypt the data elements in the fourth set Y to obtain a third set βHY. After obtaining the third set, the second data end sends the third set βHY to the second data end. It can be understood that the data elements in the third set (βHY) are obtained by the second data end encrypting the data elements in the fourth set based on the second private key (β), and the number of data elements in the fourth set is greater than the number of data elements in the first set.
[0132] It should be noted that if the data elements in the first set are the original data in the first data end, then the data elements in the fourth set are also the original data in the second data end. If the data elements in the first set are the hash values of the original data in the first data end, then the data elements in the fourth set are also the hash values of the original data in the second data end.
[0133] Step S303: Encrypt the second set according to the second private key to obtain an eighth set, and receive the sixth set sent by the first data party, wherein the sixth set is obtained by the first data end performing a permutation operation on the fifth set, and the fifth set is obtained by the first data end encrypting the data elements in the third set based on the first private key.
[0134] After obtaining the third set βHY, the first data end encrypts the data elements in the third set βHY for a second time using the first private key α, thereby obtaining the fifth set αβHY. After obtaining the fifth set αβHY, the first data end performs a permutation operation on the fifth set to obtain the sixth set παβHY. Each data element in the fifth set has a corresponding serial number, which refers to the position of the data element in the fifth set. For example, the data element with serial number 2 in the fifth set refers to the data element in the second position in the fifth set. The permutation operation can change the position of the data elements in the fifth set, that is, the permutation operation is used to change the position of the data elements in the set.
[0135] The first data end sends the sixth set παβHY to the second data end. After receiving the second set αHX, the second data end encrypts each data element in the second set using the second private key β to obtain an eighth set αβHX.
[0136] Step S304 : performing a permutation operation on the data elements in the eighth set according to the sixth set to obtain a seventh set, and sending the seventh set to the first data end so that the first data end can determine the intersection between the seventh set and the fifth set.
[0137] The second data end performs a permutation operation on the data elements in the eighth set αβHX based on the received sixth set παβHY to obtain the seventh set παβHX.
[0138] Exemplarily, the second data end determines the number of intersections of the same data elements in the sixth set παβHY and the eighth set αβHX. Since the first data end scrambles the positions of the data elements in the fifth set, the serial number correspondence between each secondary encrypted data element in the fifth set and each unencrypted data element in the fourth set is also scrambled, and the second data end is a large set with more data elements. Due to the scrambled serial number correspondence, the second data end, as a large set, obtains more data elements in the non-real sub-intersection of the intersection, which cannot be used as the final intersection of the two ends. The second data end determines the strategy for performing a permutation operation on the eighth set based on the number of intersections. For example, when the number of intersections is greater than the ratio between the preset thresholds, it is necessary to replace some of the data elements in the eighth set and then scramble the positions to increase the number of data elements in the non-real intersection of the intersection obtained in the first data end, so as to ensure that the data of the first data end will not be completely exposed.
[0139] The second data end sends the seventh set παβHX to the first data end. The first data end determines the fifth set αβHY and the seventh set παβHX. Because the data elements in the seventh set παβHX are shuffled, the intersection obtained by the first data end contains a non-true intersection. The first data end feeds the intersection back to the second data end. The presence of a non-true intersection in the intersection fed back by the first data end prevents the first data end from exposing all data to the second data end. For example, if the first data end and the second data end share four identical data elements, u1, u2, u3, and u4, the data intersection between the first and second data ends will contain a maximum of four identical data elements. However, because the data elements in the seventh set παβHX are shuffled, the intersection obtained by the first data end contains four identical data elements, u1, u2, u3', and u4'. However, u3' and u4' are not truly identical data elements. Therefore, the first data end only exposes two identical data elements to the second data end, avoiding exposing all data to the second data end.
[0140] In this embodiment, the first data end changes the position of the secondary encrypted data of the second data end and sends it to the second data end, so that the second data end changes the position of the secondary encrypted data of the first data end based on the secondary encrypted data after the position change and sends it to the first data end. The number of data elements in the first data end is less than the number of data elements in the second data end, and the first data end determines the intersection based on the secondary encrypted data at both ends; the positions of the secondary encrypted data at both ends are disrupted, so that the intersection determined by the first data end contains non-real sub-intersections, so that the first data end will not expose all data to the second data end, thereby improving the data security of the data end with a small number of data elements.
[0141] Reference Figure 4 , Figure 4 Schematic diagram of the process of determining the intersection of the second data end side provided by this application Figure 2 ,based on Figure 3 In the illustrated embodiment, step S304 includes:
[0142] Step S401: Determine a target intersection between the sixth set and the eighth set.
[0143] In this embodiment, the first data end and the second data end have a negotiated intersection ratio threshold value, l, defined as a preset threshold value. The preset threshold value indicates that both parties expect the intersection ratio of their data to not exceed l. By setting the preset threshold value, the maximum amount of public data that the first data end can tolerate is set. Furthermore, the first data end and the second data end have also negotiated a degree of confusion, m. A degree of confusion of m indicates that both parties expect the proportion of real data in the final intersection to be 1-m. The second data end can perform a permutation operation on the eighth set based on the preset threshold value and the degree of confusion.
[0144] Exemplarily, the second data end determines the intersection between the sixth set παβHY and the eighth set αβHX as the target intersection, that is, compares the identical data elements between the sixth set παβHY and the eighth set αβHX, and constructs the identical data elements as the target intersection.
[0145] Step S402 : determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining a degree of confusion between the first data end and the second data end.
[0146] After determining the target intersection, the second data end determines a ratio k between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtains the confusion degree negotiated by the first data end and the second data end.
[0147] Step S403 : obtaining a comparison result between the ratio and a preset threshold, and performing a replacement operation on the data elements in the eighth set according to the comparison result and the confusion degree.
[0148] After obtaining the ratio k, the second data end compares the ratio k with the preset threshold l to obtain a comparison result, so that the data elements in the eighth set can be replaced based on the comparison result and the confusion degree.
[0149] Exemplarily, when the comparison result is a ratio greater than a preset threshold, the intersection ratio of the data of both parties exceeds the threshold, and some data elements in the eighth set need to be randomly replaced to reduce the intersection ratio of the data of both parties. At the same time, in order to meet the confusion requirements negotiated by both parties, the confusion is used to determine the set number of data elements in the eighth set that need to be changed in position, and then the positions of the set number of data elements in the set of replaced data elements are changed.
[0150] When the comparison result is a ratio less than or equal to a preset threshold, the set number of data elements in the eighth set that need to be changed in position is determined by the confusion degree, and then the positions of the set number of data elements in the set of replacement data elements are changed.
[0151] In this embodiment, by setting a preset threshold l for the intersection ratio, the number of intersections calculated by both parties is precisely controlled, ensuring that the intersection number reaches a certain set ratio at most. This avoids the risk of the smaller party's data being completely exposed when the intersection number approaches the amount of data on the smaller party in the exemplary calculation technique. Furthermore, by setting the obfuscation level, the proportion of true intersection data in the calculated intersection can be precisely controlled, allowing some non-intersection data to be mixed into the calculated intersection. This approach further enhances the data protection effect of the intersection and prevents one party from inferring the data content of the smaller party based on the intersection number.
[0152] Reference Figure 5 , Figure 5 Schematic diagram of the process of determining the intersection of the second data end side provided by this application Figure 3 ,based on Figure 4 In the illustrated embodiment, step S403 includes:
[0153] Step S501 : in response to the comparison result indicating that the ratio is less than or equal to a preset threshold, obtaining a first difference between the upper limit of the ratio and the ratio.
[0154] In this embodiment, when the comparison result indicates that the ratio is less than or equal to the preset threshold, the second data end determines a first difference between the ratio upper limit and the ratio. The ratio upper limit is 1, and the first difference = 1-k.
[0155] Step S502 : In response to the first difference being greater than or equal to the confusion degree, determining a first permutation quantity according to the confusion degree, the ratio, and the first mapping relationship.
[0156] Step S503 : permuting a first number of data elements in the eighth set, where the first number is equal to the first permuted number.
[0157] After obtaining the first difference, it is necessary to compare the first difference with the confusion degree m to determine a replacement strategy for the data elements in the eighth set.
[0158] When the first difference 1-k is greater than or equal to the confusion degree m, the first permutation quantity is determined based on the confusion degree, the ratio and the first mapping relationship. The first mapping relationship is expressed as That is, the permutation ratio p is determined through the confusion degree, the ratio, and the mapping relationship, and the product of p and the number of data elements in the eighth set is the first permutation number.
[0159] After obtaining the first permutation quantity, the second data element permutes the first number of data elements in the eighth set, where the first number is equal to the first permutation quantity. For example, if there are 10 data elements in the eighth set and the first permutation quantity is 5, then the positions of any five data elements in the eighth set are shuffled, such as changing the positions of data elements 1, 2, 3, 4, and 5.
[0160] In addition, when the first difference 1-k is less than the confusion degree m, based on the confusion degree, the ratio and the second mapping relationship A first replacement number is determined, that is, the first replacement number of data elements in the eighth set is replaced. Exemplarily, the second data end calculates a replacement ratio q based on the obfuscation degree m and the ratio k. The product of the replacement ratio q and the number of data elements in the eighth set is the first replacement number.
[0161] The second data end generates corresponding first replacement elements for a second number of data elements in the eighth set, where the second number is equal to the first replacement number. Exemplarily, the first replacement number is three, and the second data end randomly selects three data elements in the eighth set and generates a replacement element corresponding to each data element as the first replacement element. For example, a random number having the same length as the ciphertext of the data element is used as the first replacement element for the data element.
[0162] After generating each first replacement element, the second data end replaces the data elements in the eighth set with the corresponding first replacement element to perform a replacement operation. The second data end then performs a permutation operation on the eighth set after the replacement operation. For example, the second data end performs a full permutation on each data element in the eighth set after the permutation operation, that is, shuffling the positions of all data elements in the eighth set after the permutation operation.
[0163] In this embodiment, when the ratio is less than or equal to a preset threshold, a first difference between the ratio upper limit and the ratio is obtained, and the data elements of the eighth set are accurately permuted using the first difference and the confusion degree.
[0164] Reference Figure 6 , Figure 6 Schematic diagram of the process of determining the intersection of the second data end side provided by this application Figure 4 ,based on Figure 4 In the illustrated embodiment, step S403 includes:
[0165] Step S601 : in response to the comparison result indicating that the ratio is greater than a preset threshold, determining a second replacement quantity according to the ratio and the preset threshold.
[0166] In this embodiment, when the comparison result is that the ratio is greater than the preset threshold, the intersection ratio of the two parties exceeds the threshold, and the second data end needs to replace part of the elements of the eighth set to ensure that the intersection ratio of the two parties subsequently obtained by the first data end is less than or equal to the preset threshold.
[0167] Exemplarily, the device determines the replacement ratio based on the ratio and a preset threshold. The second replacement quantity is obtained based on the product between the replacement ratio and the quantity of data elements in the eighth set.
[0168] Step S602: Generate corresponding second replacement elements for the third number of data elements in the eighth set, and replace the data elements in the eighth set with the corresponding second replacement elements to obtain an intermediate set to perform a replacement operation, and the third number is equal to the second replacement number.
[0169] After determining the second replacement quantity, the second data end generates corresponding second replacement elements for the third number of data elements in the eighth set, where the third number is equal to the second replacement quantity. For example, the second replacement quantity is three, and the second data end randomly selects three data elements in the eighth set and generates a replacement element corresponding to each data element as the second replacement element. For example, a random number having the same length as the ciphertext of the data element is used as the second replacement element for the data element.
[0170] After generating each second replacement element, the second data end replaces the data elements in the eighth set with the corresponding second replacement elements to perform a replacement operation to obtain an intermediate collection.
[0171] Step S603: Obtain a second difference between the upper threshold value and the preset threshold value, and perform a permutation operation on the intermediate set according to the second difference and the confusion degree.
[0172] After completing the replacement operation, the second data end obtains a second difference between the upper threshold value and the preset threshold value. If the upper threshold value is 1, the second difference is 1-1. The second data end performs a replacement operation on the data elements in the intermediate set based on the second difference and the confusion degree.
[0173] In one example, when the second difference is greater than or equal to the confusion degree, the second data end determines the second permutation quantity based on the preset threshold, the confusion degree, and the third mapping relationship. The third mapping relationship is expressed as
[0174] It can be understood that the replacement ratio p is first determined by a preset threshold and confusion degree, and the product of the replacement ratio and the number of data elements in the intermediate set is the second replacement number.
[0175] After obtaining the second permutation quantity, the second data end permutes a fourth quantity of data elements in the intermediate set, where the fourth quantity is equal to the second permutation quantity.
[0176] Exemplarily, there are 8 data elements in the intermediate set and the second permutation quantity is 4, then the positions of any 4 data elements in the intermediate set are shuffled, such as changing the positions of the four data elements 1, 2, 3 and 4.
[0177] In another example, when the second difference is less than the confusion degree, a third replacement quantity is determined based on a preset threshold, the confusion degree, and a fourth mapping relationship. The fourth mapping relationship is expressed as: That is, the replacement ratio q is determined based on the preset threshold and the confusion degree, and the product of the replacement ratio and the number of data elements in the intermediate set is the third replacement number.
[0178] The second data end generates corresponding third replacement elements for a fifth number of data elements in the intermediate set, where the fifth number is equal to the third replacement number. Exemplarily, the second replacement number is three. The second data end randomly selects three data elements from the eighth set and generates a replacement element corresponding to each data element as the second replacement element. For example, a random number having the same length as the ciphertext of the data element is used as the second replacement element for the data element.
[0179] After generating each third replacement element, the second data end replaces the data elements in the intermediate set with the corresponding third replacement element to perform a replacement operation. The second data end performs a permutation operation on the intermediate set after the replacement operation, that is, shuffling the positions of all data elements in the intermediate set after the replacement operation.
[0180] In this embodiment, when the ratio is greater than a preset threshold, it can be determined that the intersection ratio of the two parties exceeds the threshold, and the second data end replaces a part of the elements of the eighth set to ensure that the intersection ratio of the two parties subsequently obtained by the first data end is less than or equal to the preset threshold.
[0181] Based on the contents described in the above embodiments, a first data terminal is further provided in the embodiments of the present application. Figure 7 , Figure 7 This is a schematic diagram of a program module of a first data terminal provided in an embodiment of the present application. In some embodiments, the first data terminal 700 includes:
[0182] An acquisition module 710 is configured to acquire a first set and a first private key, and encrypt each data element in the first set according to the first private key to obtain a second set;
[0183] a first sending module 720, configured to send the second set to the second data end, and receive a third set sent by the second data end, where the data elements in the third set are obtained by encrypting the data elements in the fourth set by the second data end using the second private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set;
[0184] a first encryption module 730 configured to encrypt the data elements in the third set using the first private key to obtain a fifth set, and perform a permutation operation on the data elements in the fifth set to obtain a sixth set, wherein the permutation operation is configured to change positions of the data elements in the fifth set;
[0185] a second sending module 740 configured to send the sixth set to the second data end, and receive a seventh set fed back by the second data end, wherein the seventh set is obtained by the second data end performing a permutation operation on data elements in the eighth set based on the sixth set, where the permutation operation is used to replace the data elements, and the eighth set is obtained by the second data end encrypting the data elements in the second set using the second private key;
[0186] The determination module 750 is configured to determine the intersection between the fifth set and the seventh set.
[0187] In some embodiments, the first data terminal 700 is specifically used to:
[0188] Obtaining an initial set of first data terminals;
[0189] Each data in the initial set is converted into a corresponding hash value to obtain a first set.
[0190] It should be noted that the various steps in the intersection determination method executed by the first data end are specifically referred to the above embodiment and will not be described in detail here.
[0191] Based on the contents described in the above embodiments, a first data terminal is further provided in the embodiments of the present application. Figure 8 , Figure 8 This is a schematic diagram of a program module of a first data terminal provided in an embodiment of the present application. In some embodiments, the second data terminal 800 includes:
[0192] a receiving module 810 configured to receive a second set sent by the first data end, and obtain a fourth set and a second private key, wherein the second set is obtained by the first data end encrypting the data elements in the first set based on the first private key, and the number of data elements in the fourth set is greater than the number of data elements in the first set;
[0193] A second encryption module 820 is configured to encrypt the data elements in the fourth set using the second private key to obtain a third set, and send the third set to the first data terminal;
[0194] a third encryption module 830 configured to encrypt the second set using the second private key to obtain an eighth set, and receive a sixth set sent by the first data party, wherein the sixth set is obtained by the first data end performing a permutation operation on the fifth set, and the fifth set is obtained by the first data end encrypting data elements in the third set using the first private key;
[0195] The processing module 840 is configured to perform a permutation operation on the data elements in the eighth set according to the sixth set to obtain a seventh set, and send the seventh set to the first data end so that the first data end can determine the intersection between the seventh set and the fifth set.
[0196] In some embodiments, the second data terminal 800 is specifically used to:
[0197] determining a target intersection between the sixth set and the eighth set;
[0198] Determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining a degree of confusion between the first data end and the second data end;
[0199] A comparison result between the ratio and a preset threshold is obtained, and a permutation operation is performed on the data elements in the eighth set according to the comparison result and the confusion degree.
[0200] In some embodiments, the second data terminal 800 is specifically used to:
[0201] In response to the comparison result indicating that the ratio is less than or equal to the preset threshold, obtaining a first difference between the ratio upper limit value and the ratio;
[0202] In response to the first difference being greater than or equal to the confusion degree, determining a first permutation quantity according to the confusion degree, the ratio, and the first mapping relationship;
[0203] A first number of data elements in the eighth set is permuted, the first number being equal to the first permutation number.
[0204] In some embodiments, the second data terminal 800 is specifically used to:
[0205] In response to the first difference being less than the confusion degree, determining a first replacement quantity according to the confusion degree, the ratio, and the second mapping relationship;
[0206] generating corresponding first replacement elements for a second number of data elements in the eighth set, and replacing the data elements in the eighth set with the corresponding first replacement elements to perform a replacement operation, the second number being equal to the first replacement number;
[0207] Perform a permutation operation on the eighth set after the replacement operation.
[0208] In some embodiments, the second data terminal 800 is specifically used to:
[0209] In response to the comparison result indicating that the ratio is greater than a preset threshold, determining a second replacement number based on the ratio and the preset threshold;
[0210] Generating corresponding second replacement elements for a third number of data elements in the eighth set, and replacing the data elements in the eighth set with the corresponding second replacement elements to obtain an intermediate set to perform a replacement operation, the third number being equal to the second replacement number;
[0211] A second difference between the upper threshold value and the preset threshold value is obtained, and a permutation operation is performed on the intermediate set according to the second difference and the confusion degree.
[0212] In some embodiments, the second data terminal 800 is specifically used to:
[0213] In response to the second difference being greater than or equal to the confusion degree, determining a second permutation quantity according to a preset threshold, the confusion degree, and a third mapping relationship;
[0214] A fourth number of data elements in the intermediate set is permuted, the fourth number being equal to the second permuted number.
[0215] In some embodiments, the second data terminal 800 is specifically used to:
[0216] In response to the second difference being less than the confusion degree, determining a third replacement quantity according to a preset threshold, the confusion degree, and a fourth mapping relationship;
[0217] generating corresponding third replacement elements for a fifth number of data elements in the intermediate set, the fifth number being equal to the third replacement number;
[0218] Replacing the data elements in the intermediate set with corresponding third replacement elements to perform a replacement operation;
[0219] Perform a permutation operation on the intermediate set after the replacement operation.
[0220] In some embodiments, the second data terminal 800 is specifically used to:
[0221] Obtaining an initial set of second data terminals;
[0222] Each data in the initial set is converted into a corresponding hash value to obtain a fourth set.
[0223] It should be noted that the various steps in the intersection determination method executed by the second data end are specifically referred to the above embodiment and will not be described in detail here.
[0224] Furthermore, based on the contents described in the above embodiments, an electronic device is also provided in an embodiment of the present application, which includes at least one processor, and a communication interface and a memory to which the processor is communicatively connected; wherein the communication interface is used to communicate with other communication devices, and the memory stores computer-executable instructions; the above at least one processor executes the computer-executable instructions stored in the memory to implement each step in the intersection determination method as described in the above embodiments.
[0225] In order to better understand the embodiments of the present application, refer to Figure 9 , Figure 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0226] like Figure 9 As shown, the electronic device 900 of this embodiment includes: a processor 901, a memory 902, and a communication interface 904; wherein:
[0227] Memory 902, for storing computer-executable instructions;
[0228] The communication interface 904 is used to communicate with other communication devices;
[0229] The processor 901 is configured to execute computer-executable instructions stored in the memory to implement the various steps of the query optimization method described in the above embodiment.
[0230] Optionally, the memory 902 may be independent or integrated with the processor 901 .
[0231] When the memory 902 is independently provided, the device further includes a bus 903 for connecting the memory 902 , the communication interface 904 and the processor 901 .
[0232] An embodiment of the present application provides a computer-readable storage medium having computer-executable instructions stored therein. When a processor executes the computer-executable instructions, each step of the intersection determination method described in the above embodiment is implemented.
[0233] An embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the computer program implements the various steps in the intersection determination method described in the above embodiment.
[0234] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.
[0235] Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of these modules may be selected to achieve the purpose of this embodiment based on actual needs.
[0236] In addition, the functional modules in the various embodiments of the present application may be integrated into a single processing unit, or each module may exist physically separately, or two or more modules may be integrated into a single unit. The above-mentioned modules may be implemented in the form of hardware or hardware plus software functional units.
[0237] The above-mentioned integrated module implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0238] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0239] The memory may include high-speed memory and may also include non-volatile storage, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.
[0240] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be classified into address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0241] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0242] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for determining an intersection, characterized in that: Applied to the first data end, the intersection determination method includes: Obtaining a first set and a first private key, and encrypting each data element in the first set according to the first private key to obtain a second set, where the first set consists of multiple data elements in the first data end; Sending the second set to a second data end, and receiving a third set sent by the second data end, where the data elements in the third set are obtained by encrypting the data elements in the fourth set by the second data end using the second private key, the number of data elements in the fourth set is greater than the number of data elements in the first set, and the fourth set consists of multiple data elements in the second data end; Encrypting the data elements in the third set according to the first private key to obtain a fifth set, and performing a permutation operation on the data elements in the fifth set to obtain a sixth set, wherein the permutation operation is used to change positions of the data elements in the set; The sixth set is sent to the second data end, and a seventh set fed back by the second data end is received, wherein the seventh set is obtained by the second data end performing a permutation operation on the data elements in the eighth set based on the sixth set, and the eighth set is obtained by the second data end encrypting the data elements in the second set based on the second private key; performing the permutation operation on the data elements in the eighth set based on the sixth set includes: determining a target intersection between the sixth set and the eighth set; determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining an obfuscation degree between the first data end and the second data end; obtaining a comparison result between the ratio and a preset threshold, and performing the permutation operation on the data elements in the eighth set according to the comparison result and the obfuscation degree; An intersection between the fifth set and the seventh set is determined.
2. The intersection determination method according to claim 1, characterized in that: The obtaining of the first set includes: Obtaining an initial set of the first data terminals; Each data in the initial set is converted into a corresponding hash value to obtain the first set.
3. A method for determining an intersection, characterized in that: Applied to the second data end, the intersection determination method includes: receiving a second set sent by a first data end, and obtaining a fourth set and a second private key, wherein the second set is obtained by the first data end encrypting data elements in the first set based on the first private key, the number of data elements in the fourth set is greater than the number of data elements in the first set, the first set is composed of multiple data elements in the first data end, and the fourth set is composed of multiple data elements in the second data end; encrypting the data elements in the fourth set according to the second private key to obtain a third set, and sending the third set to the first data terminal; encrypting the second set using the second private key to obtain an eighth set, and receiving a sixth set sent by the first data end, wherein the sixth set is obtained by the first data end performing a permutation operation on the fifth set, and the fifth set is obtained by the first data end encrypting data elements in the third set using the first private key, wherein the permutation operation is used to change positions of data elements in the set; performing a permutation operation on the data elements in the eighth set according to the sixth set to obtain a seventh set, and sending the seventh set to the first data end so that the first data end can determine an intersection between the seventh set and the fifth set, wherein the eighth set is obtained by encrypting the data elements in the second set by the second data end using the second private key; The performing a permutation operation on the data elements in the eighth set according to the sixth set includes: determining a target intersection between the sixth set and the eighth set; Determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining a degree of confusion between the first data end and the second data end; A comparison result between the ratio and a preset threshold is obtained, and a replacement operation is performed on the data elements in the eighth set according to the comparison result and the confusion degree.
4. The intersection determination method according to claim 3, characterized in that: The performing a permutation operation on the data elements in the eighth set according to the comparison result and the confusion degree includes: In response to the comparison result indicating that the ratio is less than or equal to a preset threshold, obtaining a first difference between an upper limit value of the ratio and the ratio; In response to the first difference being greater than or equal to the confusion degree, determining a first permutation quantity according to the confusion degree, the ratio, and a first mapping relationship; A first number of data elements in the eighth set is permuted, the first number being equal to the first permuted number.
5. The intersection determination method according to claim 4, characterized in that: After obtaining the first difference between the upper limit of the ratio and the ratio, the method further includes: In response to the first difference being less than the confusion degree, determining a first replacement quantity according to the confusion degree, the ratio, and a second mapping relationship; generating corresponding first replacement elements for a second number of data elements in the eighth set, and replacing the data elements in the eighth set with the corresponding first replacement elements to perform a replacement operation, the second number being equal to the first replacement number; Perform a permutation operation on the eighth set after the replacement operation.
6. The intersection determination method according to claim 3, characterized in that: The performing a permutation operation on the data elements in the eighth set according to the comparison result and the confusion degree includes: In response to the comparison result indicating that the ratio is greater than a preset threshold, determining a second replacement quantity according to the ratio and the preset threshold; Generating corresponding second replacement elements for a third number of data elements in the eighth set, and replacing the data elements in the eighth set with the corresponding second replacement elements to obtain an intermediate set to perform a replacement operation, wherein the third number is equal to the second replacement number; A second difference between the upper threshold value and the preset threshold is obtained, and a permutation operation is performed on the intermediate set according to the second difference and the confusion degree.
7. The intersection determination method according to claim 6, characterized in that: The performing a permutation operation on the intermediate set according to the second difference and the confusion degree includes: In response to the second difference being greater than or equal to the confusion degree, determining a second permutation quantity according to the preset threshold, the confusion degree, and a third mapping relationship; A fourth number of data elements in the intermediate set is permuted, the fourth number being equal to the second permuted number.
8. The intersection determination method according to claim 6, characterized in that: The performing a permutation operation on the intermediate set according to the second difference and the confusion degree includes: In response to the second difference being less than the confusion degree, determining a third replacement quantity according to the preset threshold, the confusion degree, and a fourth mapping relationship; generating corresponding third replacement elements for a fifth number of data elements in the intermediate set, the fifth number being equal to the third replacement number; Replacing the data elements in the intermediate set with corresponding third replacement elements to perform a replacement operation; Perform a permutation operation on the intermediate set after the replacement operation.
9. The intersection determination method according to any one of claims 3 to 8, characterized in that: The obtaining of the fourth set includes: Obtaining an initial set of the second data end; Each data in the initial set is converted into a corresponding hash value to obtain the fourth set.
10. A first data terminal, characterized in that: include: an acquisition module, configured to acquire a first set and a first private key, and encrypt each data element in the first set according to the first private key to obtain a second set, wherein the first set is composed of multiple data elements in the first data end; a first sending module, configured to send the second set to a second data end, and receive a third set sent by the second data end, where the data elements in the third set are obtained by encrypting the data elements in a fourth set by the second data end using the second private key, the number of data elements in the fourth set being greater than the number of data elements in the first set, and the fourth set being composed of multiple data elements in the second data end; a first encryption module, configured to encrypt the data elements in the third set according to the first private key to obtain a fifth set, and perform a permutation operation on the data elements in the fifth set to obtain a sixth set, wherein the permutation operation is configured to change positions of the data elements in the set; a second sending module, configured to send the sixth set to the second data end, and receive a seventh set fed back by the second data end, wherein the seventh set is obtained by the second data end performing a permutation operation on data elements in the eighth set based on the sixth set, and the eighth set is obtained by the second data end encrypting the data elements in the second set based on the second private key; performing the permutation operation on the data elements in the eighth set based on the sixth set includes: determining a target intersection between the sixth set and the eighth set; determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining a degree of confusion between the first data end and the second data end; obtaining a comparison result between the ratio and a preset threshold, and performing the permutation operation on the data elements in the eighth set according to the comparison result and the degree of confusion; A determination module is configured to determine an intersection between the fifth set and the seventh set.
11. A second data terminal, characterized in that: include: a receiving module, configured to receive a second set sent by a first data end, and obtain a fourth set and a second private key, wherein the second set is obtained by the first data end encrypting data elements in the first set based on the first private key, the number of data elements in the fourth set is greater than the number of data elements in the first set, the first set is composed of multiple data elements in the first data end, and the fourth set is composed of multiple data elements in the second data end; a second encryption module, configured to encrypt the data elements in the fourth set according to the second private key to obtain a third set, and send the third set to the first data end; a third encryption module, configured to encrypt the second set using the second private key to obtain an eighth set, and receive a sixth set sent by the first data end, wherein the sixth set is obtained by the first data end performing a permutation operation on the fifth set, and the fifth set is obtained by the first data end encrypting data elements in the third set using the first private key, wherein the permutation operation is used to change positions of data elements in the set; a processing module, configured to perform a permutation operation on the data elements in the eighth set according to the sixth set to obtain a seventh set, and send the seventh set to the first data end so that the first data end can determine an intersection between the seventh set and the fifth set, wherein the eighth set is obtained by encrypting the data elements in the second set by the second data end using the second private key; The processing module is specifically used for: determining a target intersection between the sixth set and the eighth set; Determining a ratio between the number of data elements in the target intersection and the number of data elements in the eighth set, and obtaining a degree of confusion between the first data end and the second data end; A comparison result between the ratio and a preset threshold is obtained, and a replacement operation is performed on the data elements in the eighth set according to the comparison result and the confusion degree.
12. An electronic device, characterized in that: include: a processor, and a memory and a communication interface communicatively connected to the processor; The communication interface is used to communicate with other communication devices; The memory is used to store computer-executable instructions; The processor is configured to execute computer-executable instructions stored in the memory to implement the intersection determination method according to any one of claims 1-2 or 3-9.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the intersection determination method according to any one of claims 1-2 or 3-9 is implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the intersection determination method according to any one of claims 1 to 2 or 3 to 9 is implemented.
Citation Information
Patent Citations
Common data set determination method, device and system based on data privacy protection
CN111741020A
Method and device for acquiring intersection information by PSI with intersection counting
CN114374518A