Two-party multi-branch conditional implementation method and system for protecting privacy data
By using selection and comparison operators in multi-party security calculations, branch conditions are processed in the order from back to front, the problem of low efficiency in the implementation of privacy data protection and multi-branch conditions in the prior art is solved, and efficient and secure multi-dimensional Branch condition calculation.
Patent Information
- Application Number
- CN202111014694.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-31
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-08-31
AI Technical Summary
The existing technology is difficult to implement the multi-branch conditions of two parties under the premise of protecting private data, especially in the multi-branch conditions for comparing the size of private data, and it is impossible to effectively perform parallel processing in multi-party security calculations, resulting in inefficiency and privacy data. Risk of leakage.
In multi-party security calculation, the two-party selection operator and comparison operator are used to obtain the slice of the comparison results of each branch condition separately, and N rounds of selection processing are performed in the order from back to front to achieve N+1 The process of selecting two values can be performed on the premise of protecting private data.
It realizes that multi-branch conditions are efficiently executed under the premise of protecting private data, avoiding privacy data leakage, improving computing efficiency and parallel processing capabilities.
Smart Images

Figure CN113626871B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the computer field, and in particular, to a two-party multi-branch conditional implementation method and system for protecting privacy data. Background Art
[0002] Secure multi-party computation is also called multi-party secure computation, which means that multiple parties jointly calculate the result of a function without disclosing the input data of each party of the function, and the result of the calculation is made public to one or more of the parties. Among them, the input data of each party is often private data.
[0003] The two-party multi-branch condition is one of the basic operation functions of the user operation logic in secure multi-party computing. It is used to return the value corresponding to the branch condition that is satisfied from the N+1 values arranged in sequence according to the branch condition that is satisfied among the N branch conditions executed sequentially. Any branch condition includes a size comparison of the private data held by each party. Summary of the invention
[0004] One or more embodiments of this specification describe a method and system for implementing a two-party multi-branch condition for protecting privacy data, which can implement the two-party multi-branch condition under the premise of protecting privacy data.
[0005] In a first aspect, a two-party multi-branch condition implementation method for protecting private data is provided, which is used to return a value corresponding to a branch condition that is satisfied from N+1 values arranged in sequence according to a branch condition that is satisfied among N branch conditions that are executed in sequence, wherein any branch condition includes a size comparison of private data held by a first party and a second party respectively; the method comprises:
[0006] The first party and the second party respectively obtain a slice of the comparison result of each branch condition in the N branch conditions;
[0007] Taking the N+1th value as the initial value of the intermediate result, N rounds of selection processing are performed for the remaining N values in order from the back to the front, each round of selection processing includes: the first party and the second party respectively use the current value and the slice of the intermediate result of the previous round as the slice of the to-be-selected object, use the slice of the comparison result of the branch condition corresponding to the current value as the selection bit slice, and input it into the two-party selection operator, and the two-party selection operator selects one from the current value and the intermediate result of the previous round as the intermediate result of this round according to the comparison result;
[0008] The fragments corresponding to the intermediate results after the N rounds of selection processing are output to the first party and the second party respectively.
[0009] In a possible implementation, the first party has N private data in a first private data set, and the second party has N private data in a second private data set, and the comparison result is characterized based on whether the first private data in the first private data set and the second private data in the second private data set satisfy a preset comparison relationship.
[0010] Furthermore, the preset comparison relationship includes at least one of the following:
[0011] Less than, less than or equal to, equal to, greater than or equal to, greater than.
[0012] Furthermore, the first party and the second party respectively obtain a slice of the comparison result of each branch condition in the N branch conditions, including:
[0013] For each of the N branch conditions, the following comparison process is performed respectively:
[0014] The first party and the second party jointly perform multi-party secure computing using the privacy data they respectively hold, and the first party obtains a first shard of the comparison result of the branch condition, and the second party obtains a second shard of the comparison result of the branch condition.
[0015] Furthermore, the multi-party secure computation includes:
[0016] The first party inputs the first privacy data it holds into the two-party comparison operator, and the second party inputs the second privacy data it holds into the two-party comparison operator. The two-party comparison operator compares the first privacy data and the second privacy data. The first party obtains a first slice of the comparison result of whether the preset comparison relationship holds, and the second party obtains a second slice of the comparison result.
[0017] Furthermore, the comparison processing corresponding to each branch condition is executed in parallel.
[0018] In a possible implementation manner, the N+1th value is a value returned when none of the N branch conditions are met.
[0019] In a possible implementation, the N+1 values arranged in sequence belong to values corresponding to the same variable in N+1 arrays arranged in sequence, each array is composed of the same number of values, and the same number of values corresponds to different variables.
[0020] In a possible implementation, the two-party selection operator is implemented based on multi-party secure computing technology.
[0021] Furthermore, the multi-party secure computing technology includes at least one of the following:
[0022] Secret sharing, obfuscated circuits, oblivious transfer, GMW.
[0023] In a second aspect, a two-party multi-branch condition implementation system for protecting privacy data is provided, which is used to return a value corresponding to a branch condition that is satisfied from N+1 values arranged in sequence according to a branch condition that is satisfied among N branch conditions that are executed in sequence, wherein any branch condition includes a comparison of the size of privacy data held by a first party and a second party respectively; the system includes:
[0024] The first party and the second party are used to respectively obtain a slice of the comparison result of each branch condition in the N branch conditions;
[0025] The first party and the second party are further used to use the N+1th value as the initial value of the intermediate result, and respectively perform N rounds of selection processing for the remaining N values in a sequence from the back to the front, wherein each round of selection processing includes: the first party and the second party respectively use the current value and the slices of the intermediate result of the previous round as the slices of the to-be-selected object, use the slices of the comparison result of the branch condition corresponding to the current value as the selection bit slices, and input them into the two-party selection operator, and the two-party selection operator selects one of the current value and the intermediate result of the previous round as the intermediate result of the current round according to the comparison result;
[0026] The first party and the second party are further used to respectively obtain the fragments corresponding to the intermediate results after the N rounds of selection processing.
[0027] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.
[0028] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.
[0029] Through the method and system provided by the embodiment of this specification, first, the first party and the second party respectively obtain the slices of the comparison results of each branch condition in the N branch conditions; then, the N+1th value is used as the initial value of the intermediate result, and N rounds of selection processing are performed for the remaining N values in order from back to front, and each round of selection processing includes: the first party and the second party respectively use the slices of the current value and the intermediate result of the previous round as the slices of the object to be selected, and use the slices of the comparison results of the branch conditions corresponding to the current value as the selection bit slices, and input the two-party selection operator, and the two-party selection operator selects one from the current value and the intermediate result of the previous round as the intermediate result of this round according to the comparison result; finally, the slices corresponding to the intermediate results after the N rounds of selection processing are output to the first party and the second party respectively. As can be seen from the above, in the embodiment of this specification, after the first party and the second party respectively obtain the slices of the comparison results of each branch condition, the two-party selection operator is used to perform N rounds of two-choice processing on the N+1 values in order from back to front, which can realize the two-party multi-branch conditions under the premise of protecting privacy data. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0031] Figure 1 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification;
[0032] Figure 2 A schematic diagram of an interaction between two parties and a method for implementing a multi-branch condition for protecting privacy data according to an embodiment is shown;
[0033] Figure 3 A schematic block diagram showing a two-party multi-branch condition implementation device for protecting privacy data according to an embodiment;
[0034] Figure 4 A schematic block diagram of a two-party multi-branch conditional implementation system for protecting privacy data according to one embodiment is shown. DETAILED DESCRIPTION
[0035] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0036] Figure 1Schematic diagram of an implementation scenario of an embodiment disclosed in this specification. This implementation scenario involves the realization of two-party multi-branch conditions for protecting private data. In the prior art, N branch conditions are usually executed sequentially. When a certain branch condition is satisfied, the value corresponding to the satisfied branch condition is returned from N + 1 values arranged in sequence, where any branch condition includes a size comparison of the private data held by the first party and the second party respectively. Refer to Figure 1 , the first party and the second party each have N pieces of private data for constructing N branch conditions. The first party has N pieces of private data a0, …, a(N - 1), and the second party has N pieces of private data b0, …, b(N - 1). Each branch condition corresponds to a value to be returned when it is satisfied. When none of the N branch conditions are satisfied, there is a corresponding returned value. There are N + 1 possible returned values, which can be expressed as c0, …, cN. These N + 1 values are provided by the first party or the second party. The values obtained by the first party after the execution of the above multi-branch conditions are distributed in the form of shards between the first party and the second party. The shard of the value obtained by the first party is denoted as r0, and the shard of the value obtained by the second party is denoted as r1. The sum of r0 and r1 is the above-mentioned returned value.
[0037] It can be understood that the above-mentioned shards of values belong to additive shards. Additive shards (ADDShare), a number is split into two additive shards by subtraction on the integer ring of the modulo 2 n space. The two additive shards can be added on the integer ring of the modulo 2 n space to obtain the original number. Each of the two parties holds one additive shard. Additive shards are unsigned numbers.
[0038] The above branch conditions include comparison operations, which can be comparison operations such as <, <=, ==, >=, >, etc. Taking the comparison operation included in each branch condition as < as an example, the multi-branch condition can be used to complete the following calculation:
[0039]
[0040] It can be understood that the above multi-branch condition includes N branch conditions executed sequentially. The first branch condition is a0 < b0. If a0 < b0 is satisfied, the returned value is c0, and there is no need to execute the subsequent branch conditions. If a0 < b0 is not satisfied, the second branch condition is executed; the second branch condition is a1 < b1. If a1 < b1 is satisfied, the returned value is c1, and there is no need to execute the subsequent branch conditions. If a1 < b1 is not satisfied, the third branch condition is executed; …; the Nth branch condition is a(N - 1) < b(N - 1). If a(N - 1) < b(N - 1) is satisfied, the returned value is c(N - 1). If a(N - 1) < b(N - 1) is not satisfied, the returned value is cN.
[0041] In the embodiment of this specification, the N branch conditions are no longer executed sequentially, but each branch condition is executed in parallel to obtain the comparison result of each branch condition. Based on these comparison results, N rounds of selection processing are performed to finally obtain a value among c0, ...cN. Of course, this value will exist in the form of slices on the first party and the second party.
[0042] The following will be based on Figure 2 The implementation process of the present invention is described in detail.
[0043] Figure 2 A schematic diagram of an interactive method for implementing a two-party multi-branch condition for protecting privacy data according to an embodiment is shown. The method can be based on Figure 1 The implementation scenario shown is used to return the value corresponding to the satisfied branch condition from the N+1 values arranged in sequence according to the satisfied branch condition among the N branch conditions executed in sequence, wherein any branch condition includes a comparison of the size of the private data held by the first party and the second party respectively. Figure 2 As shown, the two-party multi-branch condition implementation method for protecting privacy data in this embodiment includes the following steps: Step 21, the first party and the second party respectively obtain the slice of the comparison result of each branch condition in the N branch conditions; Step 22, the first party and the second party use the N+1th value as the initial value of the intermediate result, and perform N rounds of selection processing for the remaining N values in order from back to front, each round of selection processing includes: the first party and the second party respectively use the current value and the slice of the previous round of intermediate results as the to-be-selected object slice, and use the slice of the comparison result of the branch condition corresponding to the current value as the selection bit slice, and input the two-party selection operator, and the two-party selection operator selects one from the current value and the previous round of intermediate results as the intermediate result of this round according to the comparison result; Step 23, the first party and the second party respectively obtain the slice corresponding to the intermediate result after the N rounds of selection processing. The specific execution method of each of the above steps is described below.
[0044] First, in step 21, the first party and the second party respectively obtain a slice of the comparison result of each branch condition in the N branch conditions. It can be understood that any branch condition includes a size comparison of the private data held by the first party and the second party respectively. In order to protect the private data, the comparison result can be determined by multi-party secure computing, and the first party and the second party can obtain a slice of the comparison result.
[0045] In one example, the first party has N private data in a first private data set, and the second party has N private data in a second private data set, and the comparison result is based on whether the first private data in the first private data set and the second private data in the second private data set satisfy a preset comparison relationship representation.
[0046] Furthermore, the preset comparison relationship includes at least one of the following:
[0047] Less than, less than or equal to, equal to, greater than or equal to, greater than.
[0048] In the embodiment of the present specification, each of the N branch conditions may correspond to the same preset comparison relationship, for example, all are less than, or may correspond to different preset comparison relationships, for example, the preset comparison relationship corresponding to one branch condition is less than, and the preset comparison relationship corresponding to another branch condition is greater than.
[0049] Furthermore, the first party and the second party respectively obtain a slice of the comparison result of each branch condition in the N branch conditions, including:
[0050] For each of the N branch conditions, the following comparison process is performed respectively:
[0051] The first party and the second party jointly perform multi-party secure computing using the privacy data they respectively hold, and the first party obtains a first shard of the comparison result of the branch condition, and the second party obtains a second shard of the comparison result of the branch condition.
[0052] Furthermore, the multi-party secure computation includes:
[0053] The first party inputs the first private data it holds into the two-party comparison operator, and the second party inputs the second private data it holds into the two-party comparison operator. The two-party comparison operator compares the first private data and the second private data. The first party obtains a first slice of the comparison result of whether the preset comparison relationship holds, and the second party obtains a second slice of the comparison result. The operator in this specification is the implementation of a certain basic function of multi-party secure computing, providing a programming call interface, which can be functions such as multiplication, addition, comparison, selection, etc., and can be implemented based on multi-party secure computing technologies such as secret sharing, obfuscated circuits, and inadvertent transmission.
[0054] Among them, the two-party comparison operator: implements the comparison of a number input by each party, and outputs the slice of the comparison result bit. The operator can be implemented by using technologies such as garbled circuits and GMW. It is expressed by the following formula: [s] = cmp (a, b), compares the two numbers a and b, and outputs the slice comparison result bit s, [s] represents the slice form, for example, when a and b meet the preset comparison relationship, s is 1, when a and b do not meet the preset comparison relationship, s is 0.
[0055] Furthermore, the comparison processing corresponding to each branch condition is executed in parallel.
[0056] GMW (Goldreich-Micali-Wigderson) is a two-party secure multi-party computation protocol that implements a Boolean circuit of a computation function. The bits on each line are XOR slices of the two parties, that is, each party holds a bit on the line, and the XOR of two bits is the true value of the line. GMW calculates each gate, the XOR gate is directly calculated locally, and the AND gate is executed with oblivious transfer. GMW executes Boolean circuits, and the number of rounds of interaction between the two parties, that is, the execution delay, is determined by the depth of the AND gate in the circuit. The depth of the AND gate refers to the longest path of the AND gate related to the data in the circuit.
[0057] Then in step 22, the first party and the second party use the N+1th value as the initial value of the intermediate result, and perform N rounds of selection processing for the remaining N values in order from back to front, each round of selection processing includes: the first party and the second party respectively use the current value and the slice of the previous round of intermediate results as the slice of the object to be selected, and use the slice of the comparison result of the branch condition corresponding to the current value as the selection bit slice, and input the two-party selection operator, and the two-party selection operator selects one from the current value and the previous round of intermediate results as the intermediate result of this round according to the comparison result. It can be understood that the above-mentioned N rounds of selection processing are opposite to the execution order of the usual multi-branch conditions, and the N rounds of selection processing are performed in order from back to front to achieve the sequential execution of the multi-branch conditions.
[0058] The following takes a specific multi-branch condition as an example to illustrate the execution process of the above N rounds of selection processing. For example, the multi-branch condition is as follows:
[0059]
[0060] Corresponding to this multi-branch condition, there are N + 1 possible return values, arranged in sequence as c0, c1... c(N-1), cN. The aforementioned N rounds of selection processing are essentially in the reverse order, successively selecting one of the values corresponding to each branch condition and the intermediate result of the previous round as the intermediate result of this round according to the comparison result corresponding to each branch condition. The initial value of the intermediate result is cN, and the intermediate result after N rounds of selection processing is the value returned by the final multi-branch condition. That is to say, first, according to whether a(N-1) < b(N-1) holds, select a value from c(N-1) and cN as the intermediate result of this round. When a(N-1) < b(N-1) holds, select c(N-1) as the intermediate result of this round. When a(N-1) < b(N-1) does not hold, select cN as the intermediate result of this round. Then, according to whether a(N-2) < b(N-2) holds, select a value from c(N-2) and the intermediate result of the previous round as the intermediate result of this round. Taking the intermediate result of the previous round as c(N-1) as an example, when a(N-2) < b(N-2) holds, select c(N-2) as the intermediate result of this round. When a(N-2) < b(N-2) does not hold, select c(N-1) as the intermediate result of this round.... Finally, according to whether a0 < b0 holds, select a value from c0 and the intermediate result of the previous round as the intermediate result of this round. Since N-1 rounds of selection processing have been performed, due to the different comparison results of each branch condition, there are many possible values for the intermediate result of the previous round. Taking the intermediate result of the previous round as c1 as an example, when a0 < b0 holds, select c0 as the intermediate result of this round. When a0 < b0 does not hold, select c1 as the intermediate result of this round.至此,N轮选择处理结束,N轮选择处理之后的中间结果就是最终多分支条件返回的数值。
[0061] In one example, the (N + 1)-th value is the value returned when all of the N branch conditions do not hold.
[0062] Among them, the two-party selection operator: an operator that realizes the selection of two-party numbers according to a selection bit shard and outputs a selection result shard. The operator can be implemented by multi-party security technologies such as garbled circuits and oblivious transfer. It is represented by the formula as follows: [r] = select(a, b, [s]). a and b are the objects to be selected, which can be provided by one party. For example, a and b are provided by the first party; they can also be provided by two parties. For example, the first party provides a and the second party provides b. [s] and [r] represent shard forms. [s] is the selection bit shard, and [r] is the selection result shard. The addition shard of the selection result is output by selecting the input data of the two parties according to the selection bit shard. For example, when s is 1, the selection result is b; when s is 0, the selection result is a.
[0063] In addition, it can be understood that if the above a or b is input into the two selection operators in the form of slices, the slices can be merged first to obtain the original data, and then the selection process can be performed.
[0064] In one example, the two-party selection operator is implemented based on multi-party secure computing technology, which usually involves local computing and two-party communication.
[0065] Furthermore, the multi-party secure computing technology includes at least one of the following:
[0066] Secret sharing, obfuscated circuits, oblivious transfer, GMW.
[0067] The following is an example to illustrate the above N rounds of selection process.
[0068] Example 1: The multi-branch condition includes 3 branch conditions, that is, N=3. The multi-branch condition has only one set of N+1 values arranged in sequence, as follows:
[0069]
[0070] Among them, s0, s1 and s2 can be understood as the comparison results corresponding to the three branch conditions respectively. The above comparison results can be determined by the two-party comparison operator. For example, the branch condition corresponding to s0 is a0<b0. By inputting a0 and b0 into the two-party comparison operator, s0 can be obtained; the branch condition corresponding to s1 is a1<b1. By inputting a1 and b1 into the two-party comparison operator, s1 can be obtained; the branch condition corresponding to s2 is a2<b2. By inputting a2 and b2 into the two-party comparison operator, s2 can be obtained. In the embodiments of this specification, the comparison result takes the value of 0 or 1, where 0 represents that the corresponding branch condition is satisfied, and 1 represents that the corresponding branch condition is not satisfied; or, 0 represents that the corresponding branch condition is not satisfied, and 1 represents that the corresponding branch condition is satisfied. It should be noted that s0, s1 and s2 usually exist in the first party and the second party in the form of slices.
[0071] After determining the above s0, s1 and s2, a value can be selected from w0, w1, w2 and w3 through the above N rounds of selection processing, and the value is used as the value returned after the multi-branch condition is executed. Each round of selection processing in N rounds of selection processing can be implemented by a two-party selection operator. First, w3, w2 and s2 are input into the two-party selection operator. The two-party selection operator selects one from w3 and w2 as the value of the variable T according to whether s2 is 0 or 1. Here, T corresponds to the aforementioned intermediate result, and is expressed by the formula T=select(w3,w2,s2); then T, w1 and s1 are input into the two-party selection operator. The two-party selection operator selects one from T and w1 as the value of the variable T according to whether s1 is 0 or 1. Here, T corresponds to the aforementioned intermediate result, and is expressed by the formula T=select(T,w1,s1); finally, T, w0 and s0 are input into the two-party selection operator. The two-party selection operator selects one from T and w0 as the value of the variable x0 according to whether s0 is 0 or 1. Here, x0 corresponds to the variable that needs to be assigned a value for the multi-branch condition, and is expressed by the formula x0=select(T,w0,s0).
[0072] In this example, a set of operators is used to implement the above two-party multi-branch conditions, including N two-party comparison operators and N two-party selection operators, and can be calculated in parallel in a certain way.
[0073] In the embodiments of the present specification, each branch condition included in the multi-branch conditions may correspond to only one value or multiple values, that is, the multi-branch conditions may have only one set of N+1 values arranged in sequence or multiple sets of N+1 values arranged in sequence. When there are multiple sets of N+1 values arranged in sequence, the method can be used to return the values corresponding to the established branch conditions from each set of N+1 values arranged in sequence, wherein, for each set of N+1 values, it is not necessary to repeatedly determine the comparison results corresponding to the branch conditions, and the above comparison results only need to be determined once.
[0074] In one example, the N+1 values arranged in sequence belong to the values corresponding to the same variable in the N+1 arrays arranged in sequence, and each array is composed of the same number of values, and the same number of values corresponds to different variables. For example, the value of N is 3, and the N+1 arrays arranged in sequence are {w0,u0}, {w1,u1}, {w2,u2}, {w3,u3}, respectively, and each array includes 2 values, wherein the first value in the array corresponds to the variable x0, and the second value in the array corresponds to the variable x1, that is, the values w0, w1, w2, w3 correspond to the variable x0, and the values u0, u1, u2, u3 correspond to the variable x1. It can be understood that each variable has a specific meaning, for example, representing income, expenditure, etc., and corresponding each value to a variable means giving the value a specific meaning.
[0075] The following example illustrates the situation where a branch condition corresponds to multiple values.
[0076] Example 2: The multi-branch condition includes 3 branch conditions, that is, N=3. The multi-branch condition has two groups of N+1 values arranged in sequence, as follows:
[0077]
[0078] Among them, the comparison results in the three branch conditions can be determined by two-party comparison operators, namely [s0] = cmp(a0, b0), a0 and b0 are the private data to be compared, s0 is the comparison result; [s1] = cmp(a1, b1), a1 and b1 are the private data to be compared, s1 is the comparison result; [s2] = cmp(a2, b2), a2 and b2 are the private data to be compared, s2 is the comparison result.
[0079] The first group of N+1 numerical values arranged in sequence are w0, w1, w2, and w3. The N rounds of selection processing for this group of numerical values can be implemented through two-party selection operators, namely T=select(w3,w2,s2), according to whether s2 is 0 or 1, one is selected from w3 and w2 as the numerical value of variable T; T=select(T,w1,s1), according to whether s1 is 0 or 1, one is selected from T and w1 as the numerical value of variable T; x0=select(T,w0,s0), according to whether s0 is 0 or 1, one is selected from T and w0 as the numerical value of variable x0; it can be understood that T corresponds to the aforementioned intermediate result.
[0080] The second group of N+1 numerical values arranged in sequence are u0, u1, u2, and u3. The N rounds of selection processing for this group of numerical values can be implemented through two-party selection operators, namely T1=select(u3,u2,s2), according to whether s2 is 0 or 1, one is selected from u3 and u2 as the numerical value of variable T1; T1=select(T1,u1,s1), according to whether s1 is 0 or 1, one is selected from T1 and u1 as the numerical value of variable T1; x1=select(T1,u0,s0), according to whether s0 is 0 or 1, one is selected from T1 and u0 as the numerical value of variable x1; it can be understood that T1 corresponds to the aforementioned intermediate result.
[0081] In this example, a set of operators is used to implement the above two-party multi-branch conditions, including N two-party comparison operators and 2N two-party selection operators, and can be calculated in parallel in a certain way.
[0082] Finally, in step 23, the first party and the second party respectively obtain the slices corresponding to the intermediate results after the N rounds of selection processing. It can be understood that the intermediate results after the N rounds of selection processing are the values returned after the multi-branch conditions are executed, and the values are returned to the first party and the second party in the form of slices.
[0083] In the embodiment of this specification, the shards corresponding to the above intermediate results may specifically be addition shards.
[0084] In one example, the first party may generate a first random number and use the first random number as the first fragment of the intermediate result. The first party and the second party may then use a multi-party secure computation to compute the intermediate result in modulo 2. n The first slice of the intermediate result is subtracted from the integer ring of the space to obtain the second slice of the intermediate result, and the second slice of the intermediate result is returned to the second party. The first slice of the intermediate result and the second slice of the intermediate result are modulo 2. n The above intermediate results can be obtained by adding on the integer ring of space.
[0085] According to the method provided in the embodiment of this specification, first, the first party and the second party respectively obtain the slices of the comparison result of each branch condition in the N branch conditions; then, the N+1th value is used as the initial value of the intermediate result, and N rounds of selection processing are performed for the remaining N values in order from back to front, and each round of selection processing includes: the first party and the second party respectively use the slices of the current value and the intermediate result of the previous round as the slices of the object to be selected, and use the slices of the comparison result of the branch condition corresponding to the current value as the selection bit slices, and input the two-party selection operator, and the two-party selection operator selects one from the current value and the intermediate result of the previous round as the intermediate result of this round according to the comparison result; finally, the slices corresponding to the intermediate result after the N rounds of selection processing are output to the first party and the second party respectively. As can be seen from the above, in the embodiment of this specification, after the first party and the second party respectively obtain the slices of the comparison result of each branch condition, the two-party selection operator is used to perform N rounds of two-to-one processing on the N+1 values in order from back to front, which can realize the two-party multi-branch conditions under the premise of protecting privacy data.
[0086] According to another aspect of the embodiment, there is also provided a two-party multi-branch condition implementation device for protecting privacy data, which is used to return a numerical value corresponding to the satisfied branch condition from N+1 numerical values arranged in sequence according to the satisfied branch condition among N branch conditions executed sequentially, wherein any branch condition includes a size comparison of the privacy data respectively held by the first party and the second party, and the device is arranged on the first party to execute the action performed by the first party in the method provided in the embodiment of this specification. Figure 3FIG. 1 is a schematic block diagram of a two-party multi-branch condition implementation device for protecting privacy data according to an embodiment. Figure 3 As shown, the device 300 includes:
[0087] A comparison unit 31, configured to obtain a slice of the comparison result of each branch condition in the N branch conditions; another slice of the comparison result is held by the second party;
[0088] The selection unit 32 is used to use the N+1th value as the initial value of the intermediate result, and perform N rounds of selection processing for the remaining N values in order from the back to the front, each round of selection processing includes: taking the slice of the intermediate result of the previous round as the slice of the object to be selected, taking the slice of the comparison result of the branch condition corresponding to the current value obtained by the comparison unit 31 as the selection bit slice, and inputting the two-party selection operator, the two-party selection operator also receives the current value, and the slice of the intermediate result of the previous round input by the second party and the slice of the comparison result of the branch condition corresponding to the current value obtained by the comparison unit 31, and the two-party selection operator selects one from the current value and the intermediate result of the previous round as the intermediate result of this round according to the comparison result;
[0089] The output unit 33 is used to output a shard corresponding to the intermediate result after the N rounds of selection processing to the first party; another shard corresponding to the intermediate result after the N rounds of selection processing is held by the second party.
[0090] According to another aspect of the embodiment, a two-party multi-branch condition implementation system for protecting privacy data is also provided, which is used to return a numerical value corresponding to a satisfied branch condition from N+1 numerical values arranged in sequence according to a satisfied branch condition among N branch conditions executed sequentially, wherein any branch condition includes a size comparison of privacy data held by the first party and the second party respectively, and the system includes a first party and a second party, and is used to execute the actions performed by the first party and the second party in the method provided in the embodiment of this specification. Figure 4 FIG. 1 is a schematic block diagram of a two-party multi-branch conditional implementation system for protecting privacy data according to an embodiment. Figure 4 As shown, the system 400 includes:
[0091] The first party 41 and the second party 42 are used to respectively obtain a slice of the comparison result of each branch condition in the N branch conditions;
[0092] The first party 41 and the second party 42 are further used to use the N+1th value as the initial value of the intermediate result, and respectively perform N rounds of selection processing for the remaining N values in a sequence from the back to the front, wherein each round of selection processing includes: the first party and the second party respectively use the current value and the slices of the intermediate result of the previous round as the slices of the to-be-selected object, use the slices of the comparison result of the branch condition corresponding to the current value as the selection bit slices, and input them into the two-party selection operator, and the two-party selection operator selects one of the current value and the intermediate result of the previous round as the intermediate result of the current round according to the comparison result;
[0093] The first party 41 and the second party 42 are further used to respectively obtain the fragments corresponding to the intermediate results after the N rounds of selection processing.
[0094] Optionally, as an embodiment, the first party 41 has N privacy data in a first privacy data set, and the second party 42 has N privacy data in a second privacy data set, and the comparison result is based on whether the first privacy data in the first privacy data set and the second privacy data in the second privacy data set satisfy a preset comparison relationship representation.
[0095] Furthermore, the preset comparison relationship includes at least one of the following:
[0096] Less than, less than or equal to, equal to, greater than or equal to, greater than.
[0097] Furthermore, the first party 41 and the second party 42 are specifically used to perform the following comparison processing for each of the N branch conditions: the first party 41 and the second party 42 jointly perform multi-party secure computing using the privacy data they respectively hold, and the first party 41 obtains a first slice of the comparison result of the branch condition, and the second party 42 obtains a second slice of the comparison result of the branch condition.
[0098] Furthermore, the multi-party secure computation includes:
[0099] The first party 41 inputs the first privacy data it holds into the two-party comparison operator, and the second party 42 inputs the second privacy data it holds into the two-party comparison operator. The two-party comparison operator compares the first privacy data and the second privacy data. The first party 41 obtains a first slice of the comparison result of whether the preset comparison relationship is established, and the second party 42 obtains a second slice of the comparison result.
[0100] Furthermore, the comparison processing corresponding to each branch condition is executed in parallel.
[0101] Optionally, as an embodiment, the N+1th value is a value returned when none of the N branch conditions are met.
[0102] Optionally, as an embodiment, the N+1 numerical values arranged in sequence belong to numerical values corresponding to the same variable in N+1 arrays arranged in sequence, each array is composed of the same number of numerical values, and the same number of numerical values corresponds to different variables.
[0103] Optionally, as an embodiment, the two-party selection operator is implemented based on multi-party secure computing technology.
[0104] Furthermore, the multi-party secure computing technology includes at least one of the following:
[0105] Secret sharing, obfuscated circuits, oblivious transfer, GMW.
[0106] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 The method described.
[0107] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 2 The method described.
[0108] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0109] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A two-party multi-branch conditional implementation method for protecting private data, the method comprising: The first party and the second party respectively obtain a shard of the comparison result of each branch condition in the N branch conditions; wherein the N branch conditions correspond to N values respectively, and any branch condition includes a size comparison of the private data held by the first party and the second party respectively; Taking the N+1th value as the initial value of the intermediate result, N rounds of selection processing are performed for the N values corresponding to the N branch conditions in order from back to front, wherein the N+1th value is a value when all the branch conditions are not satisfied; each round of selection processing includes: the first party and the second party respectively use the current value and the slices of the intermediate result of the previous round as the slices to be selected, and use the slices of the comparison result of the branch condition corresponding to the current value as the selection bit slices, and input them into the two-party selection operator, and the two-party selection operator selects one from the current value and the intermediate result of the previous round as the intermediate result of this round according to the comparison result; The fragments corresponding to the intermediate results after the N rounds of selection processing are output to the first party and the second party respectively.
2. The method of claim 1, wherein: The first party has N private data in a first private data set, and the second party has N private data in a second private data set, and the comparison result is based on whether the first private data in the first private data set and the second private data in the second private data set satisfy a preset comparison relationship representation.
3. The method of claim 2, wherein: The preset comparison relationship includes at least one of the following: Less than, less than or equal to, equal to, greater than or equal to, greater than.
4. The method of claim 2, wherein: The first party and the second party respectively obtain a slice of the comparison result of each branch condition in the N branch conditions, including: For each of the N branch conditions, the following comparison process is performed respectively: The first party and the second party jointly perform multi-party secure computing using the privacy data they respectively hold, and the first party obtains a first shard of the comparison result of the branch condition, and the second party obtains a second shard of the comparison result of the branch condition.
5. The method of claim 4, wherein: The multi-party secure computation includes: The first party inputs the first privacy data it holds into the two-party comparison operator, and the second party inputs the second privacy data it holds into the two-party comparison operator. The two-party comparison operator compares the first privacy data and the second privacy data. The first party obtains a first slice of the comparison result of whether the preset comparison relationship holds, and the second party obtains a second slice of the comparison result.
6. The method of claim 4, wherein: The comparison processing corresponding to each branch condition is executed in parallel.
7. The method of claim 1, wherein: The N+1 numerical values arranged in sequence belong to numerical values corresponding to the same variable in the N+1 arrays arranged in sequence, each array is composed of the same number of numerical values, and the same number of numerical values corresponds to different variables.
8. The method of claim 1, wherein: The two-party selection operator is implemented based on a multi-party secure computing technology, and the multi-party secure computing technology includes at least one of the following: Secret sharing, obfuscated circuits, oblivious transfer, GMW.
9. A two-party multi-branch conditional implementation system for protecting privacy data, the system comprising: The first party and the second party are used to obtain a shard of the comparison result of each branch condition in N branch conditions respectively; wherein the N branch conditions correspond to N values respectively, and any branch condition includes a size comparison of the private data held by the first party and the second party respectively; The first party and the second party are further used to use the N+1th value as the initial value of the intermediate result, and respectively perform N rounds of selection processing for the N values corresponding to the N branch conditions in a sequence from back to front, wherein the N+1th value is a value when all the branch conditions are not satisfied; each round of selection processing includes: the first party and the second party respectively use the current value and the own slice of the intermediate result of the previous round as the slice of the object to be selected, and use the slice of the comparison result of the branch condition corresponding to the current value as the selection bit slice, and input them into the two-party selection operator, and the two-party selection operator selects one from the current value and the intermediate result of the previous round as the intermediate result of the current round according to the comparison result; The first party and the second party are further used to respectively obtain the fragments corresponding to the intermediate results after the N rounds of selection processing.
10. The system of claim 9, wherein: The first party has N private data in a first private data set, and the second party has N private data in a second private data set, and the comparison result is based on whether the first private data in the first private data set and the second private data in the second private data set satisfy a preset comparison relationship representation.
11. The system of claim 10, wherein: The preset comparison relationship includes at least one of the following: Less than, less than or equal to, equal to, greater than or equal to, greater than.
12. The system of claim 10, wherein: The first party and the second party are specifically used to perform the following comparison processing for each of the N branch conditions: the first party and the second party jointly perform multi-party secure computing using the privacy data they respectively hold, and the first party obtains a first slice of the comparison result of the branch condition, and the second party obtains a second slice of the comparison result of the branch condition.
13. The system of claim 12, wherein: The multi-party secure computation includes: The first party inputs the first privacy data it holds into the two-party comparison operator, and the second party inputs the second privacy data it holds into the two-party comparison operator. The two-party comparison operator compares the first privacy data and the second privacy data. The first party obtains a first slice of the comparison result of whether the preset comparison relationship holds, and the second party obtains a second slice of the comparison result.
14. The system of claim 12, wherein: The comparison processing corresponding to each branch condition is executed in parallel.
15. The system of claim 9, wherein: The N+1 numerical values arranged in sequence belong to numerical values corresponding to the same variable in the N+1 arrays arranged in sequence, each array is composed of the same number of numerical values, and the same number of numerical values corresponds to different variables.
16. The system of claim 9, wherein: The two-party selection operator is implemented based on a multi-party secure computing technology, and the multi-party secure computing technology includes at least one of the following: Secret sharing, obfuscated circuits, oblivious transfer, GMW.
17. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 8.
18. A computing device comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Two-party quantum private comparison method based on five-quantum bit entangled state
CN105871544A
KNN classification service system and method supporting privacy protection
CN110011784A
Collaborative computing method, system and device for protecting data privacy of two parties
CN111177790A
Method and device for carrying out security operation on private data
CN111539026A
Method and device for carrying out security operation on private data
CN111737757A
