Efficient homomorphic fuzzy equality comparison method and system

Through bit-by-bit comparison and the generation of parity vectors, combined with the randomization algorithm, the problem of inefficient fuzzy equality testing in homomorphic encryption is solved, and an efficient method is realized to quickly determine whether the two vectors are fuzzy and equal.

CN119690738APending Publication Date: 2025-03-25ENG UNIV OF THE CHINESE PEOPLES ARMED POLICE FORCE
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411790588.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In homomorphic encryption, it is difficult for the prior art to effectively calculate the fuzzy equality test, especially when processing large-scale data, the depth of the multiplication calculation circuit is linearly correlated with the data bit length, resulting in inefficiency.

Method used

By comparing the two input vectors bit by bit, an unequal vector is generated, and divided into odd-match vectors or even-match vectors according to the parity of the position of ‘1’ in the unequal vector. Then, the first matching element is eliminated by continuously generating multiple parity vectors and retaining the first matching element, obtaining the branch's leaf node vector. Finally, a randomization algorithm is used to determine whether there is an element ‘1’ in the leaf node vector to quickly determine whether the two vectors are fuzzy and equal.

Benefits of technology

This method can quickly determine whether the Hamming distance of the two vectors is less than a given threshold, thereby effectively calculating the fuzzy equality test, improving the efficiency of homomorphic fuzzy equality comparison.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690738A_ABST
    Figure CN119690738A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient homomorphic fuzzy equality comparison method and system, and belongs to the field of information security and privacy protection.The method comprises the steps that two input binary vectors are compared bit by bit, and unequal vectors are generated; dividing the unequal vectors into odd matching vectors or even matching vectors according to the parity of the positions of '1' in the unequal vectors; eliminating a front # imgabs0 # matching element by continuously generating a plurality of parity check vectors, and reserving a # imgabs1 # matching element to obtain a leaf node vector of a branch; and judging whether an element '1' exists in the leaf node vector or not by utilizing a randomization algorithm: giving some random binary vectors, and judging whether the element '1' exists in the leaf node vector or not by judging whether the contents of the leaf node vector and the random binary vectors are '0' or not. The method comprises the following steps: for two input binary vectors, judging whether the Hamming distance between the two input binary vectors is smaller than a given threshold value or not to measure whether the vectors are fuzzy and equal or not; the method comprises the following steps of: inputting a binary vector # imgabs3 # and # imgabs4 # of # imgabs2 # and a fuzzy upper limit # imgabs5 #, and if the Hamming weight of # imgabs6 # is greater than that of # imgabs7 #, outputting 1, and if the Hamming weight of # imgabs6 # is greater than that of # imgabs7 #, outputting 1; otherwise, outputting 0; the method can effectively calculate the fuzzy equality check.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information security and privacy protection, and in particular to an efficient homomorphic fuzzy equality comparison method and system. Background Art

[0002] Homomorphic encryption (HE) technology supports direct operation on ciphertext, and has the dual advantages of confidentiality and secret computing. It can achieve the property of being available but invisible, and is an important choice for realizing the security and privacy of information transmission and information processing in fields such as cloud computing and outsourced computing. In homomorphic encryption, fuzzy equality testing has a wide range of applications in practical scenarios, such as fingerprint feature matching; fuzzy equality is to determine whether two given binary vectors are approximately equal, that is, whether the Hamming weight of the two binary vectors is less than a given threshold. Effectively calculating fuzzy equality tests in homomorphic encryption is a challenging task.

[0003] For homomorphic fuzzy equality comparison algorithms, we can refer to the construction method of fuzzy equality comparison algorithms in computer science and implement them using homomorphic gate circuits. However, the efficiency of this construction method is usually not high enough, because the efficiency of the homomorphic encryption scheme is greatly affected by the calculation depth and number of calculations of the multiplication circuit, but the traditional construction method does not optimize this aspect very well. Therefore, cryptographers have made some attempts to further improve the efficiency of homomorphic comparison algorithms. For example, a multiplexer selector was constructed based on a single-bit fully homomorphic encryption scheme, and the MAX algorithm was constructed based on this, in which the plaintext input is encrypted bit by bit using a homomorphic encryption scheme. At present, the multiplication calculation circuit depth of these algorithms is usually linearly related to the bit length of the data, so it is impossible to perform comparison operations on large-scale data. Summary of the invention

[0004] In view of the problems existing in the prior art, the present invention provides an efficient homomorphic fuzzy equality comparison method and system, which eliminates a specific number of unequal elements in two input vectors, and then determines whether the eliminated vectors are completely equal, and quickly determines whether the number of unequal elements in the two vectors exceeds a given threshold, thereby determining whether the input vectors are fuzzily equal.

[0005] The present invention is achieved through the following technical solutions: An efficient homomorphic fuzzy equality comparison method includes the following steps: Step 1: Compare two binary vectors bit by bit to generate unequal vectors; Step 2: According to the parity of the position of "1" in the unequal vector, the unequal vector is divided into an odd matching vector or an even matching vector to obtain an odd-even matching vector; Step 3: Based on the threshold The binary vector Generate multiple parity check vectors continuously to eliminate the parity matching vector Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; Step 4: Determine whether there is an element "1" in the leaf node vector and randomly select binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final result. If the array There is no "1" in it, that is, all components are 0, then the output is a binary vector Fuzzy equals binary vector ; Otherwise, output a binary vector Unambiguous equals binary vector .

[0006] Preferably, the method for generating the unequal vectors in step 1 is as follows: Comparing binary vectors and The bits at corresponding positions of binary vectors result in unequal vectors ,in , .

[0007] Preferably, the odd matching vector in step 2 is a vector with "1" in odd positions and "0" in other positions; even numbers match vector A vector with "1" in even positions and "0" in other positions.

[0008] Preferably, the method for generating the leaf node vector of the branch is as follows: Given a threshold , the threshold The binary representation of is set to the vector ; From vector Starting from the low position of , a binary tree with one branch is generated. When it is 1, an odd vector is generated, otherwise an even vector is generated; according to the generated odd vector or even vector and the new indication value Generate a continuous generation vector and repeat the process to obtain the parity check vector branch. Represented as a leaf node of a binary tree.

[0009] Preferably, the vector The length is .

[0010] Preferably, in step 4, a randomization algorithm is used to determine whether there is an element "1" in the leaf node vector.

[0011] An efficient homomorphic fuzzy equality comparison system, including: An unequal vector module is used to compare two binary vectors bit by bit to generate an unequal vector; An odd-even matching vector module is used to classify unequal vectors into odd matching vectors or even matching vectors according to the parity of the positions of "1" in the unequal vectors; Leaf node vector module, used to calculate the leaf node vector according to the threshold value. The binary vector Generate multiple parity check vectors continuously to eliminate the parity matching vector Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; Fuzzy comparison module, used to determine whether there is an element "1" in the leaf node vector, randomly select binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final result. If the array There is no "1" in it, that is, all components are 0, then the output is a binary vector Fuzzy equals binary vector ; Otherwise, output a binary vector Unambiguous equals binary vector .

[0012] An electronic device, comprising: Memory for storing computer programs; A processor is used to implement the steps of the efficient homomorphic fuzzy equality comparison method when executing the computer program.

[0013] A computer-readable storage medium stores a computer program, which implements the steps of the efficient homomorphic fuzzy equality comparison method when executed by a processor.

[0014] Compared with the prior art, the present invention has the following beneficial technical effects: The present invention provides an efficient homomorphic fuzzy equality comparison method, which generates unequal vectors by comparing two input binary vectors bit by bit; divides the unequal vectors into odd matching vectors or even matching vectors according to the parity of the position of "1" in the unequal vectors; (by continuously generating multiple parity check vectors to eliminate the previous Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; use the randomization algorithm to determine whether there is an element "1" in the leaf node vector: given some random binary vectors, by judging whether the leaf node vector and the random binary vector are all "0", to determine whether there is an element "1" in the leaf node vector. This method measures whether the two binary vectors are fuzzily equal by judging whether their Hamming distance is less than a given threshold; that is, the input dimensional binary vector , and fuzzy upper limit ,if The Hamming weight is greater than , then output 1; otherwise, output 0. This method uses a homomorphic encryption scheme that supports batch processing and binary vectors. The operations on plaintext vectors in the randomized comparison algorithm are replaced by the corresponding ciphertext operations in the homomorphic encryption scheme. Therefore, the randomized comparison algorithm is also the corresponding randomized homomorphic comparison algorithm. This method can effectively calculate fuzzy equality tests. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a flow chart of the homomorphic fuzzy equality comparison algorithm of the present invention; Figure 2 is a flow chart of the parity check matching vector of the present invention; Figure 3 is a flow chart of the parity check vector branch of the present invention; Figure 4 It is a flow chart of the randomized algorithm of the present invention for judging leaf node vectors. DETAILED DESCRIPTION

[0016] The present invention will be further described in detail below in conjunction with the accompanying drawings, which are intended to explain the present invention rather than to limit it.

[0017] See also Figure 1 , an efficient homomorphic fuzzy equality comparison method, comprising the following steps: Step 1: Compare two binary vectors bit by bit to generate unequal vectors; Determine whether the corresponding positions are unequal, that is, compare the input binary vectors With binary vector The bits at the corresponding positions result in unequal vectors .

[0018] Step 2: Match the vectors according to the parity of the positions of "1" in the unequal vectors. Divide into odd matching vectors or even matching vector ; Among them, the odd matching vector to indicate a vector containing "1" in odd positions and 0 in other positions; even matches vector To indicate that the even positions contain "1" and the other positions are 0.

[0019] Step 3: Based on the threshold The binary vector Generate multiple parity check vectors continuously to eliminate unequal vectors. Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; First, given a threshold , the number The binary representation of is set to the vector , the length is . Secondly, use To indicate the parity check vector branch generation process. Starting from the low position (right side) of , a binary tree with one branch is generated. When is 1, an odd vector is generated, otherwise an even vector is generated. Then, according to the generated odd vector or even vector and the new indication value Generate a continuous vector and repeat the process. Finally, a parity check vector branch can be obtained. Represented as a leaf node of a binary tree.

[0020] Step 4: Use the randomization algorithm to determine whether there is an element "1" in the leaf node vector, and randomly select binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final result. If the array There is no "1" in it, that is, all components are 0, then the output is a binary vector Fuzzy equals binary vector ; Otherwise, output a binary vector Unambiguous equals binary vector .

[0021] Use the idea of ​​randomization algorithm to analyze whether two vectors are equal. Using randomization algorithm may lead to a small probability of error, but it can improve the efficiency of the algorithm.

[0022] In the above fuzzy equality comparison algorithm, two binary vectors are input, and whether the vectors are fuzzy equal is measured by judging whether their Hamming distance is less than a given threshold.

[0023] enter dimensional binary vector , and fuzzy upper limit ,if The Hamming weight is greater than , then output 1; otherwise, output 0.

[0024] The idea of ​​the fuzzy equality comparison algorithm is: if More than If there is a "1", try to eliminate the previous "1" (starting from the 0th "1" to be eliminated), and keep the "1"; otherwise, eliminate If after the above operation, there are still elements "1" in the output array, then , The Hamming distance is greater than , which is the algorithm output Unambiguous equals ; Otherwise output Fuzzy Equals .

[0025] In this efficient homomorphic fuzzy equality comparison algorithm, operations in all steps are homomorphic operations on ciphertexts, and homomorphic operations on ciphertexts will cause corresponding changes in plaintexts.

[0026] Example 1 See also Figure 2-4 , an efficient homomorphic fuzzy equality comparison method, comprising the following steps: Step 1: Generate unequal vectors. Determine whether the corresponding positions are unequal, that is, compare the input binary vectors and The bits at the corresponding positions result in unequal vectors ,in , .

[0027] Step 2: Create a parity match vector. The parity of the position of the "1" in the vector will match Divide into odd matching vectors or even matching vector .

[0028] Among them, the odd matching vector to indicate a vector containing "1"s in odd positions and 0s in other positions, which can be done by Implementation, where , ; Even matching vector To indicate that the even positions contain "1" and the other positions are 0, this can be done by accomplish, .like Figure 1 Note that the even number The first "1" in the vector The second "1" in .

[0029] Step 3: Generate parity check vector branches. Eliminate the previous Matches elements and keeps the first matching elements. First, given a threshold , the number The binary representation of is set to the vector , the length is .number The reason why we need to subtract 1 is that the matching numbers are counted from 1, while the binary trees used later are counted from 0. To indicate the parity check vector branch generation process. Starting from the low position (right side) of , a binary tree with one branch is generated. When it is 1, an odd vector is generated, otherwise an even vector is generated.

[0030] Then generate an odd vector or an even vector and a new indication value based on Generate a continuous vector and repeat the process. Finally, a parity check vector branch can be obtained. Represented as a leaf node of a binary tree. Note that the array (index array) The first "1" is the array No. "1", Step 4: Use the randomization algorithm to determine whether there is an element "1" in the leaf node vector. Random selection binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final result. There is no "1" in the output, that is, all components are 0. Fuzzy Equals ; Otherwise, output Unambiguous equals .

[0031] The homomorphic fuzzy equality comparison algorithm of this application uses a homomorphic encryption scheme that supports batch processing and binary vectors, such as the BGV scheme or the BFV scheme. The operations on the plaintext vector in the randomized comparison algorithm are replaced by the corresponding ciphertext operations in the homomorphic encryption scheme. Therefore, the randomized comparison algorithm is also the corresponding randomized homomorphic comparison algorithm. In the homomorphic fuzzy equality comparison algorithm, the fuzzy upper bound Can be given as a parameter in plain text, a binary vector , Then their corresponding ciphertexts need to be given.

[0032] The process of the homomorphic fuzzy equality comparison method is shown in Table 1

[0033] Analysis of the correctness and efficiency of the homomorphic fuzzy equality comparison method: Analysis of Step 1: The first step of the algorithm is to set the initial state of the vector: Set , and the indicator vector Set to This step does not involve any multiplication operations.

[0034] Steps 2-6 Analysis: These steps will be based on the indicator vector Generate parity check vector branch. Length Indicates the depth of the binary tree. layer, if , then set ,in ;if , then set ,in .conduct After the first cycle, "1" will be eliminated and the first "1" in the output array will be No. Notice that is given in plain text, steps 2-6 require sub-homomorphic multiplication, the depth of homomorphic multiplication is .

[0035] Step 7 Analysis: Use a randomization algorithm to output an array Is there a "1" in the . This method is a randomization algorithm, setting , then the algorithm is greater than The probability of outputting the correct result is the number of homomorphic multiplications required , the depth of homomorphic multiplication is The corresponding total number of multiplications is , the depth of the multiplication operation is ,in and The dimension of , is the upper bound (Hamming weight) of the fuzziness. Therefore, the above algorithm can efficiently compute the fuzzy equality test.

[0036] Based on the above efficient homomorphic fuzzy equality comparison method, the present application also provides an efficient homomorphic fuzzy equality comparison system, including the following steps: An unequal vector module is used to compare two binary vectors bit by bit to generate an unequal vector; An odd-even matching vector module is used to classify unequal vectors into odd matching vectors or even matching vectors according to the parity of the positions of "1" in the unequal vectors; Leaf node vector module, used to calculate the leaf node vector according to the threshold value. The binary vector Generate multiple odd-even matching vectors continuously to eliminate unequal vectors. Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; Fuzzy comparison module, used to determine whether there is an element "1" in the leaf node vector, randomly select binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final result. If the array There is no "1" in it, that is, all components are 0, then the output is a binary vector Fuzzy equals binary vector ; Otherwise, output a binary vector Unambiguous equals binary vector .

[0037] It should be noted that in the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each module is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another device, or some features can be ignored or not executed. The module described as a separate component may or may not be physically separated. The component displayed as a module may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0038] In addition, each module in each embodiment of the present invention may be integrated into a processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0039] An electronic device provided in an embodiment of the present application includes a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps of the efficient homomorphic fuzzy equality comparison method described in any of the above embodiments are implemented.

