CN112732776B - Secure approximate pattern matching method and system and electronic equipment - Google Patents

Secure approximate pattern matching method and system and electronic equipment Download PDF

Info

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
Application number
CN202011561764.XA
Other languages
Chinese (zh)
Other versions
CN112732776A (en
Inventor
魏晓超
徐琳
王皓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Normal University
Original Assignee
Shandong Normal University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shandong Normal University filed Critical Shandong Normal University
Priority to CN202011561764.XA priority Critical patent/CN112732776B/en
Publication of CN112732776A publication Critical patent/CN112732776A/en
Application granted granted Critical
Publication of CN112732776B publication Critical patent/CN112732776B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate 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

一种安全近似模式匹配方法、系统及电子设备A secure approximate pattern matching method, system and electronic device

技术领域technical field

本公开涉及模式匹配技术领域,特别涉及一种安全近似模式匹配方法、系统及电子设备。The present disclosure relates to the technical field of pattern matching, and in particular, to a method, system and electronic device for secure approximate pattern matching.

背景技术Background technique

本部分的陈述仅仅是提供了与本公开相关的背景技术,并不必然构成现有技术。The statements in this section merely provide background related to the present disclosure and do not necessarily constitute prior art.

近似模式匹配的应用非常广泛,如在人脸识别系统中,当光线、位置或表情不同时,系统所提取到的用户的面部图像的特征数据也不同,因此,当所提取的特征数据与存储在数据库中的特征模板匹配时,需要根据二者的相似度来判断面部图像对应的身份信息,而不是根据二者是否相同来判断。Approximate pattern matching is widely used. For example, in the face recognition system, when the light, position or expression is different, the feature data of the user's facial image extracted by the system is also different. When the feature templates in the database are matched, the identity information corresponding to the facial image needs to be judged according to the similarity between the two, rather than whether the two are the same.

然而,发明人发现,用户的面部数据以及数据库中的特征模板都属于私有数据,双方通常不希望公开自己所掌握的私有数据,以避免泄露自己的隐私信息。However, the inventor found that the user's facial data and the feature templates in the database belong to private data, and both parties usually do not want to disclose their private data to avoid revealing their private information.

发明内容SUMMARY OF THE INVENTION

为了解决现有技术的不足,本公开提供了一种安全近似模式匹配方法、系统及电子设备,持有模式信息的用户可以获得其模式在数据库中出现的位置,通过茫然传输算法和布尔类型阈值隐私集合求交算法,数据库方无法得知用户的模式信息,用户无法得知数据库中的其他数据信息,在进行模式匹配的同时保证了各自数据的安全性。In order to solve the deficiencies of the prior art, the present disclosure provides a method, system and electronic device for secure approximate pattern matching. Users who hold pattern information can obtain the location where their pattern appears in the database. In the privacy set intersection algorithm, the database side cannot know the user's pattern information, and the user cannot know other data information in the database, which ensures the security of their respective data while performing pattern matching.

为了实现上述目的,本公开采用如下技术方案:In order to achieve the above object, the present disclosure adopts the following technical solutions:

本公开第一方面提供了一种安全近似模式匹配方法。A first aspect of the present disclosure provides a secure approximate pattern matching method.

一种安全近似模式匹配方法,应用于持有模式字符串、文本字符串的长度以及阈值的第一终端,包括以下步骤:A secure approximate pattern matching method applied to a first terminal holding a pattern string, the length of a text string and a threshold, comprising the following steps:

第一终端与持有文本字符串、模式字符串长度及阈值的第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal executes a secure approximate pattern matching algorithm with the second terminal that holds the text string, the length of the pattern string and the threshold. If the Hamming distance between a substring of the text string and the pattern string is less than the threshold, the first A terminal outputs the position of this substring within the text string.

本公开第二方面提供了一种电子设备。A second aspect of the present disclosure provides an electronic device.

一种电子设备,包括持有模式字符串、文本字符串的长度以及阈值的第一终端,第一终端与持有文本字符串、模式字符串长度及阈值的第二终端通信;An electronic device, comprising a first terminal holding a pattern string, the length of the text string and a threshold, the first terminal communicating with a second terminal holding the text string, the length of the pattern string and the threshold;

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position.

本公开第三方面提供了一种安全近似模式匹配方法。A third aspect of the present disclosure provides a secure approximate pattern matching method.

一种安全近似模式匹配方法,应用于持有文本字符串、模式字符串长度及阈值的第二终端,包括以下步骤:A secure approximate pattern matching method, applied to a second terminal holding a text string, a pattern string length and a threshold, comprising the following steps:

第二终端与持有模式字符串、文本字符串的长度以及阈值的第一终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,使得第一终端输出此子字符串的在文本字符串中的位置。The second terminal performs a secure approximate pattern matching algorithm with the first terminal holding the pattern string, the length of the text string and the threshold, if the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, Causes the first terminal to output the position of this substring within the text string.

本公开第四方面提供了一种电子设备。A fourth aspect of the present disclosure provides an electronic device.

一种电子设备,包括持有文本字符串、模式字符串长度及阈值的第二终端,第二终端与持有模式字符串、文本字符串的长度以及阈值的第一终端通信;An electronic device, comprising a second terminal holding a text string, a pattern string length and a threshold, the second terminal communicating with a first terminal holding the pattern string, the length of the text string and the threshold;

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,使得第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the text string of the substring. in the location.

本公开第五方面提供了一种安全近似模式匹配方法。A fifth aspect of the present disclosure provides a secure approximate pattern matching method.

一种安全近似模式匹配方法,存在持有模式字符串、文本字符串的长度和阈值的第一终端以及持有文本字符串、模式字符串长度和阈值的第二终端,包括以下步骤:A method for secure approximate pattern matching, having a first terminal holding a pattern string, the 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, comprising the following steps:

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position.

本公开第六方面提供了一种安全近似模式匹配系统。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, the 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 and the second terminal Terminal communication:

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position.

与现有技术相比,本公开的有益效果是:Compared with the prior art, the beneficial effects of the present disclosure are:

1、本公开所述的方法、电子设备或系统,持有模式信息的用户可以获得其模式在数据库中出现的位置,通过茫然传输算法和布尔类型阈值隐私集合求交算法,数据库方无法得知用户的模式信息,用户无法得知数据库中的其他数据信息,在进行模式匹配的同时保证了各自数据的安全性。1. With the method, electronic device or system described in the present disclosure, the user who holds the pattern information can obtain the position where the pattern appears in the database, and the database party cannot know the location of the pattern in the database through the blind transmission algorithm and the Boolean type threshold privacy set intersection algorithm. The user's pattern information, the user cannot know other data information in the database, and ensures the security of their respective data while performing pattern matching.

2、本公开所述的方法、电子设备或系统,能够让持有模式信息的参与方获得其模式在文本中出现的位置,但持有文本的参与方无法获得任何关于模式的相关信息,持有模式的参与方无法获得文本的其他相关信息。2. The method, electronic device or system described in the present disclosure enables the participant who holds the pattern information to obtain the position where the pattern appears in the text, but the participant who holds the text cannot obtain any relevant information about the pattern. Other relevant information about the text is not available to parties with patterns.

附图说明Description of drawings

构成本公开的一部分的说明书附图用来提供对本公开的进一步理解,本公开的示意性实施例及其说明用于解释本公开,并不构成对本公开的不当限定。The accompanying drawings that constitute a part of the present disclosure are used to provide further understanding of the present disclosure, and the exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure.

图1为本公开实施例1提供的安全近似模式匹配方法的流程示意图。FIG. 1 is a schematic flowchart of the secure approximate pattern matching method provided in Embodiment 1 of the present disclosure.

具体实施方式Detailed ways

下面结合附图与实施例对本公开作进一步说明。The present disclosure will be further described below with reference to the accompanying drawings and embodiments.

应该指出,以下详细说明都是例示性的,旨在对本公开提供进一步的说明。除非另有指明,本文使用的所有技术和科学术语具有与本公开所属技术领域的普通技术人员通常理解的相同含义。It should be noted that the following detailed description is exemplary and intended to provide further explanation of the present disclosure. Unless otherwise defined, 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 should be noted that the terminology used herein is for the purpose of describing specific embodiments only, and is not intended to limit the exemplary embodiments according to the present disclosure. As used herein, unless the context clearly dictates otherwise, the singular is intended to include the plural as well, furthermore, it is to be understood that when the terms "comprising" and/or "including" are used in this specification, it indicates that There are features, steps, operations, devices, components and/or combinations thereof.

在不冲突的情况下,本公开中的实施例及实施例中的特征可以相互组合。The embodiments of this disclosure and features of the embodiments may be combined with each other without conflict.

实施例1:Example 1:

如图1所示,本公开实施例1提供了一种安全近似模式匹配方法,应用于第一终端(即P1);As shown in FIG. 1 , Embodiment 1 of the present disclosure provides a secure approximate pattern matching method, which is applied to a first terminal (ie P 1 );

参与方P0(即第二终端)的输入为文本字符串t∈{0,1}n、模式字符串的长度m以及阈值τ,参与方P1的输入为模式字符串p∈{0,1}m、文本字符串的长度n以及阈值τ;The input of the participant P 0 (ie the second terminal) is the text string t∈{0,1} n , the length m of the pattern string and the threshold τ, and the input of the participant P 1 is the pattern string p∈{0, 1} m , the length n of the text string and the threshold τ;

安全近似模式匹配算法执行结束后,如果t的第i个子字符串和p之间的汉明距离小于τ,那么P1输出位置i,形式化描述如下:After the execution of the safe approximate pattern matching algorithm, if the Hamming distance between the ith substring of t and p is less than τ, then P 1 outputs position i, which is formally described as follows:

输入:P0的输入为(t,m,τ),P1的输入为(p,n,τ)。Input: The input of P 0 is (t, m, τ), and the input of P 1 is (p, n, τ).

输出:如果t的第i个子字符串和p之间的汉明距离小于τ,P1输出i。Output: P 1 outputs i if the Hamming distance between the ith substring of t and p is less than τ.

初始化:设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ。Initialization: Set the security parameter as λ, set the global parameter p, p is a prime number, and its binary length |p|>λ.

安全近似模式匹配算法,具体如下:Safe approximate pattern matching algorithm, as follows:

(1)P0随机选择m对随机数,分别为

Figure GDA0003702726220000051
其中
Figure GDA0003702726220000052
P0根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure GDA0003702726220000053
其中i=1,…,n-m+1;(1) P 0 randomly selects m pairs of random numbers, which are
Figure GDA0003702726220000051
in
Figure GDA0003702726220000052
P 0 selects the corresponding random number according to each substring of length m of the text string t, and obtains the text set
Figure GDA0003702726220000053
where i=1,...,n-m+1;

(2)对于每一个j=1,…,m,P0和P1执行一个2选1茫然传输算法,其中P0的输入为

Figure GDA0003702726220000061
P1的输入为pj,算法执行结束后,P1得到模式集合
Figure GDA0003702726220000062
( 2 ) For each j = 1 , .
Figure GDA0003702726220000061
The input of P 1 is p j , after the execution of the algorithm, P 1 gets the pattern set
Figure GDA0003702726220000062

(3)对于每一个i=1,…,n-m+1,P0和P1执行一个布尔类型阈值隐私集合求交算法,其中P0的输入为(Ci,m,m-τ),P1的输入为(S,m,m-τ)。算法执行结束后,P1得到输出集合bi∈{0,1}n-m+1(3) For each i = 1 , . , the input of P 1 is (S,m,m-τ). After the algorithm is executed, P 1 obtains the output set b i ∈{0,1} n-m+1 .

(4)如果bi=1,P1输出i。(4) If bi = 1, P 1 outputs i .

布尔类型阈值隐私集合求交算法,具体如下:Boolean type threshold privacy set intersection algorithm, as follows:

在布尔类型阈值隐私集合求交算法中,C、S为集合,|C|、|S|分别为集合C、S的长度,t为阈值,参与方P0的输入为(C,|S|,t),参与方P1的输入为(S,|C|,t),算法运行结束后,如果|C∩S|≥t,P1输出1,否则P1输出0,具体描述如下:In the Boolean threshold privacy set intersection algorithm, C and S are sets, |C| and |S| are the lengths of sets C and S, respectively, t is the threshold, and the input of the participant P 0 is (C, |S| ,t), the input of the participant P 1 is (S,|C|,t). After the algorithm runs, if |C∩S|≥t, P 1 outputs 1, otherwise P 1 outputs 0. The specific description is as follows:

输入:P0的输入为(C,|S|,T),P1的输入为(S,|C|,t)。Input: The input of P 0 is (C, |S|, T), and the input of P 1 is (S, |C|, t).

输出:如果|C∩S|≥t,P1输出1,否则P1输出0。Output: If |C∩S|≥t, P 1 outputs 1, otherwise P 1 outputs 0.

初始化:设安全参数为λ,设置全局参数p。p为一个素数,其二进制长度|p|>λ。Initialization: Set the security parameter to λ and set the global parameter p. p is a prime number whose binary length |p|>λ.

1)P0公开加法同态加密公钥pk1,然后P0和P1执行私有集合交集基数算法,P1得到Enc(pk1,|C∩S|)。1) P 0 publishes the public additive homomorphic encryption public key pk 1 , then P 0 and P 1 execute the private set intersection cardinality algorithm, and P 1 obtains Enc(pk 1 ,|C∩S|).

2)P1选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);2) P 1 selects a random number r∈{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);

P1选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|)的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|+1P 1 selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root as r+t,r+t+1,…,r+min( |C|, |S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 , a 1 ,… ,a min(|C|,|S|+1 ;

P1用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为P 1 encrypts the coefficients of the polynomial p'(·) with the additive homomorphic encryption public key pk 2 , and the encrypted coefficients are

Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|+1);Enc(pk 2 ,a 0 ),Enc(pk 2 ,a 1 ),…,Enc(pk 2 ,a min(|C|,|S|+1 );

P1将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给P0P 1 sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to P 0 .

3)P0解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),可得到:3) P 0 decrypts the received ciphertext to get |C∩S|+r, then use the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and record the result as Enc(pk 2 ,R '),available:

Figure GDA0003702726220000071
Figure GDA0003702726220000071

P0选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给P1请求其解密。P 0 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 send it to P1 to request its decryption.

4)P1解密Enc(pk1,R′+r")并将结果R′+r"发送给P0,P0经过计算得到R′。4) P 1 decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to P 0 , and P 0 obtains R' through calculation.

5)P0和P1执行隐私相等性测试算法,其中P0输入R′,P1输入R,算法执行结束后,P1输出0或1。5) P 0 and P 1 execute the privacy equality test algorithm, where P 0 inputs R′, P 1 inputs R, and after the algorithm is executed, P 1 outputs 0 or 1.

本实施例中,茫然传输算法,具体如下:In this embodiment, the dazed transmission algorithm is specifically as follows:

茫然传输(oblivious transfer,OT)算法是一个两方算法,两个参与方分别为发送方S和接收方R,在一个2选1茫然传输算法

Figure GDA0003702726220000072
算法中,发送方S输入2个消息(x0,x1),接收方R输入一个选择信息σ∈{0,1},双方执行算法后,R输出xσ;除此之外,不泄露任何额外信息。The oblivious transfer (OT) algorithm is a two-party algorithm. The two parties are the sender S and the receiver R respectively.
Figure GDA0003702726220000072
In the algorithm, the sender S inputs 2 messages (x 0 , x 1 ), the receiver R inputs a selection information σ∈{0,1}, after both parties execute the algorithm, R outputs x σ ; in addition, no leakage any additional information.

本实施例中,隐私相等性测试,具体如下:In this embodiment, the privacy equality test is as follows:

隐私相等性测试(private equality test,PEQT)算法是一个两方算法,两个参与方分别为发送方S和接收方R。发送方S的输入为x0,接收方R的输入为x1,双方执行算法后,如果x0=x1,R输出1,否则R输出0。除此之外,不泄露任何额外信息。The private equality test (PEQT) algorithm is a two-party algorithm, and the two parties are the sender S and the receiver R respectively. The input of the sender S is x 0 , and 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. Other than that, no additional information is disclosed.

本实施例中,加密隐私集合交集基数,具体如下:In this embodiment, the encryption privacy set intersection cardinality is as follows:

加密隐私集合交集基数(encrypted private set intersection-cardinality,ePSI-CA)算法是一个两方算法,两个参与方分别为P0和P1。C、S为集合,|C|、|S|分别为集合C、S的长度,(pk1,sk1)、(pk2,sk2)为P0和P1的加法同态加密密钥对。P0的输入为(C,|S|,pk1,sk1),P1的输入为(S,|C|,pk1,pk2,sk2),双方执行协后,P1输出加密后的交集元素个数Enc(pk1,|C∩S|)。The encrypted private set intersection-cardinality (ePSI-CA) algorithm is a two-party algorithm, and the two parties are P 0 and P 1 respectively. C and S are sets, |C| and |S| are the lengths of sets C and S, respectively, (pk 1 , sk 1 ) and (pk 2 , sk 2 ) are the additive homomorphic encryption keys of P 0 and P 1 right. The input of P 0 is (C,|S|,pk 1 ,sk 1 ), and the input of P 1 is (S,|C|,pk 1 ,pk 2 ,sk 2 ), after the two parties execute the agreement, P 1 outputs encryption The number of subsequent intersection elements Enc(pk 1 ,|C∩S|).

实施例2:Example 2:

本公开实施例2提供了一种电子设备,包括持有模式字符串、文本字符串的长度以及阈值的第一终端,第一终端与持有文本字符串、模式字符串长度及阈值的第二终端通信;Embodiment 2 of the present disclosure provides an electronic device, including a first terminal holding a pattern string, the length of the text string and a threshold, the first terminal and a second terminal holding the text string, the length of the pattern string and the threshold terminal communication;

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position.

所述设备的具体工作方法与实施例1提供的方法相同,这里不再赘述。The specific working method of the device is the same as the method provided in Embodiment 1, and will not be repeated here.

实施例3:Example 3:

本公开实施例3提供了一种安全近似模式匹配方法,应用于持有文本字符串、模式字符串长度及阈值的第二终端,包括以下步骤:Embodiment 3 of the present disclosure provides a secure approximate pattern matching method, which is applied to a second terminal holding a text string, a pattern string length, and a threshold, including the following steps:

第二终端与持有模式字符串、文本字符串的长度以及阈值的第一终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,使得第一终端输出此子字符串的在文本字符串中的位置。The second terminal performs a secure approximate pattern matching algorithm with the first terminal holding the pattern string, the length of the text string and the threshold, if the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, Causes the first terminal to output the position of this substring within the text string.

详细方法与实施例1提供的方法相同,这里不再赘述。The detailed method is the same as that provided in Embodiment 1, and will not be repeated here.

实施例4:Example 4:

本公开实施例4提供了一种电子设备,包括持有文本字符串、模式字符串长度及阈值的第二终端,第二终端与持有模式字符串、文本字符串的长度以及阈值的第一终端通信;Embodiment 4 of the present disclosure provides an electronic device, including a second terminal that holds a text string, the length of the pattern string, and a threshold, the second terminal and a first terminal that holds the pattern string, the length of the text string, and the threshold terminal communication;

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,使得第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the text string of the substring. in the location.

所述设备的具体工作方法与实施例1提供的方法相同,这里不再赘述。The specific working method of the device is the same as the method provided in Embodiment 1, and will not be repeated here.

实施例5:Example 5:

本公开实施例5提供了一种安全近似模式匹配方法,存在持有模式字符串、文本字符串的长度和阈值的第一终端以及持有文本字符串、模式字符串长度和阈值的第二终端,包括以下步骤:Embodiment 5 of the present disclosure provides a secure approximate pattern matching method. There are a first terminal holding a pattern string, the length of the text string, and a threshold, and a second terminal holding the text string, the length of the pattern string, and a threshold. , including the following steps:

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position.

详细方法与实施例1提供的方法相同,这里不再赘述。The detailed method is the same as that provided in Embodiment 1, and will not be repeated here.

实施例6:Example 6:

本公开实施例6提供了一种安全近似模式匹配系统,包括持有模式字符串、文本字符串的长度和阈值的第一终端以及持有文本字符串、模式字符串长度和阈值的第二终端,第一终端与第二终端通信:Embodiment 6 of the present disclosure provides a secure approximate pattern matching system, including a first terminal holding a pattern string, the length of the text string, and a threshold, and a second terminal holding the text string, the length of the pattern string, and a threshold , the first terminal communicates with the second terminal:

第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置。The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position.

所述系统的工作方法与实施例1提供的方法相同,这里不再赘述。The working method of the system is the same as the method provided in Embodiment 1, and details are not repeated here.

本领域内的技术人员应明白,本公开的实施例可提供为方法、系统、或计算机程序产品。因此,本公开可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。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 having computer-usable program code embodied therein, including but not limited to disk storage, optical storage, and the like.

本公开是参照根据本公开实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。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 in 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 the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(RandomAccessMemory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. During execution, the processes of the embodiments of the above-mentioned methods may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.

以上所述仅为本公开的优选实施例而已,并不用于限制本公开,对于本领域的技术人员来说,本公开可以有各种更改和变化。凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。The above descriptions are only preferred embodiments of the present disclosure, and are not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included within the protection scope of the present disclosure.

Claims (6)

1.一种安全近似模式匹配方法,其特征在于:应用于持有模式字符串、文本字符串的长度以及阈值的第一终端,包括以下步骤:1. a safe approximate pattern matching method, is characterized in that: be applied to the first terminal that holds the length of pattern string, text string and threshold, comprises the following steps: 第一终端与持有文本字符串、模式字符串长度及阈值的第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置;The first terminal executes a secure approximate pattern matching algorithm with the second terminal that holds the text string, the length of the pattern string and the threshold. If the Hamming distance between a substring of the text string and the pattern string is less than the threshold, the first A terminal outputs the position of the substring within the text string; 安全近似模式匹配算法,包括:Safe approximate pattern matching algorithms, including: 第二终端随机选择m对随机数,分别为
Figure FDA0003749189060000011
第二终端根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure FDA0003749189060000012
其中i=1,…,n-m+1;
The second terminal randomly selects m pairs of random numbers, which are
Figure FDA0003749189060000011
The second terminal selects a corresponding random number according to each substring of length m of the text string t, and obtains a text set
Figure FDA0003749189060000012
where i=1,...,n-m+1;
对于每一个j=1,…,m,第一终端和第二终端执行一个2选1茫然传输算法,第二终端的输入为
Figure FDA0003749189060000013
第一终端的输入为pj,算法执行结束后,第一终端得到模式集合
Figure FDA0003749189060000014
For each j=1,...,m, the first terminal and the second terminal perform a 2-to-1 blind transmission algorithm, and the input of the second terminal is
Figure FDA0003749189060000013
The input of the first terminal is p j . After the algorithm is executed, the first terminal obtains the pattern set
Figure FDA0003749189060000014
对于每一个i=1,…,n-m+1,第一终端和第二终端执行布尔类型阈值隐私集合求交算法,其中第二终端的输入为Ci,m,m-τ,第一终端的输入为S,m,m-τ,算法执行结束后,第一终端得到输出集合bi∈{0,1}n-m+1For each i =1, . The input of the terminal is S,m,m-τ, after the algorithm is executed, the first terminal obtains the output set b i ∈{0,1} n-m+1 ; 如果bi=1,第一终端输出i;If b i =1, the first terminal outputs i; 布尔类型阈值隐私集合求交算法,包括:Boolean threshold privacy set intersection algorithm, including: 第二终端公开加法同态加密公钥pk1,然后第一终端和第二终端执行私有集合交集基数算法,第一终端得到Enc(pk1,|C∩S|);The second terminal publishes the public additive homomorphic encryption public key pk 1 , then the first terminal and the second terminal execute the private set intersection radix algorithm, and the first terminal obtains Enc(pk 1 ,|C∩S|); 第一终端选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);The first terminal selects a random number r∈{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); 第一终端选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|) 的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|) +1The first terminal selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root of r+t,r+t+1,…,r+min (|C|,|S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 ,a 1 , …,a min(|C|,|S|) +1 ; 第一终端用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|)+1);The first terminal uses the additive homomorphic encryption public key pk 2 to encrypt the coefficients of the polynomial p'(·), and the encrypted coefficients are obtained as Enc(pk 2 , a 0 ), Enc(pk 2 , a 1 ), ... ,Enc(pk 2 ,a min(|C|,|S|)+1 ); 第一终端将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给第二终端;The first terminal sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to the second terminal; 第二终端解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),得到:The second terminal decrypts the received ciphertext to obtain |C∩S|+r, then uses the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and denote the obtained result as Enc(pk 2 ,R′ ),get:
Figure FDA0003749189060000021
Figure FDA0003749189060000021
第二终端选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给第一终端请求其解密;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 send it to the first terminal to request its decryption; 第一终端解密Enc(pk1,R′+r")并将结果R′+r"发送给第二终端,第二终端经过计算得到R′;The first terminal decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to the second terminal, and the second terminal obtains R' through calculation; 第一终端和第二终端执行隐私相等性测试算法,其中第二终端输入R′,第一终端输入R,算法执行结束后,第一终端输出0或1;The first terminal and the second terminal execute the privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and after the algorithm execution ends, the first terminal outputs 0 or 1; 其中,m为模式字符串长度;n为文本字符串长度;τ为安全近似模式匹配算法中给定的阈值;C为第一终端持有的集合;S为第二终端持有的集合;设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ;|C|为集合C的元素个数;|S|为集合S的元素个数;t为布尔类型阈值隐私集合求交算法中给定的阈值。where m is the length of the pattern string; n is the length of the text string; τ is the threshold given in the secure approximate pattern matching algorithm; C is the set held by the first terminal; S is the set held by the second terminal; let The security parameter is λ, and the global parameter p is set, where p is a prime number, and its binary length |p|>λ; |C| is the number of elements in the set C; |S| is the number of elements in the set S; t is a Boolean type Thresholds given in the privacy set intersection algorithm.
2.一种电子设备,其特征在于:包括持有模式字符串、文本字符串的长度以及阈值的第一终端,第一终端与持有文本字符串、模式字符串长度及阈值的第二终端通信;2. An electronic device, characterized in that: comprising a first terminal holding a pattern string, the length of a text string and a threshold, the first terminal and a second terminal holding a text string, the length of the pattern string and the threshold communication; 第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置;The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position; 安全近似模式匹配算法,包括:Safe approximate pattern matching algorithms, including: 第二终端随机选择m对随机数,分别为
Figure FDA0003749189060000031
第二终端根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure FDA0003749189060000032
其中i=1,…,n-m+1;
The second terminal randomly selects m pairs of random numbers, which are
Figure FDA0003749189060000031
The second terminal selects a corresponding random number according to each substring of length m of the text string t, and obtains a text set
Figure FDA0003749189060000032
where i=1,...,n-m+1;
对于每一个j=1,…,m,第一终端和第二终端执行一个2选1茫然传输算法,第二终端的输入为
Figure FDA0003749189060000033
第一终端的输入为pj,算法执行结束后,第一终端得到模式集合
Figure FDA0003749189060000034
For each j=1,...,m, the first terminal and the second terminal perform a 2-to-1 blind transmission algorithm, and the input of the second terminal is
Figure FDA0003749189060000033
The input of the first terminal is p j . After the algorithm is executed, the first terminal obtains the pattern set
Figure FDA0003749189060000034
对于每一个i=1,…,n-m+1,第一终端和第二终端执行布尔类型阈值隐私集合求交算法,其中第二终端的输入为Ci,m,m-τ,第一终端的输入为S,m,m-τ,算法执行结束后,第一终端得到输出集合bi∈{0,1}n-m+1For each i =1, . The input of the terminal is S,m,m-τ, after the algorithm is executed, the first terminal obtains the output set b i ∈{0,1} n-m+1 ; 如果bi=1,第一终端输出i;If b i =1, the first terminal outputs i; 布尔类型阈值隐私集合求交算法,包括:Boolean threshold privacy set intersection algorithm, including: 第二终端公开加法同态加密公钥pk1,然后第一终端和第二终端执行私有集合交集基数算法,第一终端得到Enc(pk1,|C∩S|);The second terminal publishes the public additive homomorphic encryption public key pk 1 , then the first terminal and the second terminal execute the private set intersection radix algorithm, and the first terminal obtains Enc(pk 1 ,|C∩S|); 第一终端选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);The first terminal selects a random number r∈{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); 第一终端选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|)的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|)+1The first terminal selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root of r+t,r+t+1,…,r+min (|C|,|S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 , a 1 , …,a min(|C|,|S|)+1 ; 第一终端用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|)+1);The first terminal uses the additive homomorphic encryption public key pk 2 to encrypt the coefficients of the polynomial p'(·), and the encrypted coefficients are obtained as Enc(pk 2 , a 0 ), Enc(pk 2 , a 1 ), ... ,Enc(pk 2 ,a min(|C|,|S|)+1 ); 第一终端将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给第二终端;The first terminal sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to the second terminal; 第二终端解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),得到:The second terminal decrypts the received ciphertext to obtain |C∩S|+r, then uses the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and denote the obtained result as Enc(pk 2 ,R′ ),get:
Figure FDA0003749189060000041
Figure FDA0003749189060000041
第二终端选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给第一终端请求其解密;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 send it to the first terminal to request its decryption; 第一终端解密Enc(pk1,R′+r")并将结果R′+r"发送给第二终端,第二终端经过计算得到R′;The first terminal decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to the second terminal, and the second terminal obtains R' through calculation; 第一终端和第二终端执行隐私相等性测试算法,其中第二终端输入R′,第一终端输入R,算法执行结束后,第一终端输出0或1;The first terminal and the second terminal execute the privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and after the algorithm execution ends, the first terminal outputs 0 or 1; 其中,m为模式字符串长度;n为文本字符串长度;τ为安全近似模式匹配算法中给定的阈值;C为第一终端持有的集合;S为第二终端持有的集合;设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ;|C|为集合C的元素个数;|S|为集合S的元素个数;t为布尔类型阈值隐私集合求交算法中给定的阈值。where m is the length of the pattern string; n is the length of the text string; τ is the threshold given in the secure approximate pattern matching algorithm; C is the set held by the first terminal; S is the set held by the second terminal; let The security parameter is λ, and the global parameter p is set, where p is a prime number, and its binary length |p|>λ; |C| is the number of elements in the set C; |S| is the number of elements in the set S; t is a Boolean type Thresholds given in the privacy set intersection algorithm.
3.一种安全近似模式匹配方法,其特征在于:应用于持有文本字符串、模式字符串长度及阈值的第二终端,包括以下步骤:3. A safe approximate pattern matching method, characterized in that: being applied to a second terminal holding a text string, a pattern string length and a threshold, comprising the following steps: 第二终端与持有模式字符串、文本字符串的长度以及阈值的第一终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,使得第一终端输出此子字符串的在文本字符串中的位置;The second terminal performs a secure approximate pattern matching algorithm with the first terminal holding the pattern string, the length of the text string and the threshold, if the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, Causes the first terminal to output the position of the substring in the text string; 安全近似模式匹配算法,包括:Safe approximate pattern matching algorithms, including: 第二终端随机选择m对随机数,分别为
Figure FDA0003749189060000051
第二终端根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure FDA0003749189060000061
其中i=1,…,n-m+1;
The second terminal randomly selects m pairs of random numbers, which are
Figure FDA0003749189060000051
The second terminal selects a corresponding random number according to each substring of length m of the text string t, and obtains a text set
Figure FDA0003749189060000061
where i=1,...,n-m+1;
对于每一个j=1,…,m,第一终端和第二终端执行一个2选1茫然传输算法,第二终端的输入为
Figure FDA0003749189060000062
第一终端的输入为pj,算法执行结束后,第一终端得到模式集合
Figure FDA0003749189060000063
For each j=1,...,m, the first terminal and the second terminal perform a 2-to-1 blind transmission algorithm, and the input of the second terminal is
Figure FDA0003749189060000062
The input of the first terminal is p j . After the algorithm is executed, the first terminal obtains the pattern set
Figure FDA0003749189060000063
对于每一个i=1,…,n-m+1,第一终端和第二终端执行布尔类型阈值隐私集合求交算法,其中第二终端的输入为Ci,m,m-τ,第一终端的输入为S,m,m-τ,算法执行结束后,第一终端得到输出集合bi∈{0,1}n-m+1For each i =1, . The input of the terminal is S,m,m-τ, after the algorithm is executed, the first terminal obtains the output set b i ∈{0,1} n-m+1 ; 如果bi=1,第一终端输出i;If b i =1, the first terminal outputs i; 布尔类型阈值隐私集合求交算法,包括:Boolean threshold privacy set intersection algorithm, including: 第二终端公开加法同态加密公钥pk1,然后第一终端和第二终端执行私有集合交集基数算法,第一终端得到Enc(pk1,|C∩S|);The second terminal publishes the public additive homomorphic encryption public key pk 1 , then the first terminal and the second terminal execute the private set intersection radix algorithm, and the first terminal obtains Enc(pk 1 ,|C∩S|); 第一终端选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);The first terminal selects a random number r∈{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); 第一终端选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|)的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|)+1The first terminal selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root of r+t,r+t+1,…,r+min (|C|,|S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 , a 1 , …,a min(|C|,|S|)+1 ; 第一终端用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|)+1);The first terminal uses the additive homomorphic encryption public key pk 2 to encrypt the coefficients of the polynomial p'(·), and the encrypted coefficients are obtained as Enc(pk 2 , a 0 ), Enc(pk 2 , a 1 ), ... ,Enc(pk 2 ,a min(|C|,|S|)+1 ); 第一终端将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给第二终端;The first terminal sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to the second terminal; 第二终端解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),得到:The second terminal decrypts the received ciphertext to obtain |C∩S|+r, then uses the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and denote the obtained result as Enc(pk 2 ,R′ ),get:
Figure FDA0003749189060000071
Figure FDA0003749189060000071
第二终端选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给第一终端请求其解密;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 send it to the first terminal to request its decryption; 第一终端解密Enc(pk1,R′+r")并将结果R′+r"发送给第二终端,第二终端经过计算得到R′;The first terminal decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to the second terminal, and the second terminal obtains R' through calculation; 第一终端和第二终端执行隐私相等性测试算法,其中第二终端输入R′,第一终端输入R,算法执行结束后,第一终端输出0或1;The first terminal and the second terminal execute the privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and after the algorithm execution ends, the first terminal outputs 0 or 1; 其中,m为模式字符串长度;n为文本字符串长度;τ为安全近似模式匹配算法中给定的阈值;C为第一终端持有的集合;S为第二终端持有的集合;设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ;|C|为集合C的元素个数;|S|为集合S的元素个数;t为布尔类型阈值隐私集合求交算法中给定的阈值。where m is the length of the pattern string; n is the length of the text string; τ is the threshold given in the secure approximate pattern matching algorithm; C is the set held by the first terminal; S is the set held by the second terminal; let The security parameter is λ, and the global parameter p is set, where p is a prime number, and its binary length |p|>λ; |C| is the number of elements in the set C; |S| is the number of elements in the set S; t is a Boolean type Thresholds given in the privacy set intersection algorithm.
4.一种电子设备,其特征在于:包括持有文本字符串、模式字符串长度及阈值的第二终端,第二终端与持有模式字符串、文本字符串的长度以及阈值的第一终端通信;4. An electronic device, characterized in that: comprising a second terminal holding a text string, the length of the pattern string and a threshold, the second terminal and the first terminal holding the pattern string, the length of the text string and the threshold communication; 第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,使得第一终端输出此子字符串的在文本字符串中的位置;The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the text string of the substring. position in; 安全近似模式匹配算法,包括:Safe approximate pattern matching algorithms, including: 第二终端随机选择m对随机数,分别为
Figure FDA0003749189060000081
第二终端根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure FDA0003749189060000082
其中i=1,…,n-m+1;
The second terminal randomly selects m pairs of random numbers, which are
Figure FDA0003749189060000081
The second terminal selects a corresponding random number according to each substring of length m of the text string t, and obtains a text set
Figure FDA0003749189060000082
where i=1,...,n-m+1;
对于每一个j=1,…,m,第一终端和第二终端执行一个2选1茫然传输算法,第二终端的输入为
Figure FDA0003749189060000083
第一终端的输入为pj,算法执行结束后,第一终端得到模式集合
Figure FDA0003749189060000084
For each j=1,...,m, the first terminal and the second terminal perform a 2-to-1 blind transmission algorithm, and the input of the second terminal is
Figure FDA0003749189060000083
The input of the first terminal is p j . After the algorithm is executed, the first terminal obtains the pattern set
Figure FDA0003749189060000084
对于每一个i=1,…,n-m+1,第一终端和第二终端执行布尔类型阈值隐私集合求交算法,其中第二终端的输入为Ci,m,m-τ,第一终端的输入为S,m,m-τ,算法执行结束后,第一终端得到输出集合bi∈{0,1}n-m+1For each i =1, . The input of the terminal is S,m,m-τ, after the algorithm is executed, the first terminal obtains the output set b i ∈{0,1} n-m+1 ; 如果bi=1,第一终端输出i;If b i =1, the first terminal outputs i; 布尔类型阈值隐私集合求交算法,包括:Boolean threshold privacy set intersection algorithm, including: 第二终端公开加法同态加密公钥pk1,然后第一终端和第二终端执行私有集合交集基数算法,第一终端得到Enc(pk1,|C∩S|);The second terminal publishes the public additive homomorphic encryption public key pk 1 , then the first terminal and the second terminal execute the private set intersection radix algorithm, and the first terminal obtains Enc(pk 1 ,|C∩S|); 第一终端选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);The first terminal selects a random number r∈{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); 第一终端选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|)的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|) +1The first terminal selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root of r+t,r+t+1,…,r+min (|C|,|S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 , a 1 , …,a min(|C|,|S|) +1 ; 第一终端用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|)+1);The first terminal uses the additive homomorphic encryption public key pk 2 to encrypt the coefficients of the polynomial p'(·), and the encrypted coefficients are obtained as Enc(pk 2 , a 0 ), Enc(pk 2 , a 1 ), ... ,Enc(pk 2 ,a min(|C|,|S|)+1 ); 第一终端将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给第二终端;The first terminal sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to the second terminal; 第二终端解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),得到:The second terminal decrypts the received ciphertext to obtain |C∩S|+r, then uses the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and denote the obtained result as Enc(pk 2 ,R′ ),get:
Figure FDA0003749189060000091
Figure FDA0003749189060000091
第二终端选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给第一终端请求其解密;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 send it to the first terminal to request its decryption; 第一终端解密Enc(pk1,R′+r")并将结果R′+r"发送给第二终端,第二终端经过计算得到R′;The first terminal decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to the second terminal, and the second terminal obtains R' through calculation; 第一终端和第二终端执行隐私相等性测试算法,其中第二终端输入R′,第一终端输入R,算法执行结束后,第一终端输出0或1;The first terminal and the second terminal execute the privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and after the algorithm execution ends, the first terminal outputs 0 or 1; 其中,m为模式字符串长度;n为文本字符串长度;τ为安全近似模式匹配算法中给定的阈值;C为第一终端持有的集合;S为第二终端持有的集合;设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ;|C|为集合C的元素个数;|S|为集合S的元素个数;t为布尔类型阈值隐私集合求交算法中给定的阈值。where m is the length of the pattern string; n is the length of the text string; τ is the threshold given in the secure approximate pattern matching algorithm; C is the set held by the first terminal; S is the set held by the second terminal; let The security parameter is λ, and the global parameter p is set, where p is a prime number, and its binary length |p|>λ; |C| is the number of elements in the set C; |S| is the number of elements in the set S; t is a Boolean type Thresholds given in the privacy set intersection algorithm.
5.一种安全近似模式匹配方法,其特征在于:存在持有模式字符串、文本字符串的长度和阈值的第一终端以及持有文本字符串、模式字符串长度和阈值的第二终端,包括以下步骤:5. A method for safe approximate pattern matching, characterized in that: there is a first terminal holding a pattern string, the 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, Include the following steps: 第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置;The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position; 安全近似模式匹配算法,包括:Safe approximate pattern matching algorithms, including: 第二终端随机选择m对随机数,分别为
Figure FDA0003749189060000101
第二终端根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure FDA0003749189060000102
其中i=1,…,n-m+1;
The second terminal randomly selects m pairs of random numbers, which are
Figure FDA0003749189060000101
The second terminal selects a corresponding random number according to each substring of length m of the text string t, and obtains a text set
Figure FDA0003749189060000102
where i=1,...,n-m+1;
对于每一个j=1,…,m,第一终端和第二终端执行一个2选1茫然传输算法,第二终端的输入为
Figure FDA0003749189060000103
第一终端的输入为pj,算法执行结束后,第一终端得到模式集合
Figure FDA0003749189060000104
For each j=1,...,m, the first terminal and the second terminal perform a 2-to-1 blind transmission algorithm, and the input of the second terminal is
Figure FDA0003749189060000103
The input of the first terminal is p j . After the algorithm is executed, the first terminal obtains the pattern set
Figure FDA0003749189060000104
对于每一个i=1,…,n-m+1,第一终端和第二终端执行布尔类型阈值隐私集合求交算法,其中第二终端的输入为Ci,m,m-τ,第一终端的输入为S,m,m-τ,算法执行结束后,第一终端得到输出集合bi∈{0,1}n-m+1For each i =1, . The input of the terminal is S,m,m-τ, after the algorithm is executed, the first terminal obtains the output set b i ∈{0,1} n-m+1 ; 如果bi=1,第一终端输出i;If b i =1, the first terminal outputs i; 布尔类型阈值隐私集合求交算法,包括:Boolean threshold privacy set intersection algorithm, including: 第二终端公开加法同态加密公钥pk1,然后第一终端和第二终端执行私有集合交集基数算法,第一终端得到Enc(pk1,|C∩S|);The second terminal publishes the public additive homomorphic encryption public key pk 1 , then the first terminal and the second terminal execute the private set intersection radix algorithm, and the first terminal obtains Enc(pk 1 ,|C∩S|); 第一终端选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);The first terminal selects a random number r∈{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); 第一终端选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|)的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|)+1The first terminal selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root of r+t,r+t+1,…,r+min (|C|,|S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 , a 1 , …,a min(|C|,|S|)+1 ; 第一终端用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|)+1);The first terminal uses the additive homomorphic encryption public key pk 2 to encrypt the coefficients of the polynomial p'(·), and the encrypted coefficients are obtained as Enc(pk 2 , a 0 ), Enc(pk 2 , a 1 ), ... ,Enc(pk 2 ,a min(|C|,|S|)+1 ); 第一终端将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给第二终端;The first terminal sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to the second terminal; 第二终端解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),得到:The second terminal decrypts the received ciphertext to obtain |C∩S|+r, then uses the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and denote the obtained result as Enc(pk 2 ,R′ ),get:
Figure FDA0003749189060000111
Figure FDA0003749189060000111
第二终端选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给第一终端请求其解密;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 send it to the first terminal to request its decryption; 第一终端解密Enc(pk1,R′+r")并将结果R′+r"发送给第二终端,第二终端经过计算得到R′;The first terminal decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to the second terminal, and the second terminal obtains R' through calculation; 第一终端和第二终端执行隐私相等性测试算法,其中第二终端输入R′,第一终端输入R,算法执行结束后,第一终端输出0或1;The first terminal and the second terminal execute the privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and after the algorithm execution ends, the first terminal outputs 0 or 1; 其中,m为模式字符串长度;n为文本字符串长度;τ为安全近似模式匹配算法中给定的阈值;C为第一终端持有的集合;S为第二终端持有的集合;设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ;|C|为集合C的元素个数;|S|为集合S的元素个数;t为布尔类型阈值隐私集合求交算法中给定的阈值。where m is the length of the pattern string; n is the length of the text string; τ is the threshold given in the secure approximate pattern matching algorithm; C is the set held by the first terminal; S is the set held by the second terminal; let The security parameter is λ, and the global parameter p is set, where p is a prime number, and its binary length |p|>λ; |C| is the number of elements in the set C; |S| is the number of elements in the set S; t is a Boolean type Thresholds given in the privacy set intersection algorithm.
6.一种安全近似模式匹配系统,其特征在于:包括持有模式字符串、文本字符串的长度和阈值的第一终端以及持有文本字符串、模式字符串长度和阈值的第二终端,第一终端与第二终端通信:6. A safe approximate pattern matching system, characterized in that: comprising a first terminal holding a pattern string, the 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 communicates with the second terminal: 第一终端与第二终端执行安全近似模式匹配算法,如果文本字符串的某个子字符串和模式字符串之间的汉明距离小于阈值,第一终端输出此子字符串的在文本字符串中的位置;The first terminal and the second terminal execute a secure approximate pattern matching algorithm. If the Hamming distance between a certain substring of the text string and the pattern string is less than the threshold, the first terminal outputs the substring in the text string. s position; 安全近似模式匹配算法,包括:Safe approximate pattern matching algorithms, including: 第二终端随机选择m对随机数,分别为
Figure FDA0003749189060000121
第二终端根据文本字符串t的每一个长度为m的子字符串选择相应的随机数,得到文本集合
Figure FDA0003749189060000122
其中i=1,…,n-m+1;
The second terminal randomly selects m pairs of random numbers, which are
Figure FDA0003749189060000121
The second terminal selects a corresponding random number according to each substring of length m of the text string t, and obtains a text set
Figure FDA0003749189060000122
where i=1,...,n-m+1;
对于每一个j=1,…,m,第一终端和第二终端执行一个2选1茫然传输算法,第二终端的输入为
Figure FDA0003749189060000123
第一终端的输入为pj,算法执行结束后,第一终端得到模式集合
Figure FDA0003749189060000124
For each j=1,...,m, the first terminal and the second terminal perform a 2-to-1 blind transmission algorithm, and the input of the second terminal is
Figure FDA0003749189060000123
The input of the first terminal is p j . After the algorithm is executed, the first terminal obtains the pattern set
Figure FDA0003749189060000124
对于每一个i=1,…,n-m+1,第一终端和第二终端执行布尔类型阈值隐私集合求交算法,其中第二终端的输入为Ci,m,m-τ,第一终端的输入为S,m,m-τ,算法执行结束后,第一终端得到输出集合bi∈{0,1}n-m+1For each i =1, . The input of the terminal is S,m,m-τ, after the algorithm is executed, the first terminal obtains the output set b i ∈{0,1} n-m+1 ; 如果bi=1,第一终端输出i;If b i =1, the first terminal outputs i; 布尔类型阈值隐私集合求交算法,包括:Boolean threshold privacy set intersection algorithm, including: 第二终端公开加法同态加密公钥pk1,然后第一终端和第二终端执行私有集合交集基数算法,第一终端得到Enc(pk1,|C∩S|);The second terminal publishes the public additive homomorphic encryption public key pk 1 , then the first terminal and the second terminal execute the private set intersection radix algorithm, and the first terminal obtains Enc(pk 1 ,|C∩S|); 第一终端选择随机数r∈{0,…,p-1},进行加法同态计算得到Enc(pk1,|C∩S|+r)=Enc(pk1,|C∩S|)·Enc(pk1,r);The first terminal selects a random number r∈{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); 第一终端选择随机数r′∈{0,…,p-1}和R∈{0,…,p-1},准备一个根为r+t,r+t+1,…,r+min(|C|,|S|)的多项式p(·),然后计算多项式p′(·)=r′·p(·)+R,多项式p′(·)的系数为a0,a1,…,amin(|C|,|S|) +1The first terminal selects random numbers r′∈{0,…,p-1} and R∈{0,…,p-1}, and prepares a root of r+t,r+t+1,…,r+min (|C|,|S|) polynomial p(·), then calculate polynomial p′(·)=r′·p(·)+R, the coefficients of polynomial p′(·) are a 0 , a 1 , …,a min(|C|,|S|) +1 ; 第一终端用加法同态加密公钥pk2对多项式p′(·)的系数进行加密,得到加密后的系数分别为Enc(pk2,a0),Enc(pk2,a1),…,Enc(pk2,amin(|C|,|S|)+1);The first terminal uses the additive homomorphic encryption public key pk 2 to encrypt the coefficients of the polynomial p'(·), and the encrypted coefficients are obtained as Enc(pk 2 , a 0 ), Enc(pk 2 , a 1 ), ... ,Enc(pk 2 ,a min(|C|,|S|)+1 ); 第一终端将多项式p′(·)的加密系数以及Enc(pk1,|C∩S|+r)发送给第二终端;The first terminal sends the encryption coefficient of the polynomial p'(·) and Enc(pk 1 , |C∩S|+r) to the second terminal; 第二终端解密收到的密文得到|C∩S|+r,然后用点|C∩S|+r茫然计算多项式p′(·),将得到的结果记为Enc(pk2,R′),得到:
Figure FDA0003749189060000131
The second terminal decrypts the received ciphertext to obtain |C∩S|+r, then uses the point |C∩S|+r to calculate the polynomial p′(·) at a loss, and denote the obtained result as Enc(pk 2 ,R′ ),get:
Figure FDA0003749189060000131
Figure FDA0003749189060000141
Figure FDA0003749189060000141
第二终端选择随机数r"∈{0,…,p-1},进行加法同态计算得到Enc(pk1,R′+r")=Enc(pk1,R′)·Enc(pk1,r"),然后发送给第一终端请求其解密;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 send it to the first terminal to request its decryption; 第一终端解密Enc(pk1,R′+r")并将结果R′+r"发送给第二终端,第二终端经过计算得到R′;The first terminal decrypts Enc(pk 1 , R'+r") and sends the result R'+r" to the second terminal, and the second terminal obtains R' through calculation; 第一终端和第二终端执行隐私相等性测试算法,其中第二终端输入R′,第一终端输入R,算法执行结束后,第一终端输出0或1;The first terminal and the second terminal execute the privacy equality test algorithm, wherein the second terminal inputs R', the first terminal inputs R, and after the algorithm execution ends, the first terminal outputs 0 or 1; 其中,m为模式字符串长度;n为文本字符串长度;τ为安全近似模式匹配算法中给定的阈值;C为第一终端持有的集合;S为第二终端持有的集合;设安全参数为λ,设置全局参数p,p为一个素数,其二进制长度|p|>λ;|C|为集合C的元素个数;|S|为集合S的元素个数;t为布尔类型阈值隐私集合求交算法中给定的阈值。where m is the length of the pattern string; n is the length of the text string; τ is the threshold given in the secure approximate pattern matching algorithm; C is the set held by the first terminal; S is the set held by the second terminal; let The security parameter is λ, and the global parameter p is set, where p is a prime number, and its binary length |p|>λ; |C| is the number of elements in the set C; |S| is the number of elements in the set S; t is a Boolean type Thresholds given in the privacy set intersection algorithm.
CN202011561764.XA 2020-12-25 2020-12-25 Secure approximate pattern matching method and system and electronic equipment Active CN112732776B (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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 two-party pattern matching method and device for hidden 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 山东师范大学 A facility location method and system for hiding location information
CN111556048A (en) * 2020-04-26 2020-08-18 山东师范大学 An attribute-based secure communication method and system supporting ciphertext pattern matching

Family Cites Families (2)

* Cited by examiner, † Cited by third party
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
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 two-party pattern matching method and device for hidden 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 山东师范大学 A facility location method and system for hiding location information
CN111556048A (en) * 2020-04-26 2020-08-18 山东师范大学 An attribute-based secure communication method and system supporting ciphertext pattern matching

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
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
CN106797317B (en) Secure shared key shared system and method
RU2534944C2 (en) Method for secure communication in network, communication device, network and computer programme therefor
US10826680B2 (en) Collation system, collation method, and non-transitory recording medium
CN110084063B (en) Gradient descent calculation method for protecting private data
US20190166113A1 (en) Password manipulation for secure account creation and verification through third-party servers
CN109543434B (en) Blockchain information encryption method, decryption method, storage method and device
CN111859435B (en) Data security processing method and device
CN115580396B (en) Tight trace query system and method
CN105138923A (en) Privacy protection time sequence similarity calculation method
CN109274502A (en) The creation method of public key encryption and key signature, equipment and readable storage medium storing program for executing
CN115865311B (en) Optimization method and system for constant round secure multiparty computing protocol
CN110378138A (en) Data encryption, decryption method, neural network training method and device
CN115913537A (en) Data intersection method and system based on privacy protection and related equipment
CN113225297A (en) Data hybrid encryption method, device and equipment
CN113132104A (en) Active and safe ECDSA (electronic signature SA) digital signature two-party generation method
CN108965824B (en) CPK-based video surveillance method, system, camera, server and client
CN112732776B (en) Secure approximate pattern matching method and system and electronic equipment
CN106921491A (en) A kind of safely and efficiently outsourcing calculates method and system
Tahir et al. A scheme for the generation of strong icmetrics based session key pairs for secure embedded system applications
CN113761570B (en) Data interaction method for privacy intersection
CN117595991B (en) A privacy information retrieval method combined with key negotiation
WO2022185328A1 (en) System and method for identity-based key agreement for secure communication
CN117240454B (en) Method for realizing two-party quantum key negotiation based on non-maximum entangled GHZ state
CN116094708A (en) Privacy protection method, terminal and storage medium of DBSCAN algorithm
TWI734087B (en) Signature system based on homomorphic encryption and method thereof

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