WO2024031886A1 - 一种数据匹配方法、装置、系统、设备及介质 - Google Patents
一种数据匹配方法、装置、系统、设备及介质 Download PDFInfo
- Publication number
- WO2024031886A1 WO2024031886A1 PCT/CN2022/137361 CN2022137361W WO2024031886A1 WO 2024031886 A1 WO2024031886 A1 WO 2024031886A1 CN 2022137361 W CN2022137361 W CN 2022137361W WO 2024031886 A1 WO2024031886 A1 WO 2024031886A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- vector
- encryption
- data
- target
- distance
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/008—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols involving homomorphic encryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/04—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
- H04L63/0428—Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
- H04L9/0825—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using asymmetric-key encryption or public key infrastructure [PKI], e.g. key signature or public key certificates
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
Definitions
- the present application relates to the field of data processing technology, and in particular, to a data matching method, device, system, equipment and medium.
- Secure intersection refers to identifying the intersection of data from both parties, for example, identifying the shared users of organization A and organization B.
- Secure intersection is also the first step in vertical federated learning. That is to say, first identify the mobile phone number and identity. Key information such as certificate number and business license number are securely exchanged before proceeding to the next step of joint modeling and other steps.
- This application provides a data matching method, device, system, equipment and medium to solve the problem that the secure intersection algorithm in the existing technology can only perform secure intersection when the data of both parties are exactly the same, and the usage scenarios are limited, which affects data matching. business scope issues.
- this application provides a data matching method, which is applied to the first device.
- the method includes:
- the second encryption vector is a semi-homomorphic second vector using the first target public key. Obtained after encryption; the second vector is obtained by inputting the second data into the pre-trained vector transformation model in the second device;
- this application provides a data matching method, applied to the second device, the method includes:
- Receive the first target public key and the first encryption vector sent by the first device use the first target public key to semi-homomorphically encrypt the second vector to generate a second encryption vector; wherein, the first encryption vector It is obtained by semi-homomorphically encrypting the first vector using the first target public key.
- the first vector is obtained by inputting the first data into the pre-trained vector transformation model in the first device. of;
- the first target private key corresponding to the first target public key is used to determine the target distance between the first vector and the second vector; and the first device is determined based on the target distance and the preset first distance threshold. Whether the first data and the second data match.
- this application provides a data matching device, which is applied to the first device.
- the device includes:
- a first acquisition module configured to input the first data to be matched into the pre-trained vector transformation model, and obtain the first vector corresponding to the first data
- the first processing module is configured to use the first target public key generated by itself to perform semi-homomorphic encryption on the first vector to generate a first encryption vector, and send the first target public key and the first encryption vector to Secondary equipment;
- the first acquisition module is also used to acquire the first encryption distance calculated based on the first encryption vector and the second encryption vector sent by the second device, and the second encryption vector is calculated using the first target.
- the second vector is obtained by semi-homomorphically encrypting the second vector with the public key; the second vector is obtained by inputting the second data into the pre-trained vector conversion model in the second device;
- a first determination module configured to determine the target distance of the first vector and the second vector based on the first encryption distance and the first target private key corresponding to the first target public key; based on the target distance and a preset first distance threshold to determine whether the first data and the second data match.
- this application provides a data matching device, applied to the second device, the device includes:
- the second acquisition module is used to input the second data to be matched into the pre-trained vector transformation model, and obtain the second vector corresponding to the second data;
- the second processing module is configured to receive the first target public key and the first encryption vector sent by the first device, and use the first target public key to perform semi-homomorphic encryption on the second vector to generate a second encryption vector; wherein , the first encrypted vector is obtained by semi-homomorphically encrypting the first vector using the first target public key, and the first vector is pre-trained by inputting the first data into the first device. Obtained from the completed vector transformation model;
- a second determination module configured to calculate a first encryption distance based on the first encryption vector and the second encryption vector, and send the first encryption distance to the first device, so that the first device can calculate the first encryption distance based on the first encryption vector and the second encryption vector.
- the first encryption distance and the first target private key corresponding to the first target public key determine the target distance of the first vector and the second vector; and make the first device based on the target distance and the preset a first distance threshold to determine whether the first data and the second data match.
- this application provides a data matching system, which includes:
- the first device is configured to input the first data to be matched into the pre-trained vector conversion model to obtain the first vector corresponding to the first data; and use the first target public key generated by itself to pair the first Perform semi-homomorphic encryption on the vector to generate a first encryption vector, and send the first target public key and the first encryption vector to the second device;
- the second device is used to input the second data to be matched into the pre-trained vector transformation model, obtain the second vector corresponding to the second data; and receive the first target sent by the first device public key and the first encryption vector, using the first target public key to semi-homomorphically encrypt the second vector to generate a second encryption vector; calculate the first encryption distance based on the first encryption vector and the second encryption vector , sending the first encryption distance to the first device;
- the first device is further configured to determine the target distance of the first vector and the second vector based on the first encryption distance and the first target private key corresponding to the first target public key; based on the The target distance and the preset first distance threshold determine whether the first data and the second data match.
- the present application provides an electronic device.
- the electronic device includes a processor and a memory.
- the memory is used to store program instructions.
- the processor is used to implement any of the above when executing the computer program stored in the memory. Describe the steps of the data matching method.
- the present application provides a computer-readable storage medium that stores a computer program that implements the steps of any of the above data matching methods when executed by a processor.
- the first data and the second data to be matched can be input into the vector transformation model that has been trained in advance, and the first vector corresponding to the first data and the second vector corresponding to the second data can be obtained.
- vector and obtain the first encrypted vector encrypted based on the first vector, and the second encrypted vector encrypted based on the second vector, calculate the first encryption distance based on the first encrypted vector and the second encrypted vector, and calculate the first encryption distance based on the first encrypted vector.
- the encryption distance and the first target private key are used to determine the target distance between the first vector and the second vector.
- the first data and the second data match Based on the target distance and the preset first distance threshold, it is determined whether the first data and the second data match, that is, the first data can be
- fuzzy matching between the first data and the second data can also be achieved, broadening the usage scenarios, and the first target public key and the first target private key are introduced during the fuzzy matching process.
- Semi-homomorphic encryption and decryption realizes safe intersection and ensures the security of the matching process.
- neither the first data nor the second data leaves the corresponding first device and device in the form of original data.
- the second device ensures the security of the first data and the second data, and enables fuzzy matching of the original data without leaving the database, further ensuring the security of the matching process.
- Figure 1 is a schematic diagram of a data matching process provided by an embodiment of the present application.
- Figure 2 is a schematic diagram of the second data matching process provided by the embodiment of the present application.
- Figure 3 is a schematic diagram of the third data matching process provided by the embodiment of the present application.
- Figure 4 is a schematic structural diagram of a data matching device provided by some embodiments of the present application.
- Figure 5 is a schematic structural diagram of another data matching device provided by some embodiments of the present application.
- Figure 6 is a schematic structural diagram of a data matching system provided by some embodiments of the present application.
- Figure 7 is a schematic structural diagram of an electronic device provided by some embodiments of the present application.
- embodiments of the present application provide a data matching method, device, system, equipment, and medium.
- module means any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic or combination of hardware or/and software code capable of performing the functions associated with that element.
- Figure 1 is a schematic diagram of the first data matching process provided by the embodiment of the present application. The process includes the following steps:
- S101 Input the first data to be matched into the pre-trained vector transformation model, and obtain the first vector corresponding to the first data.
- the data matching method provided by the embodiment of the present application is applied to an electronic device (for convenience of description, referred to as the first device).
- the first device may be a smart terminal, a PC, a server, or other devices.
- a pre-trained vector transformation model is deployed in the first device.
- the pre-trained vector transformation model is used to obtain the data to be matched.
- Corresponding vectors, and for different data, the dimensions of the vectors output by the pre-trained vector transformation model can be the same.
- the first data in order to obtain the first vector (for the convenience of description, the data to be matched stored in the first device is called the first data) corresponding to the first data to be matched (for the convenience of description, the The vector corresponding to the first data is called the first vector)
- the first data can be input into the pre-trained vector transformation model, and the pre-trained vector transformation model can output the first vector corresponding to the first data
- each component in the first vector can be a number, that is, the first data can be quantified through the pre-trained vector transformation model.
- the first data "a canteen in Qingmou, Dongxin District, Xinhai City” can be input into the pre-trained word vector model.
- the first vector corresponding to the outputted first data "a small shop in Qing, Dongxin District, Hai City” may be (1.0, 2.0, 1.5, 2.0, 3.5).
- S102 Use the self-generated first target public key to perform semi-homomorphic encryption on the first vector to generate a first encryption vector, and send the first target public key and the first encryption vector to the second device.
- the first device can generate a first target public-private key pair, wherein the first target public-private key pair includes the first target public key and the first target private key (for For convenience of description, the public key generated by the first device is called the first target public key, and the private key generated by the first device is called the first target private key).
- the first target public and private key pair may be a semi-homomorphic encryption public and private key pair, that is, the first target public key may be a semi-homomorphic encryption public key, and the first target private key may be a semi-homomorphic encryption private key.
- the first device may perform semi-homomorphic encryption on the first vector according to the first target public key generated by itself to generate the first encryption vector.
- the first target public and private key pair may be a symmetric public and private key pair or an asymmetric public and private key pair, and the target public and private key pair may be set according to requirements.
- the process of generating the first target public-private key pair is an existing technology and will not be described in detail here.
- the second device since the second data to be matched with the first data is obtained by the second device, in order to facilitate subsequent determination of the first vector corresponding to the first data and the second vector corresponding to the second data
- the first device can send the first target public key and the first encryption vector to the second device, and the second device can half-process the second vector corresponding to the second data based on the first target public key.
- Homomorphic encryption generates a second encryption vector.
- S103 Obtain the first encryption distance calculated based on the first encryption vector and a second encryption vector sent by the second device.
- the second encryption vector is a half-processed second vector using the first target public key. Obtained after homomorphic encryption; the second vector is obtained by inputting the second data into the pre-trained vector transformation model in the second device; based on the first encryption distance and the first The first target private key corresponding to the target public key determines the target distance between the first vector and the second vector.
- a pre-trained vector transformation model is also deployed in the second device to obtain the second data to be matched (for convenience of description , the data to be matched in the second device is called the second data) corresponding to the second vector (for convenience of description, the vector corresponding to the second data is called the second vector).
- the second data can be input into a pre-trained vector transformation model, and the pre-trained vector transformation model can output a second vector corresponding to the second data, and the second device can output the second vector based on the received first
- the first target public key sent by the device performs semi-homomorphic encryption on the second vector to obtain the second encrypted vector.
- the second device may target each first encryption component in the first encryption vector and each second encryption component in the second vector.
- component and each second encrypted component in the second encrypted vector determine the first encrypted square component of the first encrypted component, the encrypted first encrypted component and the corresponding second component through a semi-homomorphic encryption algorithm.
- product, and the corresponding second encrypted square component of the second encrypted component based on the first encrypted square component, the product and the second encrypted square component, determine the encrypted sub-distance corresponding to the first encrypted component; and can Based on the encrypted sub-distance corresponding to each first encryption component, a first encryption distance between the first encryption vector and the second encryption vector is determined.
- the process of determining the first encryption distance of the first encryption vector and the second encryption vector provided by the embodiment of the present application is explained below in the form of a formula.
- the first vector corresponding to the first data U1 is (x 1 , x 2 , x 3 ..., x m )
- the second vector corresponding to the second data U5 is (y 1 , y, y 3 ... ..., y m ).
- the first device generates a first target public-private key pair A(pka1, ska1), where pka1 is the first target public key and ska1 is the first target private key, and performs semi-identification on the first vector based on the first target public key.
- Morphic encryption generates a first encrypted vector. For example, for each first component in the first vector, semi-homomorphic encryption can be performed on each first component in the first vector based on the first target public key to generate First encryption vector.
- the first encrypted vector corresponding to the first vector (x 1 , x 2 , x 3 ..., x m ) is (E pka1 (x 1 ), E pka1 (x 2 ), E pka1 (x 3 ) ..., E pka1 (x m )).
- the first encryption vector contains m first encryption components E pka1 ( xi ), where i is any positive integer not greater than m.
- the first device may send the first encryption vector and the first target public key to the second device.
- the second device After receiving the first target public key and the first encryption vector sent by the first device, the second device can perform semi-homomorphic encryption on the second vector based on the first target public key to obtain the second encryption vector. For example, for each second component in the second vector, semi-homomorphic encryption can be performed on each second component in the second vector based on the first target public key to generate a second encrypted vector.
- the second encrypted vector corresponding to the second vector (y 1 , y 2 , y 3 ..., y m ) is (E pka1 (y 1 ), E pka1 (y 2 ), E pka1 (y 3 ) ..., E pka1 (y m )), the second vector contains m second components y i , and the second encrypted vector contains m second encrypted components E pka1 (y i ), where i is any one not greater than m Positive integer.
- the second device may determine a first encryption square component of the first encryption component: E pka1 (x i2 ) .
- the second device can also determine the encrypted first encrypted component and the corresponding second encrypted component through a semi-homomorphic encryption algorithm.
- the second device may also determine the second encrypted square component of the corresponding second encrypted component: E pka1 (y i 2 ).
- the process of determining the product of the encrypted first encryption component and the corresponding second encryption component can be as follows:
- the encrypted exponential power is determined, wherein the base of the exponential power can be the first encryption component, and the exponent of the exponential power can be the corresponding second component.
- an exponential power can be The exponential power may be used to determine the product of the first encrypted component encrypted based on the semi-homomorphic encryption algorithm and the corresponding second component. Among them, how to determine the product of the first encryption component and the corresponding second component (E pka1 (x i y i )) based on the exponential power will be described in detail later, and will not be described in detail here.
- the method can be based on the first encrypted square component Epka1 (x i 2 ) corresponding to the first encrypted component, the encrypted first encrypted component and the corresponding product of second encryption components And the second encrypted square component E pka1 (y i 2 ), determine the encrypted sub-distance corresponding to the first encrypted component:
- the sum of the encrypted sub-distances corresponding to each first encryption component can be determined as the first encryption distance between the first encryption vector and the second encryption vector:
- the second device may send the first encryption distance to the first device.
- the first device can decrypt the first encryption distance according to the first target private key in the first target private key pair generated by the first device, and determine the first vector and the second vector. target distance.
- the first device can decrypt the first encryption distance according to the first target private key to obtain
- E pka1 (xi ) can be regarded as the operation of the first exponential power operation, that is where g can be any base.
- the semi-homomorphic encryption algorithm can be based on exponential power Determine the product of the encrypted first component and the corresponding second component (E pka1 (x i y i )), and the first device can then decrypt the first encryption distance according to the first target private key, and obtain The first device may calculate the target distance between the first vector and the second vector based on the decrypted first encrypted distance and the Euclidean distance formula. For example, the target distance between the first vector and the second vector.
- x i is the i-th component in the first vector
- y i is the i-th component in the second vector
- m is the number of components contained in the first vector or the second vector
- the first vector The number of components contained in is the same as the number of components contained in the second component, that is, the length of the first vector is equal to the length of the second vector.
- the lengths of the first vector and the second vector can both be the preset length m, m can be any positive integer.
- the distance between the first vector and the second vector can also be determined based on the cosine distance formula or the Hamming distance formula, which will not be described again here.
- the embodiment of the present application also provides another way to determine the first encryption distance.
- the first encryption distance can also be obtained by using the following process:
- the second device For each first encrypted component E pka1 (xi ) in the first encrypted vector, each second component yi in the second vector and each second encrypted component E pka1 (y i ), the second device can determine the product of the encrypted first encryption component and the corresponding second component through a semi-homomorphic encryption algorithm. and the corresponding second encrypted square component E pka1 (y i 2 ) of the second encrypted component; the second device can be based on this product And the second encrypted square component E pka1 (y i 2 ), determine the encrypted sub-distance corresponding to the first encrypted component:
- the encrypted exponential power can be determined through a semi-homomorphic encryption algorithm, where the exponent The base of the power is the first encrypted component, and the exponent of the exponential power is the corresponding second component; the exponential power is used to determine the product of the first encrypted component and the corresponding second component after encryption based on the semi-homomorphic encryption algorithm , which will not be described in detail here.
- the second device may send the encrypted sub-distance b to the first device, and the first device may determine the first encrypted component E pka1 (xi ) for each first encrypted component in the first encrypted vector.
- An encrypted square component E pka1 (x i 2 ) can be based on the first encrypted square component E pka1 (x i 2 ) and the encrypted sub-distance Update the encrypted sub-distance corresponding to the first encrypted component.
- the encrypted sub-distance can be updated as:
- the first device may determine an updated first encryption distance of the first encryption vector and the second encryption vector based on the updated sub-distance corresponding to each first encryption component.
- the sum of the updated sub-distances corresponding to each first encryption component can be determined as the updated first encryption distance between the first encryption vector and the second encryption vector:
- the first device may calculate the updated first encryption distance based on the first target private key in the first target private key pair generated by the first device. Decryption is performed to determine the target distance of the first vector and the second vector.
- the first device can decrypt the updated first encryption distance according to the first target private key to obtain
- the target distance between the first vector and the second vector can be calculated based on the decrypted first encrypted distance and the Euclidean distance formula. For example, the target distance between the first vector and the second vector. I won’t go into details here.
- S104 Based on the target distance and the preset first distance threshold, determine whether the first data and the second data match.
- the target distance in order to determine whether the first data and the second data match, after determining the target distance between the first vector and the second vector, the target distance can be compared with a preset first distance threshold. A comparison is performed, and based on the comparison result, it is determined whether the first data and the second data match. For example, it can be determined whether the target distance between the first vector and the second vector is less than the preset first distance threshold. If the target distance between the first vector and the second vector is less than the preset first distance threshold, Then it can be considered that the first data matches the second data. And if the target distance between the first vector and the second vector is not less than the preset first distance threshold, it can be determined that the first data and the second data do not match.
- the preset first distance threshold can be 1, or 1.5, etc.
- This application does not specifically limit the first distance threshold, and can be flexibly set according to needs. Wherein, the smaller the target distance between the first vector and the second vector, the closer the first vector and the second vector match.
- the target distance between the first vector and the second vector is equal to a preset second distance threshold. If the target distance If the distance is equal to the preset second distance threshold, the first data and the second data can be considered to be the same, that is, the first data and the second data completely match.
- the second distance threshold may be smaller than the first distance threshold, and the second distance threshold may be 0.
- the first data and the second data to be matched can be input into the vector transformation model that has been trained in advance, and the first vector corresponding to the first data and the second vector corresponding to the second data can be obtained.
- vector and obtain the first encrypted vector encrypted based on the first vector, and the second encrypted vector encrypted based on the second vector, calculate the first encryption distance based on the first encrypted vector and the second encrypted vector, and calculate the first encryption distance based on the first encrypted vector.
- the encryption distance and the first target private key are used to determine the target distance between the first vector and the second vector.
- the first data and the second data match Based on the target distance and the preset first distance threshold, it is determined whether the first data and the second data match, that is, the first data can be
- fuzzy matching between the first data and the second data can also be achieved, broadening the usage scenarios, and the first target public key and the first target private key are introduced during the fuzzy matching process.
- Semi-homomorphic encryption and decryption realizes safe intersection and ensures the security of the matching process.
- neither the first data nor the second data leaves the corresponding first device and device in the form of original data.
- the second device ensures the security of the first data and the second data, and enables fuzzy matching of the original data without leaving the database, further ensuring the security of the matching process.
- the first data to be matched is input into the vector transformation model that has been trained in advance, and the first vector is obtained.
- the first vector corresponding to a piece of data includes:
- the first data is input into the pre-trained first target vector transformation model to obtain the first vector corresponding to the first data.
- the first data to be matched can be text data.
- the first data can be name, gender, address, etc., or it can be numeric data.
- the first data can be an ID card. Number, bank card number, admission ticket number, etc., can also be image data.
- the first data can be an image used for face recognition, etc. Therefore, in order to obtain the corresponding third data for the first data of different data types.
- the pre-trained vector transformation models of a vector may also be different.
- the corresponding relationship between the data type and the pre-trained vector transformation model can be stored in the first device, and according to the first target data type corresponding to the obtained first data to be matched, the corresponding pre-trained vector transformation model can be used.
- the vector transformation model obtains the first vector corresponding to the first data; wherein the corresponding pre-trained vector transformation model is also the pre-trained first target vector transformation model.
- this application does not specifically limit the first target data type corresponding to the first data.
- the first target data type may be a text type, a numeric type, or an image type, etc.
- this application does not specifically limit the vector conversion model corresponding to the data type, and can be flexibly set according to needs.
- the pre-trained first target vector conversion model corresponding to the first target data type can be a word vector model or a sentence vector model; if the first target data type is a numeric type, then the first target data type
- the corresponding first target vector conversion model that has been trained in advance can be a One-Hot encoding model; if the first target data type is an image type, the first target vector conversion model that has been pre-trained corresponding to the first target data type is A target vector transformation model may be an image vector model.
- the first target can be determined based on the correspondence between the pre-saved data type and the pre-trained vector transformation model.
- the first target vector conversion model that has been pre-trained corresponding to the data type.
- the first target vector conversion model can be a word vector model or a sentence vector model, and can be obtained based on the pre-trained word vector model or sentence vector model.
- the first vector corresponding to the first data can be a word vector model or a sentence vector model.
- the first data is digital data, that is, the first target data type of the first data is a digital type
- a pre-trained first target vector conversion model corresponding to the first target data type can be determined.
- the first target vector conversion model can be a pre-trained One-Hot encoding model, and can be based on the pre-trained One-Hot encoding model. Hot coding model obtains the first vector corresponding to the first data.
- the first data is image data, that is, the first target data type of the first data is an image type
- a pre-trained first target vector transformation model corresponding to the first target data type can be determined.
- the first target vector transformation model can be a pre-trained image vector model (image vector embedding model), and can be based on the pre-trained Complete the image vector model and obtain the first vector corresponding to the first data.
- the dimension of the vector output by the pre-trained vector conversion model is 5 and the pre-trained vector conversion model is a word vector model as an example for explanation.
- the first data is text data, and the first data is "a canteen of Qing in a certain Dong New District of a sea city", then input "a canteen of a certain Qing in a certain east new district of a sea city” into the pre-trained word vector model and output
- the first vector corresponding to "a canteen in Qing, Dongxin District, Hai City” can be (1.0, 2.0, 1.5, 2.0, 3.5).
- the corresponding one-hot encoding can be set in advance for each number. For example, if the number contains 0-9, then among the numbers 0-9, the unique number corresponding to 0
- the hot code is 0000000001
- the one-hot code corresponding to 1 is 0000000010
- the one-hot code corresponding to 2 is 0000000100
- the one-hot code corresponding to 3 is 0000001000
- the one-hot code corresponding to 4 is 0000010000
- the one-hot code corresponding to 5 is 0000100000
- the one-hot encoding corresponding to 6 is 0001000000
- the one-hot encoding corresponding to 7 is 0010000000
- the one-hot encoding corresponding to 8 is 0100000000
- the one-hot encoding corresponding to 9 is 1000000000.
- the digital data is input into the One-Hot encoding model, and each first component in the first vector output by the One-Hot encoding model is the one-hot en
- the first data is digital data and the digital data is "12345”
- the digital data is "12345”
- "12345” is input into the pre-trained word vector model, and the first vector corresponding to the output "12345” is (0000000010 , 0000000100, 0000001000, 0000010000, 0000100000).
- each data and the corresponding annotation vector of the data can be pre-annotated, each data and the corresponding annotation vector can be input into the original vector transformation model, and the prediction vector output by the original vector transformation model can be and the corresponding annotation vector, adjust the parameters of the original vector transformation model, and when the convergence conditions are met, it is determined that the training of the vector transformation model is completed.
- the method also includes:
- the target distance is sent to the second device, so that the second device determines whether the first data and the second data match based on the target distance and a preset first distance threshold.
- the first device may send the determined target distance of the first vector and the second vector to the second device, After receiving the target distance of the first vector and the second vector sent by the first device, the second device may determine whether the first data and the second data match based on the target distance and the preset first distance threshold.
- the process by which the second device determines whether the first data and the second data match may be the same as the process by which the first device determines whether the first data and the second data match in the above embodiment, which will not be described again here.
- the first device determines whether the first data and the second data match, and after obtaining a matching result of whether the first data and the second data match, the matching result can be sent to the second device.
- the second device can compare the matching result determined by the first device with the matching result determined by itself to further improve accuracy.
- the second device may not perform the process of determining whether the first data and the second data match and obtain the matching result, but directly use the matching result determined by the first device, thereby saving energy consumption. .
- the first device may input the first data to be matched into a pre-trained vector transformation model deployed in the first device, and obtain a first vector corresponding to the first data.
- the second device can input the second data to be matched into the pre-trained vector transformation model deployed in the second device to obtain the second vector corresponding to the second data.
- the first vector corresponding to the first data U1 is (x 1 , x 2 , x 3 ..., x m )
- the second vector corresponding to the second data U5 is (y 1 , y, y 3 ..., y m ).
- the first device generates a first target public-private key pair A(pka1, ska1), where pka1 is the first target public key and ska1 is the first target private key, and performs semi-identification on the first vector based on the first target public key.
- State-of-the-art encryption generates the first encryption vector.
- the first encryption vector corresponding to the first vector (x 1 , x 2 , x 3 ..., x m ) is (E pka1 (x 1 ), E pka1 (x 2 ), E pka1 (x 3 )..., E pka1 (x m )), and sends the first encryption vector and the first target public key to the second device.
- the second device After receiving the first target public key and the first encryption vector sent by the first device, the second device performs semi-homomorphic encryption on the second vector based on the first target public key to obtain the second encryption vector.
- the second encrypted vector corresponding to the second vector (y 1 , y, y 3 ..., y m ) is (E pka1 (y 1 ), E pka1 (y 2 ), E pka1 (y 3 ) ... ..., E pka1 (y m ))
- the second device determines the first encryption distance based on the second encryption vector and the received first encryption vector and sends the first encryption distance to the first device.
- the first device receives the first encryption distance Then, decrypt the first encrypted distance according to the first target private key corresponding to the first target public key generated by itself to determine the target distance between the first vector and the second vector.
- the first device may determine whether the first data matches the second data based on the target distance and the preset first distance threshold, and the first device may send the target distance of the first vector and the second vector to the second device.
- the second device can determine whether the first data and the second data match according to the target distance between the second vector and the first vector and the preset first distance threshold.
- the method further includes:
- a second encryption distance is calculated based on the third encryption vector and the fourth encryption vector, and the second encryption distance is sent to the second device, so that the second device is based on the second encryption distance and the second target private key corresponding to the second target public key, determine the target distance of the first vector and the second vector, and enable the second device to based on the target distance and the preset first A distance threshold is used to determine whether the first data and the second data match.
- the second device in order to enable the second device to also determine the target distance of the first vector and the second vector without relying on the first device to send the determined target distance to the second device, further improving security , can generate a second target public-private key pair, wherein the second target public-private key pair includes the second target public key and the second target private key (for convenience of description, the public key generated by the second device is called The second target public key, the private key generated by the second device is called the second target private key).
- the second target public and private key pair can be a semi-homomorphic encryption public and private key pair, that is, the second target public key can be a semi-homomorphic encryption public key, and the second target private key can be a semi-homomorphic encryption private key.
- the second device may perform semi-homomorphic encryption on the second vector according to the second target public key generated by itself to generate a third encrypted vector.
- the second target public and private key pair may be a symmetric public and private key pair or an asymmetric public and private key pair, and the target public and private key pair may be set according to requirements.
- the process of generating the second target public-private key pair is an existing technology and will not be described in detail here.
- the second device may send the third encryption vector and the second target public key generated by the second device to the first device.
- the first device may perform semi-homomorphic encryption on the first vector based on the second target public key to generate a fourth encryption vector.
- the first device may also calculate the second encryption distance based on the third encryption vector and the fourth encryption vector, where the process of calculating the second encryption distance is similar to the process of calculating the first encryption distance. For example:
- the first device may target each third encryption component in the third encryption vector, each fourth component in the fourth vector, and each fourth encryption component in the fourth encryption vector. , through the semi-homomorphic encryption algorithm, determine the fourth encrypted square component of the fourth encrypted component, the product of the encrypted fourth component and the corresponding third encrypted component, and the third encrypted square of the corresponding third encrypted component. component; based on the fourth encrypted square component, the product and the third encrypted square component, determine the encrypted sub-distance corresponding to the fourth encrypted component; and may be based on the encrypted sub-distance corresponding to each fourth encrypted component , determine the second encryption distance between the third encryption vector and the fourth encryption vector.
- the process of determining the second encryption distance provided by the embodiment of the present application is explained below in the form of a formula.
- the first vector corresponding to the first data U1 is (x 1 , x 2 , x 3 ..., x m )
- the second vector corresponding to the second data U2 is (y 1 , y, y 3 ... ..., y m ).
- the second device generates a second target public-private key pair B(pka2, ska2), where pka2 is the second target public key and ska2 is the second target private key, and performs semi-identification on the second vector based on the second target public key.
- State encryption generates a third encryption vector.
- the third encryption vector corresponding to the second vector (y 1 , y , y 3 ..., y m ) is (E pka2 (y 1 ), E pka2 (y 2 ), E pka2 (y 3 )..., E pka2 (y m )), the third encryption vector contains m third encryption components E pka2 (x i ), where i is any positive integer not greater than m.
- the second device may send the third encryption vector and the second target public key to the first device.
- the first device can perform semi-homomorphic encryption on the first vector based on the second target public key to obtain a fourth encryption vector.
- the first vector (x 1 , x 2 , x 3 ..., x m )
- the corresponding fourth encrypted vector is (E pka2 (x 1 ), E pka2 (x 2 ), E pka2 (x 3 ) ... , E pka2 (x m ))
- the fourth encryption vector contains m fourth encryption components E pka2 (x i ), where i is any positive integer not greater than m.
- the first device may determine a fourth encryption square component of the fourth encryption component: E pka2 (x i2 ) .
- the first device may also determine the product of the encrypted fourth component and the corresponding third encrypted component, and the corresponding third encrypted component.
- the third encrypted square component of the component E pka2 (y i 2 ).
- the product of the fourth component and the corresponding third encryption component can be determined by using the semi-homomorphic encryption algorithm provided in the above embodiment to determine the product of the first encryption component and the corresponding second component.
- the base of the exponential power can be the third encryption component, and the exponent of the exponential power is the corresponding fourth component x i ; the exponential power is used to determine the difference between the fourth component encrypted based on the semi-homomorphic encryption algorithm and the corresponding
- the product of the third encryption component will not be described again here.
- each fourth encryption component it can be based on the fourth encryption square component E pka2 (x i 2 ) corresponding to the fourth encryption component, the fourth component and the corresponding third encryption component. product of And the third encrypted square component E pka2 (y i 2 ), determine the encrypted sub-distance corresponding to the fourth encrypted component:
- the sum of the encrypted sub-distances corresponding to each fourth encryption component can be determined as the second encryption distance between the third encryption vector and the fourth encryption vector:
- the first device may send the second encryption distance to the second device.
- the second device may decrypt the second encryption distance according to the second target private key in the second target private key pair generated by the second device itself to determine the first vector and the second encryption distance. Two vector target distance.
- the second device can decrypt the second encryption distance according to the second target private key to obtain
- the target distance between the first vector and the second vector can be calculated based on the decrypted second encryption distance and the Euclidean distance formula.
- the target distance between the first vector and the second vector x i is the i-th component in the first vector
- y i is the i-th component in the second vector
- m is the number of components contained in the first vector or the second vector
- the first vector The number of components contained in is the same as the number of components contained in the second component, that is, the length of the first vector is equal to the length of the second vector.
- the lengths of the first vector and the second vector can both be the preset length m
- m can be any positive integer.
- the embodiment of the present application also provides another way to determine the second encryption distance.
- the second encryption distance can also be obtained by using the following process:
- the first device may determine that the fourth component corresponds to The product of the third encryption component of and the corresponding fourth encrypted square component E pka2 (x i 2 ) of the fourth encrypted component; the first device can be based on this product And the fourth encrypted square component E pka2 (x i 2 ), determine the encrypted sub-distance corresponding to the fourth encrypted component:
- the first device may send the encrypted sub-distance a to the second device, and the second device may determine the third encrypted component E pka2 (y i ) for each third encrypted component in the third encrypted vector.
- Three encrypted square components E pka2 (y i 2 ) can be based on the third encrypted square component E pka2 (y i 2 ) and the encrypted sub-distance
- the encrypted sub-distance corresponding to the fourth encrypted component is updated.
- the encrypted sub-distance can be updated as:
- the second device may determine an updated second encryption distance of the third encryption vector and the fourth encryption vector based on the updated sub-distance corresponding to each fourth encryption component.
- the sum of the updated sub-distances corresponding to each fourth encryption component can be determined as the updated second encryption distance of the third encryption vector and the fourth encryption vector:
- the second device may decrypt the updated second encryption distance based on the second target private key to determine the relationship between the first vector and the second vector. target distance. For example, the second device can decrypt the second encryption distance according to the second target private key to obtain The target distance between the first vector and the second vector can be calculated based on the decrypted second encryption distance and the Euclidean distance formula. For example, the target distance between the first vector and the second vector.
- x i is the i-th component in the first vector
- y i is the i-th component in the second vector
- m is the number of components contained in the first vector or the second vector
- the first vector The number of components contained in is the same as the number of components contained in the second component, that is, the length of the first vector is equal to the length of the second vector.
- the lengths of the first vector and the second vector can both be the preset length m, m can be any positive integer.
- the second device After the second device determines the target distance between the first vector and the second vector, it may also determine whether the first data and the second data match based on the target distance and the preset first distance threshold, wherein the second device determines whether the first data matches the second vector.
- the process of determining whether the data and the second data match may be the same as the process of the first device determining whether the first data and the second data match in the above embodiment, and will not be described again here.
- Figure 2 is a schematic diagram of the second data matching process provided by the embodiment of the present application. As shown in Figure 2, the process includes the following operations:
- the first device inputs each first data to be matched into a pre-trained vector transformation model deployed in the first device, and for each first data, obtains a first vector corresponding to the first data.
- the second device inputs each second data to be matched into the pre-trained vector transformation model deployed in the second device, and for each second data, obtains the second data corresponding to the second data. vector.
- first data there are 4 first data, respectively, U1, U2, U3, and U4, and the first vector corresponding to U1 is (x11, x12, x13..., x1m), and the first vector corresponding to U2 is (x21, x22, x23..., x2m), the first vector corresponding to U3 is (x31, x32, x33..., x3m), and the first vector corresponding to U4 is (x41, x42, x43..., x4m) .
- the first device generates a first target public-private key pair A(pka, ska), where pka is the first target public key, ska is the first target private key, and the first target public-private key pair is a semi-homomorphic encryption target public-private key. Key pair.
- semi-homomorphic encryption is performed on the first vector based on the first target public key pair to generate a corresponding first encrypted vector.
- the first encrypted vector corresponding to the first vector (x11, x12, x13..., x1m) is (E pka (x11), E pka (x12), E pka (x13)..., E pka (x1m)) .
- the first encrypted vector corresponding to the first vector (x21, x22, x23..., x2m) is (E pka (x21), E pka (x22), E pka (x23)..., E pka (x2m)).
- the first encrypted vector corresponding to the first vector (x31, x32, x33..., x3m) is (E pka (x31), E pka (x32), E pka (x33)..., E pka (x3m)).
- the first encrypted vector corresponding to the first vector (x41, x42, x43..., x4m) is (E pka (x41), E pka (x42), E pka (x43)..., E pka (x4m)).
- the first device sends the first target public key and each first encryption vector to the second device.
- the second device After receiving the first target public key and each first encryption vector, the second device , perform semi-homomorphic encryption on the second vector based on the first target public key to generate a second encrypted vector.
- the second encrypted vector corresponding to the second vector (y11, y12, y13..., y1m) is (E pka (y11), E pka (y12), E pka (y13)..., E pka (y1m)).
- the second encrypted vector corresponding to the second vector (y21, y22, y23..., y2m) is (E pka (y21), E pka (y22), E pka (y23)..., E pka (y2m)).
- the second encrypted vector corresponding to the second vector (y31, y32, y33..., y3m) is (E pka (y31), E pka (y32), E pka (y33)..., E pka (y3m)).
- the second encrypted vector corresponding to the second vector (y41, y42, y43..., y4m) is (E pka (y41), E pka (y42), E pka (y43)..., E pka (y4m)).
- each first data it is necessary to determine whether the first data matches each second data. For example, for the first data U1, it is necessary to determine whether the first data U1 and the second data U5 match, and whether the first data U1 and the second data U5 match. Whether the second data U6 matches, whether the first data U1 matches the second data U7, whether the first data U1 matches the second data U8, therefore, for each first vector, it can be determined whether the first vector matches each For the target distance of the second vector, for each first encryption vector, the corresponding first encryption distance can also be calculated based on the first encryption vector and each second encryption vector.
- the process of calculating the first encryption distance is the same as the process of calculating the first encryption distance in the above embodiment.
- the second device may use the encrypted sub-distance b calculated based on the first encryption vector and the second encryption vector, Sent to the first device.
- the first device can update the encrypted sub-distance to E pka1 (x i 2 )-2E pka1 (x i y i )+E pka1 (y i 2 ), and use the first target private key to calculate the updated sub-distance.
- Decrypt an encrypted distance to obtain the corresponding target distance between the first vector and the second vector, which will not be described again here.
- the first device can also send the determined target distance to the second device. Both the first device and the second device can Based on the target distance and the preset first distance threshold, it is determined whether the first data corresponding to the first vector matches the second data corresponding to each second vector, that is, each first data and each third data can be determined respectively. Whether the two data match.
- first data stored in the first device there are three pieces of first data stored in the first device, which are "Qingmou's canteen in Dongxin District, certain sea city”, “Tianmou restaurant in certain sea city”, and “Yang Moufu Malatang on Gao Mou Road”.
- second data stored in the second device namely "a commissary in a certain sea city”, a "restaurant in a certain sea city in a certain day”, and "a certain Mai Lao".
- the first vector corresponding to "Qingmou commissary in Dongxin District, Donghai City” is ⁇ 1.0,2.0,1.5,2.0,3.5>, recorded as A1.
- the first vector corresponding to "a certain Haishi Tianmou restaurant” is ⁇ 3.0, 4.0, 2.5, 2.5, 1.5>, recorded as A2.
- the first vector corresponding to "Gao Road Yang Mou Fu Mala Tang” is ⁇ 4.5,5.5,7.5,1.5,0.5>, recorded as A3.
- the second vector corresponding to "Xuhai Shiqing Commissary” is ⁇ 1.0, 2.0, 1.5, 1.0, 3.5>, recorded as B1.
- the second vector corresponding to "a certain Haishi Tianmou restaurant” is ⁇ 3.0, 4.0, 2.5, 2.5, 1.5>, recorded as B2.
- the second vector corresponding to "Mai Lao” is ⁇ 3.5, 6.5, 2.5, 7.5, 2.5>, recorded as B3.
- the first device generates a first target public-private key pair A(pka, ska), where pka is the first target public key, ska is the first target private key, and the first target public-private key pair is a semi-homomorphic encryption target public-private key. Key pair.
- the first device may perform semi-homomorphic encryption on the first vector based on the first target public key pair to generate a corresponding first encrypted vector.
- the first device sends the first target public key and each first encryption vector to the second device.
- the second device After receiving the first target public key and each first encryption vector, the second device , perform semi-homomorphic encryption on the second vector based on the first target public key to generate a second encrypted vector.
- the target distance between the first vector and each second vector can be determined, for For each first encryption vector, a corresponding first encryption distance may also be calculated based on the first encryption vector and each second encryption vector.
- the process of calculating the first encryption distance based on any first encryption vector and any second encryption vector is the same as the process of calculating the first encryption distance in the above embodiment, and will not be described again here.
- Table 1 is a schematic table of target distance provided by some embodiments of the present application.
- D(x,y) represents the target distance
- x represents the first vector and y represents the second vector.
- the target distance corresponding to A1 and B1 is 1, the target distance corresponding to A1 and B2 is 3.64, the target distance corresponding to A1 and B3 is 7.66, the target distance corresponding to A2 and B1 is 3.9, the target distance corresponding to A2 and B2 is 0,
- the corresponding target distance between A2 and B3 is 5.7, the corresponding target distance between A3 and B1 is 8.35, the corresponding target distance between A3 and B2 is 5.16, and the corresponding target distance between A3 and B3 is 8.18.
- the fuzzy matching result of this time is that "Qingmou Commissary in Dongxin District, XXhai City” in the first data matches “Qingmou Commissary in XXDong New District, XXhai City” in the second data.
- the first data "A restaurant in a certain sea city and a certain day” in the second data matches "a restaurant in a certain sea city and a certain day” in the second data. From this, it can also be seen that the data matching method in this application can make the two data in incomplete At the same time, fuzzy matching of data can also be achieved, broadening the usage scenarios.
- the first device and the second device can vectorize the mobile phone numbers in the first data and the second data respectively using the One-Hot encoding model (data conversion model) to generate corresponding first vectors and second vectors
- the vector dimensions of the first vector and the second vector may be 10*11 dimensions, where 10 represents a total of 10 numbers from 0 to 9, and 11 represents a mobile phone number with a length of 11 digits.
- Table 2 which is a vector representation corresponding to the mobile phone number "13345678909".
- One of the digits in a mobile phone number Vector corresponding to number (one-hot encoding) 1 0000000010 3 0000001000 3 0000001000 4 0000010000 5 0000100000 6 0001000000
- the one-hot encoding corresponding to 0 is 0000000001
- the one-hot encoding corresponding to 1 is 0000000010
- the one-hot encoding corresponding to 2 is 0000000100
- the one-hot encoding corresponding to 3 is 0000001000
- 4 The corresponding one-hot encoding is 0000010000
- the one-hot encoding corresponding to 5 is 0000100000
- the one-hot encoding corresponding to 6 is 0001000000
- the one-hot encoding corresponding to 7 is 0010000000
- the one-hot encoding corresponding to 8 is 0100000000
- the one-hot encoding corresponding to 9 is 1000000000.
- the first vector (or second vector) corresponding to the mobile phone number "13345678909” can be (0000000010, 0000001000, 0000001000, 0000010000, 0000100000, 0001000000, 0010000000, 0100000000, 10000 00000, 0000000001, 1000000000).
- the process of determining the vectors corresponding to other mobile phone numbers is similar to this process and will not be described again here.
- the first vector corresponding to "13345678909” in the first data is marked as A4, the first vector corresponding to "13245678911” is marked as A5, and the first vector corresponding to "13334536787” is marked as A6.
- the second vector corresponding to "13334536787” in the second data is recorded as B4, the second vector corresponding to "13345678908” is recorded as B5, and the second vector corresponding to "15439402290" is recorded as B6.
- the first device generates a first target public-private key pair A(pka, ska), where pka is the first target public key, ska is the first target private key, and the first target public-private key pair is a semi-homomorphic encryption target public-private key. Key pair.
- the first device may perform semi-homomorphic encryption on the first vector based on the first target public key pair to generate a corresponding first encrypted vector.
- the first device sends the first target public key and each first encryption vector to the second device.
- the second device After receiving the first target public key and each first encryption vector, the second device , perform semi-homomorphic encryption on the second vector based on the first target public key to generate a second encrypted vector.
- the target distance between the first vector and each second vector can be determined, for For each first encryption vector, a corresponding first encryption distance may also be calculated based on the first encryption vector and each second encryption vector.
- the process of calculating the first encryption distance based on any first encryption vector and any second encryption vector is the same as the process of calculating the first encryption distance in the above embodiment, and will not be described again here.
- Table 3 is a schematic table of target distance provided by some embodiments of the present application.
- D(x,y) represents the target distance
- x represents the first vector and y represents the second vector.
- the target distance corresponding to A4 and B4 is 2.82, the target distance corresponding to A4 and B5 is 1, the target distance corresponding to A4 and B6 is 3.16, the target distance corresponding to A5 and B4 is 3, the target distance corresponding to A5 and B5 is 1.73, The target distance corresponding to A5 and B6 is 3, the target distance corresponding to A6 and B4 is 0, the target distance corresponding to A6 and B5 is 2.83, and the target distance corresponding to A6 and B6 is 3.
- Figure 3 is a schematic diagram of the third data matching process provided by the embodiment of this application. As shown in Figure 3, the method includes:
- S301 Input the second data to be matched into the pre-trained vector transformation model, and obtain the second vector corresponding to the second data.
- the data matching method provided by the embodiment of the present application is applied to a second device.
- the second device may be a smart terminal, a PC, a server, and other devices, and the second device is a different device from the first device in the present application.
- S302 Receive the first target public key and the first encryption vector sent by the first device, use the first target public key to semi-homomorphically encrypt the second vector to generate a second encryption vector; wherein, the first The encrypted vector is obtained by semi-homomorphically encrypting the first vector using the first target public key.
- the first vector is a pre-trained vector transformation model that inputs the first data into the first device. obtained from.
- S303 Calculate a first encryption distance based on the first encryption vector and the second encryption vector, and send the first encryption distance to the first device, so that the first device is based on the first encryption distance and
- the first target private key corresponding to the first target public key determines the target distance of the first vector and the second vector; and causes the first device to be based on the target distance and the preset first distance threshold. , determine whether the first data and the second data match.
- the second data to be matched is input into a pre-trained vector transformation model, and obtaining the second vector corresponding to the second data includes:
- the second data is input into the pre-trained second target vector transformation model to obtain the second vector corresponding to the second data.
- the second target data type is at least one of a text type, a numeric type, and an image type.
- the pre-trained second target vector conversion model corresponding to the second target data type is a word vector model or a sentence vector model; if The second target data type is a numeric type, and the pre-trained second target vector conversion model corresponding to the second target data type is a one-hot encoding model; if the first target data type is an image type, the The pre-trained first target vector corresponding to the first target data type is converted into an image vector model.
- the method further includes:
- the fourth encryption vector is a semi-identical search of the first vector using the second target public key.
- the first vector is obtained by inputting the first data into the pre-trained vector transformation model in the first device;
- the method further includes:
- Receive the target distance sent by the first device and determine whether the first data and the second data match based on the target distance and a preset first distance threshold.
- the method further includes:
- using the first target public key to semi-homomorphically encrypt the second vector to generate a second encrypted vector includes:
- semi-homomorphic encryption is performed on each second component in the second vector based on the first target public key to generate the second encrypted vector.
- FIG. 4 is a schematic structural diagram of a data matching device provided by some embodiments of the present application. As shown in Figure 4, the device includes:
- the first acquisition module 41 is used to input the first data to be matched into the vector transformation model that has been trained in advance, and obtain the first vector corresponding to the first data;
- the first processing module 42 is configured to perform semi-homomorphic encryption on the first vector using the first target public key generated by itself to generate a first encrypted vector, and send the first target public key and the first encrypted vector. to the second device;
- the first acquisition module 41 is also used to acquire the first encryption distance calculated based on the first encryption vector and the second encryption vector sent by the second device, and the second encryption vector is calculated using the first encryption vector.
- the second vector is obtained by semi-homomorphically encrypting the second vector with the target public key; the second vector is obtained by inputting the second data into the pre-trained vector transformation model in the second device;
- the first determination module 43 is configured to determine the target distance of the first vector and the second vector based on the first encryption distance and the first target private key corresponding to the first target public key; based on the target distance and a preset first distance threshold to determine whether the first data and the second data match.
- the first acquisition module 41 is specifically configured to determine the first target data type corresponding to the first data
- the first data is input into the pre-trained first target vector transformation model to obtain the first vector corresponding to the first data.
- the first target data type is at least one of a text type, a numeric type, and an image type.
- the pre-trained first target vector conversion model corresponding to the first target data type is a word vector model or a sentence vector model; if The first target data type is a numeric type, and the pre-trained first target vector conversion model corresponding to the first target data type is a one-hot encoding model; if the first target data type is an image type, the The pre-trained first target vector corresponding to the first target data type is converted into an image vector model.
- the device further includes:
- a receiving module configured to receive a third encryption vector sent by the second device and a second target public key generated by the second device; wherein the third encryption vector is the second device using the second The target public key is obtained after semi-homomorphic encryption of the second vector;
- the first processing module is further configured to perform semi-homomorphic encryption on the first vector based on the second target public key to generate a fourth encrypted vector;
- a sending module configured to calculate a second encryption distance based on the third encryption vector and the fourth encryption vector, and send the second encryption distance to the second device, so that the second device can calculate the second encryption distance based on the third encryption vector and the fourth encryption vector.
- the second encryption distance and the second target private key corresponding to the second target public key determine the target distance of the first vector and the second vector, and make the second device based on the target distance and
- a preset first distance threshold is used to determine whether the first data and the second data match.
- the first sending module is further configured to send the target distance to the second device, so that the second device can determine the distance based on the target distance and the preset first distance.
- a threshold value is used to determine whether the first data and the second data match.
- the first sending module is further configured to send the determined matching result of whether the first data and the second data match to the second device.
- the first processing module is specifically configured to, for each first component in the first vector, pair each first component in the first vector based on the first target public key.
- the first components are respectively subjected to semi-homomorphic encryption to generate the first encryption vector.
- the lengths of the first vector and the second vector are both preset lengths.
- the first encryption distance is obtained using the following process:
- each first encrypted component in the first encrypted vector and each second encrypted component in the second encrypted vector determine the first encrypted component and the corresponding second encrypted component through a semi-homomorphic encryption algorithm.
- the product of the components, and the corresponding second encrypted square component of the second encrypted component based on the product and the second encrypted square component, determine the encrypted sub-distance corresponding to the first encrypted component;
- a first encryption distance of the first encryption vector and the second encryption vector is determined.
- the first determination module 43 is specifically configured to determine, for each first encryption component in the first encryption vector, the first encryption square component of the first encryption component; based on The first encrypted square component and the encrypted sub-distance corresponding to the first encrypted component are updated; the encrypted sub-distance corresponding to the first encrypted component is updated;
- the updated first encryption distance is decrypted to obtain the target distance between the first vector and the second vector.
- the first encryption distance is obtained using the following process:
- a first encrypted square component of the first encrypted component is determined through a semi-homomorphic encryption algorithm , the product of the first encryption component and the corresponding second encryption component, and the second encryption square component of the corresponding second encryption component; based on the first encryption square component, the product and the second encryption square component, determine the The encrypted sub-distance corresponding to the first encrypted component;
- a first encryption distance of the first encryption vector and the second encryption vector is determined.
- the first determination module 43 is specifically used to determine the product of the first encryption component and exponent powers, wherein the exponent of the exponent power is the corresponding second encryption component;
- a product of the first encryption component and the corresponding second encryption component is determined.
- the first determination module 43 is specifically configured to determine whether the target distance is less than a preset first distance threshold
- the first determination module 43 is also used to determine whether the target distance is equal to a preset second distance threshold, and if so, determine the first data and the second data. same.
- FIG. 5 is a schematic structural diagram of another data matching device provided by some embodiments of the present application. As shown in Figure 5, the device includes:
- the second acquisition module 51 is used to input the second data to be matched into the pre-trained vector transformation model, and obtain the second vector corresponding to the second data;
- the second processing module 52 is configured to receive the first target public key and the first encryption vector sent by the first device, and use the first target public key to perform semi-homomorphic encryption on the second vector to generate a second encryption vector; Wherein, the first encrypted vector is obtained by semi-homomorphically encrypting the first vector using the first target public key, and the first vector is a pre-formatted key for inputting the first data into the first device. Obtained from the trained vector transformation model;
- the second determination module 53 is configured to calculate a first encryption distance based on the first encryption vector and the second encryption vector, and send the first encryption distance to the first device, so that the first device can calculate the first encryption distance based on the first encryption vector and the second encryption vector. Determine the target distance of the first vector and the second vector based on the first encryption distance and the first target private key corresponding to the first target public key; and make the first device based on the target distance and the predetermined Set a first distance threshold to determine whether the first data and the second data match.
- the second acquisition module 51 is specifically configured to determine the second target data type corresponding to the second data
- the second data is input into the pre-trained second target vector transformation model to obtain the second vector corresponding to the second data.
- the second target data type is at least one of a text type, a numeric type, and an image type.
- the pre-trained second target vector conversion model corresponding to the second target data type is a word vector model or a sentence vector model; if The second target data type is a numeric type, and the pre-trained second target vector conversion model corresponding to the second target data type is a one-hot encoding model; if the first target data type is an image type, the The pre-trained first target vector corresponding to the first target data type is converted into an image vector model.
- the second processing module 52 is also configured to use the second target public key generated by itself to perform semi-homomorphic encryption on the second vector to generate a third encrypted vector, and convert the third encrypted vector into a third encrypted vector.
- the four encrypted vectors are obtained by semi-homomorphically encrypting the first vector using the second target public key; the first vector is a vector transformation completed by pre-training when the first data is input into the first device.
- the second determination module 53 is also configured to receive the target distance sent by the first device, and determine the first distance based on the target distance and the preset first distance threshold. data and the second data match.
- the second determination module 53 is also configured to receive a matching result of whether the first data and the second data sent by the first device match.
- the second acquisition module 51 is also configured to, for each second component in the second vector, pair the second component in the second vector based on the first target public key.
- Each second component is separately semi-homomorphically encrypted to generate the second encryption vector.
- Figure 6 is a schematic structural diagram of a data matching system provided by some embodiments of this application. As shown in Figure 6, the system includes:
- the first device 61 is configured to input the first data to be matched into the pre-trained vector conversion model to obtain the first vector corresponding to the first data; and use the first target public key generated by itself to Perform semi-homomorphic encryption on a vector to generate a first encryption vector, and send the first target public key and the first encryption vector to the second device 62;
- the second device 62 is used to input the second data to be matched into the pre-trained vector transformation model, obtain the second vector corresponding to the second data; and receive the first data sent by the first device.
- the target public key and the first encryption vector using the first target public key to semi-homomorphically encrypt the second vector to generate a second encryption vector; calculating the first encryption based on the first encryption vector and the second encryption vector distance, sending the first encrypted distance to the first device 61;
- the first device 61 is further configured to determine the target distance of the first vector and the second vector based on the first encryption distance and the first target private key corresponding to the first target public key; based on the The target distance and the preset first distance threshold are used to determine whether the first data and the second data match.
- Figure 7 is a schematic structural diagram of an electronic device provided by some embodiments of this application. As shown in Figure 7, it includes: a processor 71, a communication interface 72, and a memory. 73 and communication bus 74, wherein the processor 71, communication interface 72, and memory 73 complete communication with each other through the communication bus 74;
- the memory 73 stores a computer program.
- the processor 71 is caused to perform the steps of the data matching method of any of the above embodiments.
- the communication bus mentioned in the above-mentioned electronic equipment can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc.
- PCI Peripheral Component Interconnect
- EISA Extended Industry Standard Architecture
- the communication bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
- the communication interface 72 is used for communication between the above-mentioned electronic device and other devices.
- the memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory.
- RAM Random Access Memory
- NVM Non-Volatile Memory
- the memory may also be at least one storage device located remotely from the aforementioned processor.
- the above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital instruction processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array, or Other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
- NP Network Processor
- DSP Digital Signal Processing
- embodiments of the present application provide a computer-readable storage medium.
- the computer-readable storage medium stores a computer program that can be executed by an electronic device. When the program is run on the electronic device, , so that the electronic device implements the steps of the data matching method of any of the above embodiments when executed. Since the problem-solving principle of the above computer-readable storage medium is similar to the data matching method, the implementation of the above-mentioned computer-readable storage medium can be referred to the implementation of the method, and repeated details will not be repeated.
- the above-mentioned computer-readable storage media can be any available media or data storage devices that can be accessed by the processor in the electronic device, including but not limited to magnetic memories such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., and optical memories such as CDs. , DVD, BD, HVD, etc., as well as semiconductor memories such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid state drive (SSD), etc.
- magnetic memories such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.
- optical memories such as CDs. , DVD, BD, HVD, etc.
- semiconductor memories such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid state drive (SSD), etc.
- the present application provides a computer program product.
- the computer program product includes: computer program code.
- the computer program code When the computer program code is run on a computer, the computer Perform the steps of the data matching method as described in any one of the above.
- embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
- computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
- These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
- the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
- These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
- Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Collating Specific Patterns (AREA)
Abstract
本申请公开了一种数据匹配方法、装置、系统、设备及介质,用以解决现有技术中的安全求交算法只能在双方数据完全相同时进行安全求交,使用场景有限,影响数据匹配的业务范围的问题。由于本申请可以分别获得该第一数据对应的第一向量以及第二数据对应的第二向量,并获取基于该第一向量加密后的第一加密向量,以及该第二向量加密后的第二加密向量,基于第一加密向量和第二加密向量计算第一加密距离,并基于第一加密距离以及第一目标私钥,确定第一向量和第二向量的目标距离,基于该目标距离以及预设的第一距离阈值确定第一数据和第二数据是否匹配,可以实现第一数据和第二数据的模糊匹配,拓宽了使用场景,保证了匹配过程的安全性。
Description
相关申请的交叉引用
本申请要求在2022年08月09日提交中国专利局、申请号为202210952494.8、申请名称为“一种数据匹配方法、装置、系统、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及数据处理技术领域,尤其涉及一种数据匹配方法、装置、系统、设备及介质。
当前隐私计算技术主要应用于安全求交和联邦学习。所谓安全求交是指识别双方数据的交集,比如,即识别机构A和机构B的共有用户,其中安全求交也为纵向联邦学习的第一个步骤,也就是说,先对手机号、身份证号、营业执照号等关键信息进行安全求交,然后再进行下一步联合建模等步骤。
相关技术中,为了识别双方数据的交集或者实现双方数据的匹配,常见的安全求交算法包括基于RSA加密算法的安全求交算法等。但是目前的安全求交算法只有当双方数据完全相同时,也就是说,当双方数据的数据类型以及数据包含的字符的数量完全相同时,才能匹配成功。但是实际业务中,往往存在很多数据不完全相同时待匹配的使用场景,因此现有技术中的安全求交算法极大限制了其使用场景,影响匹配的业务范围。
发明内容
本申请提供了一种数据匹配方法、装置、系统、设备及介质,用以解决现有技术中的安全求交算法只能在双方数据完全相同时进行安全求交,使用场景有限,影响数据匹配的业务范围的问题。
第一方面,本申请提供了一种数据匹配方法,应用于第一设备,所述方法包括:
将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;
采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;
获取所述第二设备发送的基于所述第一加密向量和第二加密向量计算的第一加密距离,所述第二加密向量为采用所述第一目标公钥对第二向量进行半同态加密后得到的;所述第二向量为将第二数据输入到所述第二设备中的预先训练完成的向量转化模型中获得的;
基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;
基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
第二方面,本申请提供了一种数据匹配方法,应用于第二设备,所述方法包括:
将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;
接收第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;其中,所述第一加密向量为采用所述第一目标公钥对第一向量进行半同态加密后得到的,所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;
基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备,以使所述第一设备基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;并使所述第一设备基于所述目标距离以及预设的第一距离阈值, 确定所述第一数据以及所述第二数据是否匹配。
第三方面,本申请提供了一种数据匹配装置,应用于第一设备,所述装置包括:
第一获取模块,用于将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;
第一处理模块,用于采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;
所述第一获取模块,还用于获取所述第二设备发送的基于所述第一加密向量和第二加密向量计算的第一加密距离,所述第二加密向量为采用所述第一目标公钥对第二向量进行半同态加密后得到的;所述第二向量为将第二数据输入到所述第二设备中的预先训练完成的向量转化模型中获得的;
第一确定模块,用于基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
第四方面,本申请提供了一种数据匹配装置,应用于第二设备,所述装置包括:
第二获取模块,用于将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;
第二处理模块,用于接收第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;其中,所述第一加密向量为采用所述第一目标公钥对第一向量进行半同态加密后得到的,所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;
第二确定模块,用于基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备,以使所述第一设备基于 所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;并使所述第一设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
第五方面,本申请提供了一种数据匹配系统,所述系统包括:
第一设备,用于将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;
所述第二设备,用于将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;并接收所述第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备;
所述第一设备,还用于基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
第六方面,本申请提供了一种电子设备,所述电子设备包括处理器和存储器,所述存储器用于存储程序指令,所述处理器用于执行存储器中存储的计算机程序时实现上述任一所述数据匹配方法的步骤。
第七方面,本申请提供了一种计算机可读存储介质,其存储有计算机程序,所述计算机程序被处理器执行时实现上述任一所述数据匹配方法的步骤。
由于在本申请实施例中,可以分别将待匹配的第一数据和第二数据输入到预先训练完成的向量转化模型中,获得该第一数据对应的第一向量以及第二数据对应的第二向量,并获取基于该第一向量加密后的第一加密向量,以及该第二向量加密后的第二加密向量,基于第一加密向量和第二加密向量计算第一加密距离,并基于第一加密距离以及第一目标私钥,确定第一向量和 第二向量的目标距离,基于该目标距离以及预设的第一距离阈值确定第一数据和第二数据是否匹配,即可以在第一数据和第二数据不完全相同时,也能实现第一数据和第二数据的模糊匹配,拓宽了使用场景,且在进行模糊匹配过程中引入了第一目标公钥和第一目标私钥分别进行半同态加密和解密,实现了安全求交,保证了匹配过程的安全性,且整个匹配的过程中,第一数据以及第二数据均未以原始数据的形式离开过对应的第一设备以及第二设备,保证了第一数据和第二数据的安全性,实现了原始数据不出库也能实现模糊匹配,进一步保证了匹配过程的安全性。
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种数据匹配过程示意图;
图2为本申请实施例提供的第二种数据匹配过程示意图;
图3为本申请实施例提供的第三种数据匹配过程示意图;
图4为本申请一些实施例提供的一种数据匹配装置结构示意图;
图5为本申请一些实施例提供的另一种数据匹配装置结构示意图;
图6为本申请一些实施例提供的一种数据匹配系统结构示意图;
图7为本申请一些实施例提供的一种电子设备结构示意图。
为了保证双方数据不完全相同时也可以进行匹配,拓宽数据匹配的业务范围,本申请实施例提供了一种数据匹配方法、装置、系统、设备及介质。
为使本申请的目的和实施方式更加清楚,下面将结合本申请示例性实施例中的附图,对本申请示例性实施方式进行清楚、完整地描述,显然,描述 的示例性实施例仅是本申请一部分实施例,而不是全部的实施例。
需要说明的是,本申请中对于术语的简要说明,仅是为了方便理解接下来描述的实施方式,而不是意图限定本申请的实施方式。除非另有说明,这些术语应当按照其普通和通常的含义理解。
本申请中说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”等是用于区别类似或同类的对象或实体,而不必然意味着限定特定的顺序或先后次序,除非另外注明。应该理解这样使用的用语在适当情况下可以互换。
术语“包括”和“具有”以及他们的任何变形,意图在于覆盖但不排他的包含,例如,包含了一系列组件的产品或设备不必限于清楚地列出的所有组件,而是可包括没有清楚地列出的或对于这些产品或设备固有的其它组件。
术语“模块”是指任何已知或后来开发的硬件、软件、固件、人工智能、模糊逻辑或硬件或/和软件代码的组合,能够执行与该元件相关的功能。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。
实施例1:
图1为本申请实施例提供的第一种数据匹配过程示意图,该过程包括以下步骤:
S101:将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量。
本申请实施例提供的数据匹配方法应用于电子设备(为方便描述,称为第一设备),第一设备可以是智能终端、PC或者服务器等设备。
为了保证双方数据不完全相同时也能实现模糊匹配,在本申请实施例中,第一设备中部署了预先训练完成的向量转化模型,该预先训练完成的向量转 化模型用于获得待匹配的数据对应的向量,且针对不同的数据,该预先训练完成的向量转化模型输出的向量的维度可以相同。
在一种可能的实施方式中,为了获得待匹配的第一数据(为方便描述,将第一设备中保存的待匹配的数据称为第一数据)对应的第一向量(为方便描述,将第一数据对应的向量称为第一向量),可以将该第一数据输入到预先训练完成的向量转化模型中,该预先训练完成的向量转化模型可以输出该第一数据对应的第一向量,可选的,该第一向量中的每个分量可以为数字,即可以通过该预先训练完成的向量转化模型将第一数据进行了量化。示例性的,以第一数据为“某海市某东新区晴某小卖部”为例,可以将该第一数据“某海市某东新区晴某小卖部”输入到预先训练完成的词向量模型中,输出的该第一数据“某海市某东新区晴某小卖部”对应的第一向量可以为(1.0,2.0,1.5,2.0,3.5)。
S102:采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备。
在一种可能的实施方式中,为了提高安全性,第一设备可以生成第一目标公私钥对,其中,该第一目标公私钥对中包含第一目标公钥和第一目标私钥(为方便描述,将第一设备生成的公钥称为第一目标公钥,将第一设备生成的私钥称为第一目标私钥)。可选的,第一目标公私钥对可以为半同态加密公私钥对,即第一目标公钥可以为半同态加密公钥,第一目标私钥可以为半同态加密私钥。第一设备可以根据自身生成的第一目标公钥对第一向量进行半同态加密生成第一加密向量。其中,该第一目标公私钥对可以为对称公私钥对,也可以为非对称公私钥对,可以根据需求设置目标公私钥对。其中,生成第一目标公私钥对的过程为现有技术,在此不做赘述。
在一种可能的实施方式中,由于待与第一数据进行匹配的第二数据为第二设备获取的,为了便于后续能够确定第一数据对应的第一向量和第二数据对应的第二向量之间的目标距离,第一设备可以将第一目标公钥以及第一加 密向量发送给第二设备,第二设备可以根据该第一目标公钥,对第二数据对应的第二向量进行半同态加密生成第二加密向量。
S103:获取所述第二设备发送的基于所述第一加密向量和第二加密向量计算的第一加密距离,所述第二加密向量为采用所述第一目标公钥对第二向量进行半同态加密后得到的;所述第二向量为将第二数据输入到所述第二设备中的预先训练完成的向量转化模型中获得的;基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离。
在一种可能的实施方式中,为了实现第一数据和第二数据的模糊匹配,第二设备中也部署了预先训练完成的向量转化模型,用于获得待匹配的第二数据(为方便描述,将第二设备中待匹配的数据称为第二数据)对应的第二向量(为方便描述,将第二数据对应的向量称为第二向量)。可选的,可以将第二数据输入到预先训练完成的向量转化模型中,该预先训练完成的向量转化模型可以输出该第二数据对应的第二向量,第二设备可以基于接收到的第一设备发送的第一目标公钥对该第二向量进行半同态加密,获得第二加密向量。
为了确定第一向量和第二向量之间的距离,在一种可能的实施方式中,第二设备可以针对第一加密向量中的每个第一加密分量、第二向量中的每个第二分量以及第二加密向量中的每个第二加密分量,通过半同态加密算法,确定该第一加密分量的第一加密平方分量、加密后的该第一加密分量与相应的第二分量的乘积,以及相应的第二加密分量的第二加密平方分量;基于该第一加密平方分量、该乘积以及该第二加密平方分量,确定该第一加密分量对应的加密后的子距离;并可以基于每个第一加密分量对应的加密后的子距离,确定第一加密向量和第二加密向量的第一加密距离。为方便理解,下面以公式形式对本申请实施例提供的确定第一加密向量和第二加密向量的第一加密距离的过程进行解释说明。
示例性的,假设第一数据U1对应的第一向量为(x
1,x
2,x
3……,x
m), 第二数据U5对应的第二向量为(y
1,y,y
3……,y
m)。
第一设备生成第一目标公私钥对A(pka1,ska1),其中,该pka1为第一目标公钥,ska1为第一目标私钥,基于该第一目标公钥对第一向量进行半同态加密生成第一加密向量,示例性的,针对第一向量中的每个第一分量,可以基于第一目标公钥对第一向量中的每个第一分量分别进行半同态加密,生成第一加密向量。例如第一向量(x
1,x
2,x
3……,x
m)对应的第一加密向量为(E
pka1(x
1),E
pka1(x
2),E
pka1(x
3)……,E
pka1(x
m))。第一加密向量中包含m个第一加密分量E
pka1(x
i),其中,i为不大于m的任一正整数。第一设备可以将该第一加密向量以及该第一目标公钥发送给第二设备。
第二设备接收到第一设备发送的第一目标公钥以及第一加密向量后,可以基于该第一目标公钥对第二向量进行半同态加密,获得第二加密向量。示例性的,针对第二向量中的每个第二分量,可以基于第一目标公钥对第二向量中的每个第二分量分别进行半同态加密,生成第二加密向量。例如第二向量(y
1,y
2,y
3……,y
m)对应的第二加密向量为(E
pka1(y
1),E
pka1(y
2),E
pka1(y
3)……,E
pka1(y
m)),第二向量中包含m个第二分量y
i,第二加密向量中包含m个第二加密分量E
pka1(y
i),其中,i为不大于m的任一正整数。
在一种可能的实施方式中,针对第一加密向量中的每个第一加密分量E
pka1(x
i),第二设备可以确定该第一加密分量的第一加密平方分量:E
pka1(x
i
2)。另外,针对第一加密向量中的每个第一加密分量E
pka1(x
i),第二设备还可以通过半同态加密算法,确定加密后的该第一加密分量与相应的第二加密分量的乘积,另外,第二设备还可以确定相应的第二加密分量的第二加密平方分量:E
pka1(y
i
2)。
在一种可能的实施方式中,通过半同态加密算法,确定加密后的第一加密分量与相应的第二加密分量的乘积的过程可以如下:
通过半同态加密算法,确定加密后的指数幂,其中,该指数幂的底数可以为该第一加密分量,该指数幂的指数可以为相应的第二分量。例如,指数 幂可以为
该指数幂可以用于确定基于半同态加密算法加密后的该第一加密分量与相应的第二分量的乘积。其中,针对如何基于该指数幂确定第一加密分量与相应的第二分量的乘积(E
pka1(x
iy
i))在后续进行详细介绍,在此先不赘述。
在一种可能的实施方式中,针对每个第一加密分量,可以基于该第一加密分量对应的第一加密平方分量E
pka1(x
i
2)、加密后的该第一加密分量与相应的第二加密分量的乘积
以及第二加密平方分量E
pka1(y
i
2),确定该第一加密分量对应的加密后的子距离:
可选的,可以将每个第一加密分量对应的加密后的子距离的和值,确定为第一加密向量和第二加密向量的第一加密距离:
在一种可能的实施方式中,第二设备获得第一加密距离之后,可以将该第一加密距离发送给第一设备。第一设备接收到该第一加密距离之后,可以根据第一设备生成的第一目标私钥对中的第一目标私钥,对该第一加密距离进行解密,确定第一向量和第二向量的目标距离。
由于g
x+y=g
x*g
y,则E
pka1(x
i+y
i)=E
pka1(x
i)*E
pka1(y
i)。
又由于x
iy
i等于y
i个x
i相加,因此,
由上述公式可以看出,通过半同态加密算法,可以基于指数幂
确定加密后的第一分量与相应的第二分量的乘积(E
pka1(x
iy
i)),第一设备进而可以根据第一目标私钥,对第一加密距离进行解密后,得到
第一设备可以基于解密后的第一加密距离以及欧氏距离公式,计算第一向量和第二向量之间的目标距离,示例性的,第一向量和第二向量之间的目标距离
其中,该x
i为第一向量中的第i个分量,y
i为第二向量中的第i个分量,m为第一向量或第二向量中包含的分量的数量,且该第一向量中包含的分量的数量与该第二分量中包含的分量的数量相同,即第一向量的长度与第二向量的长度相等,第一向量和第二向量的长度可以均为预设长度m,m可以为任意正整数。
在另外一种可能的实施方式中,还可以基于余弦距离公式或者汉明距离公式等确定第一向量与第二向量之间的距离,在此不再赘述。
另外,本申请实施例还提供了另一种确定第一加密距离的方式,在一种可能的实施方式中,第一加密距离还可以采用以下过程获得:
针对第一加密向量中的每个第一加密分量E
pka1(x
i)、第二向量中的每个第二分量y
i以及第二加密向量中的每个第二加密分量E
pka1(y
i),第二设备可以通过半同态加密算法,确定加密后的该第一加密分量与相应的第二分量的乘积
以及相应的第二加密分量的第二加密平方分量E
pka1(y
i
2);第二设备可以基于该乘积
以及该第二加密平方分量E
pka1(y
i
2),确定该第一加密分量对应的加密后的子距离:
其中,通过半同态加密算法,确定第一加密分量与相应的第二分量的乘积的过程与上述实施例相同,例如可以通过半同态加密算法,确定加密后的指数幂,其中,该指数幂的底数为该第一加密分量,该指数幂的指数为相应的第二分量;该指数幂用于确定基于半同态加密算法加密后的该第一加密分量与相应的第二分量的乘积,在此不再赘述。
第二设备可以将该加密后的子距离b发送给第一设备,第一设备针对第一加密向量中的每个第一加密分量E
pka1(x
i),可以确定该第一加密分量的第一加密平方分量E
pka1(x
i
2),并可以基于该第一加密平方分量E
pka1(x
i
2)以及加密后的子距离
对该第一加密分量对应的加密后的子距离进行更新,可选的,可以将加密后的子距离更新为:
第一设备可以基于每个第一加密分量对应的更新后的子距离,确定第一加密向量和第二加密向量的更新后的第一加密距离。可选的,可以将每个第一加密分量对应的更新后的子距离的和值,确定为第一加密向量和第二加密向量的更新后的第一加密距离:
与上述实施例类似,确定了更新后的第一加密距离之后,第一设备可以根据第一设备生成的第一目标私钥对中的第一目标私钥,对该更新后的第一加密距离进行解密,以确定第一向量和第二向量的目标距离。
示例性的,第一设备可以根据第一目标私钥,对更新后的第一加密距离进行解密后,得到
可以基于解密后的第一加密距离以及欧氏距离公式,计算第一向量和第二向量之间的目标距离,示例性的,第一向量和第二向量之间的目标距离
在此不再赘述。
S104:基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,为了确定第一数据与第二数据是否匹配,确定了第一向量与第二向量之间的目标距离后,可以将该目标距离与预设的第一距离阈值进行比较,根据比较结果,确定该第一数据与该第二数据是否匹配。示例性的,可以判断第一向量与第二向量之间的目标距离是否小于预设的第一距离阈值,如果第一向量与第二向量之间的目标距离小于预设的第一距离阈值,则可以认为第一数据与第二数据匹配。而如果第一向量与第二向 量之间的目标距离不小于预设的第一距离阈值,则可以确定第一数据与第二数据不匹配。可选的,预设的第一距离阈值可以为1,还可以为1.5等,本申请对第一距离阈值不作具体限定,可以根据需求灵活设置。其中,第一向量与第二向量之间的目标距离越小,第一向量与第二向量越匹配。
为了确定第二数据与第一数据是否完全匹配,在一种可能的实施方式中,还可以判断第一向量与第二向量之间的目标距离是否等于预设的第二距离阈值,若该目标距离等于预设的第二距离阈值,则可以认为第一数据与第二数据相同,也就是说,该第一数据与该第二数据完全匹配。可选的,该第二距离阈值可以小于第一距离阈值,且第二距离阈值可以为0。
由于在本申请实施例中,可以分别将待匹配的第一数据和第二数据输入到预先训练完成的向量转化模型中,获得该第一数据对应的第一向量以及第二数据对应的第二向量,并获取基于该第一向量加密后的第一加密向量,以及该第二向量加密后的第二加密向量,基于第一加密向量和第二加密向量计算第一加密距离,并基于第一加密距离以及第一目标私钥,确定第一向量和第二向量的目标距离,基于该目标距离以及预设的第一距离阈值确定第一数据和第二数据是否匹配,即可以在第一数据和第二数据不完全相同时,也能实现第一数据和第二数据的模糊匹配,拓宽了使用场景,且在进行模糊匹配过程中引入了第一目标公钥和第一目标私钥分别进行半同态加密和解密,实现了安全求交,保证了匹配过程的安全性,且整个匹配的过程中,第一数据以及第二数据均未以原始数据的形式离开过对应的第一设备以及第二设备,保证了第一数据和第二数据的安全性,实现了原始数据不出库也能实现模糊匹配,进一步保证了匹配过程的安全性。
实施例2:
为了确定第一数据对应的第一向量,在上述实施例的基础上,在本申请实施例中,所述将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量包括:
确定所述第一数据对应的第一目标数据类型;
根据所述第一目标数据类型以及预先保存的数据类型和预先训练完成的向量转化模型的对应关系,确定所述第一数据对应的预先训练完成的第一目标向量转化模型;
将所述第一数据输入到所述预先训练完成的第一目标向量转化模型中,获得所述第一数据对应的所述第一向量。
在本申请实施例中,由于待匹配的第一数据可以为文本数据,比如,该第一数据可以为姓名、性别、地址等,也可以为数字数据,比如,该第一数据可以为身份证号、银行卡号以及准考证号等,也可以为图像数据,比如,该第一数据可以为用于进行人脸识别的图像等,因此,为了针对不用数据类型的第一数据,获得对应的第一向量的预先训练完成的向量转化模型也可以不相同。
具体的,可以在第一设备中保存有数据类型和预先训练完成的向量转化模型的对应关系,根据获取到的待匹配的第一数据对应的第一目标数据类型,采用对应的预先训练完成的向量转化模型,获取该第一数据对应的第一向量;其中,该对应的预先训练完成的向量转化模型也就是预先训练完成的第一目标向量转化模型。
其中,本申请对第一数据对应的第一目标数据类型不作具体限定,示例性的,第一目标数据类型可以为文本类型、或数字类型、或图像类型等。另外,本申请对数据类型对应的向量转化模型也不作具体限定,可以根据需求灵活设置。
示例性的,为了准确的确定将第一数据转换为第一向量的向量转化模型,在上述各实施例的基础上,在本申请实施例中,若所述第一目标数据类型为文本类型,则所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型可以为词向量模型或句向量模型;若所述第一目标数据类型为数字类型,则所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型可以为独热(One-Hot)编码模型;若所述第一目标数据类型为图像类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型可以为图 像向量模型。
具体的,若第一数据为文本数据,即第一数据的第一目标数据类型为文本类型,则根据预先保存的数据类型和预先训练完成的向量转化模型的对应关系,可以确定该第一目标数据类型对应的预先训练完成的第一目标向量转化模型,该第一目标向量转化模型可以为词向量模型或者句向量模型,并可以基于该预先训练完成的词向量模型或者句向量模型,获取该第一数据对应的第一向量。
在一种可能的实施方式中,若第一数据为数字数据,即第一数据的第一目标数据类型为数字类型,则根据预先保存的数据类型和预先训练完成的向量转化模型的对应关系,可以确定该第一目标数据类型对应的预先训练完成的第一目标向量转化模型,该第一目标向量转化模型可以为预先训练完成的One-Hot编码模型,并可以基于该预先训练完成的One-Hot编码模型,获取该第一数据对应的第一向量。
在一种可能的实施方式中,若第一数据为图像数据,即第一数据的第一目标数据类型为图像类型,则根据预先保存的数据类型和预先训练完成的向量转化模型的对应关系,可以确定该第一目标数据类型对应的预先训练完成的第一目标向量转化模型,该第一目标向量转化模型可以为预先训练完成的图像向量模型(图像向量嵌入模型),并可以基于该预先训练完成的图像向量模型,获取该第一数据对应的第一向量。
为方便理解,以预先训练完成的向量转化模型输出的向量的维度为5,预先训练完成的向量转化模型为词向量模型为例进行说明。若第一数据为文本数据,且该第一数据为“某海市某东新区晴某小卖部”则将“某海市某东新区晴某小卖部”输入到预先训练完成的词向量模型中,输出的该“某海市某东新区晴某小卖部”对应的第一向量可以为(1.0,2.0,1.5,2.0,3.5)。
若预先训练完成的向量转化模型为One-Hot编码模型,可以预先针对每个数字设置该对应的独热编码,比如,数字包含0-9,则该0-9各个数字中,0对应的独热编码为0000000001、1对应的独热编码为0000000010、2对应的 独热编码为0000000100、3对应的独热编码为0000001000、4对应的独热编码为0000010000、5对应的独热编码为0000100000、6对应的独热编码为0001000000、7对应的独热编码为0010000000、8对应的独热编码为0100000000、9对应的独热编码为1000000000。将数字数据输入到One-Hot编码模型中,该One-Hot编码模型输出的第一向量中每个第一分量为该第一数据中对应的每个数字的独热编码。
示例性的,若第一数据为数字数据,该数字数据为“12345”,则将“12345”输入到预先训练完成的词向量模型中,输出的该“12345”对应的第一向量为(0000000010,0000000100,0000001000,0000010000,0000100000)。
其中,在对向量转化模型进行训练时,可以预先标注每个数据和数据对应的标注向量,将每个数据和对应的标注向量输入到原始向量转化模型中,根据原始向量转化模型输出的预测向量及对应的标注向量,对该原始向量转化模型的参数进行调整,当满足收敛条件时,确定向量转化模型训练完成。
在本申请实施例中,无论第一数据和第二数据是数字数据还是文本数据,都能实现模糊匹配,进一步扩宽了应用场景。
实施例3:
为了使得第二设备也能确定第一数据以及第二数据是否匹配,在上述各实施例的基础上,在本申请实施例中,所述确定所述第一向量和所述第二向量的目标距离之后,所述方法还包括:
将所述目标距离发送给所述第二设备,使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,为了使得第二设备也能确定第一数据与第二数据是否匹配,第一设备可以将确定的第一向量和第二向量的目标距离发送给第二设备,第二设备在接收到第一设备发送的第一向量和第二向量的目标距离后,可以基于该目标距离以及预设的第一距离阈值,确定第一数据与第二数据是否匹配。其中第二设备确定第一数据和第二数据是否匹配的过程与上述实施例中第一设备确定第一数据和第二数据是否匹配的过程可以相同, 在此不再赘述。
在一种可能的实施方式中,第一设备确定了第一数据与第二数据是否匹配,得到第一数据与第二数据是否匹配的匹配结果之后,可以将该匹配结果发送给第二设备。可选的,第二设备可以将第一设备确定的匹配结果与自身确定的匹配结果进行比对,以进一步提高准确性。另外,在一种可能的实施方式中,第二设备也可以不进行确定第一数据与第二数据是否匹配,得到匹配结果的过程,直接利用第一设备确定的匹配结果,从而可以节省能耗。
为方便理解,下面通过一个具体实施例对本申请提供的数据匹配过程进行解释说明:
第一设备可以将待匹配的第一数据输入到部署在第一设备中的预先训练完成的向量转化模型中,获得该第一数据对应的第一向量。同样的,第二设备可以将待匹配的第二数据输入到部署在第二设备中的预先训练完成的向量转化模型中,获得该第二数据对应的第二向量。假设第一数据U1对应的第一向量为(x
1,x
2,x
3……,x
m),第二数据U5对应的第二向量为(y
1,y,y
3……,y
m)。
第一设备生成第一目标公私钥对A(pka1,ska1),其中,该pka1为第一目标公钥,ska1为第一目标私钥,基于该第一目标公钥对第一向量进行半同态加密生成第一加密向量,第一向量(x
1,x
2,x
3……,x
m)对应的第一加密向量为(E
pka1(x
1),E
pka1(x
2),E
pka1(x
3)……,E
pka1(x
m)),并将该第一加密向量以及该第一目标公钥发送给第二设备。
第二设备接收到第一设备发送的第一目标公钥以及第一加密向量后,基于该第一目标公钥对第二向量进行半同态加密,获得第二加密向量。具体的,该第二向量(y
1,y,y
3……,y
m)对应的第二加密向量为(E
pka1(y
1),E
pka1(y
2),E
pka1(y
3)……,E
pka1(y
m)),第二设备基于该第二加密向量以及接收到的第一加密向量,确定第一加密距离
并将该第一加密距离并发送给第一设备。
第一设备接收到该第一加密距离
后,根据自身生成的第一目标公钥对应的第一目标私钥对该第一加密距离进行解密,以确定第一向量和第二向量的目标距离
第一设备可以基于该目标距离及预设的第一距离阈值,确定第一数据与第二数据是否匹配,并且第一设备可以将该第一向量和第二向量的目标距离发送给第二设备,第二设备可以根据第二向量与第一向量的目标距离及预设的第一距离阈值,确定第一数据与第二数据是否匹配。
实施例4:
为了使得第二设备也能确定第一向量和第二向量的目标距离,在上述各实施例的基础上,所述方法还包括:
接收所述第二设备发送的第三加密向量以及所述第二设备生成的第二目标公钥;其中,所述第三加密向量为所述第二设备采用所述第二目标公钥对所述第二向量进行半同态加密后得到的;
基于所述第二目标公钥对所述第一向量进行半同态加密生成第四加密向量;
基于所述第三加密向量以及所述第四加密向量计算得到第二加密距离,并将所述第二加密距离发送给所述第二设备,以使所述第二设备基于所述第二加密距离以及与所述第二目标公钥对应的第二目标私钥,确定所述第一向量和第二向量的目标距离,并使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,为了使得第二设备也能确定第一向量和第二向量的目标距离,而无需依赖第一设备将其确定的目标距离发送给第二设备,进一步提高安全性,第二设备可以生成第二目标公私钥对,其中,该第二目标公私钥对中包含第二目标公钥和第二目标私钥(为方便描述,将第二设备生成的公钥称为第二目标公钥,将第二设备生成的私钥称为第二目标私钥)。可选的,第二目标公私钥对可以为半同态加密公私钥对,即第二目标公钥可 以为半同态加密公钥,第二目标私钥可以为半同态加密私钥。第二设备可以根据自身生成的第二目标公钥对第二向量进行半同态加密生成第三加密向量。其中,该第二目标公私钥对可以为对称公私钥对,也可以为非对称公私钥对,可以根据需求设置目标公私钥对。其中,生成第二目标公私钥对的过程为现有技术,在此不做赘述。
第二设备可以将第三加密向量以及第二设备生成的第二目标公钥发送给第一设备。第一设备接收到第二设备发送的第三加密向量以及第二目标公钥后,可以基于第二目标公钥对第一向量进行半同态加密生成第四加密向量。
第一设备也可以基于第三加密向量和第四加密向量计算得到第二加密距离,其中,计算第二加密距离与计算第一加密距离的过程类似。例如:
在一种可能的实施方式中,第一设备可以针对第三加密向量中的每个第三加密分量、第四向量中的每个第四分量以及第四加密向量中的每个第四加密分量,通过半同态加密算法,确定该第四加密分量的第四加密平方分量、加密后的该第四分量与相应的第三加密分量的乘积,以及相应的第三加密分量的第三加密平方分量;基于该第四加密平方分量、该乘积以及该第三加密平方分量,确定该第四加密分量对应的加密后的子距离;并可以基于每个第四加密分量对应的加密后的子距离,确定第三加密向量和第四加密向量的第二加密距离。为方便理解,下面以公式形式对本申请实施例提供的确定第二加密距离的过程进行解释说明。
示例性的,假设第一数据U1对应的第一向量为(x
1,x
2,x
3……,x
m),第二数据U2对应的第二向量为(y
1,y,y
3……,y
m)。
第二设备生成第二目标公私钥对B(pka2,ska2),其中,该pka2为第二目标公钥,ska2为第二目标私钥,基于该第二目标公钥对第二向量进行半同态加密生成第三加密向量,例如第二向量(y
1,y,y
3……,y
m)对应的第三加密向量为(E
pka2(y
1),E
pka2(y
2),E
pka2(y
3)……,E
pka2(y
m)),第三加密向量中包含m个第三加密分量E
pka2(x
i),其中,i为不大于m的任一正整数。 第二设备可以将该第三加密向量以及该第二目标公钥发送给第一设备。
第一设备接收到第二设备发送的第二目标公钥以及第三加密向量后,可以基于该第二目标公钥对第一向量进行半同态加密,获得第四加密向量。例如第一向量(x
1,x
2,x
3……,x
m),对应的第四加密向量为(E
pka2(x
1),E
pka2(x
2),E
pka2(x
3)……,E
pka2(x
m)),第四加密向量中包含m个第四加密分量E
pka2(x
i),其中,i为不大于m的任一正整数。
在一种可能的实施方式中,针对第四加密向量中的每个第四加密分量E
pka2(x
i),第一设备可以确定该第四加密分量的第四加密平方分量:E
pka2(x
i
2)。另外,针对第四加密向量中的每个第四加密分量E
pka2(x
i),第一设备还可以确定加密后的第四分量与相应的第三加密分量的乘积,以及相应的第三加密分量的第三加密平方分量:E
pka2(y
i
2)。
其中,可以采用上述实施例中提供的通过半同态加密算法,确定第一加密分量与相应的第二分量的乘积的方式,来确定第四分量与相应的第三加密分量的乘积。例如,可以先通过半同态加密算法,确定加密后的指数幂
其中,该指数幂的底数可以为该第三加密分量,该指数幂的指数为相应的第四分量x
i;该指数幂用于确定基于半同态加密算法加密后的第四分量与相应的第三加密分量的乘积,在此不再赘述。
在一种可能的实施方式中,针对每个第四加密分量,可以基于该第四加密分量对应的第四加密平方分量E
pka2(x
i
2)、该第四分量与相应的第三加密分量的乘积
以及第三加密平方分量E
pka2(y
i
2),确定该第四加密分量对应的加密后的子距离:
可选的,可以将每个第四加密分量对应的加密后的子距离的和值,确定为第三加密向量与第四加密向量的第二加密距离:
在一种可能的实施方式中,第一设备获得第二加密距离之后,可以将该第二加密距离发送给第二设备。第二设备接收到该第二加密距离之后,可以根据第二设备自身生成的第二目标私钥对中的第二目标私钥,对该第二加密 距离进行解密,以确定第一向量和第二向量的目标距离。
示例性的,第二设备可以根据第二目标私钥,对第二加密距离进行解密后,得到
可以基于解密后的第二加密距离以及欧氏距离公式,计算第一向量和第二向量之间的目标距离,示例性的,第一向量和第二向量之间的目标距离
其中,该x
i为第一向量中的第i个分量,y
i为第二向量中的第i个分量,m为第一向量或第二向量中包含的分量的数量,且该第一向量中包含的分量的数量与该第二分量中包含的分量的数量相同,即第一向量的长度与第二向量的长度相等,第一向量和第二向量的长度可以均为预设长度m,m可以为任意正整数。
另外,本申请实施例还提供了另一种确定第二加密距离的方式,在一种可能的实施方式中,第二加密距离还可以采用以下过程获得:
针对第四加密向量中的每个第四加密分量E
pka2(x
i)以及第三加密向量中的每个第三加密分量E
pka2(y
i),第一设备可以确定该第四分量与相应的第三加密分量的乘积
以及相应的第四加密分量的第四加密平方分量E
pka2(x
i
2);第一设备可以基于该乘积
以及该第四加密平方分量E
pka2(x
i
2),确定该第四加密分量对应的加密后的子距离:
第一设备可以将该加密后的子距离a发送给第二设备,第二设备针对第三加密向量中的每个第三加密分量E
pka2(y
i),可以确定该第三加密分量的第三加密平方分量E
pka2(y
i
2),并可以基于该第三加密平方分量E
pka2(y
i
2)以及加密后的子距离
对该第四加密分量对应的加密后的子距离进行更新,可选的,可以将加密后的子距离更新为:
第二设备可以基于每个第四加密分量对应的更新后的子距离,确定第三加密向量和第四加密向量的更新后的第二加密距离。可选的,可以将每个第四加密分量对应的更新后的子距离的和值,确定为第三加密向量和第四加密 向量的更新后的第二加密距离:
与上述实施例类似,确定了更新后的第二加密距离之后,第二设备可以基于第二目标私钥,对该更新后的第二加密距离进行解密,以确定第一向量和第二向量的目标距离。示例性的,第二设备可以根据第二目标私钥,对第二加密距离进行解密后,得到
可以基于解密后的第二加密距离以及欧氏距离公式,计算第一向量和第二向量之间的目标距离,示例性的,第一向量和第二向量之间的目标距离
其中,该x
i为第一向量中的第i个分量,y
i为第二向量中的第i个分量,m为第一向量或第二向量中包含的分量的数量,且该第一向量中包含的分量的数量与该第二分量中包含的分量的数量相同,即第一向量的长度与第二向量的长度相等,第一向量和第二向量的长度可以均为预设长度m,m可以为任意正整数。
由于第一数据对应的第一向量的长度与第二数据对应的第二向量的长度相等,因此,即使第一数据与第二数据不相同,也能实现模糊匹配,拓宽了使用场景。
第二设备确定了第一向量和第二向量的目标距离之后,也可以基于该目标距离以及预设的第一距离阈值,确定第一数据和第二数据是否匹配,其中第二设备确定第一数据和第二数据是否匹配的过程与上述实施例中第一设备确定第一数据和第二数据是否匹配的过程可以相同,在此不再赘述。
为方便理解,下面通过一个具体实施例对本申请提供的数据匹配过程进行说明。图2为本申请实施例提供的第二种数据匹配过程示意图,如图2所示,该过程包括以下操作:
第一设备分别将待匹配的每个第一数据输入到部署在第一设备中的预先训练完成的向量转化模型中,针对每个第一数据,获得该第一数据对应的第一向量。同样的,第二设备分别将待匹配的每个第二数据输入到部署在第二设备中的预先训练完成的向量转化模型中,针对每个第二数据,获得该第二 数据对应的第二向量。如图2所述,分别有4个第一数据,分别为U1、U2、U3、U4,且U1对应的第一向量为(x11,x12,x13……,x1m),U2对应的第一向量为(x21,x22,x23……,x2m),U3对应的第一向量为(x31,x32,x33……,x3m),U4对应的第一向量为(x41,x42,x43……,x4m)。另外,分别有4个第二数据,分别为U5、U6、U7、U8,且U5对应的第二向量为(y11,y12,y13……,y1m),U6对应的第二向量为(y21,y22,y23……,y2m),U7对应的第二向量为(y31,y32,y33……,y3m),U8对应的第二向量为(y41,y42,y43……,y4m)。
第一设备生成第一目标公私钥对A(pka,ska),其中,该pka为第一目标公钥,ska为第一目标私钥,该第一目标公私钥对为半同态加密目标公私钥对。针对每个第一向量,基于该第一目标公钥对对该第一向量进行半同态加密,生成相应的第一加密向量。例如,第一向量(x11,x12,x13……,x1m)对应的第一加密向量为(E
pka(x11),E
pka(x12),E
pka(x13)……,E
pka(x1m))。第一向量(x21,x22,x23……,x2m)对应的第一加密向量为(E
pka(x21),E
pka(x22),E
pka(x23)……,E
pka(x2m))。第一向量(x31,x32,x33……,x3m)对应的第一加密向量为(E
pka(x31),E
pka(x32),E
pka(x33)……,E
pka(x3m))。第一向量(x41,x42,x43……,x4m)对应的第一加密向量为(E
pka(x41),E
pka(x42),E
pka(x43)……,E
pka(x4m))。
第一设备将第一目标公钥以及每个第一加密向量均发送给第二设备,第二设备在接收到该第一目标公钥以及每个第一加密向量后,针对每个第二向量,基于第一目标公钥对该第二向量进行半同态加密生成第二加密向量。第二向量(y11,y12,y13……,y1m)对应的第二加密向量为(E
pka(y11),E
pka(y12),E
pka(y13)……,E
pka(y1m))。第二向量(y21,y22,y23……,y2m)对应的第二加密向量为(E
pka(y21),E
pka(y22),E
pka(y23)……,E
pka(y2m))。第二向量(y31,y32,y33……,y3m)对应的第二加密向量为(E
pka(y31),E
pka(y32),E
pka(y33)……,E
pka(y3m))。第 二向量(y41,y42,y43……,y4m)对应的第二加密向量为(E
pka(y41),E
pka(y42),E
pka(y43)……,E
pka(y4m))。
由于针对每个第一数据,需要确定该第一数据与每个第二数据是否匹配,例如,针对第一数据U1,需要确定第一数据U1与第二数据U5是否匹配、第一数据U1与第二数据U6是否匹配、第一数据U1与第二数据U7是否匹配、第一数据U1与第二数据U8是否匹配,因此,针对每个第一向量,均可以确定该第一向量与每个第二向量的目标距离,针对每个第一加密向量,也均可以基于该第一加密向量与每个第二加密向量,分别计算相应的第一加密距离。其中,基于任一第一加密向量与任一第二加密向量,计算第一加密距离的过程均与上述实施例中计算第一加密距离的过程相同,例如,针对任一第一加密向量与任一第二加密向量,第二设备可以将基于该第一加密向量和该第二加密向量计算的加密后的子距离b,
发送给第一设备。第一设备可以将加密后的子距离更新为E
pka1(x
i
2)-2E
pka1(x
iy
i)+E
pka1(y
i
2),并采用第一目标私钥,对更新后的第一加密距离进行解密,以进而得到相应的第一向量与第二向量的目标距离,在此不再赘述。
针对每个第一向量,分别确定了该第一向量与每个第二向量的目标距离之后,第一设备还可以将确定的目标距离发送给第二设备,第一设备和第二设备均可以分别基于该目标距离以及预设的第一距离阈值,确定该第一向量对应的第一数据分别与每个第二向量对应的第二数据是否匹配,即可以分别确定各个第一数据与各个第二数据是否匹配。
为方便理解,下面再通过一个具体实施例对本申请提供的数据匹配过程进行说明。假设保存在第一设备中的第一数据有3个,分别为“某海市某东新区晴某小卖部”、“某海市天某餐饮店”、“高某路杨某福麻辣烫”。保存在第二设备中的第二数据也有3个,分别为“某海市晴某小卖部”、“某海市天某餐饮店”、“麦某劳”。
其中第一数据中,“某海市某东新区晴某小卖部”对应的第一向量为<1.0,2.0,1.5,2.0,3.5>,记为A1。“某海市天某餐饮店”对应的第一向量为<3.0,4.0,2.5,2.5,1.5>,记为A2。“高某路杨某福麻辣烫”对应的第一向量为<4.5,5.5,7.5,1.5,0.5>,记为A3。
第二数据中,“某海市晴某小卖部”对应的第二向量为<1.0,2.0,1.5,1.0,3.5>,记为B1。“某海市天某餐饮店”对应的第二向量为<3.0,4.0,2.5,2.5,1.5>,记为B2。“麦某劳”对应的第二向量为<3.5,6.5,2.5,7.5,2.5>,记为B3。
第一设备生成第一目标公私钥对A(pka,ska),其中,该pka为第一目标公钥,ska为第一目标私钥,该第一目标公私钥对为半同态加密目标公私钥对。针对每个第一向量,第一设备可以基于该第一目标公钥对对该第一向量进行半同态加密,生成相应的第一加密向量。
第一设备将第一目标公钥以及每个第一加密向量均发送给第二设备,第二设备在接收到该第一目标公钥以及每个第一加密向量后,针对每个第二向量,基于第一目标公钥对该第二向量进行半同态加密生成第二加密向量。
由于针对每个第一数据,需要确定该第一数据与每个第二数据是否匹配,因此,针对每个第一向量,均可以确定该第一向量与每个第二向量的目标距离,针对每个第一加密向量,也均可以基于该第一加密向量与每个第二加密向量,分别计算相应的第一加密距离。其中,基于任一第一加密向量与任一第二加密向量,计算第一加密距离的过程均与上述实施例中计算第一加密距离的过程相同,在此不再赘述。
如表1所示,表1为本申请一些实施例提供的一种目标距离的示意表。
表1
| D(x,y) | B1 | B2 | B3 |
| A1 | 1 | 3.64 | 7.66 |
| A2 | 3.9 | 0 | 5.7 |
| A3 | 8.35 | 5.61 | 8.18 |
假设D(x,y)表征目标距离,其中x表征的第一向量,y表征的第二向量。A1与B1对应的目标距离为1,A1与B2对应的目标距离为3.64,A1与B3对应的目标距离为7.66,A2与B1对应的目标距离为3.9,A2与B2对应的目标距离为0,A2与B3对应的目标距离为5.7,A3与B1对应的目标距离为8.35,A3与B2对应的目标距离为5.16,A3与B3对应的目标距离为8.18。
假设第一距离阈值为2,则本次模糊匹配结果为第一数据中的“某海市某东新区晴某小卖部”与第二数据中的“某海市晴某小卖部”匹配,第一数据中的“某海市天某餐饮店”与第二数据中的“某海市天某餐饮店”匹配,由此也可以看出,本申请中的数据匹配方法可以使得两个数据在不完全相同时,也能实现数据的模糊匹配,拓宽了使用场景。
为方便理解,下面再通过一个具体实施例对本申请提供的数据匹配过程进行说明。假设保存在第一设备中的第一数据有3个,分别为3个手机号码“13345678909”、“13245678911”、“13334536787”。保存在第二设备中的第二数据也有3个,分别为3个手机号码“13334536787”、“13345678908”、“15439402290”。
第一设备和第二设备分别可以利用独热(One-Hot)编码模型(数据转化模型)第一数据和第二数据中的手机号码进行向量化,生成相应的第一向量和第二向量,可选的,第一向量和第二向量的向量维度可以为10*11维,其中10代表0-9共10个数字,11代表手机号长度为11个数字。示例性的,参阅表2,表2为手机号码“13345678909”对应的向量示意表。
表2
| 手机号码中的其中一个数字 | 数字对应的向量(独热编码) |
| 1 | 0000000010 |
| 3 | 0000001000 |
| 3 | 0000001000 |
| 4 | 0000010000 |
| 5 | 0000100000 |
| 6 | 0001000000 |
| 7 | 0010000000 |
| 8 | 0100000000 |
| 9 | 1000000000 |
| 0 | 0000000001 |
| 9 | 1000000000 |
参阅表2,在一种可能的实施方式中,0对应的独热编码为0000000001、1对应的独热编码为0000000010、2对应的独热编码为0000000100、3对应的独热编码为0000001000、4对应的独热编码为0000010000、5对应的独热编码为0000100000、6对应的独热编码为0001000000、7对应的独热编码为0010000000、8对应的独热编码为0100000000、9对应的独热编码为1000000000。则手机号码“13345678909”对应的第一向量(或第二向量)可以为(0000000010,0000001000,0000001000,0000010000,0000100000,0001000000,0010000000,0100000000,1000000000,0000000001,1000000000)。确定其他手机号码对应的向量的过程与该过程类似,在此不再赘述。
为方便描述,将第一数据中“13345678909”对应的第一向量记为A4、“13245678911”对应的第一向量记为A5、“13334536787”对应的第一向量记为A6。将第二数据中“13334536787”对应的第二向量记为B4、“13345678908”对应的第二向量记为B5、“15439402290”对应的第二向量记为B6。
第一设备生成第一目标公私钥对A(pka,ska),其中,该pka为第一目标公钥,ska为第一目标私钥,该第一目标公私钥对为半同态加密目标公私钥对。针对每个第一向量,第一设备可以基于该第一目标公钥对对该第一向量进行半同态加密,生成相应的第一加密向量。
第一设备将第一目标公钥以及每个第一加密向量均发送给第二设备,第二设备在接收到该第一目标公钥以及每个第一加密向量后,针对每个第二向量,基于第一目标公钥对该第二向量进行半同态加密生成第二加密向量。
由于针对每个第一数据,需要确定该第一数据与每个第二数据是否匹配,因此,针对每个第一向量,均可以确定该第一向量与每个第二向量的目标距离,针对每个第一加密向量,也均可以基于该第一加密向量与每个第二加密向量,分别计算相应的第一加密距离。其中,基于任一第一加密向量与任一 第二加密向量,计算第一加密距离的过程均与上述实施例中计算第一加密距离的过程相同,在此不再赘述。
如表3所示,表3为本申请一些实施例提供的一种目标距离的示意表。
表3
| D(x,y) | B4 | B5 | B6 |
| A4 | 2.82 | 1 | 3.16 |
| A5 | 3 | 1.73 | 3 |
| A6 | 0 | 2.82 | 3 |
假设D(x,y)表征目标距离,其中x表征的第一向量,y表征的第二向量。A4与B4对应的目标距离为2.82,A4与B5对应的目标距离为1,A4与B6对应的目标距离为3.16,A5与B4对应的目标距离为3,A5与B5对应的目标距离为1.73,A5与B6对应的目标距离为3,A6与B4对应的目标距离为0,A6与B5对应的目标距离为2.83,A6与B6对应的目标距离为3。
假设第一距离阈值为2,则本次模糊匹配结果为第一数据中的“13345678909”与第二数据中的“13345678909”匹配,第一数据中的“13334536787”与第二数据中的“13334536787”匹配,由此也可以看出,本申请中的数据匹配方法不仅能实现数据的模糊匹配,还可以实现数据的精准匹配,拓宽了使用场景。
实施例5:
基于相同的技术构思,本申请提供了一种数据匹配方法,应用于第二设备,图3为本申请实施例提供的第三种数据匹配过程示意图,如图3所示,该方法包括:
S301:将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量。
本申请实施例提供的数据匹配方法应用于第二设备,该第二设备可以是智能终端、PC或者服务器等设备,且该第二设备与本申请中的第一设备为不同的设备。
S302:接收第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;其中,所述第一加密向量为采用所述第一目标公钥对第一向量进行半同态加密后得到的,所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的。
S303:基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备,以使所述第一设备基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;并使所述第一设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量包括:
确定所述第二数据对应的第二目标数据类型;
根据所述第二目标数据类型以及预先保存的数据类型和预先训练完成的向量转化模型的对应关系,确定所述第二数据对应的预先训练完成的第二目标向量转化模型;
将所述第二数据输入到所述预先训练完成的第二目标向量转化模型中,获得所述第二数据对应的所述第二向量。
在一种可能的实施方式中,所述第二目标数据类型为文本类型、数字类型、图像类型中的至少一种。
在一种可能的实施方式中,若所述第二目标数据类型为文本类型,所述第二目标数据类型对应的预先训练完成的第二目标向量转化模型为词向量模型或句向量模型;若所述第二目标数据类型为数字类型,所述第二目标数据类型对应的预先训练完成的第二目标向量转化模型为独热编码模型;若所述第一目标数据类型为图像类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为图像向量模型。
在一种可能的实施方式中,所述方法还包括:
采用自身生成的第二目标公钥对所述第二向量进行半同态加密生成第三加密向量,将所述第二目标公钥和所述第三加密向量发送给所述第一设备;
接收所述第一设备发送的基于所述第三加密向量以及第四加密向量计算得到的第二加密距离,所述第四加密向量为采用所述第二目标公钥对第一向量进行半同态加密后得到的;所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;
基于所述第二加密距离以及与所述第二目标公钥对应的第二目标私钥,确定所述第一向量和第二向量的目标距离,并使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述将所述第一加密距离发送给所述第一设备之后,所述方法还包括:
接收所述第一设备发送的目标距离,基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述方法还包括:
接收所述第一设备发送的所述第一数据以及所述第二数据是否匹配的匹配结果。
在一种可能的实施方式中,所述采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量包括:
针对所述第二向量中的每个第二分量,基于所述第一目标公钥对所述第二向量中的每个第二分量分别进行半同态加密,生成所述第二加密向量。
实施例6:
基于相同的技术构思,本申请提供了一种数据匹配装置,应用于第一设备。图4为本申请一些实施例提供的一种数据匹配装置结构示意图,如图4所示,所述装置包括:
第一获取模块41,用于将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;
第一处理模块42,用于采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;
所述第一获取模块41,还用于获取所述第二设备发送的基于所述第一加密向量和第二加密向量计算的第一加密距离,所述第二加密向量为采用所述第一目标公钥对第二向量进行半同态加密后得到的;所述第二向量为将第二数据输入到所述第二设备中的预先训练完成的向量转化模型中获得的;
第一确定模块43,用于基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述第一获取模块41,具体用于确定所述第一数据对应的第一目标数据类型;
根据所述第一目标数据类型以及预先保存的数据类型和预先训练完成的向量转化模型的对应关系,确定所述第一数据对应的预先训练完成的第一目标向量转化模型;
将所述第一数据输入到所述预先训练完成的第一目标向量转化模型中,获得所述第一数据对应的所述第一向量。
在一种可能的实施方式中,所述第一目标数据类型为文本类型、数字类型、图像类型中的至少一种。
在一种可能的实施方式中,若所述第一目标数据类型为文本类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为词向量模型或句向量模型;若所述第一目标数据类型为数字类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为独热编码模型;若所述第一目标数据类型为图像类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为图像向量模型。
在一种可能的实施方式中,所述装置还包括:
接收模块,用于接收所述第二设备发送的第三加密向量以及所述第二设备生成的第二目标公钥;其中,所述第三加密向量为所述第二设备采用所述第二目标公钥对所述第二向量进行半同态加密后得到的;
所述第一处理模块,还用于基于所述第二目标公钥对所述第一向量进行半同态加密生成第四加密向量;
发送模块,用于基于所述第三加密向量以及所述第四加密向量计算得到第二加密距离,并将所述第二加密距离发送给所述第二设备,以使所述第二设备基于所述第二加密距离以及与所述第二目标公钥对应的第二目标私钥,确定所述第一向量和第二向量的目标距离,并使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述第一发送模块,还用于将所述目标距离发送给所述第二设备,使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述第一发送模块,还用于将确定的所述第一数据以及所述第二数据是否匹配的匹配结果发送给所述第二设备。
在一种可能的实施方式中,所述第一处理模块,具体用于针对所述第一向量中的每个第一分量,基于所述第一目标公钥对所述第一向量中的每个第一分量分别进行半同态加密,生成所述第一加密向量。
在一种可能的实施方式中,所述第一向量和所述第二向量的长度均为预设长度。
在一种可能的实施方式中,所述第一加密距离是采用以下过程获得的:
针对所述第一加密向量中的每个第一加密分量以及所述第二加密向量中的每个第二加密分量,通过半同态加密算法,确定该第一加密分量与相应的第二加密分量的乘积,以及相应的第二加密分量的第二加密平方分量;基于该乘积以及该第二加密平方分量,确定该第一加密分量对应的加密后的子距离;
基于每个第一加密分量对应的加密后的子距离,确定所述第一加密向量和第二加密向量的第一加密距离。
在一种可能的实施方式中,所述第一确定模块43,具体用于针对所述第一加密向量中的每个第一加密分量,确定该第一加密分量的第一加密平方分量;基于该第一加密平方分量以及该第一加密分量对应的所述加密后的子距离,对该第一加密分量对应的所述加密后的子距离进行更新;
基于每个第一加密分量对应的更新后的子距离,确定所述第一加密向量和第二加密向量的更新后的第一加密距离;
采用与所述第一目标公钥对应的第一目标私钥,对所述更新后的第一加密距离进行解密,得到所述第一向量和第二向量的目标距离。
在一种可能的实施方式中,所述第一加密距离是采用以下过程获得的:
针对所述第一加密向量中的每个第一加密分量以及所述第二加密向量中的每个第二加密分量,通过半同态加密算法,确定该第一加密分量的第一加密平方分量、该第一加密分量与相应的第二加密分量的乘积,以及相应的第二加密分量的第二加密平方分量;基于该第一加密平方分量、该乘积以及该第二加密平方分量,确定该第一加密分量对应的加密后的子距离;
基于每个第一加密分量对应的加密后的子距离,确定所述第一加密向量和第二加密向量的第一加密距离。
在一种可能的实施方式中,所述第一确定模块43,具体用于确定该第一加密分量个指数幂的乘积,其中,所述指数幂的指数为相应的第二加密分量;
基于该第一加密分量个指数幂的乘积,确定该第一加密分量个相应的第二加密分量的和;
基于该第一加密分量个相应的第二加密分量的和,确定该第一加密分量与相应的第二加密分量的乘积。
在一种可能的实施方式中,所述第一确定模块43,具体用于判断所述目标距离是否小于预设的第一距离阈值;
若是,则确定所述第一数据与所述第二数据匹配;
否则,确定所述第一数据与所述第二数据不匹配。
在一种可能的实施方式中,所述第一确定模块43,还用于判断所述目标距离是否等于预设的第二距离阈值,若是,则确定所述第一数据与所述第二数据相同。
实施例7:
基于相同的技术构思,本申请提供了另一种数据匹配装置,应用于第二设备。图5为本申请一些实施例提供的另一种数据匹配装置结构示意图,如图5所示,所述装置包括:
第二获取模块51,用于将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;
第二处理模块52,用于接收第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;其中,所述第一加密向量为采用所述第一目标公钥对第一向量进行半同态加密后得到的,所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;
第二确定模块53,用于基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备,以使所述第一设备基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;并使所述第一设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述第二获取模块51,具体用于确定所述第二数据对应的第二目标数据类型;
根据所述第二目标数据类型以及预先保存的数据类型和预先训练完成的向量转化模型的对应关系,确定所述第二数据对应的预先训练完成的第二目标向量转化模型;
将所述第二数据输入到所述预先训练完成的第二目标向量转化模型中,获得所述第二数据对应的所述第二向量。
在一种可能的实施方式中,所述第二目标数据类型为文本类型、数字类型、图像类型中的至少一种。
在一种可能的实施方式中,若所述第二目标数据类型为文本类型,所述第二目标数据类型对应的预先训练完成的第二目标向量转化模型为词向量模型或句向量模型;若所述第二目标数据类型为数字类型,所述第二目标数据类型对应的预先训练完成的第二目标向量转化模型为独热编码模型;若所述第一目标数据类型为图像类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为图像向量模型。
在一种可能的实施方式中,所述第二处理模块52,还用于采用自身生成的第二目标公钥对所述第二向量进行半同态加密生成第三加密向量,将所述第二目标公钥和所述第三加密向量发送给所述第一设备;接收所述第一设备发送的基于所述第三加密向量以及第四加密向量计算得到的第二加密距离,所述第四加密向量为采用所述第二目标公钥对第一向量进行半同态加密后得到的;所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;基于所述第二加密距离以及与所述第二目标公钥对应的第二目标私钥,确定所述第一向量和第二向量的目标距离,并使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述第二确定模块53,还用于接收所述第一设备发送的目标距离,基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
在一种可能的实施方式中,所述第二确定模块53,还用于接收所述第一设备发送的所述第一数据以及所述第二数据是否匹配的匹配结果。
在一种可能的实施方式中,所述第二获取模块51,还用于针对所述第二向量中的每个第二分量,基于所述第一目标公钥对所述第二向量中的每个第二分量分别进行半同态加密,生成所述第二加密向量。
实施例8:
基于相同的技术构思,本申请提供了一种数据匹配系统,图6为本申请一些实施例提供的一种数据匹配系统结构示意图,如图6所示,所述系统包括:
第一设备61,用于将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备62;
所述第二设备62,用于将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;并接收所述第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备61;
所述第一设备61,还用于基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
基于相同的技术构思,本申请还提供了一种电子设备,图7为本申请一些实施例提供的一种电子设备结构示意图,如图7所示,包括:处理器71、通信接口72、存储器73和通信总线74,其中,处理器71,通信接口72,存储器73通过通信总线74完成相互间的通信;
所述存储器73中存储有计算机程序,当所述程序被所述处理器71执行时,使得所述处理器71执行上述任一实施例的数据匹配方法的步骤。
由于上述电子设备解决问题的原理与数据匹配方法相似,因此上述电子设备的实施可以参见方法的实施,重复之处不再赘述。
上述电子设备提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据 总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口72用于上述电子设备与其他设备之间的通信。
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选地,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述处理器可以是通用处理器,包括中央处理器、网络处理器(Network Processor,NP)等;还可以是数字指令处理器(Digital Signal Processing,DSP)、专用集成电路、现场可编程门陈列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。
基于相同的技术构思,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有可由电子设备执行的计算机程序,当所述程序在所述电子设备上运行时,使得所述电子设备执行时实现上述任一实施例的数据匹配方法的步骤。由于上述计算机可读存储介质解决问题的原理与数据匹配方法相似,因此上述计算机可读存储介质的实施可以参见方法的实施,重复之处不再赘述。
上述计算机可读存储介质可以是电子设备中的处理器能够存取的任何可用介质或数据存储设备,包括但不限于磁性存储器如软盘、硬盘、磁带、磁光盘(MO)等、光学存储器如CD、DVD、BD、HVD等、以及半导体存储器如ROM、EPROM、EEPROM、非易失性存储器(NAND FLASH)、固态硬盘(SSD)等。
基于相同的技术构思,在上述各实施例的基础上,本申请提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码在计算机上运行时,使得计算机执行如上述任一所述数据匹配方法的步骤。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、 或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。
Claims (28)
- 一种数据匹配方法,应用于第一设备,所述方法包括:将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;获取所述第二设备发送的基于所述第一加密向量和第二加密向量计算的第一加密距离,所述第二加密向量为采用所述第一目标公钥对第二向量进行半同态加密后得到的;所述第二向量为将第二数据输入到所述第二设备中的预先训练完成的向量转化模型中获得的;基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 根据权利要求1所述的方法,其中,所述将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量包括:确定所述第一数据对应的第一目标数据类型;根据所述第一目标数据类型以及预先保存的数据类型和预先训练完成的向量转化模型的对应关系,确定所述第一数据对应的预先训练完成的第一目标向量转化模型;将所述第一数据输入到所述预先训练完成的第一目标向量转化模型中,获得所述第一数据对应的所述第一向量。
- 根据权利要求2所述的方法,其中,所述第一目标数据类型为文本类型、数字类型、图像类型中的至少一种。
- 根据权利要求3所述的方法,其中,若所述第一目标数据类型为文本类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型 为词向量模型或句向量模型;若所述第一目标数据类型为数字类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为独热编码模型;若所述第一目标数据类型为图像类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为图像向量模型。
- 根据权利要求1所述的方法,所述方法还包括:接收所述第二设备发送的第三加密向量以及所述第二设备生成的第二目标公钥;其中,所述第三加密向量为所述第二设备采用所述第二目标公钥对所述第二向量进行半同态加密后得到的;基于所述第二目标公钥对所述第一向量进行半同态加密生成第四加密向量;基于所述第三加密向量以及所述第四加密向量计算得到第二加密距离,并将所述第二加密距离发送给所述第二设备,以使所述第二设备基于所述第二加密距离以及与所述第二目标公钥对应的第二目标私钥,确定所述第一向量和第二向量的目标距离,并使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 根据权利要求1所述的方法,所述确定所述第一向量和第二向量的目标距离之后,所述方法还包括:将所述目标距离发送给所述第二设备,使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 根据权利要求1所述的方法,所述方法还包括:将确定的所述第一数据以及所述第二数据是否匹配的匹配结果发送给所述第二设备。
- 根据权利要求1所述的方法,其中,所述采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量包括:针对所述第一向量中的每个第一分量,基于所述第一目标公钥对所述第一向量中的每个第一分量分别进行半同态加密,生成所述第一加密向量。
- 根据权利要求1或8所述的方法,其中,所述第一向量和所述第二向 量的长度均为预设长度。
- 根据权利要求8所述的方法,其中,所述第一加密距离是采用以下过程获得的:针对所述第一加密向量中的每个第一加密分量、所述第二向量中的每个第二分量以及所述第二加密向量中的每个第二加密分量,通过半同态加密算法,确定加密后的该第一加密分量与相应的第二分量的乘积,以及相应的第二加密分量的第二加密平方分量;基于该乘积以及该第二加密平方分量,确定该第一加密分量对应的加密后的子距离;基于每个第一加密分量对应的加密后的子距离,确定所述第一加密向量和第二加密向量的第一加密距离。
- 根据权利要求10所述的方法,其中,所述基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离,包括:针对所述第一加密向量中的每个第一加密分量,确定该第一加密分量的第一加密平方分量;基于该第一加密平方分量以及该第一加密分量对应的所述加密后的子距离,对该第一加密分量对应的所述加密后的子距离进行更新;基于每个第一加密分量对应的更新后的子距离,确定所述第一加密向量和第二加密向量的更新后的第一加密距离;采用与所述第一目标公钥对应的第一目标私钥,对所述更新后的第一加密距离进行解密,得到所述第一向量和第二向量的目标距离。
- 根据权利要求8所述的方法,其中,所述第一加密距离是采用以下过程获得的:针对所述第一加密向量中的每个第一加密分量、所述第二向量中的每个第二分量以及所述第二加密向量中的每个第二加密分量,通过半同态加密算法,确定该第一加密分量的第一加密平方分量、加密后的该第一加密分量与相应的第二分量的乘积,以及相应的第二加密分量的第二加密平方分量;基于该第一加密平方分量、该乘积以及该第二加密平方分量,确定该第一加密 分量对应的加密后的子距离;基于每个第一加密分量对应的加密后的子距离,确定所述第一加密向量和第二加密向量的第一加密距离。
- 根据权利要求10或12所述的方法,其中,通过半同态加密算法,确定加密后的该第一加密分量与相应的第二分量的乘积,包括:通过半同态加密算法,确定加密后的指数幂,其中,所述指数幂的底数为该第一加密分量,所述指数幂的指数为相应的第二分量;所述指数幂用于确定基于半同态加密算法加密后的该第一加密分量与相应的第二分量的乘积。
- 根据权利要求1所述的方法,其中,所述基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配包括:判断所述目标距离是否小于预设的第一距离阈值;若是,则确定所述第一数据与所述第二数据匹配;否则,确定所述第一数据与所述第二数据不匹配。
- 根据权利要求14所述的方法,所述确定所述第一数据与所述第二数据匹配之后,所述方法还包括:判断所述目标距离是否等于预设的第二距离阈值,若是,则确定所述第一数据与所述第二数据相同。
- 一种数据匹配方法,应用于第二设备,所述方法包括:将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;接收第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;其中,所述第一加密向量为采用所述第一目标公钥对第一向量进行半同态加密后得到的,所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备,以使所述第一设备基于所述第一加密距离以 及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;并使所述第一设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 根据权利要求16所述的方法,其中,所述将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量包括:确定所述第二数据对应的第二目标数据类型;根据所述第二目标数据类型以及预先保存的数据类型和预先训练完成的向量转化模型的对应关系,确定所述第二数据对应的预先训练完成的第二目标向量转化模型;将所述第二数据输入到所述预先训练完成的第二目标向量转化模型中,获得所述第二数据对应的所述第二向量。
- 根据权利要求17所述的方法,其中,所述第二目标数据类型为文本类型、数字类型、图像类型中的至少一种。
- 根据权利要求18所述的方法,其中,若所述第二目标数据类型为文本类型,所述第二目标数据类型对应的预先训练完成的第二目标向量转化模型为词向量模型或句向量模型;若所述第二目标数据类型为数字类型,所述第二目标数据类型对应的预先训练完成的第二目标向量转化模型为独热编码模型;若所述第一目标数据类型为图像类型,所述第一目标数据类型对应的预先训练完成的第一目标向量转化模型为图像向量模型。
- 根据权利要求16所述的方法,所述方法还包括:采用自身生成的第二目标公钥对所述第二向量进行半同态加密生成第三加密向量,将所述第二目标公钥和所述第三加密向量发送给所述第一设备;接收所述第一设备发送的基于所述第三加密向量以及第四加密向量计算得到的第二加密距离,所述第四加密向量为采用所述第二目标公钥对第一向量进行半同态加密后得到的;所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;基于所述第二加密距离以及与所述第二目标公钥对应的第二目标私钥, 确定所述第一向量和第二向量的目标距离,并使所述第二设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 根据权利要求16所述的方法,所述将所述第一加密距离发送给所述第一设备之后,所述方法还包括:接收所述第一设备发送的目标距离,基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 根据权利要求16所述的方法,所述方法还包括:接收所述第一设备发送的所述第一数据以及所述第二数据是否匹配的匹配结果。
- 根据权利要求16所述的方法,其中,所述采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量包括:针对所述第二向量中的每个第二分量,基于所述第一目标公钥对所述第二向量中的每个第二分量分别进行半同态加密,生成所述第二加密向量。
- 一种数据匹配装置,应用于第一设备,所述装置包括:第一获取模块,用于将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;第一处理模块,用于采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;所述第一获取模块,还用于获取所述第二设备发送的基于所述第一加密向量和第二加密向量计算的第一加密距离,所述第二加密向量为采用所述第一目标公钥对第二向量进行半同态加密后得到的;所述第二向量为将第二数据输入到所述第二设备中的预先训练完成的向量转化模型中获得的;第一确定模块,用于基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否 匹配。
- 一种数据匹配装置,应用于第二设备,所述装置包括:第二获取模块,用于将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;第二处理模块,用于接收第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;其中,所述第一加密向量为采用所述第一目标公钥对第一向量进行半同态加密后得到的,所述第一向量为将第一数据输入到所述第一设备中的预先训练完成的向量转化模型中获得的;第二确定模块,用于基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备,以使所述第一设备基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;并使所述第一设备基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是否匹配。
- 一种数据匹配系统,所述系统包括:第一设备,用于将待匹配的第一数据输入到预先训练完成的向量转化模型中,获得所述第一数据对应的第一向量;采用自身生成的第一目标公钥对所述第一向量进行半同态加密生成第一加密向量,将所述第一目标公钥以及所述第一加密向量发送给第二设备;所述第二设备,用于将待匹配的第二数据输入到预先训练完成的向量转化模型中,获得所述第二数据对应的第二向量;并接收所述第一设备发送的第一目标公钥以及第一加密向量,采用所述第一目标公钥对所述第二向量进行半同态加密生成第二加密向量;基于所述第一加密向量和第二加密向量计算第一加密距离,将所述第一加密距离发送给所述第一设备;所述第一设备,还用于基于所述第一加密距离以及与所述第一目标公钥对应的第一目标私钥,确定所述第一向量和第二向量的目标距离;基于所述目标距离以及预设的第一距离阈值,确定所述第一数据以及所述第二数据是 否匹配。
- 一种电子设备,所述电子设备包括处理器和存储器,所述存储器用于存储程序指令,所述处理器用于执行存储器中存储的计算机程序时实现权利要求1-23任一所述数据匹配方法的步骤。
- 一种计算机可读存储介质,其存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-23任一所述数据匹配方法的步骤。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US19/102,188 US20260058798A1 (en) | 2022-08-09 | 2022-12-07 | Data matching method |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210952494.8A CN115442021A (zh) | 2022-08-09 | 2022-08-09 | 一种数据匹配方法、装置、系统、设备及介质 |
| CN202210952494.8 | 2022-08-09 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2024031886A1 true WO2024031886A1 (zh) | 2024-02-15 |
Family
ID=84242406
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/137361 Ceased WO2024031886A1 (zh) | 2022-08-09 | 2022-12-07 | 一种数据匹配方法、装置、系统、设备及介质 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US20260058798A1 (zh) |
| CN (1) | CN115442021A (zh) |
| TW (1) | TWI832640B (zh) |
| WO (1) | WO2024031886A1 (zh) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115442021A (zh) * | 2022-08-09 | 2022-12-06 | 中国银联股份有限公司 | 一种数据匹配方法、装置、系统、设备及介质 |
| CN116070272B (zh) * | 2023-01-20 | 2025-09-12 | 中国银联股份有限公司 | 生物特征匹配方法、终端设备、服务器、系统及介质 |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150046708A1 (en) * | 2013-08-07 | 2015-02-12 | Fujitsu Limited | Information processing technique for secure pattern matching |
| US20160119119A1 (en) * | 2014-05-15 | 2016-04-28 | Xeror Corporation | Compact fuzzy private matching using a fully-homomorphic encryption scheme |
| US20180212759A1 (en) * | 2017-01-20 | 2018-07-26 | Enveil, Inc. | Secure Probabilistic Analytics Using Homomorphic Encryption |
| CN112329519A (zh) * | 2020-09-21 | 2021-02-05 | 中国人民武装警察部队工程大学 | 一种安全的在线指纹匹配方法 |
| CN114817943A (zh) * | 2022-02-28 | 2022-07-29 | 中国银联股份有限公司 | 一种数据匹配方法、装置、设备及介质 |
| CN115442021A (zh) * | 2022-08-09 | 2022-12-06 | 中国银联股份有限公司 | 一种数据匹配方法、装置、系统、设备及介质 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| PH12018500541B1 (en) * | 2015-09-11 | 2024-04-12 | Jumio Corp | Method and system for determining a quality metric in biometric authentication |
| CN105426356B (zh) * | 2015-10-29 | 2019-05-21 | 杭州九言科技股份有限公司 | 一种目标信息识别方法和装置 |
| CN114091043A (zh) * | 2020-08-04 | 2022-02-25 | 中移(成都)信息通信科技有限公司 | 一种相关性系数计算方法、装置、设备及计算机存储介质 |
| CN113032846B (zh) * | 2021-05-20 | 2021-08-06 | 华控清交信息科技(北京)有限公司 | 一种数据处理方法、装置和用于数据处理的装置 |
| CN113794548B (zh) * | 2021-09-13 | 2024-11-08 | 深圳前海微众银行股份有限公司 | 同态加密方法、设备、介质及计算机程序产品 |
-
2022
- 2022-08-09 CN CN202210952494.8A patent/CN115442021A/zh active Pending
- 2022-12-07 WO PCT/CN2022/137361 patent/WO2024031886A1/zh not_active Ceased
- 2022-12-07 US US19/102,188 patent/US20260058798A1/en active Pending
- 2022-12-28 TW TW111150288A patent/TWI832640B/zh active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150046708A1 (en) * | 2013-08-07 | 2015-02-12 | Fujitsu Limited | Information processing technique for secure pattern matching |
| US20160119119A1 (en) * | 2014-05-15 | 2016-04-28 | Xeror Corporation | Compact fuzzy private matching using a fully-homomorphic encryption scheme |
| US20180212759A1 (en) * | 2017-01-20 | 2018-07-26 | Enveil, Inc. | Secure Probabilistic Analytics Using Homomorphic Encryption |
| CN112329519A (zh) * | 2020-09-21 | 2021-02-05 | 中国人民武装警察部队工程大学 | 一种安全的在线指纹匹配方法 |
| CN114817943A (zh) * | 2022-02-28 | 2022-07-29 | 中国银联股份有限公司 | 一种数据匹配方法、装置、设备及介质 |
| CN115442021A (zh) * | 2022-08-09 | 2022-12-06 | 中国银联股份有限公司 | 一种数据匹配方法、装置、系统、设备及介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| TWI832640B (zh) | 2024-02-11 |
| CN115442021A (zh) | 2022-12-06 |
| TW202408199A (zh) | 2024-02-16 |
| US20260058798A1 (en) | 2026-02-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12056582B2 (en) | Method and device for training a model based on federated learning | |
| US11201751B2 (en) | System and method for off-chain cryptographic transaction verification | |
| CN109639714B (zh) | 一种基于区块链的物联网身份注册与验证方法 | |
| TWI835300B (zh) | 一種資料匹配方法、裝置、設備及介質 | |
| CN110110229A (zh) | 一种信息推荐方法及装置 | |
| US12131321B2 (en) | Data processing method, apparatus, device, and medium in blockchain fund settlement system | |
| TWI832640B (zh) | 一種資料匹配方法、裝置、系統、設備及介質 | |
| CN110489985B (zh) | 数据处理方法、装置、计算机可读存储介质及电子设备 | |
| WO2021204273A1 (zh) | 资产类型注册、交易记录验证 | |
| US12244694B2 (en) | Method for providing oracle service of blockchain network by using zero-knowledge proof and aggregator terminal using the same | |
| TW202536726A (zh) | 大模型的訓練方法、裝置、設備及儲存媒體 | |
| CN108564461B (zh) | 一种资源配置方法、计算机可读存储介质及终端设备 | |
| Xu et al. | FedG2L: a privacy-preserving federated learning scheme base on “G2L” against poisoning attack | |
| CN112149174A (zh) | 模型训练方法、装置、设备和介质 | |
| US12314382B2 (en) | Model protection method and apparatus, data processing method and apparatus, and device and medium | |
| CN115412256A (zh) | 基于区块链的身份认证方法及装置、存储介质、终端设备 | |
| TWI833528B (zh) | 數據匹配方法、裝置、系統、設備及介質 | |
| CN116737702A (zh) | 基于区块链的数据管理方法、装置、电子设备及存储介质 | |
| HK40076583A (zh) | 一种数据匹配方法、装置、系统、设备及介质 | |
| US10505714B2 (en) | Floating point cohort based encryption | |
| HK40069149B (zh) | 一种数据匹配方法、装置、设备及介质 | |
| CN118300879B (zh) | 通信认证方法、装置、计算机设备、存储介质和程序产品 | |
| HK40082345A (zh) | 一种数据匹配方法、装置、系统、设备及介质 | |
| Bayramova et al. | Transition to Post-Quantum Cryptographic Algorithms in Critical Software: Challenges and Strategies | |
| HK40069149A (zh) | 一种数据匹配方法、装置、设备及介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22954824 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 22954824 Country of ref document: EP Kind code of ref document: A1 |