[0040] Another electronic device provided in the embodiment of the present application may also include: an input port connected to the processor, used to transmit multimodal data collected by an external acquisition device to the processor; and a display unit connected to the processor, used to display the processing results of the processor to the outside world; a communication module connected to the processor, used to realize the communication between the electronic device and the outside world. The display unit can be a display panel, a laser scanning display, etc.; the communication mode adopted by the communication module includes but is not limited to mobile high-definition link technology (HML), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless connection (including wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s).

[0041] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the efficient homomorphic fuzzy equality comparison method described in any of the above embodiments are implemented.

[0042] The computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.

[0043] For the description of the relevant parts of the efficient homomorphic fuzzy equality comparison system, electronic device, and computer-readable storage medium provided in the embodiments of the present application, please refer to the detailed description of the corresponding parts in the efficient homomorphic fuzzy equality comparison method provided in the embodiments of the present application, which will not be repeated here. In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.

[0044] The above contents are only for explaining the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.

Claims

1. An efficient homomorphic fuzzy equality comparison method, characterized in that: The following steps are involved: Step 1: Compare two binary vectors bit by bit to generate unequal vectors; Step 2: According to the parity of the position of "1" in the unequal vector, the unequal vector is divided into an odd matching vector or an even matching vector to obtain an odd-even matching vector; Step 3: Based on the threshold The binary vector Generate multiple parity check vectors continuously to eliminate the parity matching vector Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; Step 4: Determine whether there is an element "1" in the leaf node vector and randomly select binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final fuzzy result. If the array There is no "1" in , that is, all components are 0, then the output is a binary vector Fuzzy equals binary vector ; Otherwise, output a binary vector Unambiguous equals binary vector .

