Privacy protection similarity calculation method and device

By converting the knowledge graph subgraph into binarized vectors to generate ciphertexts and performing similarity calculations based on these ciphertexts, the problems of privacy exposure and high computing resources consumption during similarity calculations in the knowledge graph are solved, achieving efficient and private Protected similarity calculation.

CN119442294APending Publication Date: 2025-02-14ZHEJIANG ZEEKR INTELLIGENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310968956.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-02
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

When performing similarity calculations in knowledge graph representations, data plaintext needs to be obtained for calculations, but this will expose user privacy and consume a lot of computing resources.

Method used

By converting the knowledge graph subgraph into a binarized vector, a set of index values ​​corresponding to the first and second types of values ​​is generated to form a ciphertext and similarity calculation is performed based on these ciphertexts.

Benefits of technology

It realizes similarity calculation without directly obtaining data plaintext, protects user privacy and greatly reduces calculation costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119442294A_ABST
    Figure CN119442294A_ABST
Patent Text Reader

Abstract

The invention provides a privacy protection similarity calculation method and device, and the method comprises the steps: obtaining a first ciphertext provided by a demand side, and obtaining a second ciphertext provided by a provider; calculating the similarity between the first sub-graph and the second sub-graph based on a first number of equal index values in a first set and a third set in the first ciphertext and the second ciphertext and a second number of equal index values in a second set and a fourth set, and respectively sending the similarity to the demand side and the provider. And during similarity calculation, the data plaintext corresponding to the sub-graph cannot be directly obtained, so that the privacy of the user is well protected. Meanwhile, the sub-graph corresponding to the knowledge graph is converted into the binary vector, and only the index value corresponding to the value in the binary vector is calculated, so that the calculation cost during similarity calculation is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information security technology, and in particular to a privacy-preserving similarity calculation method, device, electronic device, and readable storage medium. Background Art

[0002] In recent years, with the rapid development of deep learning, natural language processing and graph data processing technologies, many breakthroughs have been made in the construction and application of knowledge graphs. Knowledge graphs are widely used in search engines, question answering, language understanding, recommendation systems, etc.

[0003] Knowledge graph representation aims to represent the entities and relationships of the knowledge graph in a low-dimensional continuous vector space, thereby effectively achieving more accurate search. However, current knowledge graph representations often require large storage and computational overheads. Therefore, more computing resources are usually required when performing similarity calculations based on knowledge graph representations.

[0004] At the same time, similarity calculation for data content in knowledge graph representation usually requires obtaining the data plaintext of the data content in the knowledge graph and performing similarity calculation based on the data plaintext. In actual applications, users who provide data may not want their privacy to be exposed. Summary of the invention

[0005] The present application provides a privacy-preserving similarity calculation method, the method comprising:

[0006] Obtain a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph, and obtain a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph;

[0007] The first ciphertext is composed of a first set and a second set generated by index values ​​of the first type of values ​​and the second type of values ​​contained in the binary vector corresponding to the first subgraph in the binary vector respectively;

[0008] The second ciphertext is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector respectively; the binary vector is a vector composed of the first and second types of values ​​used to describe the subgraph;

[0009] Based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, the similarity between the first subgraph and the second subgraph is calculated, and the similarity is sent to the demander and the provider respectively.

[0010] Optionally, any one of the first subgraph and the second subgraph includes:

[0011] Specified entities and / or relations from the knowledge graph.

[0012] Optionally, the first ciphertext includes: a ciphertext consisting of the first set and the second set encrypted by the demander based on a secure hash algorithm;

[0013] The second ciphertext includes: a ciphertext consisting of the third set and the fourth set encrypted by the provider based on a secure hash algorithm.

[0014] Optionally, the first ciphertext includes: a ciphertext consisting of a first set encrypted by the demander based on a private key provided by the demander and the second set;

[0015] The second ciphertext includes: the ciphertext consisting of the third set and the fourth set sent by the provider to the demander and encrypted by the demander based on the demander's private key;

[0016] Optionally, the second ciphertext includes the third set and the fourth set encrypted based on random numbers and sent by the provider to the demander, and the ciphertext consisting of the third set and the fourth set encrypted by the demander based on the demander's private key and further decrypted by the provider based on random numbers.

[0017] The present application also provides a privacy-preserving similarity calculation device, the device comprising:

[0018] A ciphertext acquisition unit, used to acquire a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph, and to acquire a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph;

[0019] The first ciphertext is composed of a first set and a second set generated by index values ​​of the first type of values ​​and the second type of values ​​contained in the binary vector corresponding to the first subgraph in the binary vector respectively;

[0020] The second ciphertext is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector respectively; the binary vector is a vector composed of the first and second types of values ​​used to describe the subgraph;

[0021] A similarity calculation unit is used to calculate the similarity between the first subgraph and the second subgraph based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, and send the similarity to the demander and the provider respectively.

[0022] Optionally, any one of the first subgraph and the second subgraph includes:

[0023] Specified entities and / or relations from the knowledge graph.

[0024] Optionally, the first ciphertext includes: a ciphertext consisting of the first set and the second set encrypted by the demander based on a secure hash algorithm;

[0025] The second ciphertext includes: a ciphertext consisting of the third set and the fourth set encrypted by the provider based on a secure hash algorithm.

[0026] Optionally, the first ciphertext includes: a ciphertext consisting of a first set encrypted by the demander based on a private key provided by the demander and the second set;

[0027] The second ciphertext includes: the ciphertext consisting of the third set and the fourth set sent by the provider to the demander and encrypted by the demander based on the demander's private key;

[0028] Optionally, the second ciphertext includes the third set and the fourth set encrypted based on random numbers and sent by the provider to the demander, and the ciphertext consisting of the third set and the fourth set encrypted by the demander based on the demander's private key and further decrypted by the provider based on random numbers.

[0029] The present application also provides an electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus;

[0030] The memory stores machine-readable instructions, and the processor executes the above method by calling the machine-readable instructions.

[0031] The present application also provides a computer-readable storage medium, which stores machine-readable instructions. When the machine-readable instructions are called and executed by a processor, the above method is implemented.

[0032] In the scheme recorded in the above embodiment, the ciphertext corresponding to the subgraph specified by the demander and the provider is obtained respectively, and the similarity is calculated based on the ciphertext. Since the ciphertext is composed of a set generated by the index values ​​corresponding to the first and second categories of values ​​in the binary vector, the data plaintext corresponding to the subgraph is not directly obtained during the similarity calculation, which better protects the privacy of the user. At the same time, since the subgraph corresponding to the knowledge graph is converted into a binary vector, only the index value corresponding to the value in the binary vector is calculated, which greatly reduces the computational cost when performing similarity calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a flowchart of a privacy-preserving similarity calculation method shown in an exemplary embodiment.

[0034] Figure 2 It is an interactive schematic diagram of another privacy-preserving similarity calculation method shown in an exemplary embodiment.

[0035] Figure 3 It is a hardware structure diagram of an electronic device in which a privacy-preserving similarity calculation device is located, showing an exemplary embodiment.

[0036] Figure 4 It is a block diagram of a privacy-preserving similarity calculation device shown in an exemplary embodiment. DETAILED DESCRIPTION

[0037] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0038] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0039] With the development of technology, users pay more and more attention to their privacy and security, and the country has also introduced a number of laws and regulations to strengthen the protection of citizens' personal information and data.

[0040] When calculating similarity for subgraphs in the knowledge graph, it is often necessary to obtain the plaintext data of the subgraphs in the knowledge graph. However, in actual applications, users may not want their ciphertext data to be exposed to the data service provider that provides similarity calculation services. Therefore, how to achieve similarity calculation while protecting user privacy and meeting user needs has become an urgent problem to be solved.

[0041] In view of this, the present application proposes a technical solution for similarity calculation based on ciphertext generated by index values ​​of first and second categories of values ​​in a binary vector.

[0042] During implementation, a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph may be obtained, and a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph may be obtained;

[0043] The first ciphertext is composed of a first set and a second set generated by index values ​​of the first type of values ​​and the second type of values ​​contained in the binary vector corresponding to the first subgraph in the binary vector respectively;

[0044] The second ciphertext is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector respectively; the binary vector is a vector composed of the first and second types of values ​​used to describe the subgraph;

[0045] Based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, the similarity between the first subgraph and the second subgraph is calculated, and the similarity is sent to the demander and the provider respectively.

[0046] See also Figure 1 , Figure 1 The following is a flowchart of a privacy-preserving similarity calculation method provided by an exemplary embodiment. The method may include the following steps:

[0047] Step 102, obtaining a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph, and obtaining a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph.

[0048] In this specification, the demander can generally refer to a user who needs to obtain certain data in the knowledge graph. Correspondingly, the provider can refer to a user of certain data in a certain knowledge graph.

[0049] Usually, in practical applications, the demander can specify the first entity in the knowledge graph and the relationship corresponding to the first entity, the provider can provide the second entity, and a third-party similarity calculation service provider performs similarity calculation on the first entity specified by the demander and the relationship corresponding to the first entity, and the second entity, and sends the results of the similarity calculation to the demander and the provider respectively, so that the demander and the provider can confirm whether the two match.

[0050] For example, the demander can specify the first entity as "China" and the relationship corresponding to the first entity as "capital", while the provider can specify the second entity as "Beijing". The third-party similarity calculation service provider can perform similarity calculation based on "China-capital" and "Beijing".

[0051] In this specification, the first subgraph specified by the demander in the first knowledge graph may include a first entity and a relationship corresponding to the first entity, for example, "China-capital".

[0052] The second subgraph specified by the provider in the second knowledge graph may include a second entity, such as "Beijing".

[0053] It should be noted that the demander specifies the first entity and the relationship corresponding to the first entity, and the provider specifies the second entity is only one possible implementation. In actual applications, the demander may specify only the first entity, and the provider may specify the second entity and the relationship corresponding to the second entity; or both the demander and the provider may specify only the entity without specifying the relationship corresponding to the entity, etc., which is not specifically limited in this specification.

[0054] In this specification, the first ciphertext corresponding to the first subgraph is composed of a first set and a second set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the first subgraph, respectively.

[0055] The second ciphertext corresponding to the second subgraph is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector, respectively.

[0056] In this specification, a binary vector is a vector composed of a first type of value and a second type of value used to describe the subgraph. The binary vector is a vector consisting of only the first type of value and the second type of value. The first type of value and the second type of value can be set based on actual applications, for example, 0 or 1, or other values, which are not specifically limited in this specification.

[0057] In practical applications, any entity and relationship in the knowledge graph can be represented by a real number vector. For example, the entity "Beijing" in the knowledge graph can have a real number vector (1, -3, 5, -7, 9).

[0058] A real number vector can be converted into a binary vector by using a quantization function, wherein the quantization function can be set based on conditions required for actual application and is not specifically limited in this specification.

[0059] For example, in this specification, the following quantization function can be used to binarize the real vector in the knowledge graph:

[0060]

[0061] Among them, x can represent each element in the real vector, +α can represent the first type of value of the binary vector, and ―α can represent the second type of value of the binary vector.

[0062] Through the quantization function, when α is 2, the binary vector corresponding to the above entity "Beijing" is (2, -2, 2, -2, 2).

[0063] The first set is composed of index values ​​of the first type of values ​​contained in the binary vector in the binary vector, and the second set is composed of index values ​​of the second type of values ​​contained in the binary vector in the binary vector.

[0064] In the above example, the first type of value, that is, 2, has indices 0, 2, and 4 in the binary vector, so the first set is (0, 2, 4). The second type of value, that is, -2, has indices 1 and 3 in the binary vector, so the second set is (1, 3).

[0065] It should be noted that in this specification, the first subgraph provided by the demander may be a subgraph composed of entities and relationships corresponding to the entities. For entities and relationships corresponding to the entities, the elements with the same index value in the real vector corresponding to the entity and the real vector corresponding to the relationship corresponding to the entity can be multiplied, and a real vector corresponding to the subgraph is generated. After the real vector corresponding to the subgraph is generated, the real vector is converted into a binary vector.

[0066] For example, the first subgraph may be "China - Capital", where the real vector corresponding to the entity "China" is (-2, 4, -6, 8, -10), and the real vector corresponding to the relationship "Capital" is (1, 1, -1, 1, 1). The elements with the same index value in the real vector corresponding to "China" and the real vector corresponding to "Capital" can be multiplied respectively to obtain the vector (-1, 4, 6, 8, -10) corresponding to the first subgraph. The vector corresponding to the first subgraph is then converted into a binary vector (-2, 2, 2, 2, -2) based on the above quantization function.

[0067] Thus, the first set and the second set are combined into a first ciphertext. Since the set does not contain plaintext content, the data corresponding to the subgraph cannot be directly obtained.

[0068] Similarly, the generation process of the second ciphertext is the same as the generation process of the first ciphertext, which will not be repeated here.

[0069] Step 104, based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, calculate the similarity between the first subgraph and the second subgraph, and send the similarity to the demander and the provider respectively.

[0070] In this specification, the first ciphertext is composed of the first set and the second set, and the second ciphertext is composed of the third set and the fourth set. Therefore, the similarity can be calculated based on the number of elements that are equal in the first set and the third set, and the number of elements that are equal in the second set and the fourth set.

[0071] For example, in practical applications, the first ciphertext can be represented by h=[h0:h1], where h0 can represent the first set and h1 can represent the second set. The second ciphertext can be represented by h′=[h′0:h′1], where h′0 can represent the third set and h′1 can represent the fourth set. The CountSame function can be used to calculate the number of equal elements between two sets. Therefore, the number of equal elements in the first set and the third set can be n1=CountSame(h0,h′0), and the number of equal elements in the second set and the fourth set can be n2=CountSame(h1,h′1). Therefore, the similarity between the first subgraph and the second subgraph can be further calculated based on n1 and n2.

[0072] The specific similarity calculation formula is not specifically limited in this specification and can be specifically set based on the actual needs of the user.

[0073] For example, the value of the following formula may be used as the similarity between the first sub-graph and the second sub-graph.

[0074] S=α 3 *(2*n1+2*n2―K)

[0075] Wherein, S represents the similarity between the first sub-graph and the second sub-graph, K represents the length of the binary vector, and α represents the value of the binary vector.

[0076] After calculating the similarity between the first subgraph and the second subgraph, the similarity may be sent to the demander and the provider respectively, so that the demander and the provider can confirm the similarity respectively.

[0077] In one implementation, in order to further ensure security, the demander and the provider may encrypt the first set and the second set, the third set and the fourth set based on a secure hash algorithm before sending the ciphertext.

[0078] The first ciphertext may include a ciphertext consisting of the first set and the second set encrypted by the demander based on a secure hash algorithm, and the second ciphertext may include a ciphertext consisting of the third set and the fourth set encrypted by the provider based on a secure hash algorithm.

[0079] For example, H′ can be used to represent a secure hash algorithm, h0 can represent a first set, and h1 can represent a second set. Therefore, the first set encrypted based on the secure hash algorithm can be represented as:

[0080] C0=H′(h0)

[0081] The second set encrypted based on the secure hash algorithm can be expressed as:

[0082] C1=H′(h1)

[0083] In one embodiment, in order to further ensure security, the demander may also use the demander's private key to encrypt the first set and the second set, and the provider may send the third set and the fourth set to the demander, and the demander may encrypt them based on the demander's private key and send the encrypted third set and fourth set to the provider.

[0084] The encryption algorithm used by the demander using the demander's private key for the first set and the second set is not specifically limited in this specification. For example, it can be an RSA encryption algorithm.

[0085] Among them, the encryption and decryption process using the private key can be expressed as the following process, assuming that the plaintext data is m, the ciphertext data is c, the private key is (d, N), and the public key is (e, N).

[0086] Then the encryption process based on the private key is:

[0087] c=m d ,mod N

[0088] The decryption process based on the public key is:

[0089] m=c e ,mod N

[0090] For example, (d, N) can be used to represent the demander's private key, h0 can represent the first set, and h1 can represent the second set. Therefore, the first set encrypted based on the demander's private key can be expressed as:

[0091] K0=(h0) d ,mod N

[0092] The second set encrypted based on the demander's private key can be expressed as:

[0093] K1=(h1) d ,mod N

[0094] After encryption by the demander's private key, the demander and the provider can still use the secure hash algorithm again to encrypt the encrypted first set and the second set again to further ensure security.

[0095] For example, the first set encrypted based on the demander's private key and further encrypted using a secure hash algorithm can be expressed as:

[0096] K0=(h0) d ,mod N

[0097] C0=H′(K0)

[0098] In the above implementation, since the demander uses the private key of the data demander for encryption and the provider does not have the private key of the demander, the third set and the fourth set can only be sent to the demander for encryption by the demander using the private key of the demander.

