Disclosure of Invention
In order to solve the technical problems, the invention provides a multiparty secret sharing method and electronic equipment for secure multiparty computing, which improve the communication efficiency and the computing efficiency of multiparty secret sharing.
In order to solve the problems, the invention adopts the following technical scheme:
the invention discloses a multi-party secret sharing method for secure multi-party computation, which is characterized by comprising the following steps of:
s1: each participant divides data to be shared, which is held by the participant, into a first data fragment and a second data fragment, wherein the sum of the first data fragment and the second data fragment is equal to the data to be shared;
each participant splits the data to be shared held by the participant into a third data fragment and a fourth data fragment again, wherein the sum of the third data fragment and the fourth data fragment is equal to the data to be shared;
s2: randomly selecting two participants from all the participants by adopting a random decision method as computing nodes, respectively recording the computing nodes as a first computing node and a second computing node, wherein the first computing node and the second computing node form a first computing node group;
randomly selecting two participants from all the participants by adopting a random decision method again to serve as computing nodes, and respectively recording the computing nodes as a third computing node and a fourth computing node, wherein the third computing node and the fourth computing node form a second computing node group;
s3: each participant sends the first data fragment to the first computing node, sends the second data fragment to the second computing node, sends the third data fragment to the third computing node, and sends the fourth data fragment to the fourth computing node.
In the scheme, all participants jointly decide to randomly select a first computing node group and a second computing node group, and each computing node group comprises two participants as computing nodes. Each participant splits own data to be shared into two shares and stores the two shares in two computing nodes of a first computing node group, then splits own data to be shared once again and stores the two newly split shares in two computing nodes of a second computing node group.
When multi-party safety calculation is carried out, two calculation nodes of a first calculation node group cooperate to carry out multi-party safety calculation according to held data fragments and send calculation results to all participants, two calculation nodes of a second calculation node group cooperate to carry out multi-party safety calculation according to the held data fragments and send the calculation results to all the participants, and if the calculation results sent by the first calculation node group and the calculation results sent by the second calculation node group received by the participants are consistent, the calculation results are correct.
Because the two computing nodes of each computing node group can calculate the result by data interaction during the multi-party security calculation, compared with the traditional multi-party secret sharing method, the communication efficiency and the calculation efficiency are greatly improved under the condition that the number of the participants is large, the calculation result of the second computing node can be used for checking the first computing node group, the correctness of the calculation result is ensured, and the calculation result can be effectively prevented from being interfered by a malicious party existing in the participants. In addition, all the participants as the computing nodes are randomly selected by adopting a random decision method, so that each participant can not predict the selection process of the computing nodes.
Preferably, in step S1, the value of the third data fragment generated by each participant is different from the value of the first data fragment and the value of the second data fragment generated by the participant.
Preferably, the step S2 further comprises the steps of:
when two participants serving as the computing nodes in the selected second computing node group are both used as the computing nodes in the first computing node group, all the participants randomly select two participants from all the participants to be used as the computing nodes again by adopting a random decision method until the two participants serving as the computing nodes in the second computing node group are not both used as the computing nodes in the first computing node group. I.e., two participants in the first computing node group are inconsistent with two participants in the second computing node group.
Preferably, the method for the participants to randomly select two participants as the computing nodes from all the participants to form the computing node group by using a random decision method is as follows:
n1: all the participants are numbered 1, 2 and 3 in sequence as 8230, N and N are the number of the participants;
n2: each participant generates two random numbers and broadcasts the random numbers to other participants, and the value of the random numbers is 0 or 1;
n3: each participant calculates numbers I1 and I2 of two participants serving as computing nodes according to the received broadcast data, the participants numbered I1 and I2 form a computing node group, the participant numbered I1 serves as a first computing node or a third computing node, and the participant numbered I2 serves as a second computing node or a fourth computing node.
Preferably, the method for calculating the numbers I1 and I2 of the two parties as the computing nodes in the step N3 is as follows:
n31: all participants negotiate all combination modes of two participants forming the computing node group in advance, and N-1 combination modes are shared in total, and the number of all combination modes is 1, 2 and 3 ... (N-1);
n32: the two random numbers generated by each participant are respectively marked as e and b, and the two random numbers generated by the participant with the number i are respectively marked as ei 、bi ,1≤i≤N;
Each participant calculates a parameter E according to the random numbers E generated by all participants and calculates a parameter B according to the random numbers B generated by all participants;
n33: and each participant calculates the number F of the combination mode of the computing node group according to the parameter E and the parameter B to obtain the numbers of two participants in the computing node group with the combination mode of the number F, wherein the numbers of the two participants are the numbers I1 and I2 of the two participants serving as the computing nodes.
And (2) randomly selected from the N participants to be arranged to obtain N (N-1) combination modes.
Preferably, in step N33, the formula for calculating the number F of the combination scheme of the node group according to the parameter E and the parameter B is as follows:
using BE Instead of using B directly, it is to prevent any one participant from deliberately sifting through the final selection result by the bits provided by itself, and by introducing an exponent, each participant cannot predict the final F.
Preferably, the method for calculating the numbers I1 and I2 of the two parties as the computing nodes in the step N3 is as follows:
n31: the two random numbers generated by each participant are respectively marked as e and b, and the two random numbers generated by the participant with the number i are respectively marked as ei 、bi ,1≤i≤N;
The parameters E and B are calculated,
n32: the parameter R is calculated out as a function of,
n33: the numbers I1, I2 of the two parties acting as computation nodes are calculated,
wherein,
indicating rounding up.
An electronic device of the present invention includes a memory and a processor, the memory having stored thereon executable code, which when executed by the processor, performs a multiparty secret sharing method for secure multiparty computing as described above.
The invention has the beneficial effects that: the first computing node group and the second computing node group are jointly decided and randomly selected by all the participants, and each participant divides the data to be shared into two parts which are respectively stored in the first computing node group and the second computing node group, so that the process complexity is reduced, the communication efficiency and the computing efficiency of multi-party secret sharing are improved, large-scale commercial use is convenient to realize, and the data of any participant cannot be exposed.
Detailed description of the preferred embodiments
The technical scheme of the invention is further specifically described by the following embodiments and the accompanying drawings.
Example 1: a multiparty secret sharing method for secure multiparty computing according to this embodiment, as shown in fig. 1, includes the following steps:
s1: each participant divides data to be shared held by the participant into a first data fragment and a second data fragment, and the sum of the first data fragment and the second data fragment is equal to the data to be shared;
each participant splits the data to be shared held by the participant into a third data fragment and a fourth data fragment again, the sum of the third data fragment and the fourth data fragment is equal to the data to be shared, the value of the third data fragment generated by each participant is different from the value of the first data fragment generated by the participant and the value of the second data fragment, and the value of the fourth data fragment generated by each participant is different from the value of the first data fragment generated by the participant and the value of the second data fragment;
s2: randomly selecting two participants from all the participants by adopting a random decision method as computing nodes, respectively recording the computing nodes as a first computing node and a second computing node, wherein the first computing node and the second computing node form a first computing node group;
randomly selecting two participants from all the participants by adopting a random decision method again to serve as computing nodes, and respectively recording the computing nodes as a third computing node and a fourth computing node, wherein the third computing node and the fourth computing node form a second computing node group;
when two participants serving as the computing nodes in the selected second computing node group are both used as the computing nodes in the first computing node group, all the participants randomly select two participants from all the participants again by adopting a random decision method to serve as the computing nodes until the two participants serving as the computing nodes in the second computing node group are not both used as the computing nodes in the first computing node group;
s3: each participant sends the first data fragment to the first computing node, sends the second data fragment to the second computing node, sends the third data fragment to the third computing node, and sends the fourth data fragment to the fourth computing node.
In step S2, the method for randomly selecting two participants as computing nodes from all the participants by using a random decision method to form a computing node group is as follows:
n1: all the participants are numbered 1, 2 and 3 in sequence, 8230, N, N is more than or equal to 4, and N is the number of the participants;
n2: each participant generates two random numbers and broadcasts the random numbers to other participants, and the value of the random numbers is 0 or 1;
n3: each participant calculates numbers I1 and I2 of two participants as computing nodes according to the received broadcast data, the participants numbered I1 and I2 form a computing node group, the participant numbered I1 serves as a first computing node or a third computing node, and the participant numbered I2 serves as a second computing node or a fourth computing node.
The method for calculating the numbers I1, I2 of the two parties as computation nodes in step N3 is as follows:
n31: all participants negotiate all combination modes of two participants forming a computing node group in advance, 2 participants are randomly selected from N participants to be arranged, N (N-1) combination modes are shared, and the combination modes are numbered as 1, 2 and 3 ... N (N-1) in sequence;
n32: the two random numbers generated by each participant are respectively marked as e and b, and the two random numbers generated by the participant with the number i are respectively marked as ei 、bi ,1≤i≤N;
Each participant calculates a parameter E according to the random numbers E generated by all participants and calculates a parameter B according to the random numbers B generated by all participants;
n33: each participant calculates the number F of the combination mode of the computing node group according to the parameters E and B,
,
;
and obtaining the numbers of the two participants in the computing node group with the combination mode of the number F, wherein the numbers of the two participants are the numbers I1 and I2 of the two participants as the computing nodes.
In the scheme, all participants make a decision to randomly select a first computing node group and a second computing node group together, each computing node group comprises two participants as computing nodes, and no repeated participant exists in the first computing node group and the second computing node group. Each participant splits own data to be shared into two shares and stores the two shares in two computing nodes of a first computing node group, then splits own data to be shared once again and stores the two newly split shares in two computing nodes of a second computing node group.
Using BE Instead of using B directly, it is to prevent any one participant from deliberately sifting through the final selection result by the bits provided by itself, and by introducing an exponent, each participant cannot predict the final F.
When carrying out multi-party safety calculation, two calculation nodes of a first calculation node group cooperate to carry out multi-party safety calculation according to held data fragments and send calculation results to all participants, two calculation nodes of a second calculation node group cooperate to carry out multi-party safety calculation according to held data fragments and send calculation results to all participants, and if the calculation results sent by the first calculation node group and the calculation results sent by the second calculation node group received by the participants are consistent, the calculation results are correct.
Because the two computing nodes of each computing node group can compute the result by data interaction during multi-party security computation, compared with the traditional multi-party secret sharing method, the method has the advantages that the communication efficiency and the computing efficiency are greatly improved under the condition that the number of the participating parties is large, the computing result of the second computing node can be used for verifying the first computing node group, the correctness of the computing result is ensured, and the computing result can be effectively prevented from being interfered by a malicious party in the participating parties. In addition, all the participants as the computing nodes are randomly selected by adopting a random decision method, so that each participant can not predict the selection process of the computing nodes.
By way of example:
the number of the participants is 5, the numbers are 1, 2, 3, 4 and 5 respectively, and the data to be shared held by the participant with the number i is Xi Splitting a first data fragment Xi1 Second data fragment Xi2 Splitting the third data fragment X againi3 Fourth data slice Xi4 ,Xi =Xi1 +Xi2 ,Xi =Xi3 +Xi4 ,1≤i≤5;
All participants negotiate in advance all combination modes of two participants forming the computing node group, and the total number of the combination modes is 5 × 4=20 combination modes, all the combination modes are numbered as 1, 2 and 3 ...20, as shown in figure 2,
each participant generates two random numbers e and b, and the two random numbers generated by the participant with the number i are respectively marked as ei 、bi :
Participant number 1 generates a random number e1 =0,b1 =1;
Participant number 2 generates a random number e2 =1,b2 =0;
Participant number 3 generates a random number e3 =0,b3 =0;
Participant number 4 generates a random number e4 =1,b4 =0;
Participant number 5 generates a random number e5 =1,b5 =1;
Each participant calculates E =26, b =17,
each participant calculates the number F of the combination mode of the computing node group according to the parameters E and B,
F=1726mod 20=9,
the numbers of two participants in the computing node group with the combination mode of thenumber 9 are I1=3 and I2=1, the participant with the number 3 is a first computing node, and the participant with thenumber 1 is a second computing node.
Similarly, all the participants randomly select two participants from all the participants to form a second computing node group again by using the random decision method, if the calculated number F is 2 or 9, both the participants in the second computing node group as computing nodes are also used as computing nodes in the first computing node group, and all the participants randomly select two participants from all the participants as computing nodes again by using the random decision method until the calculated number F is not 2 or 9, and assuming that the calculated number F is 20, the numbers of the two participants in the computing node group with the combination mode of thenumber 20 are I1=5, I2=4, the participant with the number 5 is a third computing node, and the participant with the number 4 is a fourth computing node.
The participant with the number i slices the first data Xi1 Sending the data to the first computing node, and fragmenting the second data Xi2 Sending the third data fragment X to a second computing nodei3 Sending the fourth data fragment X to a third computing nodei4 And sending to the fourth computing node.
When the sum S of the data to be shared of all participants needs to be calculated,
first computing node calculates
,
Second computing node calculates
,
Third computational node is computed
,
The fourth computing node calculates
,
The participant acquires S1 from the first computing node, acquires S2 from the second computing node, calculates the sum of the data to be shared of all participants S = S1+ S2, then acquires S3 from the third computing node, acquires S4 from the fourth computing node, and if S3+ S4= S1+ S2, it indicates that the calculated sum of the data to be shared is correct.
An electronic device of this embodiment includes a memory and a processor, where the memory stores executable code thereon, and when the executable code is executed by the processor, the electronic device performs the above-mentioned multiparty secret sharing method for secure multiparty computing.
Example 2: the multiparty secret sharing method for secure multiparty computation of the embodiment comprises the following steps:
s1: each participant divides data to be shared, which is held by the participant, into a first data fragment and a second data fragment, wherein the sum of the first data fragment and the second data fragment is equal to the data to be shared;
each participant splits the data to be shared held by the participant into a third data fragment and a fourth data fragment again, the sum of the third data fragment and the fourth data fragment is equal to the data to be shared, the value of the third data fragment generated by each participant is different from the value of the first data fragment generated by the participant and the value of the second data fragment, and the value of the fourth data fragment generated by each participant is different from the value of the first data fragment generated by the participant and the value of the second data fragment;
s2: randomly selecting two participants from all the participants by adopting a random decision method as computing nodes, respectively recording the computing nodes as a first computing node and a second computing node, wherein the first computing node and the second computing node form a first computing node group;
randomly selecting two participants from all the participants by adopting a random decision method again to serve as computing nodes, and respectively recording the computing nodes as a third computing node and a fourth computing node, wherein the third computing node and the fourth computing node form a second computing node group;
when two participants serving as the computing nodes in the selected second computing node group are both used as the computing nodes in the first computing node group, all the participants randomly select two participants from all the participants again by adopting a random decision method to serve as the computing nodes until the two participants serving as the computing nodes in the second computing node group are not both used as the computing nodes in the first computing node group;
s3: each participant sends the first data fragment to the first computing node, sends the second data fragment to the second computing node, sends the third data fragment to the third computing node, and sends the fourth data fragment to the fourth computing node.
In step S2, the method for randomly selecting two participants as computing nodes from all the participants by using a random decision method to form a computing node group is as follows:
n1: all the participants are numbered 1, 2 and 3 in sequence, 8230, N, N is more than or equal to 4, and N is the number of the participants;
n2: each participant generates two random numbers and broadcasts the random numbers to other participants, and the value of the random numbers is 0 or 1;
n3: each participant calculates numbers I1 and I2 of two participants as computing nodes according to the received broadcast data, the participants numbered I1 and I2 form a computing node group, the participant numbered I1 serves as a first computing node or a third computing node, and the participant numbered I2 serves as a second computing node or a fourth computing node.
The method for calculating the numbers I1, I2 of the two parties as computation nodes in step N3 is as follows:
n31: the two random numbers generated by each participant are respectively marked as e and b, and the two random numbers generated by the participant with the number i are respectively marked as ei 、bi ,1≤i≤N;
The parameters E and B are calculated,
n32: the parameter R is calculated out as a function of,
n33: the numbers I1, I2 of the two parties acting as computation nodes are calculated,
wherein,
indicating rounding up.
In this embodiment, the method of calculating the numbers I1 and I2 of the two parties as the calculation nodes in step N3 is different from that inembodiment 1, and the rest of the method is the same as that inembodiment 1.
For example, the following steps are carried out:
the number of the participants is 5, the numbers are 1, 2, 3, 4 and 5 respectively, and the data to be shared held by the participant with the number i is Xi Splitting into a first data fragment Xi1 Second data slice Xi2 Splitting the third data fragment X againi3 Fourth data slice Xi4 ,Xi =Xi1 +Xi2 ,Xi =Xi3 +Xi4 ,1≤i≤5;
Each participant generates two random numbers e and b, and the two random numbers generated by the participant with the number i are respectively marked as ei 、bi :
Participant number 1 generates a random number e1 =0,b1 =1;
Participant number 2 generates a random number e2 =1,b2 =0;
Participant number 3 generates a random number e3 =0,b3 =0;
Participant number 4 generates a random number e4 =1,b4 =0;
Participant number 5 generates a random number e5 =1,b5 =1;
Each participant calculates E =26, b =17,
calculate R =1726mod 20=9,
Calculating I1= (8968), 9/(5-1) \ 8969; =3, I2=1,
the participant numbered 3 is a first compute node and the participant numbered 1 is a second compute node.
The 20 numbering combinations of I1I2 are configured into a matrix, as shown in fig. 3, R =9 is equivalent to selecting the 9th numbering combination 31 in the matrix, i.e., I1=3 and I2=1, and the formula of the method can directly calculate the numbers of I1 and I2 corresponding to the 9 th numbering combination.
Similarly, all the participants randomly select two participants from all the participants to form a second computing node group again by using a random decision method, if I1=3, I2=1 or I1=1, I2=3, all the participants randomly select two participants from all the participants to be computing nodes again by using the random decision method until the numbers of the two participants serving as computing nodes in the second computing node group are not I1=3, I2=1 or I1=1, I2=3, and it is assumed that I1=5, I2=4, the participant with the number of 5 is a third computing node, and the participant with the number of 4 is a fourth computing node.
The participant with the number i slices the first data Xi1 Sending the data to the first computing node to fragment the second data Xi2 Sending the third data fragment X to a second computing nodei3 Sending the fourth data fragment X to a third computing nodei4 And sending to the fourth computing node.
An electronic device of this embodiment includes a memory and a processor, where the memory stores executable code thereon, and when the executable code is executed by the processor, the electronic device performs the above-mentioned multiparty secret sharing method for secure multiparty computing.