2. According to claim 1, an efficient homomorphic fuzzy equality comparison method is characterized in that: The method for generating the unequal vectors in step 1 is as follows: Comparing binary vectors and The bits at corresponding positions of binary vectors result in unequal vectors ,in , .

3. An efficient homomorphic fuzzy equality comparison method according to claim 1, characterized in that: Odd matching vector in step 2 is a vector with "1" in odd positions and "0" in other positions; even numbers match the vector A vector with "1" in even positions and "0" in other positions.

4. The efficient homomorphic fuzzy equality comparison method according to claim 1, characterized in that: The method for generating the leaf node vector of the branch is as follows: Given a threshold , the threshold The binary representation of is set to the vector ; From vector Starting from the low position of , a binary tree with one branch is generated. When it is 1, an odd vector is generated, otherwise an even vector is generated; according to the generated odd vector or even vector and the new indication value Generate a continuous generation vector and repeat the process to obtain the parity check vector branch. Represented as a leaf node of a binary tree.

5. The efficient homomorphic fuzzy equality comparison method according to claim 4, characterized in that: The vector The length is .

6. The efficient homomorphic fuzzy equality comparison method according to claim 1, characterized in that: In step 4, a randomization algorithm is used to determine whether there is an element "1" in the leaf node vector.

7. An efficient homomorphic fuzzy equality comparison system, characterized in that: include: An unequal vector module is used to compare two binary vectors bit by bit to generate an unequal vector; An odd-even matching vector module, used to classify unequal vectors into odd matching vectors or even matching vectors according to the parity of the positions of "1" in the unequal vectors; Leaf node vector module, used to calculate the leaf node vector according to the threshold value. The binary vector Generate multiple parity check vectors continuously to eliminate the parity matching vector Matches elements and keeps the first Matching elements, get the leaf node vector of the branch; Fuzzy comparison module, used to determine whether there is an element "1" in the leaf node vector, randomly selected binary vector ; Calculate vector and The inner product of ; for all Perform an OR operation and output the final result. If the array There is no "1" in , that is, all components are 0, then the output is a binary vector Fuzzy equals binary vector ; Otherwise, output a binary vector Unambiguous equals binary vector .

8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the efficient homomorphic fuzzy equality comparison method as described in any one of claims 1-6 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the efficient homomorphic fuzzy equality comparison method as described in any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Two-party data equality comparison method based on secret sharing

    CN120811581A