[0099] In order to further ensure the data security of the provider, the provider can encrypt the random numbers by multiplying the random numbers in the third set and the fourth set, and encrypt the random numbers by the public key corresponding to the private key of the data demander. Therefore, after sending the encrypted third set and the fourth set to the demander, the demander cannot obtain the real information of the provider. At the same time, when the demander uses the demander's private key to encrypt, since the provider uses the public key to encrypt the random numbers, it is equivalent to the private key decrypting the random numbers. At the same time, the demander's private key encryption is implemented for the third set and the fourth set. The demander can further send the encrypted third set and the fourth set back to the provider, so that the provider can further decrypt the random numbers for the third set and the fourth set, and obtain the third set and the fourth set encrypted only by the demander's private key.

[0100] This ensures that the provider's data security is protected while the provider's data is encrypted using the demander's private key.

[0101] For example, h′0 may represent the third set, h′1 may represent the fourth set, (d, N) represents the demander's private key, (e, N) represents the public key corresponding to the demander's private key, and R represents a random number.

[0102] The provider multiplies the third set by a random number and encrypts the random number using the public key corresponding to the private key of the data demander, which can be expressed as:

[0103] Y0=h′0·(R) e ,mod N

[0104] The provider multiplies the fourth set by a random number and encrypts the random number using the public key corresponding to the private key of the data demander, which can be expressed as:

[0105] Y1=h′1·(R) e ,mod N

[0106] The demander can use the demander's private key to encrypt Y0 and Y1 respectively:

[0107] Y′0=(Y0) d ,mod N=h′0) d ·((R) e ) d ,mod N=h′0) d ·R, mod N

[0108] Y′1=(Y1) d ,mod N=(h′1) d ·((R) e ) d ,mod N=(h′1)d ·R, mod N

[0109] The demander can send the encrypted Y′0 and Y′1 to the provider, so that the provider can divide Y′0 and Y′1 by a random number to obtain data encrypted only by the demander's private key.

[0110] The third set encrypted based on the demander's private key can be expressed as:

[0111]

[0112] The fourth set encrypted based on the demander's private key can be expressed as:

[0113]

[0114] In the scheme recorded in the above embodiment, the ciphertext corresponding to the subgraph specified by the demander and the provider is obtained respectively, and the similarity is calculated based on the ciphertext. Since the ciphertext is composed of a set generated by the index values ​​corresponding to the first and second categories of values ​​in the binary vector, the data plaintext corresponding to the subgraph is not directly obtained during the similarity calculation, which better protects the privacy of the user. At the same time, since the subgraph corresponding to the knowledge graph is converted into a binary vector, only the index value corresponding to the value in the binary vector is calculated, which greatly reduces the computational cost when performing similarity calculation.

[0115] See also Figure 2 , Figure 2 It is an interactive schematic diagram of a privacy-preserving similarity calculation method provided by an exemplary embodiment.

[0116] like Figure 2 As shown, in step 201, the provider can send the third set and the fourth set encrypted based on random numbers to the demander. Among them, h′0 can be used to represent the third set, h′1 can be used to represent the fourth set, (d, N) represents the demander's private key, (e, N) represents the public key corresponding to the demander's private key, and R represents a random number. Y0 represents the third set encrypted by random numbers, and Y1 represents the fourth set encrypted by random numbers.

[0117] The provider may use the following formula to generate the third set and the fourth set encrypted based on random numbers, and send them to the demander.

[0118] Y0=h′0·(R) e ,mod N

[0119] Y1=h′1·(R) e ,mod N

[0120] In step 202, the demander can use the demander's private key to encrypt the third set and the fourth set encrypted with the random number, that is, the demander can use the demander's private key (d, N) to encrypt the above Y0 and Y1 to obtain Y′0 and Y′1.

[0121] The demander can use the following formula to encrypt the third set and the fourth set encrypted with random numbers.

[0122] Y′0=(Y0) d ,mod N=(h′0) d ·((R) e ) d ,mod N=(h′0) d ·R, mod N

[0123] Y′1=(Y1) d ,mod N=(h′1) d ·((R) e ) d ,mod N=(h′1) d ·R, mod N

[0124] In step 203, the demander sends the third set and the fourth set encrypted with the demander's private key to the provider, that is, the demander sends Y′0 and Y′1 to the provider.

[0125] Step 204: The provider uses the random number to perform decryption, and further encrypts the third set and the fourth set based on the secure hash algorithm to generate a second ciphertext. The provider can use the random number to perform decryption on Y′0 and Y′1 to obtain K′0 and K′1.

[0126] The provider may use the following formula to perform decryption based on random numbers for the third set and the fourth set.

[0127]

[0128]

[0129] The provider may also use a secure hash algorithm to obtain C′0 and C′1 for K′0 and K′1, and combine C′0 and C′1 into a second ciphertext C′=[C′0:C′1].

[0130] The provider may use the following formula to encrypt the third set and the fourth set based on a secure hash algorithm.

[0131] C′0=H′(K′0)

[0132] C′1=H′(K′1)

[0133] In step 205, the provider may send the second ciphertext to the service provider so that the service provider can calculate the similarity.

[0134] In step 206 , the demander may use the demander's private key and a secure hash algorithm to encrypt the first set and the second set to generate a first ciphertext.

[0135] Among them, h0 can be used to represent the first set, and h1 can be used to represent the second set. The demander can use the following formula to encrypt the first set and the second set.

[0136] K0=(h0) d ,mod N

[0137] K1=(h1) d ,mod N

[0138] The demander can also use a secure hash algorithm to obtain C0 and C1 for K0 and K1, and 01 The combination is the first ciphertext C = [C0:C1].

[0139] The provider may use the following formula to encrypt the first set and the second set based on a secure hash algorithm.

[0140] C0=H′(K0)

[0141] C1=H′(K1)

[0142] In step 207 , the provider may send the first ciphertext to the service provider so that the service provider can calculate the similarity.

[0143] In step 208, the service provider may calculate the similarity based on the first ciphertext and the second ciphertext. The service provider may use the value of the following formula as the similarity between the first ciphertext and the second ciphertext. Where S represents the similarity, K represents the length of the binary vector, and α represents the value of the binary vector.

[0144] n1=CountSame(C0,C′0)

[0145] n2=CountSame(C1,C′1)

[0146] S=α 3 *(2*n1+2*n2―K)

[0147] Corresponding to the embodiment of the privacy-preserving similarity calculation method, this specification also provides an embodiment of a privacy-preserving similarity calculation device.

[0148] See also Figure 3 , Figure 3 This is a hardware structure diagram of an electronic device in which a privacy-preserving similarity calculation device is located, which is shown as an exemplary embodiment. At the hardware level, the device includes a processor 302, an internal bus 304, a network interface 306, a memory 308, and a non-volatile memory 310, and of course may also include hardware required for other services. One or more embodiments of this specification can be implemented based on software, such as the processor 302 reading the corresponding computer program from the non-volatile memory 310 into the memory 308 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0149] See also Figure 4 , Figure 4 FIG. 1 is a block diagram of a privacy-preserving similarity calculation device shown in an exemplary embodiment. The privacy-preserving similarity calculation device can be applied to Figure 4 In the electronic device shown in the figure, the technical solution of this specification is implemented. Among them, the above-mentioned privacy protection similarity calculation device may include:

[0150] A privacy-preserving similarity calculation device, the device comprising:

[0151] The ciphertext acquisition unit 402 is used to acquire a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph, and to acquire a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph;

[0152] The first ciphertext is composed of a first set and a second set generated by index values ​​of the first type of values ​​and the second type of values ​​contained in the binary vector corresponding to the first subgraph in the binary vector respectively;

[0153] The second ciphertext is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector respectively; the binary vector is a vector composed of the first and second types of values ​​used to describe the subgraph;

[0154] A similarity calculation unit 404 is used to calculate the similarity between the first subgraph and the second subgraph based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, and send the similarity to the demander and the provider respectively.

[0155] In this embodiment, any one of the first sub-graph and the second sub-graph includes:

[0156] Specified entities and / or relations from the knowledge graph.

[0157] In this embodiment, the first ciphertext includes: a ciphertext consisting of the first set and the second set encrypted by the demander based on a secure hash algorithm;

[0158] The second ciphertext includes: a ciphertext consisting of the third set and the fourth set encrypted by the provider based on a secure hash algorithm.

[0159] In this embodiment, the first ciphertext includes: a ciphertext consisting of a first set encrypted by the demander based on a private key provided by the demander and the second set;

[0160] The second ciphertext includes: the ciphertext consisting of the third set and the fourth set sent by the provider to the demander and encrypted by the demander based on the demander's private key;

[0161] In this embodiment, the second ciphertext includes the third set and the fourth set encrypted based on random numbers and sent by the provider to the demander, and the ciphertext consisting of the third set and the fourth set encrypted by the demander based on the demander's private key and further decrypted by the provider based on random numbers.

