Method, device and system for two parties to securely select and determine selection result fragments

By performing local calculation and random number processing in the safe selection of two parties, the communication cost and circuit complexity are reduced, the problem of high communication cost in the existing technology is solved, and an efficient selection operation is achieved.

CN113722734BActive Publication Date: 2024-09-10SASI DIGITAL TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111005926.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-30
Publication Date
2024-09-10
Estimated Expiration
2041-08-30

AI Technical Summary

Technical Problem

The existing technology has a high communication cost in the two-party security selection, and the circuit is complex, making it difficult to effectively reduce the communication volume and the number of rounds.

Method used

The first party and the second party locally calculate the fragment difference of the input data, and use random numbers and Boolean circuits to select, avoiding merging fragments, and only need to select and split the input data and intermediate results. points to reduce communication costs.

Benefits of technology

It realizes selection operations without merging shards, significantly reduces communication costs and circuit complexity, and improves efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113722734B
    Figure CN113722734B
Patent Text Reader

Abstract

The embodiments of this specification provide a method, device and system for two parties to securely select and determine the selection result slice, which is implemented by multi-party secure computing, such as a confusion circuit. The method includes: the first party locally calculates the first difference between the slice of the first data and the slice of the second data, and determines the first input data according to the first difference; the second party performs selection in the first input data and the second input data based on the selection bit, takes the result of the selection as the intermediate result, and calculates the third difference between the intermediate result and the first random number; the second input data is determined based on the second difference, and the second difference is obtained by subtracting the slice of the second data from the slice of the first data by the second party; the sum of the slice of the second data and the first random number is calculated locally to obtain the sum result, and the first slice of the selection result is determined according to the sum result; the second slice of the selection result is determined by the second party according to the third difference. It can effectively reduce the communication cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the computer field, and more particularly, to a method, device, and system for two parties to securely select and determine a selection result shard. 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] Two-party secure selection is the basic computing unit of secure multi-party computing, which is used to select two numbers based on a selection bit. It can be used to construct IfE l se logic, MAX / MIN and other functions, general computing in secure multi-party computing, and privacy-preserving machine learning. Summary of the invention

[0004] One or more embodiments of the present specification describe a method, device, and system for two parties to securely select and determine selection result fragments, which can effectively reduce communication costs.

[0005] In a first aspect, a method for two-party secure selection to determine a selection result slice is provided, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data and the selection bit are all distributed in a sliced ​​form between a first party and a second party, and the method is performed by the first party, including:

[0006] locally calculating a first difference between the local slice of the first data and the local slice of the second data, and determining first input data according to the first difference;

[0007] generating a first random number;

[0008] The second party performs selection between the first input data and the second input data based on the selection bit, takes the selection result as an intermediate result, and calculates a third difference between the intermediate result and the first random number; the second input data is determined based on the second difference, and the second difference is a value obtained by the second party by subtracting the second party slice of the second data from the second party slice of the first data; locally calculates the sum of the own slice of the second data and the first random number to obtain a sum result, and determines a first slice of the selection result according to the sum result; the second slice of the selection result is determined by the second party according to the third difference.

[0009] In a possible implementation manner, determining the first input data according to the first difference includes:

[0010] Using the first difference as the first input data; or,

[0011] The first input data is obtained by performing a local calculation on the first difference in a first manner.

[0012] In a possible implementation, determining the first slice of the selection result according to the sum result includes:

[0013] The sum result is used as the first slice of the selection result; or,

[0014] After the sum result is locally calculated in a second manner, a first slice of the selection result is obtained.

[0015] In a possible implementation manner, the performing selection between the first input data and the second input data based on the selection bit by the second party includes:

[0016] The first input data, the first-party slice of the selection bit, and the first random number are input into a Boolean circuit, and the Boolean circuit also receives the second input data of the second party and the second-party slice of the selection bit, and selects the first input data or the second input data as an intermediate result according to the selection bit, and outputs the third difference to the second party.

[0017] Furthermore, the Boolean circuit is used to perform the following calculation process:

[0018] Calculate the exclusive OR of the first party slice of the selection bit and the second party slice of the selection bit to obtain the selection bit;

[0019] Selecting the first input data or the second input data as an intermediate result according to the selection bit;

[0020] The difference between the intermediate result and the first random number is calculated to obtain the third difference.

[0021] In a possible implementation manner, the performing selection between the first input data and the second input data based on the selection bit by the second party and using the selection result as an intermediate result includes:

[0022] When the selection bit is 1, selecting the first input data as the intermediate result;

[0023] When the selection bit is 0, the second input data is selected as the intermediate result.

[0024] In a possible implementation, the sum of the first shard of the first data and the second shard of the first data is the first data; the sum of the first shard of the second data and the second shard of the second data is the second data.

[0025] Furthermore, the Boolean circuit is implemented in a garbled circuit or GMW.

[0026] In a second aspect, a method for two-party secure selection to determine a selection result slice is provided, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data, and the selection bit are all distributed in a sliced ​​form between a first party and a second party, and the method includes:

[0027] The first party locally calculates a first difference between the first party segment of the first data and the first party segment of the second data, and determines first input data according to the first difference;

[0028] The first party generates a first random number;

[0029] The second party locally calculates a second difference between the second party segment of the second data and the second party segment of the first data, and determines second input data according to the second difference;

[0030] The first party and the second party perform selection between the first input data and the second input data based on the selection bit, use the selection result as an intermediate result, and calculate a third difference between the intermediate result and the first random number;

[0031] The first party locally calculates the sum of the first party shard of the second data and the first random number to obtain a first sum result, and determines a first shard of the selection result according to the first sum result;

[0032] The second party locally calculates the sum of the third difference and the second party slice of the first data to obtain a second sum result, and determines the second slice of the selection result according to the second sum result.

[0033] In a possible implementation manner, the first party determines first input data according to the first difference, including:

[0034] The first party uses the first difference as the first input data;

[0035] The second party determines second input data according to the second difference, including:

[0036] The second party uses the second difference as the second input data.

[0037] Further, the first party determines a first slice of the selection result according to the first summation result, including:

[0038] The first party uses the first sum result as the first slice of the selection result; and the second party determines the second slice of the selection result according to the second sum result, including:

[0039] The second party uses the second summation result as a second fragment of the selection result.

[0040] In a third aspect, a device for determining a selection result slice by two-party secure selection is provided, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data and the selection bit are distributed in a sliced ​​form between a first party and a second party, and the device is arranged on the first party, comprising:

[0041] A first local calculation unit, configured to locally calculate a first difference between a local slice of the first data and a local slice of the second data, and determine first input data according to the first difference;

[0042] A generating unit, configured to generate a first random number;

[0043] A joint calculation unit, used to perform selection between the first input data and the second input data with the second party based on the selection bit, use the selection result as an intermediate result, and calculate a third difference between the intermediate result and the first random number; the second input data is determined based on the second difference, and the second difference is a value obtained by the second party by subtracting the second party slice of the second data from the second party slice of the first data; a second local calculation unit, used to locally calculate the sum of the local slice of the second data and the first random number to obtain a sum result, and determine a first slice of the selection result according to the sum result; the second slice of the selection result is determined by the second party according to the third difference output by the circuit execution unit.

[0044] In a fourth aspect, a system for determining a selection result slice by two-party secure selection is provided, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data and the selection bit are all distributed in a sliced ​​form between a first party and a second party, and the system includes:

[0045] The first party is used to locally calculate a first difference between a first party segment of the first data and a first party segment of the second data, and determine first input data according to the first difference; and generate a first random number;

[0046] The second party is used to locally calculate a second difference between the second party slice of the second data and the second party slice of the first data, and determine second input data according to the second difference;

[0047] The first party and the second party are further configured to perform selection between the first input data and the second input data based on the selection bit, use the selected result as an intermediate result, and calculate a third difference between the intermediate result and the first random number;

[0048] The first party is further used to locally calculate the sum of the first party shard of the second data and the first random number to obtain a first sum result, and determine the first shard of the selection result according to the first sum result;

[0049] The second party is further used to locally calculate the sum of the third difference and the second party slice of the first data to obtain a second summation result, and determine the second slice of the selection result according to the second summation result.

[0050] In a fifth 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 or the second aspect.

[0051] In a sixth aspect, a computing device is provided, comprising 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 or the second aspect is implemented.

[0052] Through the method, device and system provided by the embodiments of this specification, the first data, the second data and the selection bit are distributed in the form of slices on the first party and the second party. First, the first party locally calculates the first difference between the first party slice of the first data and the first party slice of the second data, and determines the first input data according to the first difference, and generates a first random number; the second party locally calculates the second difference between the second party slice of the second data and the second party slice of the first data, and determines the second input data according to the second difference; then the first party and the second party perform selection in the first input data and the second input data based on the selection bit, take the selected result as an intermediate result, and calculate the third difference between the intermediate result and the first random number; finally, the first party locally calculates the sum of the first party slice of the second data and the first random number to obtain a first sum result, and determines the first slice of the selection result according to the first sum result; the second party locally calculates the sum of the third difference and the second party slice of the first data to obtain a second sum result, and determines the second slice of the selection result according to the second sum result. As can be seen from the above, in the embodiments of the present specification, in order to achieve selection between the first data and the second data, the first party and the second party first perform local calculations to obtain the first input data and the second input data respectively, and then select from the first input data and the second input data. This method does not need to merge the shards of the first data and the shards of the second data. It only needs to make a selection for the input first input data and the second input data, and split the intermediate results. Subsequently, the first party and the second party each obtain their own shards of the selection result through local calculations. Compared with the usual processing method, this can effectively reduce the communication cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] 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.

[0054] Figure 1 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification;

[0055] Figure 2 A schematic diagram showing an interaction of a method for two parties to securely select and determine selection result shards according to an embodiment;

[0056] Figure 3 A schematic diagram of a Boolean circuit structure according to an embodiment is shown;

[0057] Figure 4A schematic block diagram showing an apparatus for determining selection result slices by two-party secure selection according to an embodiment;

[0058] Figure 5 A schematic block diagram of a system for determining a selection result slice by two-party secure selection according to one embodiment is shown. DETAILED DESCRIPTION

[0059] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0060] Figure 1 This is a schematic diagram of an implementation scenario of an embodiment disclosed in this specification. The implementation scenario involves two-party security selection, which is used to select between first data and second data according to a selection bit, and the first data, the second data and the selection bit are distributed in the form of slices to the first party and the second party. Figure 1 , the first data a can be represented as an n-bit binary number, the first party has a slice a0 of a, the second party has another slice a1 of a, a=a0+a1; the second data b can also be represented as an n-bit binary number, the first party has a slice b0 of b, the second party has another slice b1 of b, b=b0+b1; the selection bit s can be represented as a single-bit binary number, the first party has a slice s0 of s, the second party has another slice s1 of s, s=s0^s1, that is, s equals s0 XOR s1. It can be understood that the first data, the second data and the selection bit are all private data, and the first and second parties only have slices of the above private data, but cannot know the private data. Two-party secure selection, that is, under the premise of protecting the above private data from being leaked, according to the selection bit, a selection is made between the first data and the second data, and the selection result also exists in the form of slices in the first and second parties.

[0061] Among them, the two parties' safe selection is to implement the following calculation: make a selection based on s, select a if s is 1, select b if s is 0, and the selection result is r = s? a:b. Output: The first party obtains the first fragment r0 of the selection result, and the second party obtains the second fragment r1 of the selection result, r = r0 + r1.

[0062] The slicing form of the first data and the second data is specifically called additive slicing. n The integer ring can be split into two additive slices using subtraction. These two additive slices are modulo 2. n Addition on the integer ring can obtain the original number, and each party holds an addition slice of the number. The addition slice is an unsigned number. In the embodiment of this specification, the operation on the addition slice is modulo 2 n Spatial operations, including addition, subtraction, etc.

[0063] The above two safe choices can be realized through Boolean circuits. Boolean circuits are a set of logic gates connected by connecting wires, which can complete function calculations for a set of inputs and output results. Logic gates include AND gates, XOR gates, NOT gates, etc. that implement Boolean functions. Generally, a function can be compiled into a set of AND gates, XOR gates, and NOT gates to complete the calculation.

[0064] The usual circuit implementation scheme for two-party secure selection includes: merging the addition slices after the circuit is completed, that is, obtaining a=a0+a1, b=b0+b1; selecting data a and data b according to s to obtain the selection result r; and then splitting the selection result r, the first party inputs a slice r0 of the selection result r, and the second party obtains another slice r1=r-r0 of the selection result r.

[0065] The solution provided in the embodiments of this specification does not need to merge the addition slices, but only needs to select and split the results. The circuit is significantly smaller, including the number of AND gates and the depth of AND gates, which can effectively reduce the communication cost. The communication cost includes the communication volume and the number of communication rounds.

[0066] Figure 2 A schematic diagram showing an interactive method for two parties to securely select and determine a selection result fragment according to an embodiment of the present invention. The method can be based on Figure 1 In the implementation scenario shown, the two-party security selection is used to select between the first data and the second data according to the selection bit, and the first data, the second data and the selection bit are distributed in the form of slices to the first party and the second party. Figure 2 As shown, the two-party secure selection method in this embodiment includes the following steps: Step 21, the first party locally calculates the first difference between the first party slice of the first data and the first party slice of the second data, and determines the first input data according to the first difference; Step 22, the first party generates a first random number; Step 23, the second party locally calculates the second difference between the second party slice of the second data and the second party slice of the first data, and determines the second input data according to the second difference; Step 24, the first party and the second party perform selection in the first input data and the second input data based on the selection bit, take the selected result as the intermediate result, and calculate the third difference between the intermediate result and the first random number; Step 25, the first party locally calculates the sum of the first party slice of the second data and the first random number to obtain a first summation result, and determines the first slice of the selection result according to the first summation result; Step 26, the second party locally calculates the sum of the third difference and the second party slice of the first data to obtain a second summation result, and determines the second slice of the selection result according to the second summation result. The specific execution method of each of the above steps is described below.

