CN112732776B - Secure approximate pattern matching method and system and electronic equipment - Google Patents
Secure approximate pattern matching method and system and electronic equipment Download PDFInfo
- Publication number
- CN112732776B CN112732776B CN202011561764.XA CN202011561764A CN112732776B CN 112732776 B CN112732776 B CN 112732776B CN 202011561764 A CN202011561764 A CN 202011561764A CN 112732776 B CN112732776 B CN 112732776B
- Authority
- CN
- China
- Prior art keywords
- terminal
- enc
- algorithm
- polynomial
- length
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2462—Approximate or statistical queries
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Probability & Statistics with Applications (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Fuzzy Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Document Processing Apparatus (AREA)
Abstract
The present disclosure provides a secure approximate pattern matching method, system and electronic device, there are a first terminal holding a pattern character string, a length of the text character string and a threshold value and a second terminal holding the text character string, the length of the pattern character string and the threshold value, the first terminal and the second terminal execute a secure approximate pattern matching algorithm, if a hamming distance between a certain sub-character string of the text character string and the pattern character string is less than the threshold value, the first terminal outputs a position of the sub-character string in the text character string; according to the method and the device, the user with the mode information can obtain the position of the mode in the database, the database can not know the mode information of the user through the disappearing transmission algorithm and the Boolean type threshold privacy set intersection algorithm, the user can not know other data information in the database, and the mode matching is carried out while the safety of the data is guaranteed.
Description
Technical Field
The present disclosure relates to the field of pattern matching technologies, and in particular, to a secure approximate pattern matching method, system, and electronic device.
Background
The statements in this section merely provide background information related to the present disclosure and may not necessarily constitute prior art.
The application of approximate pattern matching is very wide, for example, in a face recognition system, when light, position or expression are different, feature data of a facial image of a user extracted by the system is also different, and therefore, when the extracted feature data is matched with a feature template stored in a database, identity information corresponding to the facial image needs to be judged according to the similarity of the two, rather than whether the two are the same.
However, the inventor finds that the face data of the user and the feature template in the database belong to private data, and both parties do not usually want to disclose the private data grasped by themselves so as to avoid revealing private information of themselves.
Disclosure of Invention
In order to solve the defects of the prior art, the present disclosure provides a secure approximate pattern matching method, system and electronic device, where a user holding pattern information can obtain a position where the pattern appears in a database, and through a perusal transmission algorithm and a boolean threshold privacy set intersection algorithm, the database side cannot know the pattern information of the user, and the user cannot know other data information in the database, so that the security of the respective data is ensured while performing pattern matching.
In order to achieve the purpose, the following technical scheme is adopted in the disclosure:
a first aspect of the present disclosure provides a secure approximate pattern matching method.
A secure approximate pattern matching method is applied to a first terminal which holds a pattern character string, the length of a text character string and a threshold value, and comprises the following steps:
and the first terminal and a second terminal which holds the text character string, the length of the mode character string and the threshold value execute a safe approximate mode matching algorithm, and if the Hamming distance between a certain substring of the text character string and the mode character string is smaller than the threshold value, the first terminal outputs the position of the substring in the text character string.
A second aspect of the present disclosure provides an electronic device.
An electronic device includes a first terminal holding a mode string, a length of the text string, and a threshold, the first terminal communicating with a second terminal holding the text string, the length of the mode string, and the threshold;
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
A third aspect of the present disclosure provides a secure approximate pattern matching method.
A secure approximate pattern matching method is applied to a second terminal with a text character string, a pattern character string length and a threshold value, and comprises the following steps:
and the second terminal executes a secure approximate pattern matching algorithm with the first terminal which holds the pattern character string, the length of the text character string and the threshold value, and if the Hamming distance between a certain sub-character string of the text character string and the pattern character string is less than the threshold value, the first terminal outputs the position of the sub-character string in the text character string.
A fourth aspect of the present disclosure provides an electronic device.
An electronic device comprises a second terminal holding a text string, a mode string length and a threshold, the second terminal being in communication with a first terminal holding the mode string, the text string length and the threshold;
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
A fifth aspect of the present disclosure provides a secure approximate pattern matching method.
A secure approximate pattern matching method, there are first terminals holding pattern character strings, lengths of text character strings and thresholds and second terminals holding text character strings, lengths of pattern character strings and thresholds, comprising the steps of:
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
A sixth aspect of the present disclosure provides a secure approximate pattern matching system.
A secure approximate pattern matching system comprising a first terminal holding a pattern string, a length of the text string, and a threshold, and a second terminal holding the text string, the length of the pattern string, and the threshold, the first terminal in communication with the second terminal:
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
Compared with the prior art, the beneficial effect of this disclosure is:
1. according to the method, the electronic device or the system, the user with the mode information can obtain the position of the mode in the database, the database side cannot know the mode information of the user through the disappearing transmission algorithm and the Boolean type threshold privacy set intersection algorithm, the user cannot know other data information in the database, and the mode matching is carried out while the safety of the data is guaranteed.
2. The method, the electronic device or the system can enable the participant with the pattern information to obtain the position of the pattern appearing in the text, but the participant with the pattern cannot obtain any relevant information about the pattern, and the participant with the pattern cannot obtain other relevant information about the text.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure and are not to limit the disclosure.
Fig. 1 is a schematic flow chart of a secure approximate pattern matching method provided in embodiment 1 of the present disclosure.
Detailed Description
The present disclosure is further described with reference to the following drawings and examples.
It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the disclosure. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments according to the present disclosure. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, and it should be understood that when the terms "comprises" and/or "comprising" are used in this specification, they specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof, unless the context clearly indicates otherwise.
The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
Example 1:
as shown in fig. 1, embodiment 1 of the present disclosure provides a secure approximate pattern matching method applied to a first terminal (i.e., P) 1 );
Participant P 0 (i.e. the second terminal) is entered as a text string t e {0,1} n The length m and threshold τ of the pattern string, and the party P 1 Is the mode string p ∈ {0,1} m Length n of the text string and threshold τ;
after the execution of the safe approximate pattern matching algorithm is finished, if the Hamming distance between the ith substring of t and P is less than tau, then P 1 The output position i, formally described as follows:
inputting: p 0 Is (t, m, τ), P 1 The input of (d) is (p, n, τ).
And (3) outputting: if the Hamming distance between the ith substring of t and P is less than τ, P 1 And outputting the i.
Initialization: setting the safety parameter as lambda, setting the global parameter p as a prime number, and setting the binary length | p | of p > lambda.
The secure approximate pattern matching algorithm specifically comprises the following steps:
(1)P 0 randomly selecting m pairs of random numbers respectivelyWhereinP 0 Selecting corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
(2) for each j ═ 1, …, m, P 0 And P 1 Performing a 2-of-1 obfuscation transfer algorithm, wherein P 0 Is inputted asP 1 Is p as input j After the algorithm execution is finished, P 1 Obtaining a set of patterns
(3) For each i ═ 1, …, n-m +1, P 0 And P 1 Performing a Boolean type threshold privacy set intersection algorithm, wherein P 0 Is (C) i ,m,m-τ),P 1 Is (S, m, m-tau). After the algorithm execution is finished, P 1 Get the output set b i ∈{0,1} n-m+1 。
(4) If b is i =1,P 1 And outputting the i.
The boolean threshold privacy set intersection algorithm specifically includes:
in the boolean threshold privacy set intersection algorithm, C, S is the set, | C |, | S | are the lengths of the set C, S, respectively, t is the threshold, and the party P is the party 0 The input of (C, | S |, t), the party P 1 The input of (S, | C |, t), after the algorithm operation is finished, if | C |, S |, is more than or equal to t, P 1 Output 1, otherwise P 1 Output 0, described in detail as follows:
inputting: p is 0 The input of (C, | S |, T), P 1 The input of (S, | C |, t).
And (3) outputting: if | C |, S | > is not less than t, P 1 Output 1, otherwise P 1 And 0 is output.
Initialization: setting the safety parameter as lambda and setting the global parameter p. p is a prime number with a binary length | p | > λ.
1)P 0 Public addition homomorphic encryption public key pk 1 Then P 0 And P 1 Performing a private set intersection cardinality algorithm, P 1 Obtaining Enc (pk) 1 ,|C∩S|)。
2)P 1 Selecting a random number r belonging to {0, …, p-1}, and performing additive homomorphism calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
P 1 Selecting random numbers R 'epsilon {0, …, p-1} and R epsilon {0, …, p-1}, preparing a polynomial p (·) with R + t, R + t +1, …, R + min (| C |, | S |), and calculating the coefficient of the polynomial p' (·) · R · R · R ·, which is selected with random number R ·, R ·, R · R · 0 ,a 1 ,…,a min(|C|,|S|+1 ;
P 1 Homomorphic encryption of public key pk with addition 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients respectively
Enc(pk 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|+1 );
P 1 Combining the encryption coefficient of the polynomial p' (. cndot.) with Enc (pk) 1 And | C | + S | + r) is sent to P 0 。
3)P 0 Decrypting the received ciphertext to get | C ^ S | + r, and then using the point | C ^ S | + r to perform the dilation calculation on the polynomial p' (. cndot.), and record the result as Enc (pk) 2 R'), from which:
P 0 selecting a random number r' E {0, …, p-1}, and performing additive homomorphism calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to P 1 Requesting decryption thereof.
4)P 1 Decrypting Enc (pk) 1 R '+ R ") and sends the result R' + R" to P 0 ,P 0 And calculating to obtain R'.
5)P 0 And P 1 Performing a privacy equivalence test algorithm, wherein P 0 Input R', P 1 Inputting R, after the algorithm execution is finished, P 1 Outputting 0 or 1.
In this embodiment, the at a glance transmission algorithm specifically includes the following:
the ubiquitous transmission (OT) algorithm is a two-party algorithm, in which two parties are respectively a sender S and a receiver R, and the ubiquitous transmission algorithm is 1-out-of-2In the algorithm, the sender S inputs 2 messages (x) 0 ,x 1 ) The receiver R inputs a selection information sigma belonged to {0,1}, and after the two parties execute the algorithm, R outputs x σ (ii) a In addition, no additional information is revealed.
In this embodiment, the privacy equivalence test specifically includes the following steps:
the privacy equality test (PEQT) algorithm is a two-party algorithm, the two parties being the sender S and the receiver R, respectively. The input of the sender S is x 0 The input of the receiver R is x 1 After both parties execute the algorithm, if x 0 =x 1 R outputs 1, otherwise R outputs 0. In addition, no additional information is revealed.
In this embodiment, the encryption of the intersection cardinality of the privacy set is specifically as follows:
the encryption privacy set intersection-cardinality (ePSI-CA) algorithm is a two-party algorithm, and two parties are P parties respectively 0 And P 1 . C. S is a set, and | C | and | S | are respectively the length of the set C, S, (pk) 1 ,sk 1 )、(pk 2 ,sk 2 ) Is P 0 And P 1 The pair of addition homomorphic encryption keys. P 0 Is (C, | S |, pk) 1 ,sk 1 ),P 1 Is (S, | C |, pk) 1 ,pk 2 ,sk 2 ) After both parties have performed the agreement, P 1 Outputting the encrypted intersection element number Enc (pk) 1 ,|C∩S|)。
Example 2:
the embodiment 2 of the present disclosure provides an electronic device, including a first terminal holding a mode character string, a length of the text character string, and a threshold, the first terminal communicating with a second terminal holding the text character string, the length of the mode character string, and the threshold;
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
The specific working method of the device is the same as that provided in embodiment 1, and is not described herein again.
Example 3:
the embodiment 3 of the present disclosure provides a secure approximate pattern matching method, which is applied to a second terminal having a text string, a pattern string length, and a threshold, and includes the following steps:
and the second terminal and the first terminal holding the mode character string, the length of the text character string and the threshold value execute a safe approximate mode matching algorithm, and if the Hamming distance between a certain sub character string of the text character string and the mode character string is smaller than the threshold value, the first terminal outputs the position of the sub character string in the text character string.
The detailed method is the same as that provided in example 1 and will not be described herein.
Example 4:
the embodiment 4 of the present disclosure provides an electronic device, including a second terminal holding a text string, a length of a mode string, and a threshold, the second terminal communicating with a first terminal holding the mode string, the length of the text string, and the threshold;
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
The specific working method of the device is the same as that provided in embodiment 1, and is not described herein again.
Example 5:
the embodiment 5 of the present disclosure provides a secure approximate pattern matching method, where there are a first terminal holding a pattern character string, a length of the text character string, and a threshold, and a second terminal holding the text character string, the length of the pattern character string, and the threshold, including the following steps:
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is smaller than a threshold value, the first terminal outputs the position of the substring in the text string.
The detailed method is the same as that provided in example 1 and will not be described herein.
Example 6:
the embodiment 6 of the present disclosure provides a secure approximate pattern matching system, including a first terminal holding a pattern character string, a length of the text character string, and a threshold, and a second terminal holding the text character string, the length of the pattern character string, and the threshold, where the first terminal communicates with the second terminal:
and the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is less than a threshold value, the first terminal outputs the position of the substring in the text string.
The working method of the system is the same as that provided in embodiment 1, and is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure, and various modifications and changes may be made to the present disclosure by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.
Claims (6)
1. A secure approximate pattern matching method, characterized by: the method is applied to a first terminal holding the mode character string, the length of the text character string and a threshold value, and comprises the following steps:
the method comprises the steps that a first terminal and a second terminal with a text character string, a mode character string length and a threshold value execute a safe approximate mode matching algorithm, and if the Hamming distance between a certain sub character string of the text character string and the mode character string is smaller than the threshold value, the first terminal outputs the position of the sub character string in the text character string;
a secure approximate pattern matching algorithm, comprising:
the second terminal randomly selects m pairs of random numbers respectivelyThe second terminal selects corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
for each j-1, …, m, the first terminal and the second terminal perform a 1-of-2-out transmission algorithm, the input to the second terminal beingThe input of the first terminal is p j And after the algorithm execution is finished, the first terminal obtains a mode set
For each i-1, …, n-m +1, the first terminal and the second terminal perform a boolean threshold privacy set intersection algorithm, where the input of the second terminal is C i M, m-tau, the input of the first terminal is S, m, m-tau, after the algorithm execution is finished, the first terminal obtains an output set b i ∈{0,1} n-m+1 ;
If b is i 1, the first terminal outputs i;
a boolean threshold privacy set intersection algorithm comprising:
public addition homomorphic encryption public key pk of second terminal 1 Then the first terminal and the second terminal execute a private set intersection cardinality algorithm, and the first terminal obtains Enc (pk) 1 ,|C∩S|);
The first terminal selects a random number r epsilon {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
The first terminal selects random numbers R 'epsilon {0, …, p-1} and R epsilon {0, …, p-1}, prepares a polynomial p (·) with R + t, R + t +1, …, R + min (| C |, | S |), and calculates the coefficient of the polynomial p' (·) · R ·, the polynomial p ·), the R ·, and the polynomial p ·), and the random numbers R ·), and R ·, and the polynomial p ·, and R ·, and the equation p ·), and the coefficient of the equation p ·, and the random number R ∈ ·, are selected by the first, and prepared by the first terminal, and the first terminal, and the random number R ∈ {0, preparation method ·, and preparation method can be used to the first, and then 0 ,a 1 ,…,a min(|C|,|S|) +1 ;
First terminal uses addition homomorphic encryption public key pk 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients Enc (pk) 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|)+1 );
The first terminal combines the encryption coefficient of the polynomial p' (. cndot.) with Enc (pk) 1 And | C | + S | + r) is sent to the second terminal;
the second terminal decrypts the received ciphertext to obtain | C ^ S | + r, then computes the polynomial p' (. cndot.) through the point | C ^ S | + r, and records the result as Enc (pk) 2 R'), to obtain:
the second terminal selects a random number r ∈ {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to the first terminal requesting decryption thereof;
the first terminal decrypts Enc (pk) 1 R '+ R') and willThe result R ' + R ' is sent to the second terminal, and the second terminal obtains R ' through calculation;
the method comprises the steps that a first terminal and a second terminal execute a privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and the first terminal outputs 0 or 1 after the algorithm execution is finished;
wherein m is the length of the mode character string; n is the text string length; tau is a given threshold value in the safe approximate pattern matching algorithm; c is a set held by the first terminal; s is a set held by the second terminal; setting a safety parameter as lambda, setting a global parameter p, wherein p is a prime number and the binary length | p | is larger than lambda; | C | is the number of elements of the set C; the | S | is the number of elements of the set S; t is a threshold given in the boolean threshold privacy set intersection algorithm.
2. An electronic device, characterized in that: a first terminal including a holding mode string, a length of the text string, and a threshold, the first terminal communicating with a second terminal holding the text string, the length of the mode string, and the threshold;
the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is smaller than a threshold value, the first terminal outputs the position of the substring in the text string;
a secure approximate pattern matching algorithm, comprising:
the second terminal randomly selects m pairs of random numbers respectivelyThe second terminal selects corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
for each j-1, …, m, the first terminal and the second terminal perform a 1-of-2-out transmission algorithm, the input to the second terminal beingThe input of the first terminal is p j And after the algorithm execution is finished, the first terminal obtains a mode set
For each i-1, …, n-m +1, the first terminal and the second terminal perform a boolean threshold privacy set intersection algorithm, where the input of the second terminal is C i M, m-tau, the input of the first terminal is S, m, m-tau, after the algorithm execution is finished, the first terminal obtains an output set b i ∈{0,1} n-m+1 ;
If b is i 1, the first terminal outputs i;
a boolean threshold privacy set intersection algorithm comprising:
public addition homomorphic encryption public key pk of second terminal 1 Then the first terminal and the second terminal execute a private set intersection cardinality algorithm, and the first terminal obtains Enc (pk) 1 ,|C∩S|);
The first terminal selects a random number r epsilon {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
The first terminal selects random numbers R 'epsilon {0, …, p-1} and R epsilon {0, …, p-1}, prepares a polynomial p (·) with the root of R + t, R + t +1, …, R + min (| C |, | S |), and then calculates the coefficient of the polynomial p' (·) R '· p (·) + R, polynomial p' (·) as a 0 ,a 1 ,…,a min(|C|,|S|)+1 ;
First terminal uses addition homomorphic encryption public key pk 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients Enc (pk) 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|)+1 );
The first terminal combines the encryption coefficient of the polynomial p' (. cndot.) with Enc (pk) 1 And | C | + S | + r) is sent to the second terminal;
second terminal decryptionThe received ciphertext is then convolved with the point | C ≦ S | + r to compute the polynomial p' (. cndot.) and the result is denoted Enc (pk) 2 R'), to obtain:
the second terminal selects a random number r ∈ {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to the first terminal requesting decryption thereof;
the first terminal decrypts Enc (pk) 1 R ' + R ") and sending the result R ' + R" to the second terminal, which obtains R ' through calculation;
the method comprises the steps that a first terminal and a second terminal execute a privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and the first terminal outputs 0 or 1 after the algorithm execution is finished;
wherein m is the length of the mode character string; n is the text string length; tau is a given threshold value in the safe approximate pattern matching algorithm; c is a set held by the first terminal; s is a set held by the second terminal; setting a safety parameter as lambda, setting a global parameter p, wherein p is a prime number and the binary length | p | is larger than lambda; | C | is the number of elements of the set C; the | S | is the number of elements of the set S; t is a threshold given in the boolean threshold privacy set intersection algorithm.
3. A secure approximate pattern matching method, characterized by: the method is applied to a second terminal with a text character string, a mode character string length and a threshold value, and comprises the following steps:
the second terminal and the first terminal which holds the pattern character string, the length of the text character string and the threshold value execute a safe approximate pattern matching algorithm, if the Hamming distance between a certain sub character string of the text character string and the pattern character string is smaller than the threshold value, the first terminal outputs the position of the sub character string in the text character string;
a secure approximate pattern matching algorithm, comprising:
the second terminal randomly selects m pairs of random numbers respectivelyThe second terminal selects corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
for each j-1, …, m, the first terminal and the second terminal perform a 1-of-2-makedown transmission algorithm, the input to the second terminal beingThe input of the first terminal is p j And after the algorithm execution is finished, the first terminal obtains a mode set
For each i-1, …, n-m +1, the first terminal and the second terminal perform a boolean threshold privacy set intersection algorithm, where the input of the second terminal is C i M, m-tau, the input of the first terminal is S, m, m-tau, after the algorithm execution is finished, the first terminal obtains an output set b i ∈{0,1} n-m+1 ;
If b is i 1, the first terminal outputs i;
the Boolean type threshold privacy set intersection algorithm comprises the following steps:
public addition homomorphic encryption public key pk of second terminal 1 Then the first terminal and the second terminal execute a private set intersection cardinality algorithm, and the first terminal obtains Enc (pk) 1 ,|C∩S|);
The first terminal selects a random number r epsilon {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
The first terminal selects a random number R' e {0, …, p-1} and R e {0, …,p-1, preparing a polynomial p (·) with the root of R + t, R + t +1, …, R + min (| C |, | S |), and then calculating the coefficient of the polynomial p ' (·) R ' · p (·) + R, the coefficient of the polynomial p ' (·) is a 0 ,a 1 ,…,a min(|C|,|S|)+1 ;
First terminal uses addition homomorphic encryption public key pk 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients Enc (pk) 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|)+1 );
The first terminal converts the encryption coefficient of the polynomial p' (. cndot.) and Enc (pk) 1 And | C | + S | + r) is sent to the second terminal;
the second terminal decrypts the received ciphertext to obtain | C ^ S | + r, then computes the polynomial p' (. cndot.) through the point | C ^ S | + r, and records the result as Enc (pk) 2 R'), to obtain:
the second terminal selects a random number r ∈ {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to the first terminal requesting decryption thereof;
the first terminal decrypts Enc (pk) 1 R ' + R ") and sending the result R ' + R" to the second terminal, which obtains R ' through calculation;
the method comprises the steps that a first terminal and a second terminal execute a privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and the first terminal outputs 0 or 1 after the algorithm execution is finished;
wherein m is the length of the mode string; n is the text string length; tau is a given threshold value in the safe approximate pattern matching algorithm; c is a set held by the first terminal; s is a set held by the second terminal; setting a safety parameter as lambda, setting a global parameter p, wherein p is a prime number, and the binary length | p | > lambda of the global parameter p is set; | C | is the number of elements of the set C; the | S | is the number of elements of the set S; t is a threshold given in the boolean type threshold privacy set intersection algorithm.
4. An electronic device, characterized in that: the second terminal is communicated with the first terminal which holds the mode character string, the length of the text character string and the threshold;
the first terminal and the second terminal execute a safe approximate pattern matching algorithm, and if the Hamming distance between a certain substring of the text string and the pattern string is smaller than a threshold value, the first terminal outputs the position of the substring in the text string;
a secure approximate pattern matching algorithm, comprising:
the second terminal randomly selects m pairs of random numbers respectivelyThe second terminal selects corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
for each j-1, …, m, the first terminal and the second terminal perform a 1-of-2-out transmission algorithm, the input to the second terminal beingThe input of the first terminal is p j And after the algorithm execution is finished, the first terminal obtains a mode set
For each i-1, …, n-m +1, the first terminal and the second terminal perform a boolean threshold privacy set intersection algorithm, where the input to the second terminal is C i M, m-tau, the input of the first terminal is S, m, m-tau, after the algorithm execution is finished, the first terminal obtains an output set b i ∈{0,1} n-m+1 ;
If b is i 1, the first terminal outputs i;
a boolean threshold privacy set intersection algorithm comprising:
public addition homomorphic encryption public key pk of second terminal 1 Then the first terminal and the second terminal execute a private set intersection cardinality algorithm, and the first terminal obtains Enc (pk) 1 ,|C∩S|);
The first terminal selects a random number r epsilon {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
The first terminal selects random numbers R 'epsilon {0, …, p-1} and R epsilon {0, …, p-1}, prepares a polynomial p (·) with the root of R + t, R + t +1, …, R + min (| C |, | S |), and then calculates the coefficient of the polynomial p' (·) R '· p (·) + R, polynomial p' (·) as a 0 ,a 1 ,…,a min(|C|,|S|) +1 ;
First terminal uses addition homomorphic encryption public key pk 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients Enc (pk) 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|)+1 );
The first terminal combines the encryption coefficient of the polynomial p' (. cndot.) with Enc (pk) 1 And | C | + S | + r) is sent to the second terminal;
the second terminal decrypts the received ciphertext to obtain | C ^ S | + r, then computes the polynomial p' (. cndot.) through the point | C ^ S | + r, and records the result as Enc (pk) 2 R'), to obtain:
the second terminal selects a random number r' epsilon {0, …, p-1}, and performs addition homomorphic calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to the first terminal requesting decryption thereof;
the first terminal decrypts Enc (pk) 1 R '+ R') and will joinThe result R ' + R ' is sent to a second terminal, and the second terminal obtains R ' through calculation;
the method comprises the steps that a first terminal and a second terminal execute a privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and the first terminal outputs 0 or 1 after algorithm execution is finished;
wherein m is the length of the mode string; n is the text string length; tau is a given threshold value in the safe approximate pattern matching algorithm; c is a set held by the first terminal; s is a set held by the second terminal; setting a safety parameter as lambda, setting a global parameter p, wherein p is a prime number and the binary length | p | is larger than lambda; | C | is the number of elements of the set C; the | S | is the number of elements of the set S; t is a threshold given in the boolean threshold privacy set intersection algorithm.
5. A secure approximate pattern matching method, characterized by: there is a first terminal holding a text string, a length of the text string and a threshold and a second terminal holding a text string, a length of the text string and a threshold, comprising the steps of:
the first terminal and the second terminal execute a safe approximate mode matching algorithm, and if the Hamming distance between a certain substring of the text string and the mode string is smaller than a threshold value, the first terminal outputs the position of the substring in the text string;
a secure approximate pattern matching algorithm, comprising:
the second terminal randomly selects m pairs of random numbers respectivelyThe second terminal selects corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
for each j-1, …, m, the first terminal and the second terminal perform a 1-of-2-out transmission algorithm, the input to the second terminal beingThe input of the first terminal is p j And after the algorithm execution is finished, the first terminal obtains a mode set
For each i-1, …, n-m +1, the first terminal and the second terminal perform a boolean threshold privacy set intersection algorithm, where the input of the second terminal is C i M, m-tau, the input of the first terminal is S, m, m-tau, after the algorithm execution is finished, the first terminal obtains an output set b i ∈{0,1} n-m+1 ;
If b is i 1, the first terminal outputs i;
a boolean threshold privacy set intersection algorithm comprising:
public addition homomorphic encryption public key pk of second terminal 1 Then the first terminal and the second terminal execute a private set intersection cardinality algorithm, and the first terminal obtains Enc (pk) 1 ,|C∩S|);
The first terminal selects a random number r belonging to {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
The first terminal selects random numbers R 'epsilon {0, …, p-1} and R epsilon {0, …, p-1}, prepares a polynomial p (·) with the root of R + t, R + t +1, …, R + min (| C |, | S |), and then calculates the coefficient of the polynomial p' (·) R '· p (·) + R, polynomial p' (·) as a 0 ,a 1 ,…,a min(|C|,|S|)+1 ;
First terminal uses addition homomorphic encryption public key pk 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients Enc (pk) 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|)+1 );
The first terminal combines the encryption coefficient of the polynomial p' (. cndot.) with Enc (pk) 1 And | C | + S | + r) is sent to the second terminal;
the second terminal decrypts the received ciphertext to get | C ≧ S | + r, then computes the polynomial p' (·) with the point | C ≧ S | + r, and records the result as Enc (pk) 2 R'), to obtain:
the second terminal selects a random number r' epsilon {0, …, p-1}, and performs addition homomorphic calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to the first terminal requesting decryption thereof;
first terminal decrypting Enc (pk) 1 R ' + R ") and sending the result R ' + R" to the second terminal, which obtains R ' through calculation;
the method comprises the steps that a first terminal and a second terminal execute a privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and the first terminal outputs 0 or 1 after the algorithm execution is finished;
wherein m is the length of the mode string; n is the text string length; tau is a given threshold value in the safe approximate pattern matching algorithm; c is a set held by the first terminal; s is a set held by the second terminal; setting a safety parameter as lambda, setting a global parameter p, wherein p is a prime number and the binary length | p | is larger than lambda; the | C | is the number of elements of the set C; the | S | is the number of elements of the set S; t is a threshold given in the boolean threshold privacy set intersection algorithm.
6. A secure approximate pattern matching system, characterized by: the system comprises a first terminal holding a mode character string, the length of the text character string and a threshold value and a second terminal holding the text character string, the length of the mode character string and the threshold value, wherein the first terminal is communicated with the second terminal:
the first terminal and the second terminal execute a safe approximate mode matching algorithm, and if the Hamming distance between a certain substring of the text string and the mode string is smaller than a threshold value, the first terminal outputs the position of the substring in the text string;
a secure approximate pattern matching algorithm, comprising:
the second terminal randomly selects m pairs of random numbers respectivelyThe second terminal selects corresponding random numbers according to each substring with the length of m of the text string t to obtain a text setWherein i is 1, …, n-m + 1;
for each j-1, …, m, the first terminal and the second terminal perform a 1-of-2-makedown transmission algorithm, the input to the second terminal beingThe input of the first terminal is p j And after the algorithm execution is finished, the first terminal obtains a mode set
For each i-1, …, n-m +1, the first terminal and the second terminal perform a boolean threshold privacy set intersection algorithm, where the input to the second terminal is C i M, m-tau, the input of the first terminal is S, m, m-tau, after the algorithm execution is finished, the first terminal obtains an output set b i ∈{0,1} n-m+1 ;
If b is i 1, the first terminal outputs i;
a boolean threshold privacy set intersection algorithm comprising:
public addition homomorphic encryption public key pk of second terminal 1 Then the first terminal and the second terminal execute a private set intersection cardinality algorithm, and the first terminal obtains Enc (pk) 1 ,|C∩S|);
The first terminal selects a random number r epsilon {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,|C∩S|+r)=Enc(pk 1 ,|C∩S|)·Enc(pk 1 ,r);
First terminalSelecting random numbers R 'belonging to {0, …, p-1} and R belonging to {0, …, p-1}, preparing a polynomial p (·) with the root of R + t, R + t +1, …, R + min (| C |, | S |), and calculating the coefficient of the polynomial p' (·) R '· p (·) + R, the coefficient of the polynomial p' (·) is a 0 ,a 1 ,…,a min(|C|,|S|) +1 ;
First terminal uses addition homomorphic encryption public key pk 2 Encrypting the coefficients of the polynomial p' (. cndot.) to obtain the encrypted coefficients Enc (pk) 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|)+1 );
The first terminal combines the encryption coefficient of the polynomial p' (. cndot.) with Enc (pk) 1 And | C | + S | + r) is sent to the second terminal;
the second terminal decrypts the received ciphertext to obtain | C ^ S | + r, then computes the polynomial p' (. cndot.) through the point | C ^ S | + r, and records the result as Enc (pk) 2 R'), to obtain:
the second terminal selects a random number r ∈ {0, …, p-1}, and performs additive homomorphic calculation to obtain Enc (pk) 1 ,R′+r")=Enc(pk 1 ,R′)·Enc(pk 1 R ") and then sent to the first terminal requesting decryption thereof;
first terminal decrypting Enc (pk) 1 R ' + R ") and sending the result R ' + R" to the second terminal, which obtains R ' through calculation;
the method comprises the steps that a first terminal and a second terminal execute a privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and the first terminal outputs 0 or 1 after the algorithm execution is finished;
wherein m is the length of the mode string; n is the text string length; tau is a given threshold value in the safe approximate pattern matching algorithm; c is a set held by the first terminal; s is a set held by the second terminal; setting a safety parameter as lambda, setting a global parameter p, wherein p is a prime number and the binary length | p | is larger than lambda; | C | is the number of elements of the set C; the | S | is the number of elements of the set S; t is a threshold given in the boolean threshold privacy set intersection algorithm.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011561764.XA CN112732776B (en) | 2020-12-25 | 2020-12-25 | Secure approximate pattern matching method and system and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011561764.XA CN112732776B (en) | 2020-12-25 | 2020-12-25 | Secure approximate pattern matching method and system and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112732776A CN112732776A (en) | 2021-04-30 |
CN112732776B true CN112732776B (en) | 2022-08-26 |
Family
ID=75616220
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011561764.XA Active CN112732776B (en) | 2020-12-25 | 2020-12-25 | Secure approximate pattern matching method and system and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112732776B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116132029B (en) * | 2022-12-22 | 2023-09-26 | 泉城省实验室 | Wild card symbol pattern matching method and system based on three-choice-one-blank transmission protocol |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101369278A (en) * | 2008-09-27 | 2009-02-18 | 成都市华为赛门铁克科技有限公司 | Approximate adaptation method and apparatus |
US9009089B1 (en) * | 2011-06-27 | 2015-04-14 | Hrl Laboratories, Llc | Secure pattern matching |
WO2018059303A1 (en) * | 2016-09-30 | 2018-04-05 | 中兴通讯股份有限公司 | Method and device for encrypting and decrypting information in short message |
CN109359476A (en) * | 2018-10-26 | 2019-02-19 | 山东师范大学 | A kind of two side's method for mode matching and device of hiding input |
CN110708167A (en) * | 2019-10-14 | 2020-01-17 | 杭州云萃流图网络科技有限公司 | Method, device, equipment and medium for generating public key and private key |
CN111368312A (en) * | 2020-02-17 | 2020-07-03 | 山东师范大学 | Facility site selection method and system for hiding position information |
CN111556048A (en) * | 2020-04-26 | 2020-08-18 | 山东师范大学 | Attribute-based secure communication method and system supporting ciphertext mode matching |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11194865B2 (en) * | 2017-04-21 | 2021-12-07 | Visa International Service Association | Hybrid approach to approximate string matching using machine learning |
US10608811B2 (en) * | 2017-06-15 | 2020-03-31 | Microsoft Technology Licensing, Llc | Private set intersection encryption techniques |
-
2020
- 2020-12-25 CN CN202011561764.XA patent/CN112732776B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101369278A (en) * | 2008-09-27 | 2009-02-18 | 成都市华为赛门铁克科技有限公司 | Approximate adaptation method and apparatus |
US9009089B1 (en) * | 2011-06-27 | 2015-04-14 | Hrl Laboratories, Llc | Secure pattern matching |
WO2018059303A1 (en) * | 2016-09-30 | 2018-04-05 | 中兴通讯股份有限公司 | Method and device for encrypting and decrypting information in short message |
CN109359476A (en) * | 2018-10-26 | 2019-02-19 | 山东师范大学 | A kind of two side's method for mode matching and device of hiding input |
CN110708167A (en) * | 2019-10-14 | 2020-01-17 | 杭州云萃流图网络科技有限公司 | Method, device, equipment and medium for generating public key and private key |
CN111368312A (en) * | 2020-02-17 | 2020-07-03 | 山东师范大学 | Facility site selection method and system for hiding position information |
CN111556048A (en) * | 2020-04-26 | 2020-08-18 | 山东师范大学 | Attribute-based secure communication method and system supporting ciphertext mode matching |
Non-Patent Citations (2)
Title |
---|
SMSPPRL: A Similarity Matching Strategy for Privacy Preserving Record Linkage;Vijay Maruti Shelake等;《2020 Sixth International Conference on Parallel, Distributed and Grid Computing (PDGC)》;20201108;全文 * |
安全的常数轮多用户k-均值聚类计算协议;秦红等;《计算机研究与发展》;20201009;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112732776A (en) | 2021-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108809646B (en) | Secure shared key sharing system | |
JP6384314B2 (en) | Information processing method, information processing program, and information processing apparatus | |
CN108111294B (en) | Multi-label classification method for protecting privacy based on ML-kNN | |
JP6349841B2 (en) | Ciphertext processing apparatus, ciphertext processing method, ciphertext processing program, and information processing apparatus | |
CN109245903B (en) | Signature method and device for cooperatively generating SM2 algorithm by two parties and storage medium | |
CN111162906A (en) | Collaborative secret sharing method, device, system and medium based on vast transmission algorithm | |
JP2016080766A (en) | Encryption processing method, encryption processing device and encryption processing program | |
US10503915B2 (en) | Encrypted text verification system, method and recording medium | |
Boneh et al. | Hosting services on an untrusted cloud | |
CN113225297A (en) | Data hybrid encryption method, device and equipment | |
JP6738061B2 (en) | Ciphertext verification system, method, and recording medium | |
CN111241596B (en) | Block chain asset account recovery method and device | |
CN112732776B (en) | Secure approximate pattern matching method and system and electronic equipment | |
CN114564730A (en) | Symmetric encryption-based federal packet statistic calculation method, device and medium | |
CN109088721B (en) | Entrustable uncovering and encrypting method | |
CN112380404B (en) | Data filtering method, device and system | |
Takagi | Recent developments in post-quantum cryptography | |
CN113761570B (en) | Data interaction method for privacy intersection | |
CN114866312B (en) | Shared data determining method and device for protecting data privacy | |
JPWO2020174515A1 (en) | Cryptographic system, key generator, key generator, key generator, and homomorphic arithmetic unit | |
CN115913649A (en) | Efficient attribute base signcryption method and system based on quotient secret SM9 | |
CN115525907A (en) | Vector similarity judgment method under malicious adversary model and communication equipment | |
US20230085577A1 (en) | Secured performance of an elliptic curve cryptographic process | |
CN117478305B (en) | Fully homomorphic encryption method, system, terminal and medium based on two-party security cooperation | |
CN115102750B (en) | Private data processing method, system, computer terminal and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |