An image blur matching method and apparatus
By applying homomorphic encryption and privacy protection to the image hash value, the problems of accuracy and security in image fuzzy matching are solved, thereby improving the security and accuracy of image fuzzy matching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNIONPAY
- Filing Date
- 2022-09-05
- Publication Date
- 2026-06-26
AI Technical Summary
Existing privacy set intersection methods have low accuracy in image fuzzy matching and cannot effectively protect the privacy of image data and the accuracy of matching.
Homomorphic encryption technology is used to encrypt the image hash value, and bit-by-bit difference and privacy protection processing are used to ensure that the first-party device cannot parse the hash value of the second-party device, thus achieving fuzzy image matching.
It improves the security and accuracy of fuzzy image matching, expands the application scope of privacy intersection, and realizes fuzzy privacy intersection of images.
Smart Images

Figure CN116244726B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of privacy computing technology, specifically to an image fuzzy matching method and apparatus. Background Technology
[0002] Private Set Intersection (PSI) refers to finding the intersection of the data held by two participating parties without revealing any additional information. In privacy computing and federated learning practices, PSI methods based on technologies such as RSA, OT, and Diffie-Hellman have been developed to achieve accurate privacy matching of numerical information.
[0003] Since images differ from numerical information, and determining whether two images are identical is somewhat ambiguous, directly applying the aforementioned privacy set intersection method to image fuzzy matching results in low accuracy. Summary of the Invention
[0004] This application provides an image fuzzy matching method and apparatus for image privacy fuzzy matching.
[0005] In a first aspect, embodiments of this application provide an image fuzzy matching method, applied to a first-party device, comprising:
[0006] The first image to be matched is hashed to obtain a first hash value, and the first hash value is homomorphically encrypted using an encryption key to obtain the first ciphertext.
[0007] The first ciphertext and the encryption key are sent to the second-party device, so that the second-party device performs homomorphic encryption on the second hash value based on the encryption key to obtain the second ciphertext, wherein the second hash value is obtained by the second-party device by performing a hash transformation on the second image to be matched;
[0008] The device receives target ciphertext sent by the second-party device. The target ciphertext is obtained by the second-party device by subtracting the first ciphertext and the second ciphertext bit by bit and performing privacy protection processing. The privacy protection processing makes it impossible for the first-party device to parse the second hash value from the target ciphertext.
[0009] Based on the target ciphertext, a fuzzy matching result is determined between the first image to be matched and the second image to be matched.
[0010] By performing privacy protection processing on the image hash value, the protection of the first and second hash values in image fuzzy matching is achieved, which improves the security of image similarity matching between two devices. At the same time, it expands the application scope of privacy intersection, that is, it extends the precise privacy intersection of numerical information to the fuzzy privacy intersection of images, and also improves the accuracy of image fuzzy matching.
[0011] Optionally, the encryption key is a homomorphic encryption public key; the step of performing a hash transformation on the first image to be matched to obtain a first hash value, and then homomorphically encrypting the first hash value using the encryption key to obtain the first ciphertext, includes:
[0012] The first image to be matched is hashed using a perceptual hash algorithm to obtain a first hash value.
[0013] Using a homomorphic encryption public key, each element in the first hash value is homomorphically encrypted to obtain the first ciphertext.
[0014] Optionally, determining the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext includes:
[0015] Based on the target ciphertext, determine the degree of difference between the first image to be matched and the second image to be matched;
[0016] If the degree of difference is greater than a preset threshold, then it is determined that the first image to be matched and the second image to be matched do not match;
[0017] If the degree of difference is less than or equal to a preset threshold, then the first image to be matched and the second image to be matched are determined to be a match.
[0018] Optionally, the target ciphertext is obtained by the second-party device through bit-by-bit subtraction of the first ciphertext and the second ciphertext, followed by privacy protection processing, including:
[0019] The target ciphertext is obtained by the second-party device by taking the difference bit by bit between the first ciphertext and the second ciphertext, and then randomly adjusting the order of multiple elements in the resulting hash difference ciphertext.
[0020] Optionally, determining the degree of difference between the first image to be matched and the second image to be matched based on the target ciphertext includes:
[0021] The degree of difference between the first image to be matched and the second image to be matched is determined based on the number of non-zero elements in the target ciphertext.
[0022] Optionally, the target ciphertext is obtained by the second-party device through bit-by-bit subtraction of the first ciphertext and the second ciphertext, followed by privacy protection processing, including:
[0023] The target ciphertext is obtained by the second-party device by subtracting the first ciphertext and the second ciphertext bit by bit, and then summing the squares of multiple elements in the resulting hash difference ciphertext.
[0024] Optionally, determining the degree of difference between the first image to be matched and the second image to be matched based on the target ciphertext includes:
[0025] The sum of squares of multiple elements in the hash difference ciphertext is obtained from the target ciphertext, and the sum of squares is decrypted to obtain the degree of difference between the first image to be matched and the second image to be matched.
[0026] Secondly, embodiments of this application provide an image fuzzy matching method, applied to a second-party device, comprising:
[0027] The device receives a first ciphertext and an encryption key sent by a first-party device, wherein the first ciphertext is obtained by the first-party device performing a hash transformation on a first image to be matched and using the encryption key to perform homomorphic encryption on the first hash value obtained by the hash transformation.
[0028] The second image to be matched is hashed to obtain a second hash value, and the second hash value is homomorphically encrypted using the encryption key to obtain the second ciphertext.
[0029] The first ciphertext and the second ciphertext are subtracted bit by bit and privacy protection processing is performed to obtain the target ciphertext. The privacy protection processing makes it impossible for the first device to parse the second hash value from the target ciphertext.
[0030] The target ciphertext is sent to the first party device so that the first party device can determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0031] Optionally, the encryption key is a homomorphic encryption public key; the step of performing a hash transformation on the second image to be matched to obtain a second hash value, and then using the encryption key to homomorphically encrypt the second hash value to obtain the second ciphertext, includes:
[0032] The perceptual hash algorithm is used to perform a hash transformation on the second image to be matched to obtain a second hash value;
[0033] Using the homomorphic encryption public key, each element in the second hash value is homomorphically encrypted to obtain the second ciphertext.
[0034] Optionally, the step of subtracting the first ciphertext and the second ciphertext bit by bit and performing privacy protection processing to obtain the target ciphertext includes:
[0035] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0036] The target ciphertext is obtained by randomly adjusting the order of multiple elements in the hash difference ciphertext.
[0037] Optionally, the step of subtracting the first ciphertext and the second ciphertext bit by bit and performing privacy protection processing to obtain the target ciphertext includes:
[0038] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0039] Determine the square value of each element in the hash difference ciphertext, and randomly adjust the order of the obtained square values to obtain the target ciphertext.
[0040] Optionally, the step of subtracting the first ciphertext and the second ciphertext bit by bit and performing privacy protection processing to obtain the target ciphertext includes:
[0041] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0042] The sum of squares of multiple elements in the hash difference ciphertext is taken as the target ciphertext.
[0043] Optionally, the step of subtracting the first ciphertext and the second ciphertext bit by bit and performing privacy protection processing to obtain the target ciphertext includes:
[0044] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0045] The number of non-zero elements in the hash difference ciphertext is taken as the target ciphertext.
[0046] Thirdly, embodiments of this application provide an image fuzzy matching method, including:
[0047] The first-party device performs a hash transformation on the first image to be matched to obtain a first hash value, and uses an encryption key to homomorphically encrypt the first hash value to obtain the first ciphertext;
[0048] The first-party device sends the first ciphertext and the encryption key to the second-party device;
[0049] The second-party device performs a hash transformation on the second image to be matched to obtain a second hash value, and uses the encryption key to homomorphically encrypt the second hash value to obtain the second ciphertext;
[0050] The second-party device performs bit-by-bit subtraction on the first ciphertext and the second ciphertext and performs privacy protection processing to obtain the target ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second hash value from the target ciphertext.
[0051] The first device receives the target ciphertext sent by the second device and determines the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0052] Fourthly, embodiments of this application provide an image blur matching apparatus, applied to a first-party device, comprising:
[0053] The first processing module is used to perform a hash transformation on the first image to be matched to obtain a first hash value, and to perform homomorphic encryption on the first hash value using an encryption key to obtain the first ciphertext.
[0054] The first processing module is further configured to send the first ciphertext and the encryption key to the second-party device, so that the second-party device performs homomorphic encryption on the second hash value based on the encryption key to obtain the second ciphertext, wherein the second hash value is obtained by the second-party device performing a hash transformation on the second image to be matched;
[0055] The first acquisition module is used to receive target ciphertext sent by the second party device. The target ciphertext is obtained by the second party device by taking the difference bit by bit between the first ciphertext and the second ciphertext and performing privacy protection processing. The privacy protection processing makes it impossible for the first party device to parse the second hash value from the target ciphertext.
[0056] The first processing module is further configured to determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0057] Optionally, the first processing module is specifically used for:
[0058] The encryption key is a homomorphic encryption public key;
[0059] The step of performing a hash transformation on the first image to be matched to obtain a first hash value, and then homomorphically encrypting the first hash value using an encryption key to obtain the first ciphertext, includes:
[0060] The first image to be matched is hashed using a perceptual hash algorithm to obtain a first hash value.
[0061] Using a homomorphic encryption public key, each element in the first hash value is homomorphically encrypted to obtain the first ciphertext.
[0062] Optionally, the first processing module is specifically used for:
[0063] Based on the target ciphertext, determine the degree of difference between the first image to be matched and the second image to be matched;
[0064] If the degree of difference is greater than a preset threshold, then it is determined that the first image to be matched and the second image to be matched do not match;
[0065] If the degree of difference is less than or equal to a preset threshold, then the first image to be matched and the second image to be matched are determined to be a match.
[0066] Optionally, the first acquisition module is specifically used for:
[0067] The target ciphertext is obtained by the second-party device by taking the difference bit by bit between the first ciphertext and the second ciphertext, and then randomly adjusting the order of multiple elements in the resulting hash difference ciphertext.
[0068] Optionally, the first processing module is specifically used for:
[0069] The degree of difference between the first image to be matched and the second image to be matched is determined based on the number of non-zero elements in the target ciphertext.
[0070] Optionally, the first acquisition module is specifically used for:
[0071] The target ciphertext is determined by the second-party device by subtracting the first ciphertext and the second ciphertext bit by bit, and then summing the squares of multiple elements in the resulting hash difference ciphertext.
[0072] Optionally, the first processing module is specifically used for:
[0073] The sum of squares of multiple elements in the hash difference ciphertext is obtained from the target ciphertext, and the sum of squares is used as the degree of difference between the first image to be matched and the second image to be matched.
[0074] Fifthly, embodiments of this application provide an image blur matching apparatus, applied to a second-party device, comprising:
[0075] The second acquisition module is used to receive the first ciphertext and encryption key sent by the first party device, wherein the first ciphertext is obtained by the first party device performing a hash transformation on the first image to be matched and using the encryption key to perform homomorphic encryption on the first hash value obtained by the hash transformation.
[0076] The second processing module is used to perform a hash transformation on the second image to be matched to obtain a second hash value, and to perform homomorphic encryption on the second hash value using the encryption key to obtain a second ciphertext;
[0077] The second processing module is used to perform bit-by-bit difference calculation on the first ciphertext and the second ciphertext and perform privacy protection processing to obtain the target ciphertext. The privacy protection processing makes it impossible for the first device to parse the second hash value from the target ciphertext.
[0078] The second processing module is used to send the target ciphertext to the first party device, so that the first party device can determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0079] Optionally, the second processing module is specifically used for:
[0080] The encryption key is a homomorphic encryption public key;
[0081] The step of performing a hash transformation on the second image to be matched to obtain a second hash value, and then using the encryption key to homomorphically encrypt the second hash value to obtain the second ciphertext, includes:
[0082] The perceptual hash algorithm is used to perform a hash transformation on the second image to be matched to obtain a second hash value;
[0083] Using the homomorphic encryption public key, each element in the second hash value is homomorphically encrypted to obtain the second ciphertext.
[0084] Optionally, the second processing module is further specifically used for:
[0085] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0086] The target ciphertext is obtained by randomly adjusting the order of multiple elements in the hash difference ciphertext.
[0087] Optionally, the second processing module is further specifically used for:
[0088] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0089] Determine the square value of each element in the hash difference ciphertext, and randomly adjust the order of the obtained square values to obtain the target ciphertext.
[0090] Optionally, the second processing module is further specifically used for:
[0091] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0092] The sum of squares of multiple elements in the hash difference ciphertext is taken as the target ciphertext.
[0093] Optionally, the second processing module is further specifically used for:
[0094] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0095] The number of non-zero elements in the hash difference ciphertext is taken as the target ciphertext.
[0096] Sixthly, embodiments of this application provide an image fuzzy matching system, including:
[0097] A first-party device is used to perform a hash transformation on a first image to be matched to obtain a first hash value, and to homomorphically encrypt the first hash value using an encryption key to obtain a first ciphertext;
[0098] The first-party device is further configured to send the first ciphertext and the encryption key to the second-party device;
[0099] The second-party device is used to perform a hash transformation on the second image to be matched to obtain a second hash value, and to homomorphically encrypt the second hash value using the encryption key to obtain a second ciphertext;
[0100] The second-party device is further configured to perform bit-by-bit difference calculation on the first ciphertext and the second ciphertext and perform privacy protection processing to obtain the target ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second hash value from the target ciphertext.
[0101] The first device is further configured to receive the target ciphertext sent by the second device, and determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0102] In a seventh aspect, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor performs any of the operation behavior recognition methods described in the first aspect above.
[0103] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform any of the operation behavior recognition methods described in the first aspect above.
[0104] This application achieves privacy protection for the first and second hash values in image fuzzy matching by performing privacy protection processing on the image hash value, thereby improving the security of image similarity matching between two devices. At the same time, it expands the application scope of privacy intersection, that is, it extends the precise privacy intersection of numerical information to the fuzzy privacy intersection of images, and also improves the accuracy of image fuzzy matching. Attached Figure Description
[0105] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0106] Figure 1 This is a schematic diagram of an image fuzzy matching system architecture provided in an embodiment of the present invention;
[0107] Figure 2 This is a flowchart illustrating an image fuzzy matching method provided in an embodiment of the present invention;
[0108] Figure 3A This is a flowchart illustrating an image fuzzy matching method provided in an embodiment of the present invention;
[0109] Figure 3B This is a flowchart illustrating an image fuzzy matching method provided in an embodiment of the present invention;
[0110] Figure 3C This is a flowchart illustrating an image fuzzy matching method provided in an embodiment of the present invention;
[0111] Figure 4 This is a schematic diagram of the structure of an image blur matching device provided in an embodiment of the present invention;
[0112] Figure 5 This is a schematic diagram of another image blur matching device provided in an embodiment of the present invention;
[0113] Figure 6 This is a schematic diagram of the structure of an image fuzzy matching system provided in an embodiment of the present invention;
[0114] Figure 7 This is a schematic diagram of the structure of a computing device provided in an embodiment of the present invention. Detailed Implementation
[0115] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0116] See Figure 1 This is an architecture diagram of an image fuzzy matching system used in an embodiment of this application. The image fuzzy matching system 100 includes a first-party device 101 and a second-party device 102. The first-party device 101 can be a smartphone, tablet, laptop, desktop computer, ATM, acquiring device, etc., but is not limited to these. The first-party device 101 can also be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The second-party device is the same as above.
[0117] The first-party device 101 and the second-party device 102 can be connected directly or indirectly through wired or wireless communication, and this application does not impose any restrictions on this.
[0118] The image fuzzy matching system 100 can be applied to secure intersection and privacy query scenarios of image elements between first-party devices and second-party devices, such as: (1) secure intersection of image information such as storefronts in the respective databases of first-party devices and second-party devices; (2) hiding query scenarios in privacy computing to realize the function of secure "image search"; (3) matching user card face with the back-end card face database under the premise of ensuring that privacy information such as bank card number and name is not leaked.
[0119] Based on the above system architecture Figure 2 An exemplary flow of an image blur matching method is shown, the flow of which is executed interactively by a first-party device and a second-party device, including the following steps:
[0120] In step S201, the first-party device performs a hash transformation on the first image to be matched to obtain a first hash value, and uses an encryption key to homomorphically encrypt the first hash value to obtain the first ciphertext.
[0121] Specifically, the first image to be matched, I A Given an image in a first-party device, the first-party device uses a hash algorithm to match the first image I.A Perform a hash transformation to obtain a 64-bit first hash value h. A =H(I A The encryption key is used to pair the first hash value h. A Perform homomorphic encryption to obtain the first ciphertext.
[0122] In one embodiment, the encryption key is a homomorphic encryption public key; a perceptual hash algorithm is used to perform a hash transformation on the first image to be matched to obtain a first hash value; and the homomorphic encryption public key is used to homomorphically encrypt each element in the first hash value to obtain the first ciphertext.
[0123] Specifically, the first-party device uses a perceptual hash algorithm to analyze the first image to be matched, I. A Perform a hash transformation to obtain a 64-bit first hash value h. A =H(I A Simultaneously, the first-party device generates a homomorphic encryption public-private key pair (pk, sk), where the public key pk is the encryption key and the private key sk is the decryption key. The first-party device uses the homomorphic encryption public key pk to encrypt the 64-bit first hash value h. A Each element is homomorphically encrypted to obtain the first ciphertext.
[0124]
[0125] Perceptual hashing is a general term for a class of hashing algorithms. It includes mean hashing (aHash), perceptual hashing (pHash), and difference hashing (dHash). aHash is faster but less accurate; pHash is more accurate but slower; dHash combines the advantages of both, offering both high accuracy and speed. The purpose of perceptual hashing is to generate a "fingerprint" string for each image, comparing the fingerprint information of different images to determine their similarity; the closer the hash values, the more similar the images.
[0126] In step S202, the first-party device sends the first ciphertext and encryption key to the second-party device.
[0127] Specifically, the first-party device generates the encryption key pk and the first ciphertext Eh. A Send to a second-party device.
[0128] In step S203, the second-party device performs a hash transformation on the second image to be matched to obtain a second hash value, and uses an encryption key to homomorphically encrypt the second hash value to obtain the second ciphertext.
[0129] Specifically, the second image to be matched, I B Given an image from a second-party device, the second-party device uses a hash algorithm to match the second image I.B Perform a hash transformation to obtain a 64-bit second hash value h. B =H(I B The second hash value h is obtained by using the encryption key. B Perform homomorphic encryption to obtain the second ciphertext.
[0130] In some embodiments, the encryption key is a homomorphic encryption public key; a perceptual hash algorithm is used to perform a hash transformation on the second image to be matched to obtain a second hash value; and a homomorphic encryption public key is used to homomorphically encrypt each element in the second hash value to obtain the second ciphertext.
[0131] Specifically, the second-party device receives the homomorphic encryption key pk and the first ciphertext Eh generated by the first-party device. A The second-party device uses a perceptual hash algorithm to analyze the second image to be matched, I. B Perform a hash transformation to obtain a 64-bit second hash value h. B =H(I B The second-party device uses the homomorphic encryption public key pk generated by the first-party device to pair with a 64-bit second hash value h. B Each element in the ciphertext is homomorphically encrypted to obtain the second ciphertext.
[0132] In step S204, the second-party device performs bit-by-bit difference calculation on the first ciphertext and the second ciphertext and performs privacy protection processing to obtain the target ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second hash value from the target ciphertext.
[0133] Specifically, the second-party device accesses the first ciphertext Eh. A Second ciphertext Eh B Subtract each digit one by one to get Then, privacy protection processing is performed to obtain the target encrypted text.
[0134] The purpose of the privacy protection processing is to prevent the first-party device from using the target ciphertext and its own generated first hash value to reverse-engineer the second hash value generated by the second-party device.
[0135] For example, taking 5-bit ciphertext as an example, the first ciphertext is Eh A =(E(1),E(0),E(1),E(1),E(0)), second ciphertext Eh B =(E(1),E(0),E(1),E(0),E(1)), the first ciphertext Eh A Second ciphertext Eh B Subtracting each digit one by one, we get Eh A-B =(E(0),E(0),E(0),E(1),E(-1)).
[0136] Step S205: The first-party device receives the target ciphertext sent by the second-party device.
[0137] Step S206: Determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0138] Specifically, the first-party device decrypts the received target ciphertext to obtain the first image to be matched, I. A With the second image to be matched I B The fuzzy matching result is used to determine whether the first image to be matched and the second image to be matched are similar images.
[0139] In some embodiments, based on the target ciphertext, the degree of difference between the first image to be matched and the second image to be matched is determined; if the degree of difference is greater than a preset threshold, it is determined that the first image to be matched and the second image to be matched do not match; if the degree of difference is less than or equal to the preset threshold, it is determined that the first image to be matched and the second image to be matched match.
[0140] Specifically, the preset threshold is set by the user as needed, for example, it can range from 1 to 64 bits.
[0141] Taking a 12-bit target ciphertext as an example, the difference between the first image to be matched and the second image to be matched is 4 bits. If the preset threshold is 3 bits, 4 is greater than 3, that is, the difference between the first image to be matched and the second image to be matched is greater than the preset threshold, then it is determined that the first image to be matched and the second image to be matched do not match. If the preset threshold is 6 bits, 4 is less than 6, that is, the difference between the first image to be matched and the second image to be matched is less than the preset threshold, then it is determined that the first image to be matched and the second image to be matched match.
[0142] In some embodiments, the degree of difference can be represented by Hamming distance.
[0143] Taking a 5-bit perceptual hash value as an example, h A = (10110), h B = (10101), Hamming distance is h A and h B XOR value Therefore, the Hamming distance between the two is d(h) A ,h B =2.
[0144] In this embodiment, privacy protection processing of image hash values is performed to protect the first and second hash values in image fuzzy matching, which improves the security of image similarity matching between two devices. At the same time, it expands the application scope of privacy intersection, that is, it extends the precise privacy intersection of numerical information to the fuzzy privacy intersection of images, and also improves the accuracy of image fuzzy matching.
[0145] In step S204 above, regarding the bit-by-bit difference calculation and privacy protection processing of the first ciphertext and the second ciphertext by the second device, this application provides at least the following implementation methods:
[0146] Implementation Method 1: Calculate the difference between the first ciphertext and the second ciphertext bit by bit to obtain the hash difference ciphertext; randomly adjust the order of multiple elements in the hash difference ciphertext to obtain the target ciphertext. Determine the degree of difference between the first and second images to be matched based on the number of non-zero elements in the target ciphertext.
[0147] Specifically, regarding the first ciphertext Eh A Second ciphertext Eh B Calculate the difference bit by bit to obtain the hash difference ciphertext. By randomly rearranging the order of multiple elements in the hash difference ciphertext, the target ciphertext Eh′ can be obtained. A-B .
[0148] Taking a 5-bit hash value ciphertext as an example, Eh A-B = (E(0), E(0), E(0), E(1), E(-1)), randomly adjust the order of multiple elements in the hash difference ciphertext to obtain the target ciphertext Eh′. A-B =(E(0),E(-1),E(0),E(0),E(1)).
[0149] The first party, based on the target ciphertext Eh′ A-B For the target ciphertext Eh′ A-B Decryption yields h′ A-B = (0, -1, 0, 0, 1), and calculate Eh′. A-B The number of non-zero elements in the middle is h. A and h B Hamming distance d(h) A ,h B If the value is 2, the Hamming distance is used as the degree of difference between the first image to be matched and the second image to be matched.
[0150] Due to Eh′ A-B The order of multiple elements is shuffled by a second-party device, and the first party cannot specifically know h. A and h BBecause of their different locations, the first-party device cannot know the perceived hash value h of the second-party device. B .
[0151] Implementation Method 2: Divide the first ciphertext and the second ciphertext bit by bit to obtain the hash difference ciphertext; determine the square value of each element in the hash difference ciphertext, and randomly adjust the order of the obtained multiple square values to obtain the target ciphertext; determine the degree of difference between the first image to be matched and the second image to be matched based on the number of non-zero elements in the target ciphertext.
[0152] Specifically, regarding the first ciphertext Eh A Second ciphertext Eh B Calculate the difference bit by bit to obtain the hash difference ciphertext. Eh A-B Perform a ciphertext square operation on each element to obtain The order of the obtained square values is randomly adjusted to obtain the target ciphertext.
[0153] Taking a 5-bit hash value ciphertext as an example, Eh A-B =(E(0),E(0),E(0),E(1),E(-1)), change Eh A-B Perform a ciphertext square operation on each element to obtain Eh′ A-B = (E(0),E(0),E(0),E(1),E(1)), and randomly adjust the order of the obtained multiple square values to obtain the target ciphertext Eh′. A-B =(E(1),E(0),E(1),E(0),E(0)). The first party uses the target ciphertext Eh′ A-B For the target ciphertext Eh′ A-B Decrypt and count Eh′ A-B The number of non-zero elements in the middle is h. A and h B Hamming distance d(h) A ,h B If the value is 2, the Hamming distance is used as the degree of difference between the first image to be matched and the second image to be matched.
[0154] Because the second-party device is h A and h B The difference between each bit is ciphertext-squared, and the order of multiple squared values is randomly adjusted before being sent to the first-party device. The first party cannot specifically know h. A and h B Because of their different locations, the first-party device cannot know the perceived hash value h of the second-party device. B .
[0155] Implementation method 3: Divide the first ciphertext and the second ciphertext bit by bit to obtain the hash difference ciphertext; take the sum of squares of multiple elements in the hash difference ciphertext as the target ciphertext, and decrypt the sum of squares to obtain the degree of difference between the first image to be matched and the second image to be matched.
[0156] Specifically, regarding the first ciphertext Eh A Second ciphertext Eh B Calculate the difference bit by bit to obtain the hash difference ciphertext. Eh A-B Perform a ciphertext square operation on each element to obtain and Eh′ A-B Add all elements in the ciphertext to obtain the target ciphertext. Due to the homomorphic nature of ciphertext
[0157] Taking a 5-bit hash value ciphertext as an example, Eh A-B =(E(0),E(0),E(0),E(1),E(-1)), change Eh A-B Perform a ciphertext square operation on each element to obtain Eh′ A-B =(E(0),E(0),E(0),E(1),E(1)), and put Eh′ A-B Add all elements in the ciphertext to obtain the target ciphertext. The target ciphertext can be represented as the ciphertext Hamming distance Ed(h) A ,h B )=Eh″ A-B =(E(0)) 2 E(0) 2 E(0) 2 E(1) 2 E(-1) 2 )=E(2). The first party uses the ciphertext Hamming distance Ed(h) A ,h B Decrypt to obtain h A and h B Hamming distance d(h) A ,h B The value is 2, which means that the degree of difference between the first image to be matched and the second image to be matched is obtained.
[0158] Because the second-party device is h A and h B The sum of the squared differences of each bit is sent to the first-party device, but the first party cannot know the specific value of h. A and h B Because of their different locations, the first-party device cannot know the perceived hash value h of the second-party device.B .
[0159] Implementation Method 4: Divide the first ciphertext and the second ciphertext bit by bit to obtain the hash difference ciphertext; take the number of non-zero elements in the hash difference ciphertext as the target ciphertext, and determine the degree of difference between the first image to be matched and the second image to be matched based on the number of non-zero elements in the target ciphertext.
[0160] Specifically, specifically, regarding the first ciphertext Eh A Second ciphertext Eh B Calculate the difference bit by bit to obtain the hash difference ciphertext. Statistical hash difference ciphertext Eh A-B The number of non-zero elements in the target ciphertext is used as the target ciphertext.
[0161] Taking a 5-bit hash value ciphertext as an example, Eh A-B =(E(0),E(0),E(0),E(1),E(-1)), the second-party device statistical hash difference ciphertext Eh A-B The number of non-zero elements in the string is 2. This ciphertext is sent to the first device. The first device decrypts the string to obtain h. A and h B Hamming distance d(h) A ,h B The value is 2, representing the degree of difference between the first image to be matched and the second image to be matched.
[0162] Because the second-party device is used for statistical h A and h B The ciphertext of the difference between each bit Eh A-B After determining the number of non-zero elements, the data is sent to the first-party device. The first-party device cannot specifically know the value of h. A and h B Because of their different locations, the first-party device cannot know the perceived hash value h of the second-party device. B .
[0163] like Figure 3A The flowchart shown illustrates how to compare image similarity while protecting the image perceptual hash value.
[0164] First, we will use the privacy protection processing of additive semi-homomorphism as an example to illustrate the process of image fuzzy matching, such as... Figure 3B As shown:
[0165] Party A uses the perceptual hashing algorithm H to process the first image I. A Converted to a 64-bit first-perceptual hash value h A h A =H(I A Party B uses the perceptual hashing algorithm H to convert the second image I...B Converted to a 64-bit second-sensory hash value h B h B =H(I B ).
[0166] Party A generates a homomorphic encryption public key pk and a private key sk, forming a homomorphic encryption public-private key pair (pk, sk). Party A sends the public key pk to Party B and uses the public key pk to calculate the perceptual hash value h. A Each bit is homomorphically encrypted to obtain the first ciphertext. And the first ciphertext Eh A Send to Party B; Party B uses Party A's public key pk to detect the hash value h. B Each bit is homomorphically encrypted to obtain the second ciphertext. B has the first ciphertext Eh A Second ciphertext Eh B Subtract each element one by one to obtain the difference ciphertext. Due to the homomorphic property of ciphertext, difference ciphertext Party B will send the difference ciphertext Eh A-B The elements in the text are shuffled to obtain the out-of-order ciphertext Eh′. A-B And send it to Party A; Party A receives the out-of-order ciphertext Eh′ A-B Decrypting each element yields the scrambled plaintext h′ A-B The number of non-zero elements is counted to obtain h. A and h B Hamming distance d(h) A ,h B ).
[0167] A will use the Hamming distance d(h) A ,h B The data is synchronized to party B. Both parties A and B can then determine the Hamming distance d(h) based on this information. A ,h B If the value is less than a preset threshold, determine whether the first image I is less than a preset threshold. A Second image I B Does it match?
[0168] The following example of privacy protection processing using fully homomorphic encryption illustrates the process of image fuzzy matching, such as... Figure 3C As shown:
[0169] Party A uses the perceptual hashing algorithm H to process image I. A Convert to a 64-bit perceptual hash value h A h A =H(I A Party B uses the perceptual hashing algorithm H to process image I. BConvert to a 64-bit perceptual hash value h B h B =H(I B ).
[0170] Party A generates a homomorphic encryption public key pk and a private key sk, forming a homomorphic encryption public-private key pair (pk, sk). Party A sends the public key pk to Party B and uses the public key pk to calculate the perceptual hash value h. A Each bit is homomorphically encrypted to obtain the first ciphertext. And the first ciphertext Eh A Send to Party B; Party B uses Party A's public key pk to detect the hash value h. B Each bit is homomorphically encrypted to obtain the second ciphertext. B has the first ciphertext Eh A Second ciphertext Eh B Subtract each element one by one to obtain the difference ciphertext. Due to the homomorphic property of ciphertext, difference ciphertext Party B will Eh A-B Perform a ciphertext squaring operation on each element in the ciphertext to obtain the squared ciphertext. For square ciphertext Eh′ A-B Add all elements in the ciphertext to obtain the ciphertext Hamming distance. And send it to party A. Due to the homomorphic property of ciphertext, the ciphertext Hamming distance is... A's Hamming distance to the ciphertext Ed(h) A ,h B Decrypt to obtain h A and h B Hamming distance
[0171] A will use the Hamming distance d(h) A ,h B The data is synchronized to party B. Both parties A and B can then use the Hamming distance d(h) to determine the time and distance between them. A ,h B Determine if image I is less than a preset threshold. A I B Does it match?
[0172] In this embodiment, privacy protection processing of image hash values is performed to protect the first and second hash values in image fuzzy matching, which improves the security of image similarity matching between two devices. At the same time, it expands the application scope of privacy intersection, that is, it extends the precise privacy intersection of numerical information to the fuzzy privacy intersection of images, and also improves the accuracy of image fuzzy matching.
[0173] Based on the same technical concept, this application provides a schematic diagram of an image fuzzy matching device, applied to a first-party device, such as... Figure 4 As shown, the device 400 includes:
[0174] The first processing module 402 is used to perform a hash transformation on the first image to be matched to obtain a first hash value, and to perform homomorphic encryption on the first hash value using an encryption key to obtain a first ciphertext;
[0175] The first processing module 402 is further configured to send the first ciphertext and the encryption key to the second-party device, so that the second-party device performs homomorphic encryption on the second hash value based on the encryption key to obtain the second ciphertext, wherein the second hash value is obtained by the second-party device performing a hash transformation on the second image to be matched;
[0176] The first acquisition module 401 is used to receive target ciphertext sent by the second party device. The target ciphertext is obtained by the second party device by subtracting the first ciphertext and the second ciphertext bit by bit and performing privacy protection processing. The privacy protection processing makes it impossible for the first party device to parse the second hash value from the target ciphertext.
[0177] The first processing module 402 is further configured to determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0178] Optionally, the first processing module 402 is specifically used for:
[0179] The encryption key is a homomorphic encryption public key;
[0180] The step of performing a hash transformation on the first image to be matched to obtain a first hash value, and then homomorphically encrypting the first hash value using an encryption key to obtain the first ciphertext, includes:
[0181] The first image to be matched is hashed using a perceptual hash algorithm to obtain a first hash value.
[0182] Using a homomorphic encryption public key, each element in the first hash value is homomorphically encrypted to obtain the first ciphertext.
[0183] Optionally, the first processing module 402 is specifically used for:
[0184] Based on the target ciphertext, determine the degree of difference between the first image to be matched and the second image to be matched;
[0185] If the degree of difference is greater than a preset threshold, then it is determined that the first image to be matched and the second image to be matched do not match;
[0186] If the degree of difference is less than or equal to a preset threshold, then the first image to be matched and the second image to be matched are determined to be a match.
[0187] Optionally, the first acquisition module 401 is specifically used for:
[0188] The target ciphertext is obtained by the second-party device by taking the difference bit by bit between the first ciphertext and the second ciphertext, and then randomly adjusting the order of multiple elements in the resulting hash difference ciphertext.
[0189] Optionally, the first processing module 402 is specifically used for:
[0190] The degree of difference between the first image to be matched and the second image to be matched is determined based on the number of non-zero elements in the target ciphertext.
[0191] Optionally, the first acquisition module 401 is specifically used for:
[0192] The target ciphertext is determined by the second-party device by subtracting the first ciphertext and the second ciphertext bit by bit, and then summing the squares of multiple elements in the resulting hash difference ciphertext.
[0193] Optionally, the first processing module 402 is specifically used for:
[0194] The sum of squares of multiple elements in the hash difference ciphertext is obtained from the target ciphertext, and the sum of squares is used as the degree of difference between the first image to be matched and the second image to be matched.
[0195] By performing privacy protection processing on the image hash value, the protection of the first and second hash values in image fuzzy matching is achieved, which improves the security of image similarity matching between two devices. At the same time, it expands the application scope of privacy intersection, that is, it extends the precise privacy intersection of numerical information to the fuzzy privacy intersection of images.
[0196] Based on the same technical concept, this application provides another schematic diagram of an image fuzzy matching device structure, applied to a second-party device, such as... Figure 5 As shown, the device 500 includes:
[0197] The second acquisition module 501 is used to receive the first ciphertext and encryption key sent by the first party device, wherein the first ciphertext is obtained by the first party device performing a hash transformation on the first image to be matched and using the encryption key to perform homomorphic encryption on the first hash value obtained by the hash transformation.
[0198] The second processing module 502 is used to perform a hash transformation on the second image to be matched to obtain a second hash value, and to perform homomorphic encryption on the second hash value using the encryption key to obtain a second ciphertext;
[0199] The second processing module 502 is used to perform bit-by-bit difference calculation on the first ciphertext and the second ciphertext and perform privacy protection processing to obtain the target ciphertext. The privacy protection processing makes it impossible for the first device to parse the second hash value from the target ciphertext.
[0200] The second processing module 502 is used to send the target ciphertext to the first device, so that the first device can determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0201] Optionally, the second processing module 502 is specifically used for:
[0202] The encryption key is a homomorphic encryption public key;
[0203] The step of performing a hash transformation on the second image to be matched to obtain a second hash value, and then using the encryption key to homomorphically encrypt the second hash value to obtain the second ciphertext, includes:
[0204] The perceptual hash algorithm is used to perform a hash transformation on the second image to be matched to obtain a second hash value;
[0205] Using the homomorphic encryption public key, each element in the second hash value is homomorphically encrypted to obtain the second ciphertext.
[0206] Optionally, the second processing module 502 is further specifically used for:
[0207] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0208] The target ciphertext is obtained by randomly adjusting the order of multiple elements in the hash difference ciphertext.
[0209] Optionally, the second processing module 502 is further specifically used for:
[0210] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0211] Determine the square value of each element in the hash difference ciphertext, and randomly adjust the order of the obtained square values to obtain the target ciphertext.
[0212] Optionally, the second processing module 502 is further specifically used for:
[0213] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0214] The sum of squares of multiple elements in the hash difference ciphertext is taken as the target ciphertext.
[0215] Optionally, the second processing module 502 is further specifically used for:
[0216] The hash difference ciphertext is obtained by subtracting each bit from the first ciphertext and the second ciphertext.
[0217] The number of non-zero elements in the hash difference ciphertext is taken as the target ciphertext.
[0218] By performing privacy protection processing on the image hash value, the protection of the first and second hash values in image fuzzy matching is achieved, which improves the security of image similarity matching between two devices. At the same time, it expands the application scope of privacy intersection, that is, it extends the precise privacy intersection of numerical information to the fuzzy privacy intersection of images, and also improves the accuracy of image fuzzy matching.
[0219] Based on the same technical concept, this application provides a schematic diagram of an image fuzzy matching system structure, as shown in the embodiment. Figure 6 As shown, the system 600 includes a first-party device 601 and a second-party device 602, specifically:
[0220] First-party device 601 is used to perform a hash transformation on a first image to be matched to obtain a first hash value, and to homomorphically encrypt the first hash value using an encryption key to obtain a first ciphertext;
[0221] The first-party device 601 is further configured to send the first ciphertext and the encryption key to the second-party device;
[0222] The second-party device 602 is used to perform a hash transformation on the second image to be matched to obtain a second hash value, and to perform homomorphic encryption on the second hash value using the encryption key to obtain a second ciphertext;
[0223] The second-party device 602 is further configured to perform bit-by-bit difference calculation on the first ciphertext and the second ciphertext and perform privacy protection processing to obtain the target ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second hash value from the target ciphertext.
[0224] The first device 601 is further configured to receive the target ciphertext sent by the second device, and determine the fuzzy matching result between the first image to be matched and the second image to be matched based on the target ciphertext.
[0225] Based on the same technical concept, embodiments of this application provide a computer device, which can be... Figure 1 The first-party or second-party equipment shown, such as Figure 7 As shown, it includes at least one processor 701 and a memory 702 connected to at least one processor. In this embodiment, the specific connection medium between the processor 701 and the memory 702 is not limited. Figure 7 Taking the connection between the processor 701 and the memory 702 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.
[0226] In this embodiment of the application, the memory 702 stores instructions that can be executed by at least one processor 701. By executing the instructions stored in the memory 702, at least one processor 701 can perform the steps of the above-described image blur matching method.
[0227] The processor 701 is the control center of the computer device. It can connect to various parts of the computer device using various interfaces and lines. By running or executing instructions stored in the memory 702 and calling data stored in the memory 702, it can perform fuzzy matching on the image to be matched. Optionally, the processor 701 may include one or more processing units. The processor 701 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.
[0228] The processor 701 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0229] Memory 702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 702 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 702 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer device, but is not limited thereto. In the embodiments of this application, memory 702 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0230] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the above-described image fuzzy matching method.
[0231] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can 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.) containing computer-usable program code.
[0232] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0233] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0234] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0235] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. An image fuzzy matching method based on additive semi-homomorphism, applied to a first-party device, characterized in that, include: The first image to be matched is hashed using a perceptual hash algorithm to obtain a first perceptual hash value. The first perceptual hash value is a binary sequence and a fingerprint string of the first image to be matched. Each element in the first perceptual hash value is homomorphically encrypted using a homomorphic encryption key to obtain the first ciphertext. The first ciphertext and the homomorphic encryption key are sent to the second-party device, so that the second-party device performs homomorphic encryption on each element in the second perceptual hash value based on the homomorphic encryption key to obtain the second ciphertext. The second perceptual hash value is obtained by the second-party device using the perceptual hash algorithm to perform a hash transformation on the second image to be matched. The device receives out-of-order ciphertext sent by the second-party device. The out-of-order ciphertext is obtained by the second-party device by subtracting the first ciphertext and the second ciphertext bit by bit to obtain a hash difference ciphertext, and then performing privacy protection processing on the hash difference ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second perceptual hash value from the out-of-order ciphertext. The privacy protection processing involves shuffling the elements in the hash difference ciphertext. Decrypt each element in the scrambled ciphertext to obtain the scrambled plaintext; The Hamming distance between the first image to be matched and the second image to be matched is determined based on the number of non-zero elements in the disordered plaintext. The first image to be matched is determined based on the Hamming distance to determine whether it matches the second image to be matched.
2. The method as described in claim 1, characterized in that, The step of determining whether the first image to be matched matches the second image to be matched based on the Hamming distance includes: If the Hamming distance is greater than a preset threshold, then it is determined that the first image to be matched and the second image to be matched do not match; If the Hamming distance is less than or equal to a preset threshold, then the first image to be matched and the second image to be matched are determined to be matched.
3. An image fuzzy matching method based on additive semi-homomorphism, applied to a second-party device, characterized in that, include: The device receives a first ciphertext and an encryption key sent by a first-party device. The first ciphertext is obtained by the first-party device performing a hash transformation on a first image to be matched using a perceptual hash algorithm, and then performing homomorphic encryption on each element of the first perceptual hash value obtained by the hash transformation using a homomorphic encryption key. The first perceptual hash value is a binary sequence and is the fingerprint string of the first image to be matched. The perceptual hash algorithm is used to perform a hash transformation on the second image to be matched to obtain a second perceptual hash value, and the homomorphic encryption key is used to homomorphically encrypt each element in the second perceptual hash value to obtain the second ciphertext. The first ciphertext and the second ciphertext are subtracted bit by bit to obtain a hash difference ciphertext. The hash difference ciphertext is then subjected to privacy protection processing to obtain a scrambled ciphertext. The privacy protection processing prevents the first device from parsing the second perceptual hash value from the scrambled ciphertext. The privacy protection processing involves scrambling the elements in the hash difference ciphertext. The out-of-order ciphertext is sent to the first device, so that the first device decrypts each element in the out-of-order ciphertext to obtain the out-of-order plaintext; the Hamming distance between the first image to be matched and the second image to be matched is determined based on the number of non-zero elements in the out-of-order plaintext; and whether the first image to be matched matches the second image to be matched is determined based on the Hamming distance.
4. An image fuzzy matching method based on additive semi-homomorphism, characterized in that, include: The first-party device uses a perceptual hash algorithm to perform a hash transformation on the first image to be matched to obtain a first perceptual hash value. The first perceptual hash value is a binary sequence and a fingerprint string of the first image to be matched. The device then uses a homomorphic encryption key to homomorphically encrypt each element in the first perceptual hash value to obtain the first ciphertext. The first-party device sends the first ciphertext and the homomorphic encryption key to the second-party device; The second-party device uses the perceptual hash algorithm to perform a hash transformation on the second image to be matched to obtain a second perceptual hash value, and uses the homomorphic encryption key to homomorphically encrypt each element in the second perceptual hash value to obtain the second ciphertext; The second-party device calculates the difference between the first ciphertext and the second ciphertext bit by bit to obtain a hash difference ciphertext, and performs privacy protection processing on the hash difference ciphertext to obtain a scrambled ciphertext. The privacy protection processing prevents the first-party device from parsing the second perceptual hash value from the scrambled ciphertext. The privacy protection processing involves scrambling the elements in the hash difference ciphertext. The first device receives the out-of-order ciphertext sent by the second device and decrypts each element in the out-of-order ciphertext to obtain out-of-order plaintext; based on the number of non-zero elements in the out-of-order plaintext, it determines the Hamming distance between the first image to be matched and the second image to be matched, and determines whether the first image to be matched matches the second image to be matched based on the Hamming distance.
5. An image fuzzy matching device based on additive semi-homomorphism, applied to a first-party device, characterized in that, include: The first processing module is used to perform a hash transformation on the first image to be matched using a perceptual hash algorithm to obtain a first perceptual hash value. The first perceptual hash value is a binary sequence and a fingerprint string of the first image to be matched. The module also uses a homomorphic encryption key to homomorphically encrypt each element in the first perceptual hash value to obtain the first ciphertext. The first processing module is further configured to send the first ciphertext and the homomorphic encryption key to the second-party device, so that the second-party device performs homomorphic encryption on each element in the second perceptual hash value based on the homomorphic encryption key to obtain the second ciphertext, wherein the second perceptual hash value is obtained by the second-party device using the perceptual hash algorithm to perform hash transformation on the second image to be matched; The first acquisition module is used to receive out-of-order ciphertext sent by the second-party device. The out-of-order ciphertext is obtained by the second-party device by subtracting the first ciphertext and the second ciphertext bit by bit to obtain a hash difference ciphertext, and then performing privacy protection processing on the hash difference ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second perceptual hash value from the out-of-order ciphertext. The privacy protection processing involves scrambling the elements in the hash difference ciphertext. The first processing module is further configured to decrypt each element in the scrambled ciphertext to obtain scrambled plaintext; determine the Hamming distance between the first image to be matched and the second image to be matched based on the number of non-zero elements in the scrambled plaintext; and determine whether the first image to be matched matches the second image to be matched based on the Hamming distance.
6. An image fuzzy matching device based on additive semi-homomorphism, applied to a second-party device, characterized in that, include: The second acquisition module is used to receive the first ciphertext and encryption key sent by the first party device. The first ciphertext is obtained by the first party device using a perceptual hash algorithm to perform a hash transformation on the first image to be matched, and using a homomorphic encryption key to homomorphically encrypt each element in the first perceptual hash value obtained by the hash transformation. The first perceptual hash value is a binary sequence and the first perceptual hash value is the fingerprint string of the first image to be matched. The second processing module is used to perform a hash transformation on the second image to be matched using the perceptual hash algorithm to obtain a second perceptual hash value, and to perform homomorphic encryption on each element in the second perceptual hash value using the homomorphic encryption key to obtain a second ciphertext. The second processing module is used to calculate the difference between the first ciphertext and the second ciphertext bit by bit to obtain a hash difference ciphertext, and to perform privacy protection processing on the hash difference ciphertext to obtain a scrambled ciphertext. The privacy protection processing makes it impossible for the first device to parse the second perceptual hash value from the scrambled ciphertext. The privacy protection processing involves scrambling the elements in the hash difference ciphertext. The second processing module is configured to send the out-of-order ciphertext to the first device, so that the first device can decrypt each element in the out-of-order ciphertext to obtain out-of-order plaintext; determine the Hamming distance between the first image to be matched and the second image to be matched based on the number of non-zero elements in the out-of-order plaintext; and determine whether the first image to be matched matches the second image to be matched based on the Hamming distance.
7. An image fuzzy matching system based on additive semi-homomorphism, characterized in that, include: A first-party device is used to perform a hash transformation on a first image to be matched using a perceptual hash algorithm to obtain a first perceptual hash value. The first perceptual hash value is a binary sequence and a fingerprint string of the first image to be matched. The device is also used to perform homomorphic encryption on each element in the first perceptual hash value using a homomorphic encryption key to obtain a first ciphertext. The first-party device is further configured to send the first ciphertext and the homomorphic encryption key to the second-party device; The second-party device is used to perform a hash transformation on the second image to be matched using the perceptual hash algorithm to obtain a second perceptual hash value, and to perform homomorphic encryption on each element in the second perceptual hash value using the homomorphic encryption key to obtain a second ciphertext. The second-party device is further configured to calculate the difference between the first ciphertext and the second ciphertext bit by bit to obtain a hash difference ciphertext, and to perform privacy protection processing on the hash difference ciphertext to obtain a scrambled ciphertext. The privacy protection processing makes it impossible for the first-party device to parse the second perceptual hash value from the scrambled ciphertext. The privacy protection processing involves scrambling the elements in the hash difference ciphertext. The first device is further configured to receive the out-of-order ciphertext sent by the second device, and decrypt each element in the out-of-order ciphertext to obtain out-of-order plaintext; determine the Hamming distance between the first image to be matched and the second image to be matched based on the number of non-zero elements in the out-of-order plaintext, and determine whether the first image to be matched matches the second image to be matched based on the Hamming distance.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 4.
9. A computer-readable storage medium, characterized in that, It stores a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the method according to any one of claims 1 to 4.