[0067] First, in step 21, the first party locally calculates a first difference between the first party segment of the first data and the first party segment of the second data, and determines first input data according to the first difference. It can be understood that the first input data is obtained by the first party's local calculation, and the above local calculation at least includes calculating the first difference.

[0068] In an example, the sum of the first shard of the first data and the second shard of the first data is the first data; the sum of the first shard of the second data and the second shard of the second data is the second data.

[0069] In one example, determining the first input data according to the first difference includes:

[0070] Using the first difference as the first input data; or,

[0071] The first input data is obtained by performing a local calculation on the first difference in a first manner.

[0072] For example, the first party slice of the first data is a0, and the first party slice of the second data is b0. The above-mentioned first difference is a0-b0. The first difference can be directly used as the first input data, that is, the first input data in0=a0-b0; the first difference can also be locally calculated in a first manner to obtain the first input data. The local calculation of the first manner can be to add the first difference to an agreed data shared with the second party. For example, when the agreed data is 1, in0=a0-b0+1.

[0073] Then, in step 22, the first party generates a first random number. It is understandable that the first random number can be generated by any common random number generation method.

[0074] Then, in step 23, the second party locally calculates a second difference between the second party slice of the second data and the second party slice of the first data, and determines second input data according to the second difference. It can be understood that the second input data is obtained by the second party's local calculation, and the above local calculation at least includes calculating the second difference.

[0075] In one example, determining the second input data according to the second difference includes:

[0076] Using the second difference as the second input data; or,

[0077] The second difference is locally calculated in a first manner to obtain the second input data.

[0078] For example, the second party fragment of the first data is a1, and the second party fragment of the second data is b1. The above-mentioned second difference is b1-a1. The second difference can be directly used as the second input data, that is, the second input data in1=b1-a1; the second difference can also be locally calculated in a first manner to obtain the second input data. The local calculation of the first manner can be to add the second difference to an agreed data shared with the first party. For example, when the agreed data is 1, in1=b1-a1+1.

[0079] In the embodiments of the present specification, there are many possible combinations of ways to determine the first input data and the second input data, for example, the first input data in0 = a0-b0, the second input data in1 = b1-a1; the first input data in0 = a0-b0+2, the second input data in1 = b1-a1+2; the first input data in0 = a0-b0+1, the second input data in1 = b1-a1+1; the first input data in0 = a0-b0+5, the second input data in1 = b1-a1+5, etc. There are many possible situations, which will not be elaborated here one by one.

[0080] Then in step 24, the first party and the second party perform selection in the first input data and the second input data based on the selection bit, use the selected result as the intermediate result, and calculate the third difference between the intermediate result and the first random number. It can be understood that the first random number is used as the first party slice of the intermediate result, and the third difference is used as the second party slice of the intermediate result.

[0081] In one example, the first party inputs the first input data, the first-party slice of the selection bit, and the first random number into a Boolean circuit, and the second party inputs the second input data and the second-party slice of the selection bit into the Boolean circuit, and the Boolean circuit selects the first input data or the second input data as an intermediate result based on the selection bit, and outputs a third difference between the intermediate result and the first random number to the second party.

[0082] The above-mentioned Boolean circuit of the embodiment of this specification is significantly different from the usual Boolean circuit used for two-party security selection in terms of input, output and circuit structure. The input of the above-mentioned Boolean circuit includes the first input data of the first party and the second input data of the second party, but does not include the slices of the first data and the slices of the second data respectively possessed by the first party and the second party; the output of the above-mentioned Boolean circuit is the slices of the intermediate result, rather than the slices of the final selection result, and the first party and the second party need to obtain the slices of the selection result through local calculation based on the slices of the intermediate result; the circuit structure of the above-mentioned Boolean circuit does not need to merge the addition slices, but only needs to select the first input data and the second input data, and split the intermediate result, so the circuit is significantly smaller, including the number of AND gates and the depth of AND gates.

[0083] Figure 3 FIG. 2 shows a schematic diagram of a Boolean circuit structure according to an embodiment. Figure 3 The Boolean circuit includes a selection module and a splitting module, whose input includes the first input data in0 of the first party, the first party fragment s0 of the selection bit, and the first random number t0, the second input data in1 of the second party, and the second party fragment s1 of the selection bit. The selection module is used to select an intermediate result t from the first input data and the second input data according to the selection bit, and the splitting module is used to split the intermediate result t according to the first random number t0 to obtain t1=t-t0, and t1 is used as the output of the Boolean circuit.

[0084] Furthermore, the Boolean circuit is used to perform the following calculation process:

[0085] Calculate the exclusive OR of the first party slice of the selection bit and the second party slice of the selection bit to obtain the selection bit;

[0086] Selecting the first input data or the second input data as an intermediate result according to the selection bit;

[0087] The difference between the intermediate result and the first random number is calculated to obtain the third difference.

[0088] For example, the first party has first input data in0, a first party slice s0 of selected bits, and a first random number t0, and the second party has second input data in1, a second party slice s1 of selected bits, and the circuit calculation includes:

[0089] s=s0^s1;

[0090] t=s?in0:in1;

[0091] t1=t-t0.

[0092] The second party obtains t1.

[0093] In one example, the performing selection between the first input data and the second input data based on the selection bit and using the selection result as an intermediate result by the second party includes:

[0094] When the selection bit is 1, selecting the first input data as the intermediate result;

[0095] When the selection bit is 0, the second input data is selected as the intermediate result.

[0096] Furthermore, the Boolean circuit is implemented in a garbled circuit or GMW.

[0097] Garbled circuit (GC) is a two-party secure multi-party computing protocol. It uses cryptographic functions to generate a garbled table for a Boolean circuit that implements a computing function, calculates the result for two inputs, and the input of one party will not be leaked to the other party during the calculation process. At present, the best implementation of garbled circuits does not require communication for XOR gates and NOT gates, only local calculations are required, and AND gates need to call cryptographic calculations and communicate, and in general application scenarios, the communication volume is the bottleneck of the throughput limit. The communication volume of the garbled circuit is positively correlated with the number of AND gates in the Boolean circuit.

[0098] 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.

[0099] Then in step 25, the first party locally calculates the sum of the first party slice of the second data and the first random number to obtain a first sum result, and determines the first slice of the selection result according to the first sum result. It can be understood that the first random number is used as the first party slice of the intermediate result. Since the first random number is generated by the first party, the above calculation process does not depend on the output result of the Boolean circuit.

[0100] In one example, determining the first slice of the selection result according to the first summation result includes:

[0101] Using the first summation result as the first slice of the selection result; or,

[0102] After performing a local calculation in a second manner on the first summation result, a first slice of the selection result is obtained.

[0103] For example, the first square slice of the second data is b0, and the first random number is t0. The first summation result can be used as the first slice of the selection result, that is, the first slice of the selection result r0=b0+t0; or, the first summation result is locally calculated in a second manner to obtain the first slice of the selection result. The local calculation of the second manner can be to subtract a preset constant from the first summation result. For example, when the above preset constant is 1, r0=b0+t0-1.

[0104] Finally, in step 26, the second party locally calculates the sum of the third difference and the second party slice of the first data to obtain a second summation result, and determines the second slice of the selection result according to the second summation result.

[0105] In one example, determining the second slice of the selection result according to the second summation result includes:

[0106] The second summation result is used as the second slice of the selection result; or,

[0107] After performing a local calculation in a second manner on the second summation result, a second slice of the selection result is obtained.

[0108] For example, the second square slice of the first data is a1, and the third difference is t1. The second summation result can be used as the second slice of the selection result, that is, the second slice of the selection result r1=a1+t1; or, the second summation result is locally calculated in a second manner to obtain the second slice of the selection result. The local calculation of the second manner can be to add a preset constant to the first summation result. For example, when the above preset constant is 1, r1=a1+t1+1.

[0109] In the embodiments of this specification, the method of determining the first input data in step 21 and the method of determining the second input data in step 23 are closely related to the method of determining the first shard of the selection result in subsequent step 25 and the method of determining the second shard of the selection result in step 26, and it is meaningless for a shard of the selection result to exist in isolation, and the correctness of the final selection result needs to be guaranteed.

[0110] For example, if the first input data in0=a0-b0, and the second input data in1=b1-a1, then the slices of the selection result can be calculated as follows: the first slice of the selection result r0=b0+t0, and the second slice of the selection result r1=a1+t1.

[0111] The above calculation method has been verified to be correct as follows:

[0112] If s=0, then t=in1; r0+r1=b0+t0+a1+t1=b0+a1+in1=b0+a1+b1-a1=b;

[0113] If s=1, then t=in0; r0+r1=b0+t0+a1+t1=b0+a1+in0=b0+a1+a0-b0=a.

[0114] It can be seen from the above derivation that the solution provided in the embodiments of this specification can achieve safe selection for both parties.

[0115] The solution provided by the embodiments of this specification meets the security requirements, wherein t1 will not leak information to the second party, and since the intermediate result is split by the Boolean circuit, the second party cannot determine whether the Boolean circuit selects in0 or in1 through t1. The difference between a and b will not be leaked to the first party and the second party.

[0116] In addition, it should be noted that, under the premise that the first input data and the second input data are determined, the calculation method of the slice of the selection result is not unique. For example, if the first input data in0 = a0-b0, and the second input data in1 = b1-a1, then the slice of the selection result can also be calculated in the following way: the first slice of the selection result r0 = b0+t0-1, the second slice of the selection result r1 = a1+t1+1; or, the first slice of the selection result r0 = b0+t0-2, the second slice of the selection result r1 = a1+t1+2.

[0117] Next, we will use examples to illustrate how to determine the shards of the selection results for other input data determination methods. For example, if the first input data in0 = a0-b0+c, and the second input data in1 = b1-a1+c, where c represents the agreed data shared by the first and second parties, then the shards of the selection results can be calculated in the following manner: the first shard of the selection result r0 = b0+t0-c, and the second shard of the selection result r1 = a1+t1. Taking c = 1 as an example, if the first input data in0 = a0-b0+1, and the second input data in1 = b1-a1+1, then the shards of the selection result can be calculated in the following manner: the first shard of the selection result r0 = b0+t0-1, and the second shard of the selection result r1 = a1+t1. There are many possible ways, which will not be elaborated here.

[0118] Through the method provided in the embodiments of this specification, in order to achieve selection between the first data and the second data, the first party and the second party first perform local calculations to obtain the first input data and the second input data respectively, and then select from the first input data and the second input data. This method does not require merging the shards of the first data and the shards of the second data. It only needs to make a selection for the input first input data and the second input data, and split the intermediate results. Subsequently, the first party and the second party each obtain their own shards of the selection result through local calculation. Compared with the usual processing method, this can effectively reduce the communication cost.

[0119] In addition, when the method provided in the embodiments of the present specification is combined with a Boolean circuit, in order to achieve selection between the first data and the second data, the slices of the first data and the slices of the second data are not directly input into the Boolean circuit, but the first party and the second party first perform local calculations to obtain the first input data and the second input data respectively, and then input the first input data and the second input data into the Boolean circuit. The above-mentioned Boolean circuit does not need to merge the slices of the first data and the slices of the second data, but only needs to make a selection for the input first input data and the second input data, and split the intermediate results. Subsequently, the first party and the second party each obtain their own slices of the selection result through local calculation. Compared with the usual circuit structure, the circuit is significantly smaller, including the number of AND gates and the depth of AND gates are reduced, thereby effectively reducing the communication cost.

[0120] According to an embodiment of another aspect, a device for two-party secure selection to determine selection result slices is also provided, wherein the two-party secure selection is used to select between first data and second data based on a selection bit, wherein the first data, the second data and the selection bit are all in the form of slices and distributed on 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 4 FIG. 2 shows a schematic block diagram of a two-party security selection device according to an embodiment. Figure 4 As shown, the device 400 includes:

[0121] A first local calculation unit 41 is used to locally calculate a first difference between a local slice of the first data and a local slice of the second data, and determine first input data according to the first difference;

[0122] A generating unit 42, configured to generate a first random number;

[0123] a joint calculation unit 43, configured to perform selection with the second party between the first input data and the second input data based on the selection bit, use the selection result as an intermediate result, and calculate a third difference between the intermediate result and the first random number; the second input data is determined based on the second difference, and the second difference is a value obtained by the second party by subtracting the second party slice of the second data from the second party slice of the first data;

[0124] The second local calculation unit 44 is used to locally calculate the sum of the local slice of the second data and the first random number to obtain a sum result, and determine the first slice of the selection result based on the sum result; the second slice of the selection result is determined by the second party based on the third difference output by the circuit execution unit 43.

[0125] Optionally, as an embodiment, the first local calculation unit 41 is specifically configured to use the first difference as the first input data; or to obtain the first input data after performing a first method of local calculation on the first difference.

[0126] Optionally, as an embodiment, the second local calculation unit 44 is specifically used to use the sum result as the first slice of the selection result; or, obtain the first slice of the selection result after performing a local calculation in a second manner on the sum result.

[0127] Optionally, as an embodiment, the joint calculation unit 43 is specifically used to input the first input data, the first-party slice of the selection bit and the first random number into a Boolean circuit, and the Boolean circuit also receives the second input data input by the second party and the second-party slice of the selection bit, and selects the first input data or the second input data as an intermediate result according to the selection bit, and outputs the third difference to the second party.

[0128] Furthermore, the Boolean circuit is used to perform the following calculation process:

[0129] Calculate the exclusive OR of the first party slice of the selection bit and the second party slice of the selection bit to obtain the selection bit;

[0130] Selecting the first input data or the second input data as an intermediate result according to the selection bit;

[0131] The difference between the intermediate result and the first random number is calculated to obtain the third difference.

[0132] Optionally, as an embodiment, the joint calculation unit 43 is specifically used to:

[0133] When the selection bit is 1, selecting the first input data as the intermediate result;

[0134] When the selection bit is 0, the second input data is selected as the intermediate result.

[0135] Optionally, as an embodiment, the sum of the first shard of the first data and the second shard of the first data is the first data; the sum of the first shard of the second data and the second shard of the second data is the second data.

[0136] Furthermore, the Boolean circuit is implemented in a garbled circuit or GMW.

[0137] According to an embodiment of another aspect, a system for two-party secure selection to determine selection result slices is also provided, wherein the two-party secure selection is used to select between first data and second data based on a selection bit, wherein the first data, the second data and the selection bit are all in the form of slices and distributed between the first party and the second party, 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 5 A schematic block diagram of a system for two-party secure selection to determine selection result sharding according to an embodiment is shown. Figure 5 As shown, the system 500 includes:

[0138] The first party 51 is used to locally calculate a first difference between a first party slice of the first data and a first party slice of the second data, and determine first input data according to the first difference; and generate a first random number;

[0139] The second party 52 is used to locally calculate a second difference between the second party slice of the second data and the second party slice of the first data, and determine second input data according to the second difference;

[0140] The first party 51 and the second party 52 are further configured to perform selection between the first input data and the second input data based on the selection bit, use the selected result as an intermediate result, and calculate a third difference between the intermediate result and the first random number;

[0141] The first party 51 is further used to locally calculate the sum of the first party shard of the second data and the first random number to obtain a first sum result, and determine the first shard of the selection result according to the first sum result;

[0142] The second side 52 is further used to locally calculate the sum of the third difference and the second side slice of the first data to obtain a second summation result, and determine the second slice of the selection result according to the second summation result.

[0143] Optionally, as an embodiment, the first party 51 is specifically configured to use the first difference as the first input data;

[0144] The second party 52 is specifically configured to use the second difference as the second input data.

[0145] Furthermore, the first party 51 is specifically used to use the first summation result as the first slice of the selection result; and the second party 52 is specifically used to use the second summation result as the second slice of the selection result.

[0146] 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.

[0147] 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.

[0148] 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.

[0149] 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 method for determining a selection result slice by two-party secure selection, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data and the selection bit are distributed in the form of slices between a first party and a second party, and the method is performed by the first party, comprising: locally calculating a first difference between the local slice of the first data and the local slice of the second data, and determining first input data according to the first difference; generating a first random number; performing selection with the second party between the first input data and the second input data based on the selection bit, taking the selected result as an intermediate result, and calculating a third difference between the intermediate result and the first random number; The second input data is determined based on a second difference value, where the second difference value is a value obtained by subtracting a second party slice of the second data from a second party slice of the first data by the second party; Locally calculating the sum of the local shard of the second data and the first random number to obtain a sum result, and determining the first shard of the selection result according to the sum result; The second slice of the selection result is determined by the second party according to the third difference.

2. The method of claim 1, wherein: The determining the first input data according to the first difference includes: Using the first difference as the first input data; or, The first input data is obtained by performing a local calculation on the first difference in a first manner.

3. The method of claim 1, wherein: The step of determining the first slice of the selection result according to the summation result includes: The sum result is used as the first slice of the selection result; or, After the sum result is locally calculated in a second manner, a first slice of the selection result is obtained.

4. The method of claim 1, wherein: The second party performs selection between the first input data and the second input data based on the selection bit, including: The first input data, the first-party slice of the selection bit, and the first random number are input into a Boolean circuit, and the Boolean circuit also receives the second input data of the second party and the second-party slice of the selection bit, and selects the first input data or the second input data as an intermediate result according to the selection bit, and outputs the third difference to the second party.

5. The method of claim 4, wherein: The Boolean circuit is used to perform the following calculation process: Calculate the exclusive OR of the first party slice of the selection bit and the second party slice of the selection bit to obtain the selection bit; Selecting the first input data or the second input data as an intermediate result according to the selection bit; The difference between the intermediate result and the first random number is calculated to obtain the third difference.

6. The method of claim 1, wherein: The second party and the first party select the first input data and the second input data based on the selection bit, and use the selection result as an intermediate result, including: When the selection bit is 1, selecting the first input data as the intermediate result; When the selection bit is 0, the second input data is selected as the intermediate result.

7. The method of claim 1, wherein: The sum of the first-party fragment of the first data and the second-party fragment of the first data is the first data; the sum of the first-party fragment of the second data and the second-party fragment of the second data is the second data.

8. The method of claim 4, wherein: The Boolean circuit is implemented in a garbled circuit or GMW.

9. A method for two-party secure selection to determine selection result slicing, the two-party secure selection is used to select between first data and second data according to a selection bit, the first data, the second data and the selection bit are all distributed in the form of slices between a first party and a second party, the method comprising: The first party locally calculates a first difference between the first party segment of the first data and the first party segment of the second data, and determines first input data according to the first difference; The first party generates a first random number; The second party locally calculates a second difference between the second party segment of the second data and the second party segment of the first data, and determines second input data according to the second difference; The first party and the second party perform selection between the first input data and the second input data based on the selection bit, use the selection result as an intermediate result, and calculate a third difference between the intermediate result and the first random number; The first party locally calculates the sum of the first party shard of the second data and the first random number to obtain a first sum result, and determines a first shard of the selection result according to the first sum result; The second party locally calculates the sum of the third difference and the second party slice of the first data to obtain a second sum result, and determines the second slice of the selection result according to the second sum result.

10. The method of claim 9, wherein: The first party determines first input data according to the first difference, including: The first party uses the first difference as the first input data; The second party determines second input data according to the second difference, including: The second party uses the second difference as the second input data.

11. The method of claim 10, wherein: The first party determines a first shard of a selection result according to the first summation result, including: The first party uses the first sum result as the first slice of the selection result; The second party determines a second fragment of the selection result according to the second summation result, including: The second party uses the second summation result as a second fragment of the selection result.

12. A device for determining a selection result slice by two-party secure selection, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data and the selection bit are distributed in the form of slices between a first party and a second party, and the device is arranged on the first party, comprising: A first local calculation unit, configured to locally calculate a first difference between a local slice of the first data and a local slice of the second data, and determine first input data according to the first difference; A generating unit, configured to generate a first random number; a joint calculation unit, configured to perform selection with the second party between the first input data and the second input data based on the selection bit, use the selected result as an intermediate result, and calculate a third difference between the intermediate result and the first random number; The second input data is determined based on a second difference value, where the second difference value is a value obtained by subtracting a second party slice of the second data from a second party slice of the first data by the second party; A second local calculation unit is used to locally calculate the sum of the local shard of the second data and the first random number to obtain a sum result, and determine the first shard of the selection result according to the sum result; The second slice of the selection result is determined by the second party according to the third difference output by the circuit execution unit.

13. The device of claim 12, wherein: The joint calculation unit is specifically used to input the first input data, the first-party slice of the selection bit and the first random number into a Boolean circuit. The Boolean circuit also receives the second input data input by the second party and the second-party slice of the selection bit, and selects the first input data or the second input data as an intermediate result according to the selection bit, and outputs the third difference to the second party.

14. The device of claim 13, wherein: The Boolean circuit is used to perform the following calculation process: Calculate the exclusive OR of the first party slice of the selection bit and the second party slice of the selection bit to obtain the selection bit; Selecting the first input data or the second input data as an intermediate result according to the selection bit; The difference between the intermediate result and the first random number is calculated to obtain the third difference.

15. The device of claim 13, wherein: The Boolean circuit is implemented in a garbled circuit or GMW.

16. A system for determining a selection result slice by a two-party secure selection, wherein the two-party secure selection is used to select between first data and second data according to a selection bit, wherein the first data, the second data and the selection bit are distributed in a sliced ​​form between a first party and a second party, and the system comprises: The first party is used to locally calculate a first difference between a first party segment of the first data and a first party segment of the second data, and determine first input data according to the first difference; and generating a first random number; The second party is used to locally calculate a second difference between the second party slice of the second data and the second party slice of the first data, and determine second input data according to the second difference; The first party and the second party are further configured to perform selection between the first input data and the second input data based on the selection bit, use the selected result as an intermediate result, and calculate a third difference between the intermediate result and the first random number; The first party is further used to locally calculate the sum of the first party shard of the second data and the first random number to obtain a first sum result, and determine the first shard of the selection result according to the first sum result; The second party is further used to locally calculate the sum of the third difference and the second party slice of the first data to obtain a second summation result, and determine the second slice of the selection result according to the second summation result.

17. The system of claim 16, wherein: The first party is specifically configured to use the first difference as the first input data; The second party is specifically configured to use the second difference as the second input data.

18. The system of claim 17, wherein: The first party is specifically used to use the first summation result as the first slice of the selection result; the second party is specifically used to use the second summation result as the second slice of the selection result.

19. 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 11.

20. 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 11 is implemented.