Median determination method and device based on secure multi-party computation, equipment and medium

By using encryption and exchanging secret fragment sequences, the problem of low median lookup efficiency in secure multi-party computation is solved, achieving more efficient median data determination.

CN116401423BActive Publication Date: 2026-06-09HANGZHOU BODUN XIYAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU BODUN XIYAN TECH CO LTD
Filing Date
2023-03-31
Publication Date
2026-06-09

Smart Images

  • Figure CN116401423B_ABST
    Figure CN116401423B_ABST
Patent Text Reader

Abstract

The application provides a median determination method and device based on secure multi-party computation, electronic equipment and computer readable storage medium, comprising: each participant encrypts the plaintext data held by the participant to obtain the ciphertext data corresponding to each plaintext data; each participant exchanges the secret fragment sequence composed of the secret fragments corresponding to the same participant, so that each participant obtains the secret fragment sequence corresponding to the total number of participants of the participant; each participant determines the median secret fragment corresponding to each secret fragment sequence held by the participant, determines the target secret fragment sequence from all secret fragment sequences based on the median secret fragment; and the participant holding the target secret fragment sequence determines the median data from the plaintext data held by each participant based on the target secret fragment. The application can reduce the search range of the median data in the multi-party privacy computation scenario, thereby improving the search efficiency of the median data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of secure multi-party computation technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for determining the median based on secure multi-party computation. Background Technology

[0002] With increasing public awareness of privacy protection and the continuous improvement of relevant laws and regulations, society has increasingly stringent requirements for data security during circulation and use. To fully protect the security of the privacy data held by each party in computational scenarios involving multiple participants, Secure Multi-Party Computation (SMCC) technology has emerged. SMCC allows for a variety of computations based on the privacy data held by each party without exposing their individual data, thus meeting business needs. For example, SMCC can determine the median of the privacy data held by each party.

[0003] Secure multi-party computation (MPC) technology allows multiple parties to provide their respective private data. Through cooperation among these parties, a median can be determined from all the private data without any party exposing its own data to others. To calculate the median, the parties typically first collaborate to sort all the private data, and then select the middle value from the sorted results as the median.

[0004] However, in specific business scenarios, the large volume of privacy data often results in a high computational load required to sort all the privacy data held by each participant in secure multi-party computation. Therefore, the efficiency of finding the median of privacy data is currently low in secure multi-party computation scenarios. Summary of the Invention

[0005] This application provides a method, apparatus, electronic device, and computer-readable storage medium for determining the median based on secure multi-party computation, in order to solve the problem of low efficiency in finding the median of privacy data in secure multi-party computation scenarios of related technologies.

[0006] In a first aspect, embodiments of this application provide a method for determining the median based on secure multi-party computation, the method comprising:

[0007] Each participant encrypts the plaintext data held by itself to obtain ciphertext data corresponding to each plaintext data; wherein, each ciphertext data is composed of a total of secret fragments corresponding to different participants;

[0008] Each participant exchanges a sequence of secret fragments consisting of secret fragments corresponding to the same participant, so that each participant obtains a total number of secret fragment sequences corresponding to its own participant.

[0009] Each participating party determines the median secret fragment corresponding to each secret fragment sequence held by the participating party, and based on the median secret fragment, determines the target secret fragment sequence from all secret fragment sequences; wherein, the number of the target secret fragment sequences is less than the total number of secret fragment sequences;

[0010] The participants holding the target secret fragment sequence determine the median data of the plaintext data held by each participant based on the target secret fragment.

[0011] In one optional implementation, encrypting the plaintext data held by the participating party to obtain ciphertext data corresponding to each plaintext data includes:

[0012] Sort the plaintext data held by this participant to obtain a plaintext sequence;

[0013] Each plaintext data in the plaintext sequence is encrypted to obtain a ciphertext sequence composed of ciphertext data corresponding to each plaintext data; wherein the order of the ciphertext data in the ciphertext sequence is the same as the order of the plaintext data corresponding to the ciphertext data in the plaintext sequence.

[0014] In one optional implementation, the exchange of secret fragment sequences consisting of secret fragments corresponding to the same participant, such that each participant obtains a total number of secret fragment sequences corresponding to its own participant, includes:

[0015] Extract all secret fragments corresponding to each participant from the ciphertext sequence held by this participant to obtain the secret fragment sequence corresponding to each participant. The order of the secret fragments in the secret fragment sequence is the same as the order of the secret fragments in the ciphertext sequence.

[0016] Send the secret fragment sequence to the corresponding participants;

[0017] Obtain the secret fragment sequence corresponding to this participant from each of the other participants, and obtain a total of secret fragment sequences for the participants.

[0018] In one optional implementation, determining the target secret fragment sequence from all secret fragment sequences based on the median secret fragment includes:

[0019] The secret fragment sequence corresponding to the largest median secret fragment among the median secret fragments is determined as the first secret fragment sequence, and the secret fragment sequence corresponding to the smallest median secret fragment among the median secret fragments is determined as the second secret fragment sequence;

[0020] Remove secret fragments from the first secret fragment sequence that are greater than the maximum median secret fragment to obtain a third secret fragment sequence;

[0021] Remove the secret fragments in the second secret fragment sequence that are smaller than the minimum median secret fragment to obtain the fourth secret fragment sequence;

[0022] The target secret fragment sequence is determined based on the third secret fragment sequence and the fourth secret fragment sequence.

[0023] In one optional implementation, the target secret fragment sequence includes a first target secret fragment sequence and a second target secret fragment sequence, and determining the target secret fragment sequence based on the third secret fragment sequence and the fourth secret fragment sequence includes:

[0024] Determine the other median secret fragments corresponding to each secret fragment sequence among the other secret fragment sequences besides the first secret fragment sequence and the second secret fragment sequence; wherein, the other secret fragment sequences include the third secret fragment sequence and the fourth secret fragment sequence, as well as the secret fragment sequences other than the first secret fragment sequence and the second secret fragment sequence among all the secret fragment sequences;

[0025] Based on the other median secret fragments, the first target secret fragment sequence and the second target secret fragment sequence are determined from the other secret fragment sequences.

[0026] In one optional implementation, determining the median data of the plaintext data held by each participant based on the target secret fragment includes:

[0027] Based on the first target secret fragment sequence and the second target secret fragment sequence, the target median secret fragment is determined; wherein, the target median secret fragment is the median secret fragment among all secret fragments in the first target secret fragment sequence and the second target secret fragment sequence;

[0028] The median secret fragment is decrypted by the participant corresponding to the median secret fragment to obtain the median data.

[0029] In one optional implementation, determining the target median secret fragment based on the first target secret fragment sequence and the second target secret fragment sequence includes:

[0030] The target median secret fragment is determined from the first target secret fragment sequence and the second target secret fragment sequence by the participants holding the first target secret fragment sequence and the participants holding the second target secret fragment sequence based on a binary search algorithm.

[0031] Secondly, embodiments of this application provide a median determination device based on secure multi-party computation, the device comprising:

[0032] The encryption module is used to encrypt the plaintext data held by each participant to obtain the ciphertext data corresponding to each plaintext data; wherein, the ciphertext data is composed of a total of secret fragments corresponding to different participants.

[0033] The exchange module is used to exchange a sequence of secret fragments consisting of secret fragments corresponding to the same participant among the participants, so that each participant can obtain a total number of secret fragment sequences corresponding to its own participant.

[0034] The filtering module is used to determine the median secret fragment corresponding to each secret fragment sequence held by each participant, and to determine the target secret fragment sequence from all secret fragment sequences based on the median secret fragment; wherein the number of the target secret fragment sequences is less than the total number of secret fragment sequences;

[0035] The lookup module is used to determine the median data of plaintext data held by each participant based on the target secret fragment sequence.

[0036] In one alternative implementation, the encryption module includes:

[0037] The sorting submodule is used to sort the plaintext data held by this participant to obtain a plaintext sequence;

[0038] An encryption submodule is used to encrypt each plaintext data in the plaintext sequence to obtain a ciphertext sequence composed of ciphertext data corresponding to each plaintext data; wherein the order of the ciphertext data in the ciphertext sequence is the same as the order of the plaintext data corresponding to the ciphertext data in the plaintext sequence.

[0039] In one alternative implementation, the switching module includes:

[0040] The sequence extraction submodule is used to extract all secret fragments corresponding to each participant from the ciphertext sequence held by the participant, so as to obtain the secret fragment sequence corresponding to each participant. The order of the secret fragments in the secret fragment sequence is the same as the order of the secret fragments in the ciphertext sequence.

[0041] The sequence sending submodule is used to send the secret fragment sequence to the corresponding participants;

[0042] The sequence acquisition submodule is used to obtain the secret fragment sequence corresponding to the participant from each other participant, so as to obtain a total number of secret fragment sequences of the participants.

[0043] In one alternative implementation, the filtering module includes:

[0044] The sequence filtering submodule is used to determine the secret fragment sequence corresponding to the largest median secret fragment among the median secret fragments as the first secret fragment sequence, and to determine the secret fragment sequence corresponding to the smallest median secret fragment among the median secret fragments as the second secret fragment sequence;

[0045] The first fragment removal submodule is used to remove secret fragments in the first secret fragment sequence that are greater than the maximum median secret fragment, to obtain a third secret fragment sequence;

[0046] The second fragment removal submodule is used to remove secret fragments in the second secret fragment sequence that are smaller than the minimum median secret fragment, to obtain a fourth secret fragment sequence;

[0047] The target secret fragment sequence submodule is used to determine the target secret fragment sequence based on the third secret fragment sequence and the fourth secret fragment sequence.

[0048] In one optional embodiment, the target secret fragment sequence includes a first target secret fragment sequence and a second target secret fragment sequence, and the target secret fragment sequence submodule includes:

[0049] The Other Median Secret Fragment Submodule is used to determine the other median secret fragments corresponding to each secret fragment sequence among the other secret fragment sequences besides the first secret fragment sequence and the second secret fragment sequence; wherein, the other secret fragment sequences include the third secret fragment sequence and the fourth secret fragment sequence, as well as the secret fragment sequences other than the first secret fragment sequence and the second secret fragment sequence among all the secret fragment sequences;

[0050] The target secret fragment sequence determination submodule is used to determine the first target secret fragment sequence and the second target secret fragment sequence from the other secret fragment sequences based on the other median secret fragments.

[0051] In one alternative implementation, the lookup module includes:

[0052] The target median secret fragment finding submodule is used to determine the target median secret fragment based on the first target secret fragment sequence and the second target secret fragment sequence; wherein, the target median secret fragment is the median secret fragment of all secret fragments in the first target secret fragment sequence and the second target secret fragment sequence;

[0053] The decryption submodule is used by the participant corresponding to the median secret fragment to decrypt the median secret fragment and obtain the median data.

[0054] In one alternative implementation, the target median secret fragment search submodule includes:

[0055] The binary search submodule is used to determine the target median secret fragment from the first target secret fragment sequence and the second target secret fragment sequence based on the binary search algorithm by the participants holding the first target secret fragment sequence and the participants holding the second target secret fragment sequence.

[0056] Thirdly, embodiments of this application also provide an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the median determination method based on secure multi-party computation.

[0057] Fourthly, embodiments of this application also provide a computer-readable storage medium that, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the median determination method based on secure multi-party computation.

[0058] In this embodiment, each participating party encrypts the plaintext data held by itself to obtain ciphertext data corresponding to each plaintext data; wherein, the ciphertext data consists of a total of secret fragments corresponding to different participating parties; each participating party exchanges secret fragment sequences, wherein the secret fragment sequences consist of secret fragments corresponding to the same participating party; each participating party obtains a total of secret fragment sequences corresponding to itself; each participating party determines the median secret fragment corresponding to each secret fragment sequence held by itself, and based on the median secret fragment, determines a target secret fragment sequence from all secret fragment sequences; wherein, the number of target secret fragment sequences is less than the total number of secret fragment sequences; the participating party holding the target secret fragment sequence determines the median data from the plaintext data held by each participating party based on the target secret fragment. This application allows for the exchange of secret fragment sequences corresponding to secret data among participating parties, enabling each participating party to hold a portion of the secret fragment sequences from all participating parties. Then, target secret fragment sequences that may contain median data are selected from these secret fragment sequences. Finally, median data is selected from the target secret fragment sequences. Since the number of target secret fragment sequences is relatively small, the search range for median data in multi-party privacy computing scenarios can be effectively narrowed, thereby improving the search efficiency for median data.

[0059] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0060] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0061] Figure 1 This is a flowchart illustrating the steps of a median determination method based on secure multi-party computation provided in an embodiment of this application.

[0062] Figure 2 This is a structural diagram of a median determination device based on secure multi-party computation provided in an embodiment of this application;

[0063] Figure 3 This is a logic block diagram of an electronic device provided in one embodiment of this application;

[0064] Figure 4 This is a logic block diagram of an electronic device according to another embodiment of the present application. Detailed Implementation

[0065] Exemplary embodiments of the present application will now be described in more detail 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 implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0066] Figure 1 This is a flowchart illustrating the steps of a median determination method based on secure multi-party computation provided in this application embodiment. It is applied to any participant in a secure multi-party computation scenario, such as... Figure 1 As shown, the method includes:

[0067] Step 101: Each participant encrypts the plaintext data held by itself to obtain the ciphertext data corresponding to each plaintext data; wherein, the ciphertext data is composed of a total of secret fragments corresponding to different participants.

[0068] In this application embodiment, the application scenario can be a privacy-preserving computation scenario involving multiple parties. Research on secure multi-party computation primarily addresses the problem of completing computations using the local data of each participating party without a trusted third party. In a multi-party secure computation scenario, there can be at least two participating parties. For ease of discussion, this application uses a scenario with three participating parties (participant P0, participant P1, and participant P2) as a basis for explanation and illustration. It should be noted that this solution does not limit the number of participating parties.

[0069] Each participant can hold plaintext data. For example, for participant P... i Its local plaintext data set (privacy data) is This set contains k plaintext data.

[0070] Each participant can encrypt their local plaintext data to obtain corresponding ciphertext data. This ciphertext data consists of a total of [number] secret fragments, each corresponding to a different participant. In other words, a participant can encrypt their local plaintext data, thereby generating a corresponding secret fragment for each participant in the entire scenario. For example, for participant P... i It can control the set of plaintext data held by its own party. Each plaintext data in the dataset is encrypted to obtain a set of ciphertext data. This set of ciphertext data also contains k ciphertext data that correspond one-to-one with the plaintext data.

[0071] In the embodiments of this application, each encrypted data can be composed of a total of *n* secret fragments corresponding to different participants. That is, each encrypted data contains a total of *n* secret fragments, and there is a one-to-one correspondence between the secret fragments in each encrypted data and the participants. For example, when there are a total of 3 participants (participants P0, P1, and P2), the encrypted data in the encrypted data set of the above example... Can include secret fragments Among the secret fragments Corresponding to participant P0, Corresponding to participant P1, This corresponds to participant P2.

[0072] Specifically, encryption algorithms such as Homomorphic Encryption (HE), Advanced Encryption Standard (AES), and Data Encryption Standard (DES) can be used to encrypt plaintext data to obtain ciphertext data corresponding to each plaintext data. This application does not impose specific limitations on this.

[0073] Optionally, step 101 may include:

[0074] Sub-step 1011: Sort the plaintext data held by this participant to obtain a plaintext sequence.

[0075] In this embodiment of the application, in order to facilitate the subsequent calculation process (determining the median from the secret fragment and using the binary search algorithm), each participating party can sort the plaintext data it holds before processing the plaintext data, thereby obtaining a plaintext sequence arranged in order (from largest to smallest or from smallest to largest).

[0076] For example, if participant P1 holds the four plaintext data “2.3”, “4.8”, “3.9”, and “3.2”, sorting these four plaintext data will yield the plaintext sequence [2.3; 3.2; 3.9; 4.8].

[0077] Sub-step 1012: Encrypt each plaintext data in the plaintext sequence to obtain a ciphertext sequence composed of ciphertext data corresponding to each plaintext data; wherein the order of the ciphertext data in the ciphertext sequence is the same as the order of the plaintext data corresponding to the ciphertext data in the plaintext sequence.

[0078] In this embodiment of the application, after each participant obtains its own plaintext sequence, it can encrypt the plaintext data sequentially according to the order in which the plaintext data is arranged in the plaintext sequence to obtain the ciphertext data corresponding to the plaintext data. Then, according to the order in which the plaintext data corresponding to the ciphertext data is arranged in the plaintext sequence, the ciphertext data corresponding to each plaintext data is sorted to obtain the ciphertext sequence.

[0079] Step 102: Each participant exchanges a sequence of secret fragments consisting of secret fragments corresponding to the same participant, so that each participant obtains a total number of secret fragment sequences corresponding to its own participant.

[0080] In this embodiment of the application, in order to enable each participant to determine the median from the plaintext data held by all participants through collaborative computing without exposing plaintext data to each other, each participant can exchange the secret fragment sequences they hold. This allows each participant to obtain a total number of secret fragment sequences corresponding to its own participant from other participants, thereby enabling each participant to hold a total number of secret fragment sequences corresponding to its own participant.

[0081] The secret fragment sequence consists of all the secret fragments held by a participant that correspond to the same participant.

[0082] For example, if a survey is needed to assess salaries in a particular industry, a joint statistical analysis of employee compensation data from three representative companies in that industry is required to obtain statistical indicators such as the median. To protect the salary data of these companies, the secure multi-party median calculation method proposed in this invention can be used to determine the median data from the full salary data of these companies without exposing their own data.

[0083] For example, when there are a total of 3 participants (participants P0, P1, and P2), what is the set of plaintext data held by participant P0? The generated ciphertext data set The distribution of ciphertext fragments contained in the ciphertext data is shown below: Ciphertext Data encrypted data encrypted data Then, among all the secret fragments held by participant P0, the secret fragments... and All correspond to participant P0, secret fragments and All correspond to participant P1, secret fragments and All of these correspond to participant P2. That is to say, This constitutes a secret fragment sequence [x0]0 corresponding to participant P0, which contains all secret fragments generated by participant P0 and corresponding to participant P0; This constitutes a secret fragment sequence [x0]1 corresponding to participant P1, which contains all secret fragments generated by participant P0 and corresponding to participant P1; This constitutes a secret fragment sequence [x0]2 corresponding to participant P2, which contains all secret fragments generated by participant P0 and corresponding to participant P2.

[0084] Continuing with the example above, the secret fragment sequence held by participant P0 before the exchange is [x0]0, [x0]1, and [x0]2; the secret fragment sequence held by participant P1 before the exchange is [x1]0, [x1]1, and [x1]2; and the secret fragment sequence held by participant P2 before the exchange is [x2]0, [x2]1, and [x2]2. Participant P0 shares the secret fragment sequence [x0]1 corresponding to Participant P1 with Participant P1, and the secret fragment sequence [x0]2 corresponding to Participant P2 with Participant P2. It retains the secret fragment sequence [x0]0 corresponding to itself. Since other participants also perform the same action, Participant P0 can also obtain the secret fragment sequence [x1]0 corresponding to itself from Participant P1 and the secret fragment sequence [x2]0 corresponding to itself from Participant P2. Thus, Participant P0 can obtain all three secret fragment sequences [x0]0, [x1]0, and [x2]0 corresponding to itself. Participant P1 can obtain all three secret fragment sequences [x0]1, [x1]1, and [x2]1 corresponding to itself. Participant P2 can obtain all three secret fragment sequences [x0]2, [x1]2, and [x2]2 corresponding to itself.

[0085] Optionally, step 102 may include:

[0086] Sub-step 1021: Extract all secret fragments corresponding to each participant from the ciphertext sequence held by this participant to obtain a secret fragment sequence corresponding to each participant. The order of the secret fragments in the secret fragment sequence is the same as the order of the secret fragments in the ciphertext sequence.

[0087] In this embodiment of the application, since the ciphertext data is arranged in a certain order in the ciphertext sequence, the generated secret fragment sequence can be sorted according to the order of its corresponding ciphertext data in the ciphertext sequence, thereby improving the calculation efficiency of the subsequent median data.

[0088] Specifically, all secret fragments corresponding to each participant can be extracted from the ciphertext sequence held by this participant to obtain the secret fragment sequence corresponding to each participant. The order of the secret fragments in the secret fragment sequence is the same as the order of the secret fragments in the ciphertext sequence.

[0089] For example, if the entire system contains three participants P0, P1, and P2, and participant P0 holds the ciphertext sequence [a, b, c], where ciphertext a contains secret fragments (a1, a2, a3), ciphertext b contains secret fragments (b1, b2, b3), and ciphertext c contains secret fragments (c1, c2, c3). Ciphertext fragment a1 corresponds to participant P0, ciphertext fragment a2 corresponds to participant P1, ciphertext fragment b1 corresponds to participant P0, and so on.

[0090] After extracting secret fragments from the ciphertext sequence in the above example, we obtain the secret fragment sequence [a1, b1, c1] corresponding to participant P0, the secret fragment sequence [a2, b2, c2] corresponding to participant P1, and the secret fragment sequence [a3, b3, c3] corresponding to participant P2. It can be seen that the order of each secret fragment in the secret fragment sequence is the same as its order in the ciphertext sequence.

[0091] Sub-step 1022: Send the secret fragment sequence to the corresponding participant.

[0092] In this embodiment, each participant can generate a secret fragment sequence that corresponds one-to-one with each other based on its own plaintext data. The secret fragment sequences corresponding to other participants can be sent to those participants, while the secret fragment sequence corresponding to the participant itself can be retained.

[0093] For example, if participant P0 processes plaintext data to obtain a secret fragment sequence [a1, b1, c1] corresponding to participant P0, a secret fragment sequence [a2, b2, c2] corresponding to participant P1, and a secret fragment sequence [a3, b3, c3] corresponding to participant P2, then participant P0 will send the secret fragment sequence [a2, b2, c2] to participant P1, send the secret fragment sequence [a3, b3, c3] to participant P2, and retain the secret fragment sequence [a1, b1, c1].

[0094] Sub-step 1023: Obtain the secret fragment sequence corresponding to this participant from each of the other participants, and obtain the total number of secret fragment sequences of the participants.

[0095] Accordingly, each participant can obtain the secret fragment sequence corresponding to itself from other participants, so that each participant can eventually obtain a total of secret fragment sequences.

[0096] Step 103: Each participant determines the median secret fragment corresponding to each secret fragment sequence held by the participant, and determines the target secret fragment sequence from all secret fragment sequences based on the median secret fragment; wherein the number of the target secret fragment sequences is less than the total number of secret fragment sequences.

[0097] In this 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, and secret fragment sequences that do not contain the secret fragment corresponding to the median data can be excluded to obtain a smaller number of target secret fragment sequences. Then, the median data can be determined through the target secret fragment sequences, thereby reducing the amount of computation required to determine the median data from the full amount of plaintext data.

[0098] Specifically, each participating party can determine the median secret fragment corresponding to each secret fragment sequence held by the participating party, and then remove secret fragments from the secret fragment sequences that meet the conditions based on these median secret fragments. The median secret fragment is then determined again for the updated secret fragment sequence, and the secret fragments in the secret fragment sequences that meet the conditions are removed again. By repeatedly performing the above operations, the secret fragment sequence with all secret fragments removed is eliminated until a small number of target secret fragment sequences remain.

[0099] Optionally, step 103 may include:

[0100] Sub-step 1031: The secret fragment sequence corresponding to the largest median secret fragment among the median secret fragments is determined as the first secret fragment sequence, and the secret fragment sequence corresponding to the smallest median secret fragment among the median secret fragments is determined as the second secret fragment sequence.

[0101] Each participant can process all the secret fragment sequences held by them to obtain the median secret fragment corresponding to each of the secret fragment sequences held by them. The specific process is as follows: steps A1 to A6:

[0102] A1. Each participant can define an array of variables to record all median fragments calculated by a participant, the position information of the median fragment in the secret fragment sequence, and the sequence number of the secret fragment sequence in which the median fragment is located (this needs to be used to identify which participant the secret fragment sequence comes from).

[0103] For example, an array variable can include the following three variables:

[0104]

[0105] Where, m all Record median fragments, Record the position of the median fragment in the secret fragment sequence, arridx all The index used to record the secret fragment sequence number in which the median fragment is located.

[0106] A2, iterate through each secret fragment sequence, determine the median fragment corresponding to each secret fragment and the position of the median fragment in the secret fragment sequence, and record them in the above variable array.

[0107] For example, it can be implemented in the following way:

[0108] foreach j∈[0,...n]do;

[0109]

[0110] The `foreach` loop iterates through the secret fragment sequence of each participant. If there are three participants, `n` equals 3. `median` is used to compute the j-th secret fragment sequence. median m j And its position information (i.e., index) idx in the secret fragment sequence. j .

[0111] A3, the determined median secret fragment m j The location information of the median secret fragment in the secret fragment sequence, idx. j The index j of the secret fragment sequence corresponding to the median secret fragment is stored in the above variable array.

[0112] For example, it can be implemented in the following way:

[0113] m all .append(m j );

[0114] idx all [m j ] = idx j ;

[0115] arridx all [m j ] = j;

[0116] A4, from m all Among all the stored median secret fragments, the largest median secret fragment is queried, and then the position information of the largest median secret fragment in the secret fragment sequence and the sequence number of the secret fragment sequence in which the largest median secret fragment is located are determined.

[0117] For example, it can be implemented in the following way:

[0118] m mmax =max(m all );

[0119] idx max =idx all [m max ];

[0120] arridx max =arridx all [m max ];

[0121] Where, m max Represents the maximum median secret fragment, idx max This represents the location information of the maximum median secret fragment in the sequence, arridx max This indicates the sequence number of the secret fragment containing the maximum median.

[0122] A5. Using a similar method, determine the minimum median secret fragment, then determine the position information of the minimum median secret fragment in the secret fragment sequence, as well as the sequence number of the secret fragment sequence in which the minimum median secret fragment is located.

[0123] m min =min(m all );

[0124] idx min =idx all [m min ];

[0125] arridx min =arridx all [m min ];

[0126] Where, m min Represents the minimum median secret fragment, idx min This represents the location information of the least median secret fragment in the sequence, arridx min This indicates the sequence number of the secret fragment containing the minimum median.

[0127] A6, the above arridx max The indicated secret fragment sequence was identified as the first secret fragment sequence, and the above arridx was used. min The indicated secret fragment sequence was identified as the second secret fragment sequence.

[0128] Sub-step 1032: Remove secret fragments from the first secret fragment sequence that are greater than the maximum median secret fragment to obtain the third secret fragment sequence.

[0129] After determining the first secret fragment sequence, all secret fragments in the first secret fragment sequence that are greater than the maximum median can be removed to obtain a third secret fragment sequence containing fewer secret fragments.

[0130] Since the median data in the plaintext data of all participants cannot be greater than the maximum median secret fragment in the first secret fragment sequence, therefore, for the sequence containing the maximum median secret fragment... Based on the position of the maximum median in the array, discard secret fragments that are greater than the maximum median.

[0131] Specifically, the slice function can be used to achieve the above operations:

[0132]

[0133] The slice function can divide the secret fragment sequence of the participants, and for the first secret fragment sequence containing the maximum median... Only keep fragments smaller than the maximum median to obtain the third secret fragment sequence.

[0134] Sub-step 1033: Remove secret fragments in the second secret fragment sequence that are smaller than the minimum median secret fragment to obtain the fourth secret fragment sequence.

[0135] After determining the second secret fragment sequence, all secret fragments in the second secret fragment sequence that are less than the minimum median secret fragment can be removed to obtain a fourth secret fragment sequence containing fewer secret fragments.

[0136] Since the median data in the plaintext data of all participants cannot be less than the minimum median secret fragment in the second secret fragment sequence, therefore, for the sequence containing the minimum median secret fragment... Based on the position of the minimum median in the array, secret fragments smaller than that median are discarded.

[0137] Specifically, the slice function can be used to achieve the above operations:

[0138]

[0139] The slice function can divide the secret fragment sequence of the participants, and for the second secret fragment sequence containing the minimum median... Only retain the secret fragments that are larger than the minimum median to obtain the fourth secret fragment sequence.

[0140] Sub-step 1034: Determine the target secret fragment sequence based on the third secret fragment sequence and the fourth secret fragment sequence.

[0141] In this embodiment of the application, the first secret fragment sequence can be replaced by the third secret fragment sequence, and the second secret fragment sequence can be replaced by the fourth secret fragment sequence. The method in sub-steps 1031 to 1032 can be run again to find the secret fragment sequences containing the maximum median secret fragment and the minimum median secret fragment, and then the secret fragments in them can be segmented and removed.

[0142] After the first round of secret fragment removal operations is completed, we can continue to determine the other median secret fragments corresponding to each secret fragment sequence in the other secret fragment sequences besides the first and second secret fragment sequences; among them, the other secret fragment sequences include the third and fourth secret fragment sequences, as well as the secret fragment sequences other than the first and second secret fragment sequences.

[0143] Based on other median secret fragments, the first target secret fragment sequence and the second target secret fragment sequence are determined from other secret fragment sequences.

[0144] In this embodiment of the application, the secret fragment sequence after all secret fragments have been removed can be discarded by repeatedly executing the above algorithm until only the secret fragment sequences of the two participants remain. Since the secret fragment corresponding to the median data exists in the secret fragment sequences of the two participants at most, the median data can be determined from the secret fragment sequences of the two remaining participants.

[0145] Step 104: The participants holding the target secret fragment sequence determine the median data of the plaintext data held by each participant based on the target secret fragment.

[0146] In this embodiment, the above steps can reduce the secret fragment sequence containing the median data, narrowing the search range for the median data to the target secret fragment sequence. In this embodiment, the number of target secret fragment sequences is less than the total number of participants. For example, if there are 10 participants, each participant holds 10 secret fragment sequences. In this embodiment, these 10 secret fragment sequences can be reduced to two target secret fragment sequences, and then the median data can be searched from these two target secret fragment sequences, greatly reducing the computational workload of searching for the median data and improving computational efficiency.

[0147] Optionally, step 104 may include:

[0148] Sub-step 1041: Based on the first target secret fragment sequence and the second target secret fragment sequence, determine the target median secret fragment; wherein, the target median secret fragment is the median secret fragment of all secret fragments in the first target secret fragment sequence and the second target secret fragment sequence.

[0149] In this embodiment of the application, the number of target secret fragment sequences can be set to two. In step 103 above, secret fragments in the secret fragment sequences can be removed and secret fragment sequences without secret fragments (secret fragment sequences in which all secret fragments have been removed) can be discarded until two secret fragment sequences remain. These two secret fragment sequences are then determined as target secret fragment sequences, which may include a first target secret fragment sequence and a second target secret fragment sequence.

[0150] The first target secret fragment sequence and the second target secret fragment sequence can be treated as a whole, and the target median secret fragment can be determined from it. The target median secret fragment is the median secret fragment of all secret fragments in the first target secret fragment sequence and the second target secret fragment sequence.

[0151] Optionally, the participant holding the first target secret fragment sequence and the participant holding the second target secret fragment sequence determine the target median secret fragment from the first target secret fragment sequence and the second target secret fragment sequence based on a binary search algorithm.

[0152] Binary search is suitable for sequences (where elements are arranged in a certain order). The algorithm first compares the value of the middle element in the sequence with the target value. If the target value matches the target value, the algorithm returns the position of that element in the sequence. If the target value is smaller than the target value, the search continues in the first half of the sequence; otherwise, it continues in the second half to find a matching element. Thus, in each iteration, binary search eliminates elements that could not possibly contain the target value, allowing for a highly efficient search of the sequence.

[0153] Specifically, given an ascending sequence A and a target value T, the processing logic of the binary search algorithm can be described in steps S1 to S6 as follows:

[0154] S1. Set L to 0 and R to n-1, where n is the number of elements in 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.

[0155] S2. If L > R, then the search algorithm will terminate.

[0156] S3. Calculate the index m of the element at the middle position in sequence A: m = floor((L+R) / 2); where floor represents rounding down.

[0157] S4. If Am < T, set L to m+1 and return to step S2.

[0158] S5, if A m >T, set R to m-1 and return to step S2.

[0159] S6, if A m If the result is T, the search ends, and m is output.

[0160] As can be seen, the binary search algorithm has high running efficiency due to its time complexity of log(n). Time complexity is used to qualitatively describe the running time of an algorithm when processing a specific task. In this embodiment, the binary search algorithm can be used to find the median data in the aforementioned target secret fragment sequence, and the specific process is as follows: steps B1 to B7:

[0161] B1. Determine the length of each target secret fragment sequence.

[0162] For example, if the target secret fragment sequence includes a first target secret fragment sequence (nums1) and a second target secret fragment sequence (nums2), an exemplary code for step B1 can be shown below:

[0163] m, n=len(nums1), len(nums2);

[0164] Where m and n represent the lengths of arrays nums1 and nums2 respectively, and len() is the function to calculate the array length. It should be noted that since each target secret fragment sequence is a sequence of elements already arranged in ascending order, nums1 and nums2 are already sorted.

[0165] B2. Initialize the median index variable, initialize the traversal position variable, and initialize the traversal end variable.

[0166] For example, an exemplary code for step B2 could be shown below:

[0167] half = (m + n + 1) / / 2;

[0168] left, right = 0, m;

[0169] Where half represents the median index variable, left is the traversal position variable, and right is the traversal end variable. The traversal position variable and the traversal end variable are initialized and assigned the values ​​0 and m respectively.

[0170] B3. If the traversal position variable is less than the traversal cutoff variable, calculate the median index of the first target secret fragment sequence based on the traversal position variable and the traversal cutoff variable. Then, calculate the median index of the second target secret fragment sequence based on the median index variable and the median index of the first target secret fragment sequence. If the secret fragment corresponding to the median index of the first target secret fragment sequence is less than the preceding secret fragment corresponding to the median index of the second target secret fragment sequence, update the value of the traversal position variable to the median index of the first target secret fragment sequence plus 1. Otherwise, update the value of the traversal cutoff variable to the median index of the first target secret fragment sequence. Repeat this process until the traversal position variable is no longer less than the traversal cutoff variable.

[0171] For example, an exemplary code for step B3 could be as follows:

[0172]

[0173] Where i represents the index of the middle position of the first target secret fragment sequence, and j represents the index of the middle position of the second target secret fragment sequence.

[0174] B4. After the above loop ends, the middle position of the first target secret fragment sequence can be updated to the traversal position variable, and the middle position of the second target secret fragment sequence can be updated to the difference between the median index variable and the traversal position variable. Thus, the middle position of the first target secret fragment sequence divides it into two parts: the left part is to the left of the median, and the right part is to the right of the median. Similarly, the middle position index of the second target secret fragment sequence divides it into two parts: the left part is to the left of the median, and the right part is to the right of the median.

[0175] For example, an exemplary code for step B4 could be shown below:

[0176] i = left;

[0177] j = half-left;

[0178] B5. If the middle position of the first target secret fragment sequence is equal to 0, it means that all secret fragments in the first target secret fragment sequence are greater than the actual median secret fragment. Therefore, the first median secret fragment can be determined as the secret fragment in the second target secret fragment sequence whose index is the position preceding the middle position of the second target secret fragment sequence. Similarly, if the middle position of the second target secret fragment sequence is equal to 0, it means that all secret fragments in the first target secret fragment sequence are less than the actual median secret fragment. Therefore, the first median secret fragment can be determined as the secret fragment in the first target secret fragment sequence whose index is the position preceding the middle position of the first target secret fragment sequence. Otherwise, the secret fragment larger between the position preceding the middle position of the first target secret fragment sequence and the position preceding the middle position of the second target secret fragment sequence is determined as the first median secret fragment.

[0179] For example, an exemplary code for step B5 could be shown below:

[0180]

[0181] Where mid1 represents the first median secret fragment.

[0182] B6. If the total number of secret fragments in the first target secret fragment sequence and the second target secret fragment sequence is odd, then the first median secret fragment is directly determined as the actual median secret fragment.

[0183] For example, an exemplary code for step B6 could be shown below:

[0184] if (m+n)%2==1;

[0185] return mid1;

[0186] The first median secret fragment mid1 is returned, which is the final calculated median secret fragment.

[0187] B7. If the middle position of the first target secret fragment sequence equals the length of the first target secret fragment sequence, it means that all secret fragments in the first target secret fragment sequence are smaller than the actual median secret fragment. Therefore, the second median secret fragment is determined as the secret fragment with the middle index of the second target secret fragment sequence. Similarly, if the middle position of the second target secret fragment sequence equals the length of the second target secret fragment sequence, it means that all secret fragments in the second target secret fragment sequence are smaller than the actual median secret fragment. Therefore, the second median secret fragment can be determined as the secret fragment with the middle index of the first target secret fragment sequence. Otherwise, the secret fragment with the larger value between the middle index of the first target secret fragment sequence and the middle index of the second target secret fragment sequence is determined as the second median secret fragment. Finally, the average of the first and second median secret fragments is determined as the actual median secret fragment.

[0188] For example, an exemplary code for step B7 could be as follows:

[0189] ifi==m:mid2=nums2[j];

[0190] elifj==n:mid2=nums1[i];

[0191] else: mid2=min(nums1[i], nums2[j]);

[0192] return(mid1+mid2) / 2;

[0193] Where mid2 represents the second median secret fragment.

[0194] Sub-step 1042: The participant corresponding to the median secret fragment decrypts the median secret fragment to obtain the median data.

[0195] Since each secret fragment is generated by a participant based on the privacy data held by that participant and sent to the corresponding participant, after obtaining the median secret fragment, the participant to whom the privacy data corresponding to the median secret fragment belongs can be determined based on the secret fragment sequence in which the median secret fragment is located. Therefore, the participant corresponding to the median secret fragment can be identified.

[0196] Specifically, the participant holding the target secret fragment sequence corresponding to the median secret fragment can determine the source participant of the target secret fragment, and then send the median secret fragment to the source participant. The source participant then identifies and determines the privacy data corresponding to the target secret fragment, which is the median data among all the privacy data held by all participants. The source participant then synchronizes this median data to other participants, thereby completing the secure and privacy-preserving calculation of the median data.

[0197] In summary, the median determination method based on secure multi-party computation provided in this application includes: each participating party encrypting the plaintext data held by itself to obtain ciphertext data corresponding to each plaintext data; wherein, each ciphertext data is composed of a total of secret fragments corresponding to different participating parties; each participating party exchanges secret fragment sequences composed of secret fragments corresponding to the same participating party, so that each participating party obtains a total of secret fragment sequences corresponding to itself; each participating party determines the median secret fragment corresponding to each secret fragment sequence held by itself, and determines a target secret fragment sequence from all secret fragment sequences based on the median secret fragment; wherein, the number of target secret fragment sequences is less than the total number of secret fragment sequences; and the participating party holding the target secret fragment sequence determines the median data from the plaintext data held by each participating party based on the target secret fragment. This application allows for the exchange of secret fragment sequences corresponding to secret data among participating parties, enabling each participating party to hold a portion of the secret fragment sequences from all participating parties. Then, target secret fragment sequences that may contain median data are selected from these secret fragment sequences. Finally, median data is selected from the target secret fragment sequences. Since the number of target secret fragment sequences is relatively small, the search range for median data in multi-party privacy computing scenarios can be effectively narrowed, thereby improving the search efficiency for median data.

[0198] Corresponding to the method provided in the above embodiments of the median determination method based on secure multi-party computation of the present invention, see [link to relevant documentation]. Figure 2 The present invention also provides a structural diagram of a median determination device based on secure multi-party computation, the device comprising:

[0199] The encryption module 201 is used to encrypt the plaintext data held by each participant to obtain the ciphertext data corresponding to each plaintext data; wherein, the ciphertext data is composed of a total of secret fragments corresponding to different participants.

[0200] The exchange module 202 is used to exchange a sequence of secret fragments consisting of secret fragments corresponding to the same participant among the participants, so that each participant can obtain a total number of secret fragment sequences corresponding to its own participant.

[0201] The filtering module 203 is used to determine the median secret fragment corresponding to each secret fragment sequence held by each participant, and to determine the target secret fragment sequence from all secret fragment sequences based on the median secret fragment; wherein the number of the target secret fragment sequences is less than the total number of secret fragment sequences.

[0202] The lookup module 204 is used to determine the median data of the plaintext data held by each participant based on the target secret fragment sequence by identifying the participants holding the target secret fragment sequence.

[0203] In one alternative implementation, the encryption module includes:

[0204] The sorting submodule is used to sort the plaintext data held by this participant to obtain a plaintext sequence;

[0205] An encryption submodule is used to encrypt each plaintext data in the plaintext sequence to obtain a ciphertext sequence composed of ciphertext data corresponding to each plaintext data; wherein the order of the ciphertext data in the ciphertext sequence is the same as the order of the plaintext data corresponding to the ciphertext data in the plaintext sequence.

[0206] In one alternative implementation, the switching module includes:

[0207] The sequence extraction submodule is used to extract all secret fragments corresponding to each participant from the ciphertext sequence held by the participant, so as to obtain the secret fragment sequence corresponding to each participant. The order of the secret fragments in the secret fragment sequence is the same as the order of the secret fragments in the ciphertext sequence.

[0208] The sequence sending submodule is used to send the secret fragment sequence to the corresponding participants;

[0209] The sequence acquisition submodule is used to obtain the secret fragment sequence corresponding to the participant from each other participant, so as to obtain a total number of secret fragment sequences of the participants.

[0210] In one alternative implementation, the filtering module includes:

[0211] The sequence filtering submodule is used to determine the secret fragment sequence corresponding to the largest median secret fragment among the median secret fragments as the first secret fragment sequence, and to determine the secret fragment sequence corresponding to the smallest median secret fragment among the median secret fragments as the second secret fragment sequence;

[0212] The first fragment removal submodule is used to remove secret fragments in the first secret fragment sequence that are greater than the maximum median secret fragment, to obtain a third secret fragment sequence;

[0213] The second fragment removal submodule is used to remove secret fragments in the second secret fragment sequence that are smaller than the minimum median secret fragment, to obtain a fourth secret fragment sequence;

[0214] The target secret fragment sequence submodule is used to determine the target secret fragment sequence based on the third secret fragment sequence and the fourth secret fragment sequence.

[0215] In one optional embodiment, the target secret fragment sequence includes a first target secret fragment sequence and a second target secret fragment sequence, and the target secret fragment sequence submodule includes:

[0216] The Other Median Secret Fragment Submodule is used to determine the other median secret fragments corresponding to each secret fragment sequence among the other secret fragment sequences besides the first secret fragment sequence and the second secret fragment sequence; wherein, the other secret fragment sequences include the third secret fragment sequence and the fourth secret fragment sequence, as well as the secret fragment sequences other than the first secret fragment sequence and the second secret fragment sequence among all the secret fragment sequences;

[0217] The target secret fragment sequence determination submodule is used to determine the first target secret fragment sequence and the second target secret fragment sequence from the other secret fragment sequences based on the other median secret fragments.

[0218] In one alternative implementation, the lookup module includes:

[0219] The target median secret fragment finding submodule is used to determine the target median secret fragment based on the first target secret fragment sequence and the second target secret fragment sequence; wherein, the target median secret fragment is the median secret fragment of all secret fragments in the first target secret fragment sequence and the second target secret fragment sequence;

[0220] The decryption submodule is used by the participant corresponding to the median secret fragment to decrypt the median secret fragment and obtain the median data.

[0221] In one alternative implementation, the target median secret fragment search submodule includes:

[0222] The binary search submodule is used to determine the target median secret fragment from the first target secret fragment sequence and the second target secret fragment sequence based on the binary search algorithm by the participants holding the first target secret fragment sequence and the participants holding the second target secret fragment sequence.

[0223] In summary, the median determination device based on secure multi-party computation provided in this application includes: an encryption module, used to encrypt plaintext data held by each participating party to obtain ciphertext data corresponding to each plaintext data; wherein the ciphertext data is composed of a total of secret fragments corresponding to different participating parties; an exchange module, used to exchange secret fragment sequences composed of secret fragments corresponding to the same participating party among the participating parties, so that each participating party obtains a total of secret fragment sequences corresponding to its own participating party; a filtering module, used to determine the median secret fragment corresponding to each secret fragment sequence held by each participating party, and based on the median secret fragment, determine a target secret fragment sequence from all secret fragment sequences; wherein the number of target secret fragment sequences is less than the total number of secret fragment sequences; and a search module, used to determine the median data from the plaintext data held by each participating party based on the target secret fragment, through the participating party holding the target secret fragment sequence. This application allows for the exchange of secret fragment sequences corresponding to secret data among participating parties, enabling each participating party to hold a portion of the secret fragment sequences from all participating parties. Then, target secret fragment sequences that may contain median data are selected from these secret fragment sequences. Finally, median data is selected from the target secret fragment sequences. Since the number of target secret fragment sequences is relatively small, the search range for median data in multi-party privacy computing scenarios can be effectively narrowed, thereby improving the search efficiency for median data.

[0224] Figure 3 This is a logical block diagram of an electronic device 600 according to one embodiment of this application. For example, the electronic device 600 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0225] Reference Figure 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.

[0226] Processing component 602 typically controls the overall operation of electronic device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. 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. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.

[0227] Memory 604 is used to store various types of data to support the operation of electronic device 600. Examples of this data include instructions for any application or method operating on electronic device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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 storage, flash memory, magnetic disk, or optical disk.

[0228] Power supply component 606 provides power to various components of electronic device 600. Power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 600.

[0229] Multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and the user. 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the electronic device 600 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0230] Audio component 610 is used to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) used to receive external audio signals when electronic device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.

[0231] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0232] Sensor assembly 614 includes one or more sensors for providing state assessments of various aspects of electronic device 600. For example, sensor assembly 614 can detect the on / off state of electronic device 600, the relative positioning of components such as the display and keypad of electronic device 600, changes in position of electronic device 600 or a component of electronic device 600, the presence or absence of user contact with electronic device 600, orientation or acceleration / deceleration of electronic device 600, and temperature changes of electronic device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. 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, sensor assembly 614 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0233] Communication component 616 facilitates wired or wireless communication between electronic device 600 and other devices. Electronic device 600 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. 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.

[0234] 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 components to implement a median determination method based on secure multi-party computation provided in this application embodiment.

[0235] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of an electronic device 600 to perform the above-described method. For example, the non-transitory storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0236] Figure 4 This is a logical block diagram of an electronic device 700 according to one embodiment of this application. For example, the electronic device 700 may be provided as a server. (See also...) Figure 4 The electronic device 700 includes a processing component 722, which further includes one or more processors, and memory resources represented by a memory 732 for storing instructions, such as application programs, that can be executed by the processing component 722. The application programs stored in the memory 732 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 722 is configured to execute instructions to perform a median determination method based on secure multi-party computation provided in embodiments of this application.

[0237] Electronic device 700 may also include a power supply component 726 configured to perform power management of electronic device 700, a wired or wireless network interface 750 configured to connect electronic device 700 to a network, and an input / output (I / O) interface 758. Electronic device 700 may operate on an operating system stored in memory 732, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.

[0238] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the median determination method based on secure multi-party computation.

[0239] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0240] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for determining the median based on secure multi-party computation, characterized in that, The method includes: Each participant encrypts the plaintext data held by itself to obtain ciphertext data corresponding to each plaintext data; wherein, each ciphertext data is composed of a total of secret fragments corresponding to different participants; Each participant exchanges a sequence of secret fragments consisting of secret fragments corresponding to the same participant, so that each participant obtains a total number of secret fragment sequences corresponding to its own participant. Each participating party determines the median secret fragment corresponding to each secret fragment sequence held by the participating party, and based on the median secret fragment, determines the target secret fragment sequence from all secret fragment sequences; wherein, the number of the target secret fragment sequences is less than the total number of secret fragment sequences; The median data of the plaintext data held by each participant is determined based on the target secret fragment sequence by the participants holding the target secret fragment; The step of determining the target secret fragment sequence from all secret fragment sequences based on the median secret fragment includes: The secret fragment sequence corresponding to the largest median secret fragment among the median secret fragments is determined as the first secret fragment sequence, and the secret fragment sequence corresponding to the smallest median secret fragment among the median secret fragments is determined as the second secret fragment sequence; Remove secret fragments from the first secret fragment sequence that are greater than the maximum median secret fragment to obtain a third secret fragment sequence; Remove the secret fragments in the second secret fragment sequence that are smaller than the minimum median secret fragment to obtain the fourth secret fragment sequence; The target secret fragment sequence is determined based on the third secret fragment sequence and the fourth secret fragment sequence.

2. The method according to claim 1, characterized in that, The encryption of the plaintext data held by this participant to obtain the ciphertext data corresponding to each plaintext data includes: Sort the plaintext data held by this participant to obtain a plaintext sequence; Each plaintext data in the plaintext sequence is encrypted to obtain a ciphertext sequence composed of ciphertext data corresponding to each plaintext data; wherein the order of the ciphertext data in the ciphertext sequence is the same as the order of the plaintext data corresponding to the ciphertext data in the plaintext sequence.

3. The method according to claim 2, characterized in that, The exchange consists of a sequence of secret fragments corresponding to the same participant, enabling each participant to obtain a total number of secret fragment sequences corresponding to their own participant, including: Extract all secret fragments corresponding to each participant from the ciphertext sequence held by this participant to obtain the secret fragment sequence corresponding to each participant. The order of the secret fragments in the secret fragment sequence is the same as the order of the secret fragments in the ciphertext sequence. Send the secret fragment sequence to the corresponding participants; Obtain the secret fragment sequence corresponding to this participant from each of the other participants, and obtain a total of secret fragment sequences for the participants.

4. The method according to claim 1, characterized in that, The target secret fragment sequence includes a first target secret fragment sequence and a second target secret fragment sequence. Determining the target secret fragment sequence based on the third secret fragment sequence and the fourth secret fragment sequence includes: Determine the other median secret fragments corresponding to each secret fragment sequence among the other secret fragment sequences besides the first secret fragment sequence and the second secret fragment sequence; wherein, the other secret fragment sequences include the third secret fragment sequence and the fourth secret fragment sequence, as well as the secret fragment sequences other than the first secret fragment sequence and the second secret fragment sequence among all the secret fragment sequences; Based on the other median secret fragments, the first target secret fragment sequence and the second target secret fragment sequence are determined from the other secret fragment sequences.

5. The method according to claim 4, characterized in that, The determination of the median data of the plaintext data held by each participant based on the target secret fragment includes: Based on the first target secret fragment sequence and the second target secret fragment sequence, the target median secret fragment is determined; wherein, the target median secret fragment is the median secret fragment among all secret fragments in the first target secret fragment sequence and the second target secret fragment sequence; The median secret fragment is decrypted by the participant corresponding to the median secret fragment to obtain the median data.

6. The method according to claim 5, characterized in that, The step of determining the target median secret fragment based on the first target secret fragment sequence and the second target secret fragment sequence includes: The target median secret fragment is determined from the first target secret fragment sequence and the second target secret fragment sequence by the participants holding the first target secret fragment sequence and the participants holding the second target secret fragment sequence based on a binary search algorithm.

7. A median determination device based on secure multi-party computation, characterized in that, The device includes: The encryption module is used to encrypt the plaintext data held by each participant to obtain the ciphertext data corresponding to each plaintext data; wherein, the ciphertext data is composed of a total of secret fragments corresponding to different participants. The exchange module is used to exchange a sequence of secret fragments consisting of secret fragments corresponding to the same participant among the participants, so that each participant can obtain a total number of secret fragment sequences corresponding to its own participant. The filtering module is used to determine the median secret fragment corresponding to each secret fragment sequence held by each participant, and to determine the target secret fragment sequence from all secret fragment sequences based on the median secret fragment; wherein the number of the target secret fragment sequences is less than the total number of secret fragment sequences; The lookup module is used to determine the median data of plaintext data held by each participant based on the target secret fragment sequence; Specifically, the filtering module is used for: The sequence filtering submodule is used to determine the secret fragment sequence corresponding to the largest median secret fragment among the median secret fragments as the first secret fragment sequence, and to determine the secret fragment sequence corresponding to the smallest median secret fragment among the median secret fragments as the second secret fragment sequence; The first fragment removal submodule is used to remove secret fragments in the first secret fragment sequence that are greater than the maximum median secret fragment, to obtain a third secret fragment sequence; The second fragment removal submodule is used to remove secret fragments in the second secret fragment sequence that are smaller than the minimum median secret fragment, to obtain a fourth secret fragment sequence; The target secret fragment sequence submodule is used to determine the target secret fragment sequence based on the third secret fragment sequence and the fourth secret fragment sequence.

8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 6.