[0162] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0163] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.

[0164] 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 manual 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 the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0165] This specification also provides an embodiment of a computer-readable storage medium. The computer-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, the privacy-preserving similarity calculation method provided in any embodiment of this specification can be implemented.

[0166] The computer-readable storage medium provided in the embodiments of this specification may specifically include, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical fiber card. That is, the readable storage medium includes a readable medium that can store or transmit information.

[0167] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0168] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0169] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0170] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0171] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0172] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0173] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0174] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0175] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A privacy-preserving similarity calculation method, characterized in that: The method comprises: Obtain a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph, and obtain a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph; The first ciphertext is composed of a first set and a second set generated by index values ​​of the first type of values ​​and the second type of values ​​contained in the binary vector corresponding to the first subgraph in the binary vector respectively; The second ciphertext is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector respectively; the binary vector is a vector composed of the first and second types of values ​​used to describe the subgraph; Based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, the similarity between the first subgraph and the second subgraph is calculated, and the similarity is sent to the demander and the provider respectively.

2. The method according to claim 1, characterized in that Any one of the first subgraph and the second subgraph comprises: Specified entities and / or relations from the knowledge graph.

3. The method according to claim 1, characterized in that The first ciphertext includes: a ciphertext consisting of the first set and the second set encrypted by the demander based on a secure hash algorithm; The second ciphertext includes: a ciphertext consisting of the third set and the fourth set encrypted by the provider based on a secure hash algorithm.

4. The method according to claim 1, characterized in that The first ciphertext includes: a ciphertext consisting of a first set encrypted by the demander based on a private key provided by the demander and the second set; The second ciphertext includes: the ciphertext consisting of the third set and the fourth set sent by the provider to the demander and encrypted by the demander based on the demander's private key.

5. The method according to claim 4, characterized in that The second ciphertext includes the third set and the fourth set encrypted based on random numbers and sent by the provider to the demander, and the ciphertext consisting of the third set and the fourth set encrypted by the demander based on the demander's private key and further decrypted by the provider based on random numbers.

6. A privacy-preserving similarity calculation device, characterized in that: The device comprises: A ciphertext acquisition unit, used to acquire a first ciphertext corresponding to a first subgraph specified by a demander in a first knowledge graph, and to acquire a second ciphertext corresponding to a second subgraph specified by a provider in a second knowledge graph; The first ciphertext is composed of a first set and a second set generated by index values ​​of the first type of values ​​and the second type of values ​​contained in the binary vector corresponding to the first subgraph in the binary vector respectively; The second ciphertext is composed of a third set and a fourth set generated by index values ​​of the first and second types of values ​​contained in the binary vector corresponding to the second subgraph in the binary vector respectively; the binary vector is a vector composed of the first and second types of values ​​used to describe the subgraph; A similarity calculation unit is used to calculate the similarity between the first subgraph and the second subgraph based on a first number of equal index values ​​in the first set and the third set, and a second number of equal index values ​​in the second set and the fourth set, and send the similarity to the demander and the provider respectively.

7. The device according to claim 6, characterized in that Any one of the first subgraph and the second subgraph comprises: Specified entities and / or relations from the knowledge graph.

8. The device according to claim 6, characterized in that The first ciphertext includes: a ciphertext consisting of the first set and the second set encrypted by the demander based on a secure hash algorithm; The second ciphertext includes: a ciphertext consisting of the third set and the fourth set encrypted by the provider based on a secure hash algorithm.

9. The device according to claim 6, characterized in that The first ciphertext includes: a ciphertext consisting of a first set encrypted by the demander based on a private key provided by the demander and the second set; The second ciphertext includes: the ciphertext consisting of the third set and the fourth set sent by the provider to the demander and encrypted by the demander based on the demander's private key.

10. The device according to claim 9, characterized in that The second ciphertext includes the third set and the fourth set encrypted based on random numbers and sent by the provider to the demander, and the ciphertext consisting of the third set and the fourth set encrypted by the demander based on the demander's private key and further decrypted by the provider based on random numbers.

11. An electronic device, characterized in that: It includes a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the method according to any one of claims 1 to 5 by calling the machine-readable instructions.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by the processor, the method according to any one of claims 1 to 5 is implemented.