CN116401423A - Method, device, equipment and medium for determining median based on secure multiparty calculation - Google Patents

Method, device, equipment and medium for determining median based on secure multiparty calculation Download PDF

Info

Publication number
CN116401423A
CN116401423A CN202310364983.6A CN202310364983A CN116401423A CN 116401423 A CN116401423 A CN 116401423A CN 202310364983 A CN202310364983 A CN 202310364983A CN 116401423 A CN116401423 A CN 116401423A
Authority
CN
China
Prior art keywords
secret
sequence
median
target
participant
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310364983.6A
Other languages
Chinese (zh)
Inventor
蔡静轩
包嘉斌
周一竞
黄翠婷
陈涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Bodun Xiyan Technology Co ltd
Original Assignee
Hangzhou Bodun Xiyan Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Bodun Xiyan Technology Co ltd filed Critical Hangzhou Bodun Xiyan Technology Co ltd
Priority to CN202310364983.6A priority Critical patent/CN116401423A/en
Publication of CN116401423A publication Critical patent/CN116401423A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Medical Informatics (AREA)
  • Storage Device Security (AREA)

Abstract

The application provides a median determining method, a median determining device, electronic equipment and a computer readable storage medium based on secure multiparty calculation, which comprise the following steps: each participant encrypts plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data; each participant exchanges a secret piece sequence composed of secret pieces corresponding to the same participant, so that each participant obtains the total number of secret piece sequences of the participants corresponding to the participant; each participant determines a median secret piece corresponding to each secret piece sequence held by the participant, and determines a target secret piece sequence from all secret piece sequences based on the median secret pieces; the median data is determined from the plaintext data held by each of the parties based on the target secret pieces by the parties holding the sequence of target secret pieces. The method and the device can reduce the searching range of the median data in the multiparty privacy computing scene, thereby improving the searching efficiency of the median data.

Description

Method, device, equipment and medium for determining median based on secure multiparty calculation
Technical Field
The embodiment of the application relates to the technical field of secure multiparty computing, in particular to a median determining method, a median determining device, electronic equipment and a computer readable storage medium based on secure multiparty computing.
Background
With the continuous improvement of people's privacy protection consciousness and the continuous perfection of related laws and regulations, the social security requirements on data in circulation and use are more and more strict, and in order to fully protect the security of privacy data held by each party under the condition that a plurality of parties participate in operation, a secure multi-Partycalculation (secure multipart calculation) technology is created. By means of secure multiparty calculation, various operations can be performed based on private data of each party without exposing the private data of each party, so that service requirements can be met, for example, median data in the private data of each party can be determined by the secure multiparty calculation.
Through a secure multiparty computing technology, the respective private data can be provided by a plurality of participants, and through mutual cooperation among the participants, the median data is determined from all the private data of all the participants under the condition that the participants do not expose the private data of themselves to other participants. In order to calculate the median data, all the privacy data are sequenced by cooperation of all the participants, and then the privacy data in the middle position are selected from the sequencing result as the median data.
However, in a specific service, the data volume of the private data is often larger, so that the operation volume required for ordering all the private data held by each participant in the secure multiparty calculation is higher, and therefore, the median searching efficiency of the private data is lower in the secure multiparty calculation scene at present.
Disclosure of Invention
The embodiment of the application provides a median determining method, device, electronic equipment and computer readable storage medium based on secure multiparty calculation, so as to solve the problem of lower median efficiency of searching private data in a secure multiparty calculation scene in the related technology.
In a first aspect, an embodiment of the present application provides a method for determining a median based on secure multiparty computation, the method including:
each participant encrypts plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments which respectively correspond to different participants in total quantity of the participants;
each participant exchanges a secret piece sequence composed of secret pieces corresponding to the same participant, so that each participant obtains the total number of secret piece sequences of the participants corresponding to the participant;
Each participant determines a median secret piece corresponding to each secret piece sequence held by the participant, and determines a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences;
and determining, by the parties holding the sequence of target secret shards, median data of plaintext data held by the respective parties based on the target secret shards.
In an optional implementation manner, the encrypting the plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data includes:
sequencing plaintext data held by the participant to obtain a plaintext sequence;
encrypting each plaintext data in the plaintext sequence to obtain a ciphertext sequence formed by ciphertext data corresponding to each plaintext data; the arrangement sequence of the ciphertext data in the ciphertext sequence is the same as the arrangement sequence of the plaintext data corresponding to the ciphertext data in the plaintext sequence.
In an alternative embodiment, the exchanging a sequence of secret patches consisting of secret patches corresponding to the same participant, causing each participant to obtain a total number of secret patch sequences of the participants corresponding to the present participant, includes:
Extracting all secret fragments corresponding to each participant from a ciphertext sequence held by the participant to obtain a secret fragment sequence corresponding to each participant, wherein the arrangement sequence of the secret fragments in the secret fragment sequence is the same as the arrangement sequence of the secret fragments in the ciphertext sequence;
transmitting the sequence of secret fragments to a corresponding participant;
and obtaining the secret fragment sequences corresponding to the participants from each other participant, and obtaining the total secret fragment sequences of the participants.
In an alternative embodiment, the determining a target secret patch sequence from all secret patch sequences based on the median secret patch includes:
determining a secret patch sequence corresponding to the largest median secret patch in the median secret patches as a first secret patch sequence, and determining a secret patch sequence corresponding to the smallest median secret patch in the median secret patches as a second secret patch sequence;
removing the secret patches larger than the maximum median secret patch in the first secret patch sequence to obtain a third secret patch sequence;
removing the secret patches smaller than the minimum median secret patch in the second secret patch sequence to obtain a fourth secret patch sequence;
A target sequence of secret patches is determined based on the third sequence of secret patches and the fourth sequence of secret patches.
In an alternative embodiment, the target clandestine fragment sequence includes a first target clandestine fragment sequence and a second target clandestine fragment sequence, and the determining the target clandestine fragment sequence based on the third clandestine fragment sequence and the fourth clandestine fragment sequence includes:
determining other median secret patches corresponding to each secret patch sequence in other secret patch sequences except the first secret patch sequence and the second secret patch sequence; wherein the other secret patch sequences include the third secret patch sequence and the fourth secret patch sequence, and of the all secret patch sequences, secret patch sequences other than the first secret patch sequence and the second secret patch sequence;
the first target clandestine fragment sequence and the second target clandestine fragment sequence are determined from the other clandestine fragment sequences based on the other median clandestine fragments.
In an alternative embodiment, the determining median data of plaintext data held by each participant based on the target secret piece includes:
Determining a target median clandestine fragment based on the first target clandestine fragment sequence and the second target clandestine fragment sequence; the target median stealth fragments are median stealth fragments of all stealth fragments in the first target stealth fragment sequence and the second target stealth fragment sequence;
decrypting the median secret shard by the party corresponding to the median secret shard to obtain the median data.
In an alternative embodiment, the determining a target median clandestine fragment based on the first target clandestine fragment sequence and the second target clandestine fragment sequence includes:
determining, by a participant in possession of the first sequence of target clandestine fragments and a participant in possession of the second sequence of target clandestine fragments, the target median clandestine fragments from the first sequence of target clandestine fragments and the second sequence of target clandestine fragments based on a binary search algorithm.
In a second aspect, embodiments of the present application provide a median determining apparatus based on secure multiparty computation, the apparatus comprising:
the encryption module is used for encrypting the plaintext data held by the participant through each participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments which respectively correspond to different participants in total quantity of the participants;
The exchange module is used for exchanging a secret fragment sequence formed by secret fragments corresponding to the same party through each party so that each party can acquire the total number of secret fragment sequences of the parties corresponding to the party;
the screening module is used for determining a median secret piece corresponding to each secret piece sequence held by the participant through each participant, and determining a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences;
and the searching module is used for determining the median data of the plaintext data held by each participant based on the target secret shard by the participant holding the target secret shard sequence.
In an alternative embodiment, the encryption module includes:
the sequencing sub-module is used for sequencing the plaintext data held by the participant to obtain a plaintext sequence;
the encryption sub-module is used for encrypting each plaintext data in the plaintext sequence to obtain a ciphertext sequence formed by ciphertext data corresponding to each plaintext data; the arrangement sequence of the ciphertext data in the ciphertext sequence is the same as the arrangement sequence of the plaintext data corresponding to the ciphertext data in the plaintext sequence.
In an alternative embodiment, the switching module includes:
the sequence extraction sub-module is used for extracting all secret fragments corresponding to each participant from a ciphertext sequence held by the participant to obtain a secret fragment sequence corresponding to each participant, and the arrangement sequence of the secret fragments in the secret fragment sequence is the same as the arrangement sequence of the secret fragments in the ciphertext sequence;
a sequence sending sub-module, configured to send the secret fragment sequence to a corresponding participant;
and the sequence acquisition sub-module is used for acquiring the secret fragment sequences corresponding to the participants from all other participants to obtain the total secret fragment sequences of the participants.
In an alternative embodiment, the screening module includes:
a sequence screening sub-module, configured to determine a secret patch sequence corresponding to a largest median secret patch among the median secret patches as a first secret patch sequence, and determine a secret patch sequence corresponding to a smallest median secret patch among the median secret patches as a second secret patch sequence;
a first fragment removing sub-module, configured to remove a secret fragment in the first secret fragment sequence that is greater than the maximum median secret fragment, to obtain a third secret fragment sequence;
A second fragment removing sub-module, configured to remove a secret fragment smaller than the minimum median secret fragment in the second secret fragment sequence, to obtain a fourth secret fragment sequence;
and the target secret patch sequence submodule is used for determining a target secret patch sequence based on the third secret patch sequence and the fourth secret patch sequence.
In an alternative embodiment, the target clandestine fragment sequence comprises a first target clandestine fragment sequence and a second target clandestine fragment sequence, the target clandestine fragment sequence submodule comprising:
other median secret patch sub-modules for determining other median secret patches corresponding to each secret patch sequence among other secret patch sequences except for the first secret patch sequence and the second secret patch sequence; wherein the other secret patch sequences include the third secret patch sequence and the fourth secret patch sequence, and of the all secret patch sequences, secret patch sequences other than the first secret patch sequence and the second secret patch sequence;
a target clandestine sequence determination submodule for determining the first target clandestine sequence and the second target clandestine sequence from the other clandestine sequences based on the other median clandestine fragments.
In an alternative embodiment, the search module includes:
a target median clandestine searching sub-module for determining a target median clandestine based on the first target clandestine sequence and the second target clandestine sequence; the target median stealth fragments are median stealth fragments of all stealth fragments in the first target stealth fragment sequence and the second target stealth fragment sequence;
and the decryption sub-module is used for decrypting the median secret shard by the participant corresponding to the median secret shard to obtain the median data.
In an alternative embodiment, the target median secret shard search submodule includes:
a binary search sub-module for determining the target median secret shard from the first target secret shard sequence and the second target secret shard sequence based on a binary search algorithm by a party holding the first target secret shard sequence and a party holding the second target secret shard sequence.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method of median determination based on secure multiparty computing.
In a fourth aspect, embodiments of the present application also provide a computer-readable storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the method of median determination based on secure multiparty computation.
In the embodiment of the application, each participant encrypts plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data consists of secret fragments which respectively correspond to different participants in total quantity of the participants; each participant exchanging a sequence of secret shards, the sequence of secret shards being made up of secret shards corresponding to the same participant; each participant obtains a total number of secret fragment sequences of the participants corresponding to the participant; each participant determines a median secret piece corresponding to each secret piece sequence held by the participant, and determines a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences; the median data is determined from the plaintext data held by each of the parties based on the target secret pieces by the parties holding the sequence of target secret pieces. According to the method and the device, the secret fragment sequences corresponding to the secret data can be exchanged among all the participants, so that all the participants hold part of the secret fragment sequences of all the participants, then the target secret fragment sequences possibly with the median data are screened out from the secret fragment sequences, and finally the median data are screened out from the target secret fragment sequences.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart of steps of a method for determining a median based on secure multiparty computing provided in an embodiment of the present application;
FIG. 2 is a diagram of a median determining device based on secure multiparty computing according to an embodiment of the present application;
FIG. 3 is a logical block diagram of an electronic device of one embodiment provided by embodiments of the present application;
fig. 4 is a logic block diagram of an electronic device of another embodiment provided by an embodiment of the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a flowchart of steps of a median determining method based on secure multiparty computing, provided in an embodiment of the present application, applied to any party in a secure multiparty computing scenario, as shown in fig. 1, the method includes:
step 101, each participant encrypts plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data; wherein the ciphertext data is composed of secret fragments respectively corresponding to different participants by the total amount of the participants.
In the embodiment of the present application, the application scenario may be a scenario in which privacy computation is performed under the circumstance of participation of multiple parties, where research of secure multiparty computation (secure multi-Party Computation) is mainly a problem of completing computation by using local data of each party under the circumstance of no trusted third party. In a multiparty secure computing scenario, at least two participants may be included, and for convenience of discussion, the present application explains a scenario based on three participants (participant P0, participant P1, and participant P2), and it should be noted that the present scenario does not limit the number of participants.
Each party may hold plaintext data. For example, for party P i Its local plain data set (privacy data) is
Figure BDA0004166402540000081
The set contains k plaintext data.
Each party can encrypt the local plaintext data to obtain ciphertext data corresponding to each plaintext data, wherein the ciphertext data is composed of the total number of secret fragments respectively corresponding to different parties, that is, one party can encrypt the local plaintext data, so that the secret fragments corresponding to the local plaintext data of the party are generated for each party in the whole scene. For example, for party P i Which can hold a plaintext data set for its own party
Figure BDA0004166402540000082
Each plaintext data in the ciphertext data set is encrypted to obtain a ciphertext data set
Figure BDA0004166402540000083
The ciphertext data set also comprises k ciphertext data corresponding to the plaintext data one by one.
In the embodiment of the present application, each ciphertext data may be formed by a total number of secret patches of the participants, which respectively correspond to different participants, that is, each ciphertext data includes a total number of secret patches of the participants, and the secret patches in each ciphertext data have a one-to-one correspondence with the participants. For example, in the case where the total number of participants is 3 (participants P0, P1, and P2), the ciphertext data in the ciphertext data set of the above example
Figure BDA0004166402540000084
May include a secret piece->
Figure BDA0004166402540000085
Wherein the secret piece->
Figure BDA0004166402540000086
Corresponding to party P0,/or->
Figure BDA0004166402540000087
Corresponding to party P1,/or->
Figure BDA0004166402540000088
Corresponding to party P2.
Specifically, encryption algorithms such as homomorphic encryption algorithm (Homomorphic Encryption, HE), advanced encryption standard algorithm (Advanced Encryption Standard, AES), data encryption standard algorithm (Data Encryption Standard) and the like may be used to encrypt the plaintext data to obtain ciphertext data corresponding to each plaintext data, which is not particularly limited in the embodiment of the present application.
Optionally, step 101 may include:
in step 1011, the plaintext data held by the present participant is ordered to obtain a plaintext sequence.
In the embodiment of the present application, to facilitate the subsequent operation (determining the median from the secret shard and using the binary search algorithm), the plaintext data held by the present party may be ordered by each party before processing the plaintext data, so as to obtain a plaintext sequence in sequential (from big to small or from small to big) arrangement.
For example, if the party P1 holds 4 plaintext data of "2.3", "4.8", "3.9", "3.2", and sequences the 4 plaintext data, a plaintext sequence [2.3 ] can be obtained; 3.2;3.9;4.8].
Step 1012, encrypting each plaintext data in the plaintext sequence to obtain a ciphertext sequence formed by ciphertext data corresponding to each plaintext data; the arrangement sequence of the ciphertext data in the ciphertext sequence is the same as the arrangement sequence of the plaintext data corresponding to the ciphertext data in the plaintext sequence.
In this embodiment of the present application, after each participant obtains a respective plaintext sequence, encryption processing may be sequentially performed on plaintext data according to an arrangement sequence of the plaintext data in the plaintext sequence, so as to obtain ciphertext data corresponding to the plaintext data, and the ciphertext data corresponding to each plaintext data may be ordered according to an order of the plaintext data corresponding to the ciphertext data in the plaintext sequence, so as to obtain a ciphertext sequence.
Step 102, each participant exchanges a secret piece sequence composed of secret pieces corresponding to the same participant, so that each participant obtains the total number of secret piece sequences of the participants corresponding to the participant.
In the embodiment of the application, in order to enable each party to determine the median from the plaintext data held by all the parties through cooperative calculation under the condition that the plaintext data is not mutually exposed among the parties, the parties can exchange secret fragment sequences held by each party, so that each party obtains the total number of secret fragment sequences corresponding to the party from other parties except the party, and each party holds the total number of secret fragment sequences corresponding to the party.
Wherein the sequence of secret shards consists of all secret shards held by one participant that correspond to the same participant.
For example, it is necessary to research payroll evaluation of an industry, and it is necessary to perform joint statistical analysis based on employee payroll data of three representative enterprises in the industry to obtain statistical indexes such as median. In order to protect salary data of the enterprises, the method for calculating the median of the secure multiparty can be used for determining the median data in the full salary data of the enterprises on the premise of not exposing the self data of the enterprises.
For example, in case of a total of 3 participants (participants P0, P1 and P2), the participant P0 holds a plaintext data set
Figure BDA0004166402540000091
Then the generated ciphertext data set +.>
Figure BDA0004166402540000101
The distribution of ciphertext fragments contained in ciphertext data is as follows: ciphertext data->
Figure BDA0004166402540000102
Ciphertext data->
Figure BDA0004166402540000103
Ciphertext data->
Figure BDA0004166402540000104
Then of all the clandestine fragments held by party P0, clandestine fragments +.>
Figure BDA0004166402540000105
And->
Figure BDA0004166402540000106
All corresponding to party P0, secret shards
Figure BDA0004166402540000107
And->
Figure BDA0004166402540000108
All corresponding to party P1, secret shard->
Figure BDA0004166402540000109
And->
Figure BDA00041664025400001010
Corresponding to party P2. That is to say +>
Figure BDA00041664025400001011
Constructing a sequence of secret fragments [ x ] corresponding to the party P0 0 ] 0 The secret shard sequence contains all secret shards generated by the party P0 and corresponding to the party P0;
Figure BDA00041664025400001012
constructing a sequence of secret fragments [ x ] corresponding to the party P1 0 ] 1 All the secret patches generated by the party P0 and corresponding to the party P1 are contained in the sequence of secret patches; />
Figure BDA00041664025400001013
Constructing a sequence of secret fragments [ x ] corresponding to the party P2 0 ] 2 All the secret fragments generated by the party P0 and corresponding to the party P2 are contained in the sequence of secret fragments.
Continuing the above example, the sequence of secret fragments held by party P0 before exchange is [ x ] 0 ] 0 、[x 0 ] 1 And [ x ] 0 ] 2 The sequence of secret fragments held by party P1 before exchange is [ x ] 1 ] 0 、[x 1 ] 1 And [ x ] 1 ] 2 The sequence of secret fragments held by the party P2 before exchange is [ x ] 2 ] 0 、[x 2 ] 1 And [ x ] 2 ] 2 . Party P0 will correspond to the sequence of secret fragments [ x ] of party P1 0 ] 1 Sharing to party P1 will correspond to the secret shard sequence [ x ] of party P2 0 ] 2 Sharing to the party P2, preserving on its own the secret fragment sequence [ x ] corresponding to the party itself 0 ] 0 Since the other participants also perform the same actions, participant P0 can also obtain from participant P1 a secret shard sequence [ x ] corresponding to the present participant 1 ] 0 Obtaining a sequence of secret fragments [ x ] corresponding to the present party from party P2 2 ] 0 So that the party P0 can obtain all 3 secret patch sequences [ x ] corresponding to the party 0 ] 0 、[x 1 ] 0 、[x 2 ] 0 Party P1 may obtain all 3 secret patch sequences [ x ] corresponding to the party 0 ] 1 、[x 1 ] 1 、[x 2 ] 1 Party P2 may obtain all 3 secret patch sequences [ x ] corresponding to the party 0 ] 2 、[x 1 ] 2 、[x 2 ] 2
Optionally, step 102 may include:
and step 1021, extracting all secret fragments corresponding to each participant from the ciphertext sequence held by the participant to obtain a secret fragment sequence corresponding to each participant, wherein the arrangement sequence of the secret fragments in the secret fragment sequence is the same as that of the secret fragments in the ciphertext sequence.
In the embodiment of the application, since the ciphertext data are arranged in the ciphertext sequence according to a certain order, in the generated secret fragment sequence, the secret fragments in the ciphertext sequence can be ordered according to the order of the corresponding ciphertext data in the ciphertext sequence, so that the calculation efficiency of subsequent median data is improved.
Specifically, all secret fragments corresponding to each participant can be extracted from the ciphertext sequence held by the participant to obtain a secret fragment sequence corresponding to each participant, and the arrangement sequence of the secret fragments in the secret fragment sequence is the same as the arrangement sequence of the secret fragments in the ciphertext sequence.
For example, if the overall system includes three parties P0, P1 and P2, party P0 holds a ciphertext sequence [ a, b, c ], where ciphertext a includes secret pieces (a 1, a2, a 3), ciphertext b includes secret pieces (b 1, b2, b 3), and ciphertext c includes secret pieces (c 1, c2, c 3). Where ciphertext fragment a1 corresponds to participant P0, ciphertext fragment a2 corresponds to participant P1, ciphertext fragment b1 corresponds to participant P0, and so on.
The secret patch extraction of the ciphertext sequence in the above example may result in a secret patch sequence [ a1, b1, c1] corresponding to the party P0, a secret patch sequence [ a2, b2, c2] corresponding to the party P1, and a secret patch sequence [ a3, b3, c3] corresponding to the party P2. It can be seen that the order of arrangement of individual secret fragments in the sequence of secret fragments is the same as its order in the sequence of ciphertext.
Sub-step 1022, sends the secret shard sequence to the corresponding participant.
In the embodiment of the application, each party can generate a secret fragment sequence corresponding to each party one by one based on plaintext data of the party. The secret shard sequences corresponding to the other participants may be sent to the corresponding participants and the secret shard sequences corresponding to the present participant may be retained.
For example, if the plaintext data is processed by the party P0, a sequence of secret patches [ a1, b1, c1] corresponding to the party P0, a sequence of secret patches [ a2, b2, c2] corresponding to the party P1, and a sequence of secret patches [ a3, b3, c3] corresponding to the party P2 are obtained. The sequence of secret patches [ a2, b2, c2] is sent by the party P0 to the party P1, the sequence of secret patches [ a3, b3, c3] is sent to the party P2, and the sequence of secret patches [ a1, b1, c1] is reserved.
Sub-step 1023, obtaining the secret patch sequences corresponding to the present participants from each other participant, and obtaining the total number of secret patch sequences of the participants.
Accordingly, each participant can obtain the secret fragment sequences corresponding to the participant from other participants except the participant, so that each participant can finally obtain the total secret fragment sequences of the participants.
Step 103, each participant determines a median secret piece corresponding to each secret piece sequence held by the participant, and determines a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences.
In the embodiment of the application, in order to improve the efficiency of determining the median data, the secret fragment sequences held by each participant can be reduced, the secret fragment sequences which do not contain the secret fragments corresponding to the median data are removed, the target secret fragment sequences with a small number are obtained, and the median data are determined through the target secret fragment sequences, so that the operation amount of determining the median data from the total plaintext data is reduced.
Specifically, each party can determine the median clash fragments corresponding to each clash fragment sequence held by the party, then based on the median clash fragments, remove the clash fragments in the clash fragment sequences meeting the conditions, re-determine the corresponding median clash fragments for the updated clash fragment sequences, remove the clash fragments in the clash fragment sequences meeting the conditions again, and remove the clash fragment sequences from which all the clash fragments are removed by repeatedly executing the operations until a target clash fragment sequence with a smaller number remains.
Optionally, step 103 may include:
sub-step 1031, determining a secret patch sequence corresponding to a largest median secret patch of the median secret patches as a first secret patch sequence, and determining a secret patch sequence corresponding to a smallest median secret patch of the median secret patches as a second secret patch sequence.
Each participant can process all secret fragment sequences held by the participant to obtain median secret fragments respectively corresponding to all secret fragment sequences held by the participant. The specific process comprises the following steps A1 to A6:
a1, each participant can define a variable array, and the variable array is used for recording all median fragments calculated by one participant, the position information of the median fragments in the secret fragment sequence, and the sequence number of the secret fragment sequence in which the median fragments are located (the sequence number is needed to be used for characterizing which participant the secret fragment sequence comes from).
For example, the array variables may include the following three variables:
Figure BDA0004166402540000121
wherein m is all The number of fragments in the middle of the record,
Figure BDA0004166402540000122
recording the position of the median fragment in the sequence of secret fragments, arodx all And the sequence number is used for recording the secret fragment sequence in which the median fragment is positioned.
A2, traversing each secret fragment sequence, determining the position of the median fragment corresponding to each secret fragment and the position of the median fragment in the secret fragment sequence, and recording the positions in the variable array.
For example, this can be achieved by:
foreachj∈[0,...n]do;
Figure BDA0004166402540000131
wherein foreach is used to traverse the secret shard sequence of each participant, n is equal to 3 if there are 3 participants. media may be used to calculate the jth sequence of secret fragments
Figure BDA0004166402540000132
Median m of (2) j And its location information (i.e. subscript) idx in the sequence of secret fragments j
A3, determining the median secret fragment m j Position information idx of median secret shard in secret shard sequence j And storing the subscript j of the secret patch sequence corresponding to the median secret patch into the variable array.
For example, this can be achieved by:
m all .append(m j );
idx all [m j ]=idx j
arridx all [m j ]=j;
a4, from m all And querying the maximum median secret piece in all stored median secret pieces, and determining the position information of the maximum median secret piece in the secret piece sequence and the sequence number of the secret piece sequence where the maximum median secret piece is located.
For example, this can be achieved by:
m mmax =max(m all );
idx max =idx all [m max ];
arridx max =arridx all [m max ];
wherein m is max Representing maximum median secret shards, idx max Representing a maximum median secret piece in a sequencePosition information in (a) and arodx max Representing the sequence number of the sequence in which the largest median secret piece is located.
A5, determining the minimum median secret piece in a similar manner, and determining the position information of the minimum median secret piece in the secret piece sequence and the sequence number of the secret piece sequence where the minimum median secret piece is located.
m min =min(m all );
idx min =idx all [m min ];
arridx min =arridx all [m min ];
Wherein m is min Representing minimum median secret shards, idx min Representing position information of minimum median secret chips in a sequence, arodx min Representing the sequence number of the sequence in which the smallest median secret piece is located.
A6, the above-mentioned Arridx is obtained max Determining the indicated secret patch sequence as a first secret patch sequence, and determining the arodx min The indicated sequence of secret patches is determined as a second sequence of secret patches.
Sub-step 1032, removing the secret piece greater than the maximum median secret piece in the first secret piece sequence to obtain a third secret piece sequence.
After determining the first sequence of secret patches, all secret patches in the first sequence of secret patches that are greater than the maximum median secret patches may be removed to obtain a third sequence of secret patches that includes fewer secret patches.
Since the median data in the plaintext data of all the parties cannot be within a range greater than the maximum median secret piece in the first sequence of secret pieces, the sequence in which the maximum median secret piece is located is targeted
Figure BDA0004166402540000141
And discarding the secret fragments larger than the maximum median secret fragments according to the position information of the maximum median in the array.
Specifically, the above operations may be implemented using a slice function:
Figure BDA0004166402540000142
The slice function may segment the secret fragment sequence of the participant, for the first secret fragment sequence with the maximum median
Figure BDA0004166402540000143
Only fragments smaller than the maximum median are retained, resulting in a third sequence of secret fragments.
Sub-step 1033, removing the secret patches smaller than the minimum median secret patch in the second secret patch sequence, to obtain a fourth secret patch sequence.
After determining the second sequence of secret patches, all secret patches in the second sequence of secret patches that are smaller than the minimum median secret patches may be removed, resulting in a fourth sequence of secret patches that includes fewer secret patches.
Since the median data in the plaintext data of all the parties cannot be within a range smaller than the minimum median secret piece in the second sequence of secret pieces, the sequence in which the minimum median secret piece is located is targeted for
Figure BDA0004166402540000144
Then a secret piece smaller than the median secret piece is discarded based on the location information of the smallest median in the array.
Specifically, the above operations may be implemented using a slice function:
Figure BDA0004166402540000151
the slice function may segment a secret fragment sequence of the participant, and for a second secret fragment sequence where the minimum median is located
Figure BDA0004166402540000152
Only the secret patches larger than the minimum median are retained, resulting in a fourth sequence of secret patches.
Substep 1034 determines a target sequence of clash fragments based on the third sequence of clash fragments and the fourth sequence of clash fragments.
In this embodiment of the present application, the third secret patch sequence may be used to replace the first secret patch sequence, the fourth secret patch sequence may be used to replace the second secret patch sequence, the methods in the sub-steps 1031 to 1032 are run again, the secret patch sequence in which the maximum median secret patch and the minimum median secret patch are located is searched again, and then the secret patches therein are cut and removed.
After the first round of secret piece removing operation is finished, continuing to determine other median secret pieces corresponding to each secret piece sequence in other secret piece sequences except the first secret piece sequence and the second secret piece sequence; wherein the other secret patch sequences include a third secret patch sequence and a fourth secret patch sequence, and the secret patch sequences other than the first secret patch sequence and the second secret patch sequence among all the secret patch sequences.
And determining a first target secret patch sequence and a second target secret patch sequence from the other secret patch sequences based on the other median secret patches.
In this embodiment of the present application, the above algorithm may be repeatedly executed to discard the secret patch sequences from which all secret patches are removed until only the secret patch sequences of two participants remain, and since the secret patches corresponding to the median data only exist in the secret patch sequences of two participants at most, the median data may be determined from the secret patch sequences of only the remaining two participants.
Step 104, determining, by the participants holding the sequence of target secret shards, median data of plaintext data held by each participant based on the target secret shards.
In this embodiment of the present application, through the above steps, the secret piece sequences existing in the median data may be reduced, so that the search range of the median data is reduced to the target secret piece sequences, in this embodiment of the present application, the number of the target secret piece sequences is less than the total number of the participants, for example, in the case that the number of the participants is 10, the number of the secret piece sequences held by each participant is 10, in this embodiment of the present application, the 10 secret piece sequences may be reduced to two target secret piece sequences, and then the median data is searched from the two target secret piece sequences, so that the operand of searching the median data is greatly reduced, and the operation efficiency is improved.
Optionally, step 104 may include:
a substep 1041 of determining a target median clandestine based on the first target clandestine sequence and the second target clandestine sequence; the target median secret piece is the median secret piece of all secret pieces in the first target secret piece sequence and the second target secret piece sequence.
In this embodiment of the present application, the number of target clandestine fragment sequences may be set to two, and in the above step 103, clandestine fragments in the clandestine fragment sequences may be removed, and clandestine fragment sequences without clandestine fragments (clandestine fragment sequences in which all clandestine fragments are removed) may be discarded until two clandestine fragment sequences remain, and the two clandestine fragment sequences are determined as target clandestine fragment sequences, wherein one first target clandestine fragment sequence and one second target clandestine fragment sequence may be included.
The first target secret piece sequence and the second target secret piece sequence can be taken as a whole, and the target median secret piece which is the median secret piece of all secret pieces in the first target secret piece sequence and the second target secret piece sequence can be determined.
Optionally, the target median secret piece is determined from the first sequence of target secret pieces and the second sequence of target secret pieces based on a binary search algorithm by a participant holding the first sequence of target secret pieces and a participant holding the second sequence of target secret pieces.
A binary search algorithm (BinarySearch) is applied to the sequence (i.e. wherein the elements are arranged in order of magnitude), which algorithm first compares the element value in the middle of the sequence with a target value and returns the position of the element value in the sequence if the target value matches the element value. If the target value is less than the element value, the search continues in the first half of the sequence, whereas the search continues in the second half of the sequence to find an element value that matches the target value. Thus, the binary search algorithm can eliminate half elements which cannot possibly contain the target value in each iteration, so that the search of the sequence can be completed with higher efficiency.
Specifically, given a positive sequence a, and a target value T, the processing logic of the binary search algorithm may be as follows in steps S1 to S6:
s1, setting L as 0, R as n-1, wherein n is the number of elements of the sequence A; where L represents the index of the first element in sequence a and R represents the index of the last element in sequence a.
S2, if L > R, the search algorithm is terminated.
S3, calculating an element subscript m=floor ((L+R)/2) of the sequence A at the middle position; wherein floor represents a rounding down.
S4, if Am is smaller than T, setting L to be m+1 and returning to the step S2.
S5, if A m Setting R to m-1 and returning to step S2.
S6, if A m And (3) after the search is finished, outputting m.
It can be seen that the binary search algorithm has higher operation efficiency due to the time complexity log (n). Wherein the time complexity is used to qualitatively describe the run time of an algorithm when processing a particular task. In the embodiment of the present application, the median data may be searched in the above target secret fragment sequence by a binary search algorithm, and the specific process is as follows steps B1 to B7:
b1, determining the length of each target secret fragment sequence.
For example, in the case where the target secret patch sequence includes a first target secret patch sequence (nums 1) and a second target secret patch sequence (nums 2), one exemplary code of step B1 may be as follows:
m,n=len(nums1),len(nums2);
where m, n denote the lengths of arrays num 1 and num 2, respectively, and len () denotes a function that calculates the array length. Since each target secret piece sequence is a sequence in which elements are already arranged in order of size, nums1 and nums2 are already arranged in order.
B2, initializing a median subscript variable, initializing a traversal position variable and initializing a traversal cut-off variable.
For example, an exemplary code for step B2 may be as follows:
half=(m+n+1)//2;
left,right=0,m;
half represents a median subscript variable, left is a traversal position variable, right is a traversal cut-off variable, and the traversal position variable and the traversal cut-off variable are initialized and respectively assigned to 0 and m.
And B3, under the condition that the traversing position variable is smaller than the traversing cut-off variable, calculating the middle position index of the first target secret piece sequence according to the traversing position variable and the traversing cut-off variable, calculating the middle position index of the second target secret piece sequence according to the middle position index variable and the middle position index of the first target secret piece sequence, if the secret piece corresponding to the middle position index of the first target secret piece sequence is smaller than the previous secret piece corresponding to the middle position index of the second target secret piece sequence, updating the value of the traversing position variable to be 1 added to the middle position index of the first target secret piece sequence, otherwise, updating the value of the traversing cut-off variable to be the middle position index of the first target secret piece sequence. By continually cycling through the above process until the traversal position variable is no longer less than the traversal cut-off variable.
For example, an exemplary code for step B3 may be as follows:
Figure BDA0004166402540000181
where i represents the intermediate position index of the first sequence of target secret patches and j represents the intermediate position index of the second sequence of target secret patches.
And B4, after the circulation is finished, updating the middle position of the first target secret piece sequence into a traversing position variable, and updating the middle position of the second target secret piece sequence into a difference value between a middle index variable and the traversing position variable. The intermediate position of the first target secret piece sequence thus divides the first target secret piece sequence into two parts, the left part being to the left of the number of digits therein and the right part being to the right of the number of digits therein. Similarly, the intermediate position index of the second target secret piece sequence divides the second target secret piece sequence into two parts, a left part being on the left of the median and a right part being on the right of the median.
For example, an exemplary code for step B4 may be as follows:
i=left;
j=half-left;
and B5, if the middle position of the first target secret patch sequence is equal to 0, indicating that all the secret patches in the first target secret patch sequence are larger than the actual middle secret patches, so that the first middle secret patch can be determined as the secret patch of the second target secret patch sequence, and the subscript is the secret patch of the intermediate position subscript previous to the second target secret patch sequence. Similarly, if the middle position of the second target secret patch sequence is equal to 0, it is indicated that all the secret patches in the first target secret patch sequence are smaller than the actual median secret patches, so that the first median secret patch can be determined as the secret patch of the first target secret patch sequence, and the subscript is the secret patch of the first bit of the intermediate position subscript of the first target secret patch sequence. Otherwise, determining the larger secret piece between the secret piece of the previous bit of the middle position index of the first target secret piece sequence and the secret piece of the previous bit of the middle position index of the second target secret piece sequence as the first middle-digit secret piece.
For example, an exemplary code of step B5 may be as follows:
Figure BDA0004166402540000191
where mid1 represents the first median secret piece.
B6, if the total number of the secret patches of the first target secret patch sequence and the second target secret patch sequence is odd, directly determining the first median secret patch as the actual median secret patch.
For example, an exemplary code of step B6 may be as follows:
if(m+n)%2==1;
return mid1;
the return of the first median secret piece mid1 is the output of the median secret piece finally calculated.
And B7, if the middle position of the first target secret patch sequence is equal to the length of the first target secret patch sequence, indicating that all secret patch sequences in the first target secret patch sequence are smaller than the actual middle secret patch, determining the second middle secret patch as a secret patch with a subscript as a subscript of the middle position of the second target secret patch sequence in the second target secret patch sequence. Similarly, if the intermediate position of the second target clandestine fragment sequence is equal to the length of the second target clandestine fragment sequence, it is indicated that all clandestine fragments in the second target clandestine fragment sequence are smaller than the actual median clandestine fragments, so that the second median clandestine fragment can be determined as the clandestine fragment with the subscript as the subscript of the intermediate position of the first target clandestine fragment sequence in the first target clandestine fragment sequence. Otherwise, determining the larger stealth fragment between the stealth fragment of the intermediate position index of the first target stealth fragment sequence and the stealth fragment of the intermediate position index of the second target stealth fragment sequence as the second intermediate stealth fragment. And finally, determining the average value of the first median secret piece and the second median secret piece as the actual median secret piece.
For example, an exemplary code for step B7 may be as follows:
ifi==m:mid2=nums2[j];
elifj==n:mid2=nums1[i];
else:mid2=min(nums1[i], nums2[j]);
return(mid1+mid2)/2;
where mid2 represents the second median secret shard.
And step 1042, decrypting the median secret piece by the participant corresponding to the median secret piece to obtain the median data.
Since each secret shard is generated by one party from the private data held by the party and sent to the corresponding party. Therefore, after the median secret piece is obtained, according to the secret piece sequence where the median secret piece is located, which party the privacy data corresponding to the median secret piece belongs to can be determined, and thus the party corresponding to the median secret piece can be determined.
Specifically, a participant in the target secret piece sequence corresponding to the median secret piece determines a source participant of the target secret piece, then sends the median secret piece to the source participant, and the source participant identifies and determines privacy data corresponding to the target secret piece, wherein the privacy data corresponding to the target secret piece is the median data in all the privacy data held by all the participants. And then the source participant synchronizes the median data to other participants, so that the safe privacy calculation of the median data is completed.
In summary, the method for determining the median based on secure multiparty computation provided for the embodiment of the application includes: each participant encrypts plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments respectively corresponding to different participants in total quantity of the participants; each participant exchanges a secret piece sequence composed of secret pieces corresponding to the same participant, so that each participant obtains the total number of secret piece sequences of the participants corresponding to the participant; each participant determines a median secret piece corresponding to each secret piece sequence held by the participant, and determines a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences; the median data is determined from the plaintext data held by each of the parties based on the target secret pieces by the parties holding the sequence of target secret pieces. According to the method and the device, the secret fragment sequences corresponding to the secret data can be exchanged among all the participants, so that all the participants hold part of the secret fragment sequences of all the participants, then the target secret fragment sequences possibly with the median data are screened out from the secret fragment sequences, and finally the median data are screened out from the target secret fragment sequences.
Corresponding to the method provided by the embodiment of the median determining method based on secure multiparty calculation of the present invention, referring to fig. 2, the present invention further provides a median determining device structure diagram based on secure multiparty calculation, which includes:
the encryption module 201 is configured to encrypt plaintext data held by each participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments which respectively correspond to different participants in total quantity of the participants;
a switching module 202, configured to switch, by each participant, a secret piece sequence formed by secret pieces corresponding to the same participant, so that each participant obtains a total number of secret piece sequences of the participants corresponding to the participant;
a screening module 203, configured to determine, by each participant, a median secret patch corresponding to each secret patch sequence held by the participant, and determine, based on the median secret patches, a target secret patch sequence from all the secret patch sequences; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences;
a search module 204, configured to determine, by the parties holding the target secret shard sequence, median data of plaintext data held by each party based on the target secret shard.
In an alternative embodiment, the encryption module includes:
the sequencing sub-module is used for sequencing the plaintext data held by the participant to obtain a plaintext sequence;
the encryption sub-module is used for encrypting each plaintext data in the plaintext sequence to obtain a ciphertext sequence formed by ciphertext data corresponding to each plaintext data; the arrangement sequence of the ciphertext data in the ciphertext sequence is the same as the arrangement sequence of the plaintext data corresponding to the ciphertext data in the plaintext sequence.
In an alternative embodiment, the switching module includes:
the sequence extraction sub-module is used for extracting all secret fragments corresponding to each participant from a ciphertext sequence held by the participant to obtain a secret fragment sequence corresponding to each participant, and the arrangement sequence of the secret fragments in the secret fragment sequence is the same as the arrangement sequence of the secret fragments in the ciphertext sequence;
a sequence sending sub-module, configured to send the secret fragment sequence to a corresponding participant;
and the sequence acquisition sub-module is used for acquiring the secret fragment sequences corresponding to the participants from all other participants to obtain the total secret fragment sequences of the participants.
In an alternative embodiment, the screening module includes:
a sequence screening sub-module, configured to determine a secret patch sequence corresponding to a largest median secret patch among the median secret patches as a first secret patch sequence, and determine a secret patch sequence corresponding to a smallest median secret patch among the median secret patches as a second secret patch sequence;
a first fragment removing sub-module, configured to remove a secret fragment in the first secret fragment sequence that is greater than the maximum median secret fragment, to obtain a third secret fragment sequence;
a second fragment removing sub-module, configured to remove a secret fragment smaller than the minimum median secret fragment in the second secret fragment sequence, to obtain a fourth secret fragment sequence;
and the target secret patch sequence submodule is used for determining a target secret patch sequence based on the third secret patch sequence and the fourth secret patch sequence.
In an alternative embodiment, the target clandestine fragment sequence comprises a first target clandestine fragment sequence and a second target clandestine fragment sequence, the target clandestine fragment sequence submodule comprising:
other median secret patch sub-modules for determining other median secret patches corresponding to each secret patch sequence among other secret patch sequences except for the first secret patch sequence and the second secret patch sequence; wherein the other secret patch sequences include the third secret patch sequence and the fourth secret patch sequence, and of the all secret patch sequences, secret patch sequences other than the first secret patch sequence and the second secret patch sequence;
A target clandestine sequence determination submodule for determining the first target clandestine sequence and the second target clandestine sequence from the other clandestine sequences based on the other median clandestine fragments.
In an alternative embodiment, the search module includes:
a target median clandestine searching sub-module for determining a target median clandestine based on the first target clandestine sequence and the second target clandestine sequence; the target median stealth fragments are median stealth fragments of all stealth fragments in the first target stealth fragment sequence and the second target stealth fragment sequence;
and the decryption sub-module is used for decrypting the median secret shard by the participant corresponding to the median secret shard to obtain the median data.
In an alternative embodiment, the target median secret shard search submodule includes:
a binary search sub-module for determining the target median secret shard from the first target secret shard sequence and the second target secret shard sequence based on a binary search algorithm by a party holding the first target secret shard sequence and a party holding the second target secret shard sequence.
In summary, the embodiment of the application provides a median determining device based on secure multiparty computation, which includes: the encryption module is used for encrypting the plaintext data held by the participant through each participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments respectively corresponding to different participants in total quantity of the participants; the exchange module is used for exchanging a secret fragment sequence formed by secret fragments corresponding to the same party through each party so that each party can acquire the total number of secret fragment sequences of the parties corresponding to the party; the screening module is used for determining a median secret piece corresponding to each secret piece sequence held by the participant through each participant, and determining a target secret piece sequence from all secret piece sequences based on the median secret piece; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences; and the searching module is used for determining median data from plaintext data held by each participant on the basis of the target secret shard by the participant holding the target secret shard sequence. According to the method and the device, the secret fragment sequences corresponding to the secret data can be exchanged among all the participants, so that all the participants hold part of the secret fragment sequences of all the participants, then the target secret fragment sequences possibly with the median data are screened out from the secret fragment sequences, and finally the median data are screened out from the target secret fragment sequences.
Fig. 3 is a logical block diagram of an electronic device 600 according to one embodiment of the present application. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 3, the electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an input/output (I/O) interface 612, a sensor component 614, and a communication component 616.
The processing component 602 generally controls overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 may include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is used to store various types of data to support operations at the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 606 provides power to the various components of the electronic device 600. The power supply components 606 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.
The multimedia component 608 includes a screen between the electronic device 600 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense demarcations of touch or sliding actions, but also detect durations and pressures associated with the touch or sliding operations. In some embodiments, the multimedia component 608 includes a front camera and/or a rear camera. When the electronic device 600 is in an operational mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 610 is for outputting and/or inputting audio signals. For example, the audio component 610 includes a Microphone (MIC) for receiving external audio signals when the electronic device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor assembly 614 may detect an on/off state of the electronic device 600, a relative positioning of the components, such as a display and keypad of the electronic device 600, the sensor assembly 614 may also detect a change in position of the electronic device 600 or a component of the electronic device 600, the presence or absence of a user's contact with the electronic device 600, an orientation or acceleration/deceleration of the electronic device 600, and a change in temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is utilized to facilitate communication between the electronic device 600 and other devices, either in a wired or wireless manner. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for implementing a method for determining a median based on secure multiparty computation as provided by embodiments of the present application.
In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as memory 604, including instructions executable by processor 620 of electronic device 600 to perform the above-described method. For example, the non-transitory storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
Fig. 4 is a logical block diagram of an electronic device 700 of one embodiment of the present application. For example, the electronic device 700 may be provided as a server. Referring to fig. 4, electronic device 700 includes a processing component 722 that further includes one or more processors and memory resources represented by memory 732 for storing instructions, such as application programs, executable by processing component 722. The application programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Further, the processing component 722 is configured to execute instructions to perform a median determination method based on secure multiparty computing provided by embodiments of the present application.
The electronic device 700 may also include a power supply component 726 configured to perform power management of the electronic device 700, a wired or wireless network interface 750 configured to connect the electronic device 700 to a network, and an input output (I/O) interface 758. The electronic device 700 may operate based on an operating system stored in memory 732, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the method for determining a median based on secure multiparty computation.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for determining a median based on secure multiparty computing, the method comprising:
each participant encrypts plaintext data held by the participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments which respectively correspond to different participants in total quantity of the participants;
Each participant exchanges a secret piece sequence composed of secret pieces corresponding to the same participant, so that each participant obtains the total number of secret piece sequences of the participants corresponding to the participant;
each participant determines a median secret piece corresponding to each secret piece sequence held by the participant, and determines a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences;
and determining, by the parties holding the sequence of target secret shards, median data of plaintext data held by the respective parties based on the target secret shards.
2. The method according to claim 1, wherein encrypting the plaintext data held by the present party to obtain ciphertext data corresponding to each plaintext data comprises:
sequencing plaintext data held by the participant to obtain a plaintext sequence;
encrypting each plaintext data in the plaintext sequence to obtain a ciphertext sequence formed by ciphertext data corresponding to each plaintext data; the arrangement sequence of the ciphertext data in the ciphertext sequence is the same as the arrangement sequence of the plaintext data corresponding to the ciphertext data in the plaintext sequence.
3. The method according to claim 2, wherein said exchanging a sequence of clandestine fragments consisting of clandestine fragments corresponding to the same party, causing each party to obtain a sequence of clandestine fragments corresponding to the total number of parties of the party, comprises:
extracting all secret fragments corresponding to each participant from a ciphertext sequence held by the participant to obtain a secret fragment sequence corresponding to each participant, wherein the arrangement sequence of the secret fragments in the secret fragment sequence is the same as the arrangement sequence of the secret fragments in the ciphertext sequence;
transmitting the sequence of secret fragments to a corresponding participant;
and obtaining the secret fragment sequences corresponding to the participants from each other participant, and obtaining the total secret fragment sequences of the participants.
4. The method of claim 1, wherein the determining a target clandestine fragment sequence from all clandestine fragment sequences based on the median clandestine fragment comprises:
determining a secret patch sequence corresponding to the largest median secret patch in the median secret patches as a first secret patch sequence, and determining a secret patch sequence corresponding to the smallest median secret patch in the median secret patches as a second secret patch sequence;
Removing the secret patches larger than the maximum median secret patch in the first secret patch sequence to obtain a third secret patch sequence;
removing the secret patches smaller than the minimum median secret patch in the second secret patch sequence to obtain a fourth secret patch sequence;
a target sequence of secret patches is determined based on the third sequence of secret patches and the fourth sequence of secret patches.
5. The method of claim 4, wherein the sequence of target clandestine fragments comprises a first sequence of target clandestine fragments and a second sequence of target clandestine fragments, the determining a sequence of target clandestine fragments based on the third sequence of clandestine fragments and the fourth sequence of clandestine fragments comprising:
determining other median secret patches corresponding to each secret patch sequence in other secret patch sequences except the first secret patch sequence and the second secret patch sequence; wherein the other secret patch sequences include the third secret patch sequence and the fourth secret patch sequence, and of the all secret patch sequences, secret patch sequences other than the first secret patch sequence and the second secret patch sequence;
The first target clandestine fragment sequence and the second target clandestine fragment sequence are determined from the other clandestine fragment sequences based on the other median clandestine fragments.
6. The method of claim 5, wherein the determining median data of plaintext data held by each participant based on the target secret piece comprises:
determining a target median clandestine fragment based on the first target clandestine fragment sequence and the second target clandestine fragment sequence; the target median stealth fragments are median stealth fragments of all stealth fragments in the first target stealth fragment sequence and the second target stealth fragment sequence;
decrypting the median secret shard by the party corresponding to the median secret shard to obtain the median data.
7. The method of claim 6, wherein the determining a target median clandestine fragment based on the first target clandestine fragment sequence and the second target clandestine fragment sequence comprises:
determining, by a participant in possession of the first sequence of target clandestine fragments and a participant in possession of the second sequence of target clandestine fragments, the target median clandestine fragments from the first sequence of target clandestine fragments and the second sequence of target clandestine fragments based on a binary search algorithm.
8. A median determining apparatus based on secure multiparty computation, the apparatus comprising:
the encryption module is used for encrypting the plaintext data held by the participant through each participant to obtain ciphertext data corresponding to each plaintext data; the ciphertext data are composed of secret fragments which respectively correspond to different participants in total quantity of the participants;
the exchange module is used for exchanging a secret fragment sequence formed by secret fragments corresponding to the same party through each party so that each party can acquire the total number of secret fragment sequences of the parties corresponding to the party;
the screening module is used for determining a median secret piece corresponding to each secret piece sequence held by the participant through each participant, and determining a target secret piece sequence from all secret piece sequences based on the median secret pieces; wherein the number of target clandestine sequences is smaller than the total number of clandestine sequences;
and the searching module is used for determining the median data of the plaintext data held by each participant based on the target secret shard by the participant holding the target secret shard sequence.
9. An electronic device, comprising: a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of any one of claims 1 to 7.
10. A computer readable storage medium, characterized in that instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of any one of claims 1 to 7.
CN202310364983.6A 2023-03-31 2023-03-31 Method, device, equipment and medium for determining median based on secure multiparty calculation Pending CN116401423A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310364983.6A CN116401423A (en) 2023-03-31 2023-03-31 Method, device, equipment and medium for determining median based on secure multiparty calculation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310364983.6A CN116401423A (en) 2023-03-31 2023-03-31 Method, device, equipment and medium for determining median based on secure multiparty calculation

Publications (1)

Publication Number Publication Date
CN116401423A true CN116401423A (en) 2023-07-07

Family

ID=87013833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310364983.6A Pending CN116401423A (en) 2023-03-31 2023-03-31 Method, device, equipment and medium for determining median based on secure multiparty calculation

Country Status (1)

Country Link
CN (1) CN116401423A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116579021A (en) * 2023-07-12 2023-08-11 蓝象智联(杭州)科技有限公司 Multiparty joint data retrieval method based on secret sharing

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116579021A (en) * 2023-07-12 2023-08-11 蓝象智联(杭州)科技有限公司 Multiparty joint data retrieval method based on secret sharing
CN116579021B (en) * 2023-07-12 2024-04-05 蓝象智联(杭州)科技有限公司 Multiparty joint data retrieval method based on secret sharing

Similar Documents

Publication Publication Date Title
CN115396100B (en) Careless random disorganizing method and system based on secret sharing
CN115396101B (en) Secret sharing based careless disorganizing method and system
CN114969830B (en) Privacy intersection method, system and readable storage medium
CN113315631B (en) Data processing method and device and data processing device
CN113449325B (en) Data processing method and device and data processing device
CN114978512B (en) Privacy intersection method and device and readable storage medium
CN114884645B (en) Privacy calculation method and device and readable storage medium
CN113254956A (en) Data processing method and device and data processing device
CN112861175A (en) Data processing method and device and data processing device
CN116305206A (en) Secure multiparty computing method, device, electronic equipment and storage medium
CN116401423A (en) Method, device, equipment and medium for determining median based on secure multiparty calculation
CN115085912A (en) Ciphertext computing method and device for ciphertext computing
CN112307056A (en) Data processing method and device and data processing device
CN115941181B (en) Out-of-order secret sharing method, system and readable storage medium
CN112464257A (en) Data detection method and device for data detection
CN114448631B (en) Multi-party security computing method, system and device for multi-party security computing
CN112468290B (en) Data processing method and device and data processing device
CN112685747B (en) Data processing method and device and data processing device
CN114915455A (en) Ciphertext data transmission method and device for ciphertext data transmission
CN114885038A (en) Encryption protocol conversion method, result acquisition node and privacy calculation node
CN114969164B (en) Data query method and device and readable storage medium
CN114448630B (en) Multi-party secure computing method, system and device for multi-party secure computing
CN112016637B (en) Hierarchical sampling method and device for hierarchical sampling
CN115499254B (en) User data processing method, device and system and readable storage medium
CN116938453B (en) Key management method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination