Method, device and medium for calculating federated group statistics based on symmetric encryption
Through symmetric encryption and secure interception algorithms, the problem of data privacy protection in federated learning is solved, and data privacy protection and data acquisition in federated learning is achieved.
Patent Information
- Application Number
- CN202210163226.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-22
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2042-02-22
AI Technical Summary
In federated learning, participant A holds data packet information and participant B holds data feature information. How to protect the data privacy of all parties during the statistical calculation process and prevent the direct or indirect exchange or leakage of packet information and feature information.
The federal packet statistics calculation method based on symmetric encryption is used to determine the federal intersection between the user packet set and the user feature set through a security interception algorithm, and the predetermined key information is used for encryption and decryption to ensure that the information is not in the encryption transmission process. Give way.
Implement data privacy protection in federated learning scenarios, ensuring that grouping information and feature information are not directly or indirectly exchanged or conveyed to other participants, while reducing the amount of calculations, obtaining more detailed dimensional analytical data, and meeting subsequent modeling or calculations. need.
Smart Images

Figure CN114564730B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of privacy computing technology, and in particular to a method, device and medium for calculating federal group statistics based on symmetric encryption. Background Art
[0002] In federated learning, it is often the case that participant A holds data grouping information and participant B holds data feature information. In the process of calculating statistics for participant B who holds data feature information, it is necessary to group B's feature information according to A's grouping information and calculate statistics for the grouped feature information to meet the needs of subsequent federated modeling or calculations.
[0003] In order to meet the requirements of data privacy protection during the federated learning process, participant A cannot leak data grouping information to participant B, and participant B cannot leak feature information to participant A.
[0004] Therefore, when group information and feature information are distributed among different participants, it is required to protect the privacy of data of all parties at the same time, that is, to ensure that the group information and feature information of any party will not be directly or indirectly exchanged or disclosed to other participants when performing group statistics calculation in the scenario of federated learning. This is still a core problem that technicians in this field need to solve.
[0005] The information disclosed in the background technology section of this application is only intended to deepen the understanding of the general background technology of this application, and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art already known to those skilled in the art. Summary of the invention
[0006] The disclosed embodiments provide a method, device, and medium for calculating federated group statistics based on symmetric encryption. When group statistics are calculated in a federated learning scenario, the group information and feature information of any party will not be directly or indirectly exchanged or disclosed to other participants, thereby fully protecting the privacy of the data of all parties or meeting relevant supervision requirements.
[0007] In a first aspect of the embodiments of the present disclosure,
[0008] This paper provides a method for calculating federated group statistics based on symmetric encryption.
[0009] The method is applied to multiple participants, the participants include a first participant and a second participant, the first participant stores user group information, and the second participant stores user feature information, the method includes:
[0010] Grouping the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0011] The first participant determines a federated intersection of each user group set and the second user set of the second participant by using a secure intersection algorithm;
[0012] The second participant determines a second user feature belonging to the intersection based on the federated intersection, calculates user feature statistics in the intersection, and obtains statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0013] The second participant encrypts the statistical information of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant;
[0014] The first participant decrypts the encrypted result according to the same key information as the second participant to determine the statistical information of each user group set.
[0015] In an optional implementation, before determining the federated intersection of each user group set and the second user set, the method further includes:
[0016] The first participant and the second participant use the same data desensitizing algorithm to perform data desensitization on each user group set corresponding to the first participant and the second user set corresponding to the second participant.
[0017] In an optional embodiment,
[0018] The method for determining the federated intersection of each user group set and the second user set includes:
[0019] The first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant to determine a federated intersection of each user group set and the second user set.
[0020] In an optional embodiment,
[0021] Before the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant, the method further includes:
[0022] The first participant and the second participant respectively encode the first element and the second element into binary codes of length n, to obtain a first binary code and a second binary code respectively;
[0023] Here, n is the coding length determined by negotiation between the first participant and the second participant.
[0024] In an optional embodiment,
[0025] The method for the first participant to perform a pairwise privacy comparison of a first element in each user group set with a second element in a second user set of the second participant includes:
[0026] The first participant randomly generates two first random binary strings of the same length from each bit in the first binary code;
[0027] The first participant selects a corresponding random binary string from the two first random binary strings according to each bit value in the first binary code to obtain a first selected binary string;
[0028] The second participant performs an oblivious transfer protocol operation on each bit in the second binary code and the first random binary string to obtain a second selected binary string;
[0029] The first participant performs an XOR operation on each element in the first selected binary string to obtain a first XOR binary string;
[0030] The second participant performs an XOR operation on each element in the second selected binary string to obtain a second XOR binary string;
[0031] The first participant sends the first XOR binary string to the second participant, and the second participant sends the second XOR binary string to the first participant;
[0032] Pairwise privacy comparison is achieved by comparing the first XOR binary string and the second XOR binary string.
[0033] In an optional embodiment,
[0034] Before the second participant encrypts the statistical information according to the predetermined key information and encryption algorithm, the method further includes:
[0035] The first party and the second party determine a first private key and a second private key respectively;
[0036] The first party and the second party determine and disclose a first public key and a second public key respectively according to the first private key and the second private key, based on a public key generation algorithm and pre-disclosed global parameters;
[0037] The first party determines a shared key based on the first private key, the first public key, and the global parameter;
[0038] The second party determines the shared key based on the second private key, the second public key, and the global parameter.
[0039] In a second aspect of the embodiments of the present disclosure,
[0040] A method for calculating federated group statistics based on symmetric encryption is provided, the method being applied to a first participant, the method comprising:
[0041] Grouping the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0042] Determine, according to each user group set and the acquired second user set of the second participant, a federated intersection of each user group set and the second user set by a secure intersection algorithm;
[0043] obtaining the encrypted information sent by the second participant, and decrypting the encrypted information according to the same key as that of the second participant, to determine the statistical information of each user group set,
[0044] The encrypted information sent by the second participant is determined based on the federal intersection, a predetermined key, the statistical information and an encryption algorithm.
[0045] In a third aspect of the embodiments of the present disclosure,
[0046] A method for calculating federated group statistics based on symmetric encryption is provided, the method being applied to a second participant, the method comprising:
[0047] The second user set of the second participant and each user group set of the first participant determine the federated intersection with each user group set of the first participant through a secure intersection algorithm;
[0048] Determine a second user feature belonging to an element of the federated intersection based on the federated intersection, calculate user feature statistics within the federated intersection, and obtain statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0049] The second participant encrypts the statistics of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant to determine the statistics information of each user group set.
[0050] In a fourth aspect of the embodiments of the present disclosure,
[0051] Provided is a federated group statistics calculation device based on symmetric encryption,
[0052] The device is applied to multiple participants, the participants include a first participant and a second participant, the first participant stores user group information, and the second participant stores user feature information, and the device includes:
[0053] The first unit is used to group the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0054] A second unit is used for the first participant to determine a federated intersection of each user group set and the second user set of the second participant by using a secure intersection algorithm;
[0055] A third unit is used for the second participant to determine a second user feature belonging to the intersection based on the federated intersection, calculate the user feature statistics in the intersection, and obtain the statistical information of each user group set, wherein the second user feature includes the feature information of the second user corresponding to the second user set;
[0056] The fourth unit is used for the second participant to encrypt the statistical information of each user group set according to the predetermined key information and encryption algorithm, and send the encrypted result to the first participant;
[0057] The fifth unit is used for the first participant to decrypt the encrypted result according to the same key information as the second participant, and determine the statistical information of each user group set.
[0058] In a fifth aspect of the embodiments of the present disclosure,
[0059] A device for calculating federated group statistics based on symmetric encryption is provided, the device being applied to a first participant, and comprising:
[0060] A sixth unit is used to group the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0061] A seventh unit is used to determine a federated intersection of each user group set and the second user set obtained by the second participant through a secure intersection algorithm according to each user group set and the second user set obtained by the second participant;
[0062] an eighth unit, configured to obtain the encrypted information sent by the second participant, decrypt the encrypted information according to the same key as that of the second participant, and determine the statistical information of each user group set,
[0063] The encrypted information sent by the second participant is determined based on the federal intersection, a predetermined key, the statistical information and an encryption algorithm.
[0064] In a sixth aspect of the embodiments of the present disclosure,
[0065] A device for calculating federated group statistics based on symmetric encryption is provided, the device being applied to a second participant, the device comprising:
[0066] Unit 9: The second user set of the second participant and each user group set of the first participant determine a federated intersection with each user group set of the first participant through a secure intersection algorithm;
[0067] A tenth unit is used to determine a second user feature belonging to the federated intersection element based on the federated intersection information, calculate user feature statistics in the intersection, and obtain statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0068] The eleventh unit is used for the second participant to encrypt the statistics of each user group set according to predetermined key information and encryption algorithm, and send the encrypted result to the first participant to determine the statistics information of each user group set.
[0069] In a seventh aspect of the embodiments of the present disclosure,
[0070] An electronic device is provided, comprising:
[0071] processor;
[0072] a memory for storing processor-executable instructions;
[0073] The processor is configured to call the instructions stored in the memory to execute any of the aforementioned methods.
[0074] In an eighth aspect of the embodiments of the present disclosure,
[0075] A computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, any of the above-mentioned methods is implemented.
[0076] The present disclosure provides a method for calculating federated group statistics based on symmetric encryption.
[0077] The method is applied to multiple participants, the participants include a first participant and a second participant, the first participant stores user group information, and the second participant stores user feature information, the method includes:
[0078] Grouping the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0079] By grouping the first user information corresponding to the first participant, the intersection of each group information and the second user information of the second participant can be accurately determined, which not only helps to reduce the amount of calculation, but also can obtain analysis data in finer dimensions to meet the needs of subsequent modeling or calculation.
[0080] The first participant determines a federated intersection of each user group set and the second user set of the second participant by using a secure intersection algorithm;
[0081] Through the secure intersection algorithm, two parties holding their own sets are allowed to jointly calculate the intersection of the two sets. One or both parties should obtain the correct intersection and will not obtain any information from the other party's set other than the intersection.
[0082] The second participant determines a second user feature belonging to the intersection based on the federated intersection, calculates user feature statistics in the intersection, and obtains statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0083] The second participant encrypts the statistical information of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant;
[0084] The first participant decrypts the encrypted result according to the same key information as the second participant to determine the statistical information of each user group set.
[0085] The first party and the second party use symmetric encryption algorithms and secure intersection algorithms to make full use of public information for encryption and decryption. When performing group statistics calculations in the federated learning scenario, it is ensured that the group information and feature information of either party will not be directly or indirectly exchanged or disclosed to other parties. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] Figure 1 This is a flow chart of a first method for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure;
[0087] Figure 2 This is a flow chart of a second method for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure;
[0088] Figure 3 This is a flow chart of a third method for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure;
[0089] Figure 4 This is a schematic diagram of the structure of a first device for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure;
[0090] Figure 5 This is a schematic diagram of the structure of a second device for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure;
[0091] Figure 6 This is a schematic diagram of the structure of a third device for calculating federal group statistics based on symmetric encryption according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0092] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0093] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in sequences other than those illustrated or described herein.
[0094] It should be understood that in the various embodiments of the present disclosure, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0095] It should be understood that in the present disclosure, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0096] It should be understood that in the present disclosure, "plurality" refers to two or more than two. "And / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "Contains A, B and C", "Contains A, B, C" means that A, B, and C are all included, "Contains A, B or C" means that one of A, B, and C is included, and "Contains A, B and / or C" means that any one, any two, or any three of A, B, and C are included.
[0097] It should be understood that in the present disclosure, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A and B can be determined based on A. Determining B based on A does not mean determining B based only on A, but B can also be determined based on A and / or other information. A and B match when the similarity between A and B is greater than or equal to a preset threshold.
[0098] Depending on the context, "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting."
[0099] The technical solution of the present disclosure is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0100] Figure 1 The flowchart of the first method for calculating federated group statistics based on symmetric encryption in the embodiment of the present disclosure is exemplarily shown. The method is applied to multiple participants, including a first participant and a second participant. The first participant stores user group information, and the second participant stores user feature information, such as Figure 1 As shown, the method includes:
[0101] S101, grouping a first user set corresponding to a first participant according to user grouping information to obtain multiple user group sets;
[0102] S102: The first participant determines a federated intersection of each user group set and the second user set of the second participant by using a secure intersection algorithm;
[0103] Exemplarily, in order to meet the needs of data privacy protection and federated computing, the disclosed embodiment performs federated group statistics calculation based on privacy-safe intersection and symmetric encryption, wherein privacy-safe intersection means that the parties holding the data obtain the intersection of the data held by both parties without leaking any additional information.
[0104] Privacy-safe intersection is very practical in real-world scenarios. For example, in a social software, when a new user registers for the social software, the user's address book friends are intersected with the users already registered in the social software to obtain which of the new user's address book friends have registered for the social software, thereby discovering and recommending friends to the new user, and not leaking any other user information outside the intersection to the user or the social software, so as to protect the privacy information of other users.
[0105] It should be noted that the embodiments of the present disclosure can be applied to multiple participants. For the convenience of description, the embodiments of the present disclosure are described with two participants, wherein P1 refers to the first participant, and P2 refers to the second participant.
[0106] Among them, P1 has data grouping information, which is shown in Table 1 below for example:
[0107] Table 1: Group ID and user ID set of P1
[0108] Group ID Group user ID collection group_1 {user_id_1_1,user_id_1_5,…} group_2 {user_id_1_3,user_id_1_10,…} group_3 {user_id_1_5,user_id_1_n,…} … … group_t {user_id_1_2,user_id_1_12,…}
[0109] Participant P1 has n user information {user_id_1_1, user_id_1_2, …, user_id_1_n}, which are divided into t groups group_1, group_2, …, group_t. The user ID sets corresponding to each group are {user_id_1_1, user_id_1_5, …}, {user_id_1_3, user_id_1_10, …}, …, {user_id_1_2, user_id_1_12, …}. Intersections between user ID sets of different groups are allowed. For example, in the above example, the user ID sets of group_1 and group_3 both have the same user user_id_1_5.
[0110] Among them, P2 has data feature information, which is shown in Table 2 below for example:
[0111] Table 2: User ID and data feature information
[0112] User ID feature_ feature_2 … feature_j user_id_2_1 f_1_1 f_2_1 … f_j_1 user_id_2_2 f_1_2 f_2_2 … f_j_2 user_id_2_3 f_1_3 f_2_3 … f_j_3 … … … … … user_id_2_m f_1_m f_2_m … f_j_m
[0113] Participant P2 has m user information {user_id_2_1, user_id_2_2, …, user_id_2_m}, and participant P2 has feature data of these m users [feature_1, feature_2, …, feature_j], where each user's feature data has j dimensions.
[0114] It is understandable that the above Tables 1 and 2 are only exemplary illustrations of P1 and P2, and do not constitute actual limitations on P1 and P2. For ease of understanding, P1 and P2 are further illustrated with specific data:
[0115] For example, taking P1 having 2000 users and the grouping information of the 2000 users as an example, the user information of P1 may be grouped, wherein the number of groups may be 20 groups, and the corresponding user grouping information is shown in the following Table 3:
[0116] Table 3: User group information of P1
[0117] Group ID Group user ID collection group_1 {A_1,A_100,…} group_2 {A_3,A_20,…} group_3 {A_5,A_2000,…} … … group_20 {A_2,A_120,…}
[0118] It can be seen that the number of groups of P1 is 20, namely group_1-group_20. Taking group_1 as an example, its corresponding user ID set is {A_1, A_100, ...}. By grouping the first user information corresponding to the first participant, the intersection of each group information and the second user information of the second participant can be accurately determined, which not only helps to reduce the amount of calculation, but also can obtain more detailed dimensional analysis data, which can meet the needs of subsequent modeling or calculation.
[0119] For example, P2 has 1000 users and the characteristic information of these 1000 users is shown in the following Table 4:
[0120] Table 4: User ID and 10-dimensional feature information of P2
[0121]
[0122]
[0123] According to the user group information of P1 and the second user information of P2, the intersection information of the user group information and the second user information can be determined by using a secure intersection algorithm.
[0124] It should be noted that, in actual applications, the first user information and the second user information contain some privacy-related data. In order to ensure privacy security, the first user information and the second user information may be desensitized.
[0125] In an optional implementation manner, before determining the intersection information of the user group information and the second user information, the method of the present disclosure further includes:
[0126] The first participant and the second participant use the same data desensitizing algorithm to respectively desensitize the first user information corresponding to the first participant and the second user information corresponding to the second participant.
[0127] The user group information and the user ID of the second user information are desensitized, wherein P1 and P2 can use the same desensitization rule to desensitize the original user ID, wherein the data desensitization method may include the SHA256 algorithm of the Hash function. It should be noted that the desensitization algorithm of the embodiment of the present disclosure is only an exemplary description, and the embodiment of the present disclosure does not specifically limit the desensitization algorithm.
[0128] Among them, the local user ID set PA_User after P1 desensitization = {en_A_1, en_A_2, ..., en_A_2000}, the local user ID set PB_User after P2 desensitization = {en_B_1, en_B_2, ..., en_B_10000}; for example, if the user ID is 'admin', after data desensitization, its user ID is converted to:
[0129] 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918, which can ensure that the user's ID data will not be leaked.
[0130] According to the original grouping information of group_1, group_2, ..., group_20, PA_User is grouped to obtain the anonymized user ID set of each group: PA_group_1 = {en_A_1, en_A_100, ...}, PA_group_2 = {en_3, en_A_20, ...}, ..., PA_group_20 = {en_A_2, en_A_120, ...};
[0131] In an optional implementation, the method for determining the federated intersection of each user group set and the second user set includes:
[0132] The first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant to determine a federated intersection of each user group set and the second user set.
[0133] In an optional embodiment,
[0134] Before the first participant performs pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant, the method further includes:
[0135] The first participant and the second participant respectively encode the first element and the second element into binary codes of length X, to obtain a first binary code and a second binary code respectively;
[0136] Wherein, X is the coding length determined by negotiation between the first participant and the second participant.
[0137] In an optional implementation, the method in which the first participant performs pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant comprises:
[0138] The first participant randomly generates two first random binary strings of the same length from each bit in the first binary code;
[0139] The first participant selects a corresponding random binary string from the two first random binary strings according to each bit value in the first binary code to obtain a first selected binary string;
[0140] The second participant performs an oblivious transfer protocol operation on each bit in the second binary code and the first random binary string to obtain a second selected binary string;
[0141] The first participant performs an XOR operation on each element in the first selected binary string to obtain a first XOR binary string;
[0142] The second participant performs an XOR operation on each element in the second selected binary string to obtain a second XOR binary string;
[0143] The first participant sends the first XOR binary string to the second participant, and the second participant sends the second XOR binary string to the first participant;
[0144] Pairwise privacy comparison is achieved by comparing the first XOR binary string and the second XOR binary string.
[0145] Exemplarily, the first participant may randomly generate two random binary strings of the same length for each bit in the first binary code, that is, each first binary code may obtain 2X random binary strings; wherein the first binary code is obtained by encoding the first element in the first participant into a binary code of length X; wherein the first element in the first participant may query the group information of the corresponding user;
[0146] Exemplarily, the second participant may perform an oblivious transfer protocol operation on each bit in the second binary code and the first random binary string of the corresponding number of bits to determine a second selected binary string, wherein the second binary code is a binary code of length X encoded by the second participant by the second element; wherein the second element in the second participant can index the characteristic information of the corresponding user.
[0147] Optionally, the first binary code of the first participant may be 1101, and the second binary code of the second participant may be 1010. It should be noted that the above specific values are only exemplary, and the embodiments of the present disclosure do not limit the specific values of the global parameters, the first binary code, and the second binary code.
[0148] The first participant may randomly generate two first random binary strings of the same length for each bit of 1101. For example, the two random binary strings corresponding to each bit of 1101 are [110,010], [100,110], [001,010], and [011,111] respectively.
[0149] The second participant may perform an oblivious transfer protocol operation on each bit of 1010 and the first random binary string corresponding to the first participant to obtain a second selected binary string. Optionally:
[0150] OT([110,010],1)=010;
[0151] OT([100,110],0)=100;
[0152] OT([001,010],1)=010;
[0153] OT([011,111],0)=011;
[0154] Among them, OT represents the oblivious transfer protocol operation;
[0155] The second participant can obtain 010, 100, 010, 011, and perform an XOR operation on each second element in the second selected binary string, that is, 010⊕100⊕010⊕011=111, so the second XOR binary string is 111;
[0156] The first participant can select the corresponding binary string 010, 110, 001, 111 from [110, 010], [100, 110], [001, 010], [011, 111] according to each bit of 1101, i.e., the first selected binary string, and perform an XOR operation on each first element in the first selected binary string, i.e., 010⊕110⊕001⊕111=010, and the first XOR binary string is 010;
[0157] From the above, we can see that the first XOR binary string is 010, and the second XOR binary string is 111. The first XOR binary string is not equal to the second XOR binary string, which means that the two original numbers are not equal, that is, a privacy comparison is completed.
[0158] S103, the second participant determines a second user feature belonging to the intersection based on the federated intersection, calculates user feature statistics in the intersection, and obtains statistical information of each user group set;
[0159] The second user characteristics include characteristic information of the second user corresponding to the second user set information.
[0160] For example, statistics are the most important concepts for estimating and inferring digital features. Common statistics include sample mean, sample variance, etc. Grouping statistics refer to the calculation of descriptive statistics after grouping samples, such as the cumulative sum, mean, maximum value, etc. within each group.
[0161] Optionally, the second participant may calculate statistical information for the second user features belonging to the intersection according to a secure intersection algorithm. For example, the maximum value of the features of all users in the intersection, the sum of the features, the average value of the features, etc. may be calculated.
[0162] It should be noted that the federated intersection is the intersection of the second user set and each user group set, that is, each user group will obtain a corresponding federated intersection, and the statistical information obtained on this basis also corresponds to the statistical information of each user group set.
[0163] S104: the second participant encrypts the statistical information of each user group set according to the predetermined key information and encryption algorithm, and sends the encrypted result to the first participant;
[0164] S105. The first participant decrypts the encrypted result according to the same key information as the second participant to determine the statistical information of each user group set.
[0165] For example, the embodiments of the present disclosure may use a symmetric encryption algorithm, that is, an encryption method of a single-key cryptographic system, where the same key can be used for both encryption and decryption of information. Symmetric means that both parties using this encryption method use the same key for encryption and decryption.
[0166] Before data transmission, the sender and receiver agree on the key in advance, and then both parties keep the key. In the symmetric encryption process, the data sender processes the plain text (original data) through a special encryption algorithm, turning it into a complex encrypted ciphertext and sending it out. After the receiver receives the ciphertext, if he wants to decipher the original plaintext, he needs to use the encryption key and the inverse algorithm of the same algorithm to decrypt the ciphertext and restore it to readable plaintext.
[0167] In an optional implementation manner, before the second participant encrypts the statistical information according to the predetermined key information and encryption algorithm, the method further includes:
[0168] The first party and the second party determine a first private key and a second private key respectively;
[0169] The first party and the second party determine and disclose a first public key and a second public key respectively according to the first private key and the second private key, based on a public key generation algorithm and pre-disclosed global parameters;
[0170] The first party determines a shared key based on the first private key, the first public key, and the global parameter;
[0171] The second party determines the shared key based on the second private key, the second public key, and the global parameter.
[0172] Exemplarily, the first party and the second party may determine in advance a first private key and a second private key, where the first private key may be represented as XA and the second private key may be represented as XB. In addition, global parameters may be disclosed in advance, and the global parameters may include a prime number q and an integer a, where a is a primitive root of q.
[0173] Optionally, the first party and the second party may select the same public key generation algorithm, wherein the public key generation algorithm of the first party may be YA=a^XA mod q, and the public key generation algorithm of the second party may be YB=a^XB mod q,
[0174] The calculation formula for the first participant to generate the shared key is K = (YB)^XA mod q. Similarly, the calculation formula for the second participant to generate the shared key is K = (YA)^XB mod q. These two calculation formulas produce the same result, and in this way, the two parties have exchanged the same key.
[0175] The present disclosure provides a method for calculating federated group statistics based on symmetric encryption.
[0176] The method is applied to multiple participants, the participants include a first participant and a second participant, the first participant stores user group information, and the second participant stores user feature information, the method includes:
[0177] Grouping the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0178] By grouping the first user information corresponding to the first participant, the intersection of each group information and the second user information of the second participant can be accurately determined, which not only helps to reduce the amount of calculation, but also can obtain analysis data in finer dimensions to meet the needs of subsequent modeling or calculation.
[0179] The first participant determines a federated intersection of each user group set and the second user set of the second participant by using a secure intersection algorithm;
[0180] Through the secure intersection algorithm, two parties holding their own sets are allowed to jointly calculate the intersection of the two sets. One or both parties should obtain the correct intersection and will not obtain any information from the other party's set other than the intersection.
[0181] The second participant determines a second user feature belonging to the intersection based on the intersection information, calculates a user feature statistic in the intersection, and obtains statistic information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0182] The second participant encrypts the statistical information of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant;
[0183] The first participant decrypts the encrypted result according to the same key information as the second participant to determine the statistical information of each user group set.
[0184] The first and second parties use symmetric encryption algorithms and secure intersection algorithms to make full use of public information for encryption and decryption. When calculating group statistics in the federated learning scenario, it is ensured that the group information and feature information of either party will not be directly or indirectly exchanged or disclosed to other parties.
[0185] In addition, the symmetric encryption algorithm of the embodiment of the present disclosure has fast encryption / decryption speed, simple key management, small calculation amount, fast encryption speed and high encryption efficiency.
[0186] Figure 2 FIG. 1 is a flow chart of a second method for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure. Figure 2 As shown, the method is applied to a first participant, and the method includes:
[0187] S201, grouping a first user set corresponding to a first participant according to user grouping information to obtain multiple user group sets;
[0188] S202: Determine a federated intersection of each user group set and the second user set of the acquired second participant by using a secure intersection algorithm;
[0189] S203, obtaining the encrypted information sent by the second participant, and decrypting the encrypted information according to the same key information as the second participant, to determine the statistical information of each user group set,
[0190] The encrypted information sent by the second participant is determined based on the federal intersection, a predetermined key, the statistical information and an encryption algorithm.
[0191] In an optional embodiment,
[0192] The method further comprises:
[0193] The first party determines a first private key;
[0194] The first party determines and publishes a first public key according to the first private key, based on a public key generation algorithm and pre-published global parameters;
[0195] Based on the first public key, the first private key, and the global parameter, a shared key is determined based on a symmetric encryption algorithm.
[0196] It is understandable that the present disclosure Figure 2 The beneficial effects of the corresponding method of the embodiment can be referred to the aforementioned Figure 1 The beneficial effects of the method corresponding to the embodiment will not be described in detail here.
[0197] Figure 3 FIG. 1 is a flow chart of a third method for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure. Figure 3 As shown, the method is applied to a second participant, and the method includes:
[0198] S301, the second user set of the second participant and each user group set of the first participant determine the federated intersection with each user group set of the first participant through a secure intersection algorithm;
[0199] S302: Determine a second user feature belonging to an element of the federated intersection based on the federated intersection, calculate user feature statistics within the federated intersection, and obtain statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0200] S303: The second participant encrypts the statistics of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant to determine the statistics information of each user group set.
[0201] In an optional embodiment,
[0202] The method further comprises:
[0203] The second party determines a second private key;
[0204] The second party determines and publishes a second public key according to the second private key, based on a public key generation algorithm and pre-published global parameters;
[0205] Based on the second public key, the second private key, and the global parameter, a shared key is determined based on a symmetric encryption algorithm.
[0206] It is understandable that the present disclosure Figure 3 The beneficial effects of the corresponding method of the embodiment can be referred to the aforementioned Figure 1 The beneficial effects of the method corresponding to the embodiment will not be described in detail here.
[0207] Figure 4 FIG. 1 is a schematic diagram of the structure of the first federal group statistics calculation device based on symmetric encryption according to an embodiment of the present disclosure. Figure 4 As shown, the device is applied to multiple participants, the participants include a first participant and a second participant, the first participant stores user group information, the second participant stores user feature information, and the device includes:
[0208] The first unit 41 is used to group the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0209] The second unit 42 is used for the first participant to determine the federated intersection of each user group set and the second user set of the second participant through a secure intersection algorithm;
[0210] The third unit 43 is used for the second participant to determine the second user feature belonging to the intersection based on the federated intersection, calculate the user feature statistics in the intersection, and obtain the statistical information of each user group set, wherein the second user feature includes the feature information of the second user corresponding to the second user set;
[0211] The fourth unit 44 is used for the second participant to encrypt the statistical information of each user group set according to the predetermined key information and encryption algorithm, and send the encrypted result to the first participant;
[0212] The fifth unit 45 is used for the first participant to decrypt the encrypted result according to the same key information as the second participant, and determine the statistical information corresponding to each user group set.
[0213] It is understandable that the present disclosure Figure 4 The beneficial effects of the corresponding device of the embodiment can be referred to the aforementioned Figure 1 The beneficial effects of the method corresponding to the embodiment will not be described in detail here.
[0214] Figure 5 FIG. 1 is a schematic diagram of the structure of a second device for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure. Figure 5 As shown, the device is applied to a first participant, and the device includes:
[0215] The sixth unit 51 is used to group the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets;
[0216] A seventh unit 52 is configured to determine a federated intersection of each user group set and the second user set obtained by the second participant through a secure intersection algorithm according to each user group set and the second user set obtained by the second participant;
[0217] The eighth unit 53 is used to obtain the encrypted information sent by the second participant, and decrypt the encrypted information according to the same key as the second participant, to determine the statistical information corresponding to each user group set,
[0218] The encrypted information sent by the second participant is determined based on the federal intersection, a predetermined key, the statistical information and an encryption algorithm.
[0219] It is understandable that the present disclosure Figure 5 The beneficial effects of the corresponding device of the embodiment can be referred to the aforementioned Figure 1 The beneficial effects of the method corresponding to the embodiment will not be described in detail here.
[0220] Figure 6 FIG. 1 is a schematic diagram of the structure of a third device for calculating federated group statistics based on symmetric encryption according to an embodiment of the present disclosure. Figure 6 As shown, the device is applied to a second participant, and the device includes:
[0221] Unit 9 61, the second user set of the second participant and each user group set of the first participant determine a federated intersection with each user group set of the first participant through a secure intersection algorithm;
[0222] A tenth unit 62 is used to determine a second user feature belonging to the federated intersection element based on the federated intersection information, calculate user feature statistics in the federated intersection, and obtain statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set;
[0223] The eleventh unit 63 is used for the second participant to encrypt the statistics of each user group set according to predetermined key information and encryption algorithm, and send the encrypted result to the first participant to determine the statistical information corresponding to each user group set.
[0224] It is understandable that the present disclosure Figure 6 The beneficial effects of the corresponding device of the embodiment can be referred to the aforementioned Figure 1 The beneficial effects of the method corresponding to the embodiment will not be described in detail here.
[0225] In a seventh aspect of the embodiments of the present disclosure,
[0226] An electronic device is provided, comprising:
[0227] processor;
[0228] a memory for storing processor-executable instructions;
[0229] The processor is configured to call the instructions stored in the memory to execute any of the aforementioned methods.
[0230] In an eighth aspect of the embodiments of the present disclosure,
[0231] A computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, any of the above-mentioned methods is implemented.
[0232] The present disclosure also provides a program product, which includes an execution instruction, which is stored in a readable storage medium. At least one processor of a device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the device implements the methods provided in the various embodiments described above.
[0233] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (Application Specific Integrated Circuits, abbreviated as: ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist in a communication device as discrete components. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0234] In the above-mentioned terminal or server embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present disclosure may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0235] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method for calculating federated group statistics based on symmetric encryption, characterized in that: The method is applied to multiple participants, the participants include a first participant and a second participant, the first participant stores user group information, and the second participant stores user feature information, the method includes: Grouping the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets; The first participant determines a federated intersection of each user group set and the second user set of the second participant by using a secure intersection algorithm; The second participant determines a second user feature belonging to the intersection based on the federated intersection, calculates user feature statistics in the intersection, and obtains statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set; The second participant encrypts the statistical information of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant; The first participant decrypts the encrypted result according to the same key information as the second participant to determine the statistical information of each user group set; Before determining the federated intersection of each user group set and the second user set, the method further includes: the first participant and the second participant respectively perform data desensitization on each user group set corresponding to the first participant and the second user set corresponding to the second participant using the same data desensitization algorithm; The method for determining the federated intersection of each user group set and the second user set comprises: the first participant performs a pairwise privacy comparison on a first element in each user group set and a second element in a second user set of the second participant to determine the federated intersection of each user group set and the second user set; Before the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant, the method further includes: the first participant and the second participant respectively encode the first element and the second element into binary codes of length X, to obtain a first binary code and a second binary code respectively; wherein X is the code length determined by mutual negotiation between the first participant and the second participant; The method in which the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant includes: the first participant randomly generates two first random binary strings of the same length for each bit in the first binary code; the first participant selects a corresponding random binary string from the two first random binary strings according to each bit value in the first binary code to obtain a first selected binary string; the second participant performs an oblivious transfer protocol operation on each bit in the second binary code and the first random binary string to obtain a second selected binary string; the first participant performs an XOR operation on each element in the first selected binary string to obtain a first XOR binary string; the second participant performs an XOR operation on each element in the second selected binary string to obtain a second XOR binary string; the first participant sends the first XOR binary string to the second participant, and the second participant sends the second XOR binary string to the first participant; and the pairwise privacy comparison is achieved by comparing the first XOR binary string with the second XOR binary string.
2. The method according to claim 1, characterized in that Before the second participant encrypts the statistical information according to the predetermined key information and encryption algorithm, the method further includes: The first party and the second party determine a first private key and a second private key respectively; The first party and the second party determine and disclose a first public key and a second public key respectively according to the first private key and the second private key, based on a public key generation algorithm and pre-disclosed global parameters; The first party determines a shared key based on the first private key, the first public key, and the global parameter; The second party determines the shared key based on the second private key, the second public key, and the global parameter.
3. A method for calculating federated group statistics based on symmetric encryption, characterized in that: The method is applied to a first participant, and the method comprises: Grouping the first user set corresponding to the first participant according to the user grouping information to obtain multiple user group sets; Determine, according to each user group set and the acquired second user set of the second participant, a federated intersection of each user group set and the second user set by a secure intersection algorithm; Obtaining encrypted information sent by the second participant, and decrypting the encrypted information according to the same key as the second participant, to determine the statistical information of each user group set, wherein the encrypted information sent by the second participant is determined according to the federated intersection, the predetermined key, the statistical information, and the encryption algorithm; Before determining the federated intersection of each user group set and the second user set, the method further includes: the first participant and the second participant respectively perform data desensitization on each user group set corresponding to the first participant and the second user set corresponding to the second participant using the same data desensitization algorithm; The method for determining the federated intersection of each user group set and the second user set comprises: the first participant performs a pairwise privacy comparison on a first element in each user group set and a second element in a second user set of the second participant to determine the federated intersection of each user group set and the second user set; Before the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant, the method further includes: the first participant and the second participant respectively encode the first element and the second element into binary codes of length X, to obtain a first binary code and a second binary code respectively; wherein X is the code length determined by mutual negotiation between the first participant and the second participant; The method in which the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant includes: the first participant randomly generates two first random binary strings of the same length for each bit in the first binary code; the first participant selects a corresponding random binary string from the two first random binary strings according to each bit value in the first binary code to obtain a first selected binary string; the second participant performs an oblivious transfer protocol operation on each bit in the second binary code and the first random binary string to obtain a second selected binary string; the first participant performs an XOR operation on each element in the first selected binary string to obtain a first XOR binary string; the second participant performs an XOR operation on each element in the second selected binary string to obtain a second XOR binary string; the first participant sends the first XOR binary string to the second participant, and the second participant sends the second XOR binary string to the first participant; and the pairwise privacy comparison is achieved by comparing the first XOR binary string with the second XOR binary string.
4. A method for calculating federated group statistics based on symmetric encryption, characterized in that: The method is applied to a second participant, and the method comprises: The second user set of the second participant and each user group set of the first participant determine the federated intersection with each user group set of the first participant through a secure intersection algorithm; Determine a second user feature belonging to an element of the federated intersection based on the federated intersection, calculate user feature statistics within the federated intersection, and obtain statistical information of each user group set, wherein the second user feature includes feature information of a second user corresponding to the second user set; The second participant encrypts the statistics of each user group set according to predetermined key information and an encryption algorithm, and sends the encrypted result to the first participant, so as to determine the statistics information corresponding to each user group set; Before determining the federated intersection with each user group set of the first participant, the method further includes: the first participant and the second participant use the same data desensitization algorithm to perform data desensitization on each user group set corresponding to the first participant and the second user set corresponding to the second participant respectively; The method for determining the federated intersection of each user group set and the second user set comprises: the first participant performs a pairwise privacy comparison on a first element in each user group set and a second element in a second user set of the second participant to determine the federated intersection of each user group set and the second user set; Before the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant, the method further includes: the first participant and the second participant respectively encode the first element and the second element into binary codes of length X, to obtain a first binary code and a second binary code respectively; wherein X is the code length determined by mutual negotiation between the first participant and the second participant; The method in which the first participant performs a pairwise privacy comparison on the first element in each user group set and the second element in the second user set of the second participant includes: the first participant randomly generates two first random binary strings of the same length for each bit in the first binary code; the first participant selects a corresponding random binary string from the two first random binary strings according to each bit value in the first binary code to obtain a first selected binary string; the second participant performs an oblivious transfer protocol operation on each bit in the second binary code and the first random binary string to obtain a second selected binary string; the first participant performs an XOR operation on each element in the first selected binary string to obtain a first XOR binary string; the second participant performs an XOR operation on each element in the second selected binary string to obtain a second XOR binary string; the first participant sends the first XOR binary string to the second participant, and the second participant sends the second XOR binary string to the first participant; and the pairwise privacy comparison is achieved by comparing the first XOR binary string with the second XOR binary string.
5. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in claim 1, and / or claim 3, and / or claim 4.
6. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method described in claim 1, claim 3, and / or claim 4 is implemented.
Citation Information
Patent Citations
Parallel training method and system for federated learning
CN112365006A
Data set processing method and device, data processing method and device and storage medium
CN113127916A