Confusion circuit calculation method and related equipment
By using an inadvertent transmission protocol in the obfuscated circuit, the output value of the logic gate is directly calculated, which solves the problem of low computing efficiency of the obfuscated circuit and realizes a more efficient calculation process.
Patent Information
- Application Number
- CN202411031517.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-07-29
AI Technical Summary
The obfuscation circuit needs to generate an obfuscation truth table when executing each logic gate, resulting in extremely low computational efficiency and a lot of time wasted.
By running an inadvertent transmission protocol, the obfuscation circuit executor calculates the obfuscation value of the actual output data based on the true value of the input data held by itself as the output of the logic gate, and directly completes the calculation of a logic gate in the obfuscation circuit without generating obfuscation True value table.
It improves the calculation efficiency of the obfuscation circuit, saves time in generating obfuscation truth tables, and improves calculation performance.
Smart Images

Figure CN118965459A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of secure computing technology, and more particularly, to a method for calculating an obfuscated circuit and related devices. Background Art
[0002] Obfuscation circuit is a cryptographic protocol that uses computer simulation integrated circuits (Application Specific Integrated Circuit, ASIC) to achieve multi-party secure computing. An obfuscation circuit often includes multiple logic gates (such as AND gates, NOT gates, NOR gates, XOR gates, etc.). When executing each logic gate, it is usually necessary for the party participating in the obfuscation circuit calculation (obfuscation circuit generator) to first generate an obfuscation truth table corresponding to the logic gate and send it to the other party (obfuscation circuit executor). The obfuscation circuit executor then calculates the output result of each logic gate based on the received obfuscation truth table and the obfuscation values of the input data of both parties. Since an obfuscation truth table must be generated for each logic gate in each execution circuit, a lot of time will be wasted, making the calculation efficiency of the obfuscation circuit extremely low. Summary of the invention
[0003] In view of this, one or more embodiments of the present specification provide a garbled circuit calculation method and related devices.
[0004] In a first aspect, the present specification provides a method for calculating an obfuscated circuit, which is applied to a first computing device corresponding to an obfuscated circuit executor, wherein the obfuscated circuit includes a plurality of logic gates; the first computing device holds first input data corresponding to a first logic gate included in the obfuscated circuit, wherein the first input data is 1-bit data with a value of 0 or 1; a second computing device corresponding to an obfuscated circuit generator holds a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1;
[0005] The method comprises:
[0006] Obtain a random number i, and a random value r randomly selected from an array consisting of a first random value and a second random value obtained from the second computing device as array elements and corresponding to the array index indicated by the random number i i ; The value of the random number i is 0 or 1;
[0007] Obtaining an intermediate calculation result corresponding to an output result of the first logic gate calculated by the second calculation device based on the first random value, the second random value, the first output data, and the second output data;
[0008] When the value of the first input data is 0, based on the random value r i Calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
[0009] In a second aspect, the present specification provides a method for calculating an obfuscated circuit, which is applied to a second computing device corresponding to an obfuscated circuit generator, wherein the obfuscated circuit includes a plurality of logic gates; a first computing device corresponding to an obfuscated circuit executor holds first input data corresponding to a first logic gate included in the obfuscated circuit, wherein the first input data is 1-bit data having a value of 0 or 1; the second computing device holds a plurality of expected output data corresponding to the first logic gate; wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1;
[0010] The method comprises:
[0011] Obtaining a first random value and a second random value, and calculating an intermediate calculation result corresponding to an output result of the first logic gate according to the first random value, the second random value, the first output data, and the second output data;
[0012] The intermediate calculation result is sent to the first computing device, so that when the value of the first input data is 0, the first computing device obtains the random value r corresponding to the random number i. i , calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i Calculate an obfuscation value corresponding to the second output data using the intermediate calculation result, and use the obfuscation value as an output result of the first logic gate;
[0013] The random number i is 0 or 1, and the random value r is i It is a random value corresponding to the array subscript indicated by the random number i, randomly selected from an array consisting of the first random value and the second random value as array elements.
[0014] In a third aspect, the present specification provides a confusion circuit calculation device, which is applied to a first computing device corresponding to a confusion circuit executor, the confusion circuit comprising a plurality of logic gates; the first computing device holds first input data corresponding to a first logic gate included in the confusion circuit, the first input data being 1-bit data with a value of 0 or 1; a second computing device corresponding to a confusion circuit generator holds a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1;
[0015] The device comprises:
[0016] a first acquisition unit, configured to acquire a random number i, and a random value r randomly selected from an array consisting of the first random value and the second random value acquired from the second computing device as array elements and corresponding to the array index indicated by the random number i; i ; The value of the random number i is 0 or 1;
[0017] a second acquisition unit, configured to acquire an intermediate calculation result corresponding to an output result of the first logic gate, which is calculated by the second calculation device based on the first random value, the second random value, the first output data, and the second output data; and
[0018] A calculation unit, configured to calculate, when the value of the first input data is 0, a value based on the random value r i Calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
[0019] In a fourth aspect, the present specification provides a confusion circuit calculation apparatus, applied to a second computing device corresponding to a confusion circuit generator, the confusion circuit comprising a plurality of logic gates; a first computing device corresponding to a confusion circuit executor holds first input data corresponding to a first logic gate included in the confusion circuit, the first input data being 1-bit data with a value of 0 or 1; the second computing device holds a plurality of expected output data corresponding to the first logic gate; wherein the plurality of expected output data comprises first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1;
[0020] The device comprises:
[0021] an acquisition unit, configured to acquire a first random value and a second random value, and calculate an intermediate calculation result corresponding to an output result of the first logic gate according to the first random value, the second random value, the first output data, and the second output data;
[0022] The sending unit is configured to send the intermediate calculation result to the first computing device, so that the first computing device calculates the intermediate calculation result based on the obtained random value r corresponding to the random number i when the value of the first input data is 0. i , calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i Calculate an obfuscation value corresponding to the second output data using the intermediate calculation result, and use the obfuscation value as an output result of the first logic gate;
[0023] The random number i is 0 or 1, and the random value r is i It is a random value corresponding to the array subscript indicated by the random number i, randomly selected from an array consisting of the first random value and the second random value as array elements.
[0024] Accordingly, the present specification also provides a computing device, comprising: a memory and a processor; the memory stores a computer program / instruction that can be executed by the processor; when the processor executes the computer program / instruction, the confusion circuit calculation method described in the first aspect or the second aspect above is executed.
[0025] Accordingly, the present specification also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the obfuscation circuit calculation method described in the first aspect or the second aspect is executed.
[0026] Accordingly, the present specification also provides a computer program product, which includes a computer program / instruction. When the computer program / instruction is executed by a processor, the obfuscation circuit calculation method described in the first aspect or the second aspect is executed.
[0027] In summary, the present application takes into account that in some simple logic gate calculations included in the obfuscation circuit, the input data (e.g., a bit) corresponding to the logic gate held by the obfuscation circuit executor can only be 0 or 1, so the obfuscation circuit generator can first calculate the two possible output data (e.g., first output data and second output data) corresponding to the logic gate based on the two possible values of 0 or 1. Furthermore, by running the oblivious transfer protocol, the obfuscated circuit executor can calculate the obfuscated value of the actual output data as the output of the logic gate based on the real value of the input data held by itself, directly completing the calculation of a logic gate in the obfuscation circuit without generating the obfuscated truth table corresponding to the logic gate, saving a lot of time and improving the calculation efficiency of the obfuscation circuit. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a schematic diagram of a logic gate circuit provided by an exemplary embodiment;
[0029] Figure 2 is a schematic diagram of an inadvertent transmission provided by an exemplary embodiment;
[0030] Figure 3 is a schematic diagram of a system architecture provided by an exemplary embodiment;
[0031] Figure 4 is a flowchart of a method for calculating a confusion circuit provided by an exemplary embodiment;
[0032] Figure 5 It is a schematic diagram of the overall steps of a method for calculating a confusion circuit provided by an exemplary embodiment;
[0033] Figure 6 is a flowchart of another garbled circuit calculation method provided by an exemplary embodiment;
[0034] Figure 7 is a structural schematic diagram of a garbled circuit calculation device provided by an exemplary embodiment;
[0035] Figure 8 is a schematic structural diagram of another garbled circuit calculation device provided by an exemplary embodiment;
[0036] Fig. 9 It is a structural diagram of a computing device provided by an exemplary embodiment. DETAILED DESCRIPTION
[0037] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0038] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0039] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0040] First, some terms in this specification are explained to facilitate understanding by those skilled in the art.
[0041] (1) Obfuscation circuit is a cryptographic protocol that uses computers to simulate integrated circuits (ASICs) to achieve multi-party secure computing. It should be understood that any given computing task can be designed with multiple logic gates (or called computing gates) according to the computing logic, and multiple logic gates (such as AND gates, NOT gates, XOR gates, etc.) are connected to form a gate circuit, and the gate circuit is used to perform calculations to complete the given computing task. The obfuscation circuit algorithm represents the computing task as a gate circuit, and then encrypts each line of each logic gate therein. The encrypted gate circuit is called an obfuscation circuit. In this way, when both parties need to input their own data and then calculate a result through the same function, the obfuscation circuit can ensure that the input data of both parties is not known to the other party, thereby achieving multi-party secure computing. It will not be described in detail here. For details, please refer to the following Figure 1 Corresponding to the description in the embodiment.
[0042] (2) The Oblivious Transfer (OT) protocol is a secure computing protocol executed by two parties. It allows one party (the sender) to transfer one or more data in a set of data to the other party (the receiver). During the transmission process, the sender does not know which data in the set of data is transmitted (or the sender does not know which data the receiver obtains). In addition to obtaining the data selected by the receiver, the receiver cannot obtain other unselected data in the set of data, thereby achieving secure information transmission while maintaining the privacy of both parties. For example, the sender holds N secret input data and the receiver holds a secret choice p. The result of the execution of the oblivious transfer protocol is that the receiver obtains the pth input data in the N input data, while the other input data of the sender is always kept confidential to the outside world. The sender cannot know the receiver's p, that is, cannot know the specific data obtained by the receiver. For example, the above-mentioned N secret input data can be the identity information or credit evaluation of N users, etc., which is not specifically limited in this specification.
[0043] There are many types of oblivious transfer protocols, such as:
[0044] 2-out-of-2OT: The sender holds two pieces of data and the receiver can choose to obtain one of them without the sender knowing the choice.
[0045] 1-out-of-n OT: The sender holds n data and the receiver can choose to obtain one of them without the sender knowing the choice. n is an integer greater than 1.
[0046] In k-out-of-n OT, the sender holds n data, and the receiver can obtain k of them without the sender knowing the choice. k is an integer greater than 1 and less than n.
[0047] Random OT is a secure computing protocol executed by two parties. The execution of random OT allows the sender of the protocol to obtain n random data, and the receiver to obtain a random choice and the random data corresponding to the choice. Random OT can be a tool for implementing other secure computing protocols, etc., which will not be elaborated here. For details, please refer to the following Figure 2 Corresponding to the description in the embodiment.
[0048] For example, see Figure 1 , Figure 1 FIG. 1 is a schematic diagram of a logic gate circuit provided by an exemplary embodiment. Figure 1As shown, the gate circuit includes two AND gates, namely AND gate 1 and AND gate 2. a, b, and d are three input data (or input wires), each of which is a bit, that is, the values of a, b, and d are all 0 or 1. Among them, the input wires of AND gate 1 are a and b, and the output wire is c. The input wires of AND gate 2 are c and d, and the output wire is s. It is not difficult to understand that Figure 1 The calculation task actually performed by the gate circuit shown may be s=a AND b AND d, where AND represents an AND calculation.
[0049] It should be noted that the obfuscated circuit algorithm is generally divided into the obfuscated truth table generation stage and the obfuscated circuit operation stage. One party participating in the multi-party secure computation can act as the obfuscated circuit generator, generating an obfuscated truth table corresponding to the logic gates contained in the obfuscated circuit in the obfuscated truth table generation stage, that is, generating an obfuscated circuit; the other party acts as the obfuscated circuit executor, performing operations based on the obfuscated truth table in the obfuscated circuit operation stage.
[0050] (1) Confusion truth table generation stage:
[0051] For example, Figure 1 Taking the AND gate 1 shown as an example, the obfuscated circuit executor can hold the input data a of the AND gate 1, the obfuscated circuit generator can hold the input data b of the AND gate 1, and the output data of the AND gate 1 is c. First, the obfuscated circuit generator can generate a truth table for expressing the operation logic of the AND gate 1. The truth table of a logic gate indicates the corresponding value of the output data (such as c) when the two input data (such as a and b) of the logic gate take any value. Exemplarily, the truth table of the AND gate 1 can be shown in Table 1 below.
[0052] Table 1
[0053]
[0054]
[0055] As shown in Table 1 above, only when the values of input data a and b of AND gate 1 are both 1, the value of its output data c is 1, and in other cases, the value of output data c is 0.
[0056] Furthermore, in order to hide the true value of each data during the calculation process, the two values of 0 and 1 of a, b, and c need to be replaced by random values, so as to obtain the replacement table shown in Table 2 below.
[0057] Table 2
[0058] a b c <![CDATA[A0]]> <![CDATA[B0]]> <![CDATA[C0]]> <![CDATA[A0]]> <![CDATA[B1]]> <![CDATA[C0]]> <![CDATA[A1]]> <![CDATA[B0]]> <![CDATA[C0]]> <![CDATA[A1]]> <![CDATA[B1]]> <![CDATA[C1]]>
[0059] As shown in Table 2 above, the obfuscated circuit generator can randomly generate 6 different random values A0, A1, B0, B1, C0, and C1 to replace the corresponding 0 and 1 in Table 1 above, where A0 is the random value corresponding to when a is 0 (i.e., the obfuscated value, or label), A1 is the random value corresponding to when a is 1, and the same is true for B0, B1, C0, and C1, which will not be repeated here.
[0060] Furthermore, the obfuscated circuit generator may use the obfuscated values of the two input data in each row as a key to encrypt the obfuscated values of the output data, thereby obtaining an encryption table as shown in Table 3 below.
[0061] Table 3
[0062] a b c <![CDATA[A0]]> <![CDATA[B0]]> <![CDATA[Enc A0,B0 (C0)]]> <![CDATA[A0]]> <![CDATA[B1]]> <![CDATA[Enc A0,B1 (C0)]]> <![CDATA[A1]]> <![CDATA[B0]]> <![CDATA[Enc A1,B0 (C0)]]> <![CDATA[A1]]> <![CDATA[B1]]> <![CDATA[Enc A1,B1 (C1)]]>
[0063] As shown in Table 3 above, A0 and B0 are used to encrypt C0 (e.g., symmetric encryption) to obtain the ciphertext Enc A0,B0 (C0), A0 and B1 are used to encrypt C0, and the ciphertext Enc A0,B1 (C0), A1 and B0 are used to encrypt C0, and the ciphertext Enc A1,B0 (C0), A1 and B1 are used to encrypt C1, and the ciphertext Enc A1,B1 (C1). In this way, when an obfuscated value of input data a and an obfuscated value of input data b are obtained, one of the rows in Table 3 can be decrypted, thereby obtaining an obfuscated value of output data c.
[0064] Furthermore, in order to make the content of each row of the encryption table independent of the row number, the obfuscation circuit generator can shuffle the order of the rows. For example, taking the order of the second row and the third row as an example, the final obfuscated truth table can be shown in Table 4 below.
[0065] Table 4
[0066] a b c <![CDATA[A0]]> <![CDATA[B0]]> <![CDATA[Enc A0,B0 (C0)]]> <![CDATA[A1]]> <![CDATA[B0]]> <![CDATA[Enc A1,B0 (C0)]]> <![CDATA[A0]]> <![CDATA[B1]]> <![CDATA[Enc A0,B1 (C0)]]> <![CDATA[A1]]> <![CDATA[B1]]> <![CDATA[Enc A1,B1 (C1)]]>
[0067] At this point, the obfuscated circuit generator has completed the generation of the obfuscated truth table of AND gate 1. The same is true for the obfuscated truth table of AND gate 2. After generating the obfuscated truth tables of each logic gate, the obfuscated circuit generator can send the obfuscated truth tables to the obfuscated circuit executor to execute the obfuscated circuit operation.
[0068] (2) Confusion circuit operation stage:
[0069] The obfuscated circuit executor obtains the obfuscated truth table of AND gate 1 sent by the obfuscated circuit generator. In addition, the obfuscated circuit executor also needs to obtain the obfuscated value of input data a and the obfuscated value of input data b to decrypt the corresponding obfuscated value of output data c based on the above obfuscated truth table.
[0070] Among them, since the obfuscated circuit generator holds the input data b, the obfuscated circuit generator can also directly send the obfuscated value of the input data b (i.e., B0) to the obfuscated circuit executor. As for the input data a held by the obfuscated circuit executor, both parties need to execute the oblivious transfer protocol so that the obfuscated circuit executor can obtain the obfuscated value of the input data a.
[0071] Specifically, the obfuscation circuit generator can act as the sender of the OT protocol, first generate obfuscation values corresponding to two possible values of 0 and 1, namely, the obfuscation value of 0 and the obfuscation value of 1, and use the obfuscation value of 0 and the obfuscation value of 1 as the two secret inputs of the OT protocol. The obfuscation circuit executor, as the receiver of the OT protocol, can use the input data a it holds as the secret option of the OT protocol to select the obfuscation value corresponding to the true value of a from the two secret inputs of the OT protocol. As described above, when a=0, the execution result of the OT protocol is that the obfuscation circuit executor obtains an obfuscation value of 0, namely, A0 in the table; when a=1, the execution result of the OT protocol is that the obfuscation circuit executor obtains an obfuscation value of 1, namely, A1 in the table. Moreover, the obfuscation circuit sender does not know which obfuscation value the obfuscation circuit executor obtains.
[0072] After obtaining the obfuscated truth table and the obfuscated value of the input data, the obfuscated circuit executor can use the obfuscated value of a and the obfuscated value of b to try to decrypt each row in the obfuscated truth table of AND gate 1, and finally can only successfully decrypt one row, thereby obtaining an obfuscated value of the output data c. Furthermore, the obfuscated circuit executor can use the obfuscated value of c and the obfuscated value of d to try to decrypt each row in the obfuscated truth table of AND gate 2, and finally can only successfully decrypt one row, thereby obtaining an obfuscated value of the output data s.
[0073] In an embodiment shown, the obfuscated circuit executor can send the final output result of the obfuscated circuit (i.e., the obfuscated value of s) to the obfuscated circuit generator. Correspondingly, the obfuscated circuit generator can translate the obfuscated value of s back to the corresponding true value based on the translation rule corresponding to the obfuscation rule used when generating the obfuscated value, thereby obtaining the actual operation result of the obfuscated circuit. Furthermore, the obfuscated circuit generator can send the operation result to the obfuscated circuit executor. In this way, the obfuscated circuit is used to implement multi-party secure computing without leaking the data of both parties.
[0074] In one embodiment shown, the obfuscation circuit also has optimization methods such as free XOR and point permute. After applying the optimization methods, the structure of the obfuscation value is different. The obfuscation circuit calculation method provided in the present application can be a further improvement based on these two optimization methods.
[0075] After applying free XOR in the obfuscation circuit, the obfuscation value of 0 and the obfuscation value of 1 of any circuit satisfy: obfuscation value of 1 = obfuscation value of 0 ⊕ Δ. Δ is a random bit string generated by the obfuscation circuit generator, which is kept confidential to the obfuscation circuit executor, and ⊕ is a bitwise XOR calculation. After applying free XOR, the XOR gate in the circuit no longer needs an obfuscation truth table. The obfuscation value of the output data (1 bit) can be obtained by directly XORing the obfuscated values of the two input data (1 bit), thereby simplifying the calculation process of the obfuscation circuit and improving the calculation efficiency.
[0076] Among them, after applying free XOR and point&permute simultaneously in the obfuscation circuit, the lowest bit of the above random bit string Δ is fixed to 1, and the other bits are random. Based on this, the obfuscation circuit executor can determine which row of the obfuscation truth table should be decrypted according to the lowest bit of the obfuscation value (the order of the ciphertexts in each row of the obfuscation truth table is also arranged according to certain rules), thereby avoiding the complex process of trying to decrypt row by row, etc., which will not be elaborated here.
[0077] In an illustrated embodiment, in a garbled circuit using free XOR optimization, an oblivious transfer protocol may also be used to enable the garbled circuit execution party to obtain the garbled value of the input data a. For example, see Figure 2 , Figure 2 FIG. 1 is a schematic diagram of an oblivious transmission provided by an exemplary embodiment. Figure 2 As shown, the executor of the obfuscated circuit holds 1 bit of input data a, which can be used as a secret option of the OT protocol.
[0078] The offline phase, or preprocessing phase, such as Figure 2 As shown in the figure, the obfuscated circuit executor and the obfuscated circuit generator both execute the random OT protocol. The execution result is: the obfuscated circuit generator (i.e. the sender of the OT protocol) obtains two random values, r0 and r1, respectively, and the obfuscated circuit executor (i.e. the receiver of the OT protocol) obtains a random number i and the corresponding random value r i The random values r0 and r1 can be 128-bit or 256-bit data, which is not specifically limited in this specification. Usually, the length of the random values r0 and r1 is consistent with the length of the random bit string Δ. The random number i is 1 bit, that is, the value of i is 0 or 1. Correspondingly, the random value ri It can be a random value corresponding to the array index indicated by the random number i, randomly selected from an array composed of random values r0 and random values r1 as array elements. In one embodiment shown, the value of the random number i can be determined as the value of the array index, that is, the random number i is used as the array subscript. Among them, the array subscript is used to represent the array element at the corresponding position in the array. For example, the array subscript is 0, which can represent the first array element in the array, and the array subscript is 1, which can represent the second array element in the array, and so on. It will not be elaborated here. For example, if the random number i=0, the array subscript is 0, and accordingly, the random value r obtained by the obfuscation circuit executor is i is the first random value in the array consisting of random values r0 and r1 as array elements, i.e. r0; if the random number i = 1, the array subscript is 1, and accordingly, the random value r obtained by the obfuscated circuit execution party i It is the second random value in the array consisting of random value r0 and random value r1 as array elements, that is, r1.
[0079] Online stage, such as Figure 2 As shown, the obfuscation circuit executor calculates the XOR result e of the random number i and the input data a, and sends the XOR result e to the obfuscation circuit generator. Correspondingly, the obfuscation circuit generator receives the XOR result e and randomly selects a random value r corresponding to the array index indicated by the XOR result e from the array composed of r0 and r1. e . Furthermore, the obfuscated circuit generator can generate the random value r e Calculate two confusion values corresponding to the two possible values of 0 and 1 of the input data a, such as Figure 2 As shown, the specific calculation is the confusion value of 0: L0 = h(r e ), and the confusion value of 1: L1=L0⊕Δ, where L0 is A0 in the above confusion truth table, and L1 is A1 in the above confusion truth table. The h() function is a hash function that converts the input random value (such as r e ) outputs a random value with the same length as the random bit string Δ after some operation. For example, if r e The length of is 256 bits, and the length of the random bit string Δ is 128 bits. Based on the hash function, we can calculate the random value r e The corresponding 128-bit hash value h(r e ), and the hash value h(r e ) is determined to be a confusion value L0 of 0. It should be understood that if the length of the random value originally input is consistent with the length of the random bit string Δ (for example, r eand the length of the random bit string Δ are both 128 bits), then the hash function can also output the original input random value directly without performing any calculation, that is, h(r e )=r e .
[0080] like Figure 2 As shown, the obfuscation circuit generator calculates f = h(r0) ⊕ h(r1) ⊕ Δ, and sends the calculated f to the obfuscation circuit executor. Figure 2 As shown, the obfuscated circuit executor receives f calculated by the obfuscated circuit generator and determines the value of the input data a it holds. If a=0, then based on the obtained random value r i Calculate the confusion value of a: L a =h(r i ), it is not difficult to understand that the calculated L a That is A0 above; if a=1, then based on the obtained random value r i Calculate the confusion value of a and f: L a =h(r i )⊕f, it is not difficult to understand that the calculated L a This is A1 mentioned above.
[0081] As mentioned above, both parties use the random information obtained by running the random OT protocol to Figure 2 The calculation method shown can allow the obfuscation circuit generator to generate two obfuscation values L0 and L1 corresponding to the two possible values 0 and 1 of the input data a held by the obfuscation circuit executor, and the obfuscation circuit executor can obtain the obfuscation value L corresponding to the real value of the input data a held by it. a .
[0082] Further, after obtaining the obfuscated value of the input data, the obfuscated circuit execution unit can perform the obfuscated circuit operation according to the above obfuscated truth table, and so on.
[0083] As mentioned above, a garbled circuit often includes multiple logic gates. When executing each logic gate, the garbled circuit generator usually needs to generate a garbled truth table corresponding to the logic gate and send it to the garbled circuit executor. The garbled circuit executor then calculates the output result of the logic gate based on the garbled truth table and the garbled values of the input data of both parties. If a garbled truth table needs to be generated for each execution of a logic gate, a lot of time will be wasted, making the calculation efficiency of the garbled circuit extremely low.
[0084] Based on this, this specification provides a technical solution. Considering that the input data held by the obfuscated circuit executor can only be 0 or 1, the obfuscated circuit generator can first calculate the two possible output data of the current logic gate based on the two possible values of 0 or 1, and then by running the oblivious transfer protocol, the obfuscated circuit executor calculates the obfuscated value of the actual output data as the output of the logic gate based on the true value of the input data held by itself.
[0085] In implementation, the present application may be applied to a first computing device corresponding to an executor of an obfuscation circuit, wherein the obfuscation circuit includes a plurality of logic gates. The first computing device may hold first input data corresponding to a first logic gate included in the obfuscation circuit, wherein the first input data is 1-bit data with a value of 0 or 1. The second computing device corresponding to a generator of the obfuscation circuit may hold a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data may include first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1. In an illustrated embodiment, the first computing device and the second computing device may run a random oblivious transfer protocol, the second computing device may obtain a first random value and a second random value generated by running the random oblivious transfer protocol, the first computing device may obtain a random number i generated by running the random oblivious transfer protocol, and a random value r randomly selected from an array consisting of the first random value and the second random value as array elements and corresponding to the array subscript indicated by the random number i i . The value of the random number i can be 0 or 1. The first computing device can receive the intermediate calculation result corresponding to the output result of the first logic gate calculated by the second computing device based on the first random value, the second random value, the first output data and the second output data. Further, if the value of the first input data held by the first computing device is 0, the first computing device can obtain the random value r based on the obtained value. i Calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate. If the value of the first input data held by the first computing device is 1, the first computing device can obtain the random value r i The obfuscation value corresponding to the second output data is calculated based on the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
[0086] In the above technical solution, considering that in some simple logic gate calculations included in the obfuscation circuit, the input data (e.g., a bit) corresponding to the logic gate held by the obfuscation circuit executor can only be 0 or 1, the obfuscation circuit generator can first calculate the two possible output data (e.g., first output data and second output data) corresponding to the logic gate based on the two possible values of 0 or 1. Furthermore, by running the oblivious transfer protocol, the obfuscated circuit executor can calculate the obfuscated value of the actual output data as the output of the logic gate based on the real value of the input data held by itself, directly completing the calculation of a logic gate in the obfuscation circuit without generating an obfuscated truth table corresponding to the logic gate, saving a lot of time and improving the calculation efficiency of the obfuscation circuit.
[0087] See also Figure 3 , Figure 3 This is a schematic diagram of a system architecture provided by an exemplary embodiment. One or more embodiments provided in this specification may be Figure 3 The present invention is specifically implemented in the system architecture shown or a similar system architecture.
[0088] like Figure 3 As shown, the system includes a computing device 100 corresponding to the obfuscation circuit executor and a computing device 200 corresponding to the obfuscation circuit generator. In an illustrated embodiment, a communication connection can be established between the computing device 100 and the computing device 200 in any possible manner, and this specification does not specifically limit this.
[0089] In one illustrated embodiment, the obfuscation circuit may include a number of logic gates, such as an AND gate, a NOT gate, a NAND gate, a NOR gate, an XOR gate, etc. These logic gates may be sequentially connected and combined with each other to implement complete and complex logical operations, thereby completing a specified computing task.
[0090] In an illustrated implementation, the computing device 100 corresponding to the garbled circuit executor may hold first input data corresponding to a first logic gate among a plurality of logic gates included in the garbled circuit, and the first input data may be 1 bit, and its value may be 0 or 1. Exemplarily, the first logic gate may be an AND gate, a NOT gate, a NAND gate, a NOR gate, or an XOR gate, etc., which is not specifically limited in this specification.
[0091] In an illustrated embodiment, the computing device 200 corresponding to the obfuscation circuit generator may hold second input data corresponding to the first logic gate, and the second input data may be 1 bit. Accordingly, the first logic gate may be used to calculate a logic operation result of the first input data and the second input data, such as an XOR result, an AND result, or a NOT result of the first input data and the second input data, and the like. This specification does not specifically limit this.
[0092] In an illustrated embodiment, the first logic gate in this specification may represent a calculation function (e.g., a target function) in addition to the simple AND gate, NOT gate, and XOR gate described above, which is used to calculate the function calculation result of the first input data and the second input data. This specification does not specifically limit the specific type of the calculation function. Correspondingly, the second input data may also be data of any length, such as 2 bits, 8 bits, or 128 bits. In this way, the first logic gate may also be used to calculate the function calculation result between a bit and data of any length, and so on. This specification does not specifically limit this. It should be understood that when the calculation function is a function for performing an XOR calculation on two input bits, the calculation function is equivalent to an XOR gate, and the same is true for an AND gate and a NOT gate, which will not be described in detail here.
[0093] It can be understood that, although the first input data held by the computing device 100 is always kept confidential, that is, the computing device 200 cannot know the true value of the first input data, considering that the first input data has only two possible values of 0 or 1, the computing device 200 can also calculate multiple expected output data corresponding to the first logic gate based on the two possible values of 0 or 1. The multiple expected output data may include: assuming that the value of the first input data is 0, the first output data calculated by the computing device 200 based on the value 0 and the second input data, and assuming that the value of the first input data is 1, the second output data calculated by the computing device 200 based on the value 1 and the second input data.
[0094] In the offline stage before the formal start of the obfuscated circuit calculation, the computing device 100 and the computing device 200 can run the random oblivious transfer protocol, wherein the computing device 200 can obtain the first random value (which can be recorded as r0) and the second random value (which can be recorded as r1) generated by running the random oblivious transfer protocol, and the computing device 100 can obtain the random number (which can be recorded as i) and the corresponding random value (which can be recorded as r1) generated by running the random oblivious transfer protocol. i ). The random number i can be 0 or 1, and the random value r i It can be a random value corresponding to the array index indicated by the random number i, which is randomly selected from the array consisting of the first random value r0 and the second random value r1 as array elements. For details, please refer to the above Figure 2 The description in the corresponding embodiment will not be repeated here.
[0095] Furthermore, in the online stage of the obfuscated circuit calculation, the computing device 200 can calculate an intermediate calculation result (which can be denoted as f) corresponding to the output result of the first logic gate based on the first random value r0, the second random value r1, the first output data, and the second output data it holds, and send the intermediate calculation result f to the computing device 100. Correspondingly, the computing device 100 can receive the intermediate calculation result f.
[0096] Furthermore, the computing device 100 may determine the value of the first input data it holds, and calculate the obfuscated value of the actual output data corresponding to the value, thereby directly calculating the output result of the first logic gate.
[0097] In an illustrated embodiment, if the value of the first input data is 0, the actual output data corresponding thereto should be the first output data. Then, the computing device 100 may obtain the random value r based on the obtained random value r. i A confusion value corresponding to the first output data is calculated, and the confusion value is used as an output result of the first logic gate.
[0098] In an illustrated embodiment, if the value of the first input data is 1, the actual output data corresponding thereto should be the second output data. Then, the computing device 100 may obtain the random value r based on the obtained random value r. i The obfuscation value corresponding to the second output data is calculated with the intermediate calculation result f, and the obfuscation value is used as the output result of the first logic gate. Figure 4 The description of the corresponding embodiments will not be elaborated in detail here.
[0099] In one illustrated embodiment, computing device 100 and computing device 200 may be a laptop computer, a desktop computer, a server, a server cluster consisting of multiple servers, or a cloud computing service center, etc. having the above-mentioned functions, and this specification does not make any specific limitations on this.
[0100] In this way, the present application takes into account that in some simple logic gate calculations included in the obfuscation circuit, the value of the input data (1 bit) corresponding to the logic gate held by the obfuscation circuit executor can only be 0 or 1. By pre-calculating two possible expected output data corresponding to 0 or 1 and the oblivious transmission protocol, the obfuscated value of the actual output data can be directly calculated, and the calculation of a logic gate in the obfuscation circuit is directly completed without generating an obfuscated truth table corresponding to the logic gate, which saves a lot of time and greatly improves the calculation efficiency of the obfuscation circuit.
[0101] See also Figure 4 , Figure 4 is a flowchart of a method for calculating a confusion circuit provided by an exemplary embodiment. The method can be applied to Figure 3 The system architecture shown can be applied to Figure 3 The computing device 100 corresponding to the obfuscation circuit execution side in the system architecture shown. Figure 4 As shown, the garbled circuit calculation method may specifically include the following steps S401 to S404.
[0102] Step S401: The first computing device obtains a random number i, and a random value r corresponding to the array index indicated by the random number i is randomly selected from an array consisting of a first random value and a second random value obtained from a second computing device as array elements. i The first computing device holds first input data corresponding to a first logic gate included in the obfuscation circuit, and the first input data is 1-bit data with a value of 0 or 1; the second computing device holds a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data include first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1.
[0103] First, as described above, a first computing device (such as the above-mentioned Figure 3 The computing device 100 shown in the figure may hold the first input data of the first logic gate included in the obfuscated circuit, such as input data a; the second computing device corresponding to the obfuscated circuit generator (such as the above Figure 3 The computing device 200 shown may hold second input data of the first logic gate, such as input data b.
[0104] The first input data is 1 bit, and its value is 0 or 1. The second input data can be data of any length, for example, t bits, where t is an integer greater than or equal to 1.
[0105] In addition, the second computing device also holds two expected output results of the first logic gate corresponding to the two possible values of the first input data, 0 and 1, including: the first output data calculated by the second computing device assuming that the first input data value is 0 (which can be recorded as x[0]), and the second output data calculated by the second computing device assuming that the first input data value is 1 (which can be recorded as x[1]).
[0106] In an illustrated embodiment, the computing device 200 may also hold an objective function (which may be denoted as g) corresponding to the logic gate. Accordingly, the first logic gate may be used to use the first input data and the second input data as input data of the objective function g to calculate the calculation result of the objective function g. Taking the first input data as a and the second input data as b as an example, the calculation result of the objective function g may be denoted as g(a, b).
[0107] In an illustrated embodiment, the objective function can be used to perform any possible calculation, such as XOR calculation, multiplication calculation, etc., which is not specifically limited in this specification.
[0108] Exemplarily, considering that the first input data has only two possible values, 0 and 1, the second computing device can use the value 0 and the second input data b as input parameters of the objective function g, and calculate the possible calculation result g(0, b) of the objective function g, that is, the first output data x[0]; the obfuscation circuit generator can also use the value 1 and the second input data b as input parameters of the objective function g, and calculate another possible calculation result g(1, b) of the objective function g, that is, the second output data x[1].
[0109] For example, taking a and b as 1 bit and the target function g as a function for performing XOR calculation, the calculation result of the target function g is g(a, b)=a⊕b, and correspondingly, the first output data x[0]=g(0, b)=0⊕b, and the second output data x[1]=g(1, b)=1⊕b.
[0110] Further, as mentioned above Figure 3 As described in the corresponding embodiment, the first computing device and the second computing device may subsequently run the OT protocol in the present application so that the first computing device obtains an obfuscated value of the actual output data corresponding to the true value of the first input data it holds, and so on.
[0111] It should be noted that, compared to the ordinary two-choice OT protocol, the present application proposes a new type of OT protocol, which can be called a two-choice obfuscated value OT protocol. In an embodiment shown, since the execution result of the OT protocol in the present application is that the first computing device obtains the obfuscated value of the actual output data corresponding to the true value of the first input data held by it, and the second computing device obtains the obfuscated values of the two expected output data, the new type of OT protocol provided by the present application can also be called the Yao Secret Sharing Oblivious Transfer (Yao Sharing OT, YSOT) protocol, and the obfuscated value held by each party can be used as a Yao's secret sharing fragment of the actual output data. Only by combining the obfuscated values held by each party can the true value of the actual output data be restored.
[0112] In one illustrated embodiment, see Figure 5 , Figure 5 FIG. 1 is a schematic diagram of the overall steps of a method for calculating a confusion circuit provided by an exemplary embodiment. Figure 5 As shown, Figure 5 In the example, the first input data held by the executor of the obfuscated circuit is a. Figure 5The YSOT protocol provided in this application and the method flow for implementing obfuscated circuit calculation based on the YSOT protocol are explained.
[0113] Among them, the entire process of the YSOT protocol can include an offline stage and an online stage.
[0114] like Figure 5 As shown, in the offline stage before the obfuscated circuit calculation is officially started, the first computing device corresponding to the obfuscated circuit executor and the second computing device corresponding to the obfuscated circuit generator can run the random oblivious transfer protocol and obtain corresponding results. The second computing device can obtain the first random value r0 and the second random value r1 generated by running the random oblivious transfer protocol, and the first computing device can obtain the random number i and the corresponding random value r generated by running the random oblivious transfer protocol. i In one embodiment shown, the information about r0, r1, i, r i For instructions, please refer to the above Figure 2 The description in the corresponding embodiment will not be repeated here.
[0115] As mentioned above, the YSOT protocol proposed in this application still needs to generate the above r0, r1, i, r based on the random oblivious transfer protocol in the offline stage. i ,Therefore, it can be said that the random oblivious transfer protocol is the basis for building the YSOT protocol.
[0116] It should be noted that this specification does not specifically limit the specific implementation of the random oblivious transfer protocol. In addition, in an embodiment shown, the above r0, r1, i, r2 can also be generated by a trusted third-party random number server. i , and send it to the corresponding first computing device and the second computing device, or the above r0, r1, i, r can be generated by any other possible method. i , etc., which are not specifically limited in this specification.
[0117] Step S402: Obtain an intermediate calculation result corresponding to the output result of the first logic gate calculated by a second calculation device based on the first random value, the second random value, the first output data and the second output data.
[0118] like Figure 5As shown, in the online stage of the obfuscation circuit calculation, on the one hand, the first computing device can calculate the XOR result e of the random number i and the first input data a, that is, e=i⊕a, and send the XOR result e to the second computing device. On the other hand, the second computing device can calculate the intermediate calculation result f corresponding to the output result of the first logic gate based on the first random value r0, the second random value r1, the first output data x[0], and the second output data x[1] it holds, and send the intermediate calculation result f to the first computing device. In an embodiment shown, the online stage of the obfuscation circuit calculation can be triggered in response to an execution instruction for the first logic gate, and this specification does not specifically limit this. Exemplarily, the first computing device can calculate the XOR result e in response to the execution instruction for the first logic gate, and send the XOR result e to the second computing device. Correspondingly, the second computing device can calculate the intermediate calculation result f in response to the execution instruction for the first logic gate, and send the intermediate calculation result f to the first computing device.
[0119] It should be noted that this specification does not specifically limit the order in which the above two operations are performed. In one embodiment shown, in order to further improve the computing efficiency, the operations performed by the first computing device and the second computing device can be performed simultaneously, that is, while the first computing device calculates the XOR result e and sends the XOR result e to the second computing device, the second computing device can calculate the intermediate calculation result f and send the intermediate calculation result f to the first computing device.
[0120] In an illustrated embodiment, when the second computing device calculates the intermediate calculation result f, it may specifically include: calculating the hash value h(r0) corresponding to the first random value r0 and the hash value h(r1) corresponding to the second random value r1 through a preset hash function. The hash function h() can be used to adjust the length of the input random value to a preset length, that is, the lengths of the hash value h(r0) and the hash value h(r1) are both preset lengths. The so-called preset length may be the length of the random bit string Δ generated by the second computing device, that is, the hash function h() may adjust the length of the input random value to the length of the random bit string Δ. For details, please refer to the above Figure 2 The description in the corresponding embodiment will not be repeated here.
[0121] Specifically, Figure 5As shown, the second computing device can perform XOR calculations on the hash value h(r0) corresponding to the first random value r0, the hash value h(r1) corresponding to the second random value r1, the first multiplication result of the first output data x[0] and the random bit string Δ, and the second multiplication result of the second output data x[1] and the random bit string Δ in sequence, thereby calculating an intermediate calculation result f, that is, f=h(r0)⊕h(r1)⊕x[0]Δ⊕x[1]Δ. Among them, x[0]Δ is the first multiplication result of the first output data x[0] and the random bit string Δ, x[1]Δ is the second multiplication result of the second output data x[1] and the random bit string Δ, and ⊕ is a bitwise XOR calculation.
[0122] Furthermore, if Figure 5 As shown, after receiving the XOR result e sent by the first computing device, the second computing device can also calculate the obfuscation value corresponding to the first output data x[0] and the obfuscation value corresponding to the second output data x[1] based on the XOR result e. The obfuscation value corresponding to the first output data x[0] and the obfuscation value corresponding to the second output data x[1] can be used by the second computing device to construct an obfuscation truth table corresponding to the second logic gate included in the obfuscation circuit. In an illustrated embodiment, the input line of the second logic gate can be connected to the output line of the above-mentioned first logic gate, and accordingly, the obfuscation truth table can be used to perform a logical calculation corresponding to the second logic gate with the output result of the first logic gate as input data. For example, please refer to Figure 1 , the first logic gate can be Figure 1 The AND gate 1 shown, the second logic gate can be Figure 1 In the AND gate 2 shown, the output s of the AND gate 1 (ie, the first output data x[0] or the second output data x[1]) can be further input as input data into the AND gate 2 to perform operation.
[0123] In an illustrated embodiment, when the second computing device calculates the obfuscation value corresponding to the first output data x[0] and the obfuscation value corresponding to the second output data x[1] based on the received XOR result e, the following steps may be specifically included:
[0124] First, if Figure 5 As shown, the second computing device can randomly select a random value r corresponding to the array index indicated by the received XOR result e from the array composed of the first random value r0 and the second random value r1 as array elements. e It should be understood that the second computing device can only obtain the XOR result e calculated by the first input data a and the random number i, but cannot obtain the true values of the first input data a and the random number i, thereby ensuring that the data held by the first computing device is not leaked.
[0125] Furthermore, the second computing device can calculate the random value r based on the above hash function. e The corresponding hash value h(r e ), where the hash value h(r e ) is consistent with the length of the random bit string Δ.
[0126] Furthermore, if Figure 5 As shown, the second computing device can calculate the hash value h(r e ) and x[0]Δ, denoted as L0, i.e., L0 = h(r e )⊕x[0]Δ, and determine the XOR result L0 as the confusion value corresponding to the first output data x[0].
[0127] Further, referring to the free XOR optimization method in the obfuscation circuit described in the above embodiment, Figure 5 As shown, the second computing device can further calculate the XOR result of the above XOR result L0 and the random bit string Δ, recorded as L1, that is, L1=L0⊕Δ, and determine the XOR result L1 as the confusion value corresponding to the second output data x[1].
[0128] In an illustrated embodiment, assuming that the first logic gate is a logic gate that performs an XOR calculation, and the second input data (e.g., b) is also 1 bit, and has a value of 0 or 1, then the expected output data of the first logic gate has only two possible values, 0 or 1. Exemplarily, assuming that the value of the first output data x[0] is 0, and the value of the second output data x[1] is 1, then the obfuscation value L0 corresponding to the first output data x[0] is an obfuscation value of 0 (or a 0 label), and the obfuscation value L1 corresponding to the second output data x[1] is an obfuscation value of 1 (or a 1 label).
[0129] Step S403: when the value of the first input data is 0, based on the random value r i An obfuscation value corresponding to the first output data is calculated, and the obfuscation value is used as an output result of the first logic gate.
[0130] Furthermore, after receiving the intermediate calculation result f sent by the second computing device, the first computing device can determine the value of the first input data a it holds, and calculate the confusion value of the actual output data corresponding to the value, thereby directly calculating the output result of the first logic gate.
[0131] In an illustrated embodiment, if the value of the first input data a is 0, the actual output data corresponding thereto should be the first output data x[0], then the first computing device may generate a random value r based on the random oblivious protocol. iThe obfuscation value corresponding to the first output data x[0] is calculated, and the obfuscation value is used as the output result of the first logic gate.
[0132] It should be noted that this specification does not explain how to use the random value r i The implementation method of calculating the obfuscation value corresponding to the first output data x[0] is not specifically limited.
[0133] In one illustrated embodiment, the first computing device may use the random value r i Determined as the obfuscated value corresponding to the first output data x[0].
[0134] In one illustrated embodiment, Figure 5 As shown, the first computing device can first calculate the random value r based on the hash function. i The corresponding hash value h(r i ), where the hash value h(r i ) is the same length as the random bit string Δ, and the hash value h(r i ) is determined as the confusion value corresponding to the first output data x[0], and the confusion value is determined as the output result of the first logic gate.
[0135] In one illustrated embodiment, Figure 5 As shown, the output result of the first logic gate can be recorded as L x[a] , represents the confusion value of the actual output data corresponding to the true value of the first input data a. As mentioned above, when a=0, L x[a] =h(r i ).
[0136] It should be understood that when a=0, the XOR result e of the random number i and a depends on the value of the random number i. For example, when i=0, the XOR result e=i⊕a=0⊕0=0, and when i=1, the XOR result e=i⊕a=1⊕0=1. In other words, when a=0, the XOR result e is consistent with the value of the random number i. Based on this, when a=0, the first computing device can also be based on the random value r e Calculate the confusion value corresponding to the first output data x[0], that is, Figure 5 L shown x[a] =h(r i )=h(r e ).
[0137] Step S404: when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
[0138] In an illustrated embodiment, if the value of the first input data a is 1, the actual output data corresponding thereto should be the second output data x[1], then the first computing device may generate a random value r based on the random oblivious protocol. i and the received intermediate calculation result f, calculate the obfuscation value corresponding to the second output data x[1], and use the obfuscation value as the output result of the first logic gate.
[0139] It should be noted that this specification does not explain how to use the random value r i The implementation method of calculating the obfuscation value corresponding to the first output data with the intermediate calculation result f is not specifically limited.
[0140] In one illustrated embodiment, Figure 5 As shown, the first computing device can first calculate the random value r based on the hash function. i The corresponding hash value h(r i ), where the hash value h(r i ) is consistent with the length of the random bit string Δ. Then, the first computing device can calculate the hash value h(r i ) and the intermediate calculation result f, and determine the XOR result as a confusion value corresponding to the second output data x[1], and use the confusion value as the output result of the first logic gate.
[0141] In one illustrated embodiment, Figure 5 As shown, the output result of the first logic gate can be recorded as L x[a] , represents the confusion value of the actual output data corresponding to the true value of the first input data a. As mentioned above, when a=1, L x[a] =h(r i )⊕f.
[0142] Below, various calculations in this application will be explained through several examples.
[0143] (1) Assume that the first logic gate is a logic gate that performs an XOR calculation, and the first input data a=0, the second input data b=0, x[0]=0, x[1]=1, and the first computing device runs the random OT protocol to obtain a random number i=0, and the random value r i =r0.
[0144] The first computing device calculates: e=i⊕a=0⊕0=0;
[0145] The second computing device calculates:
[0146] L0=h(r e )⊕x[0]Δ=h(r0)⊕0Δ=h(r0);
[0147] L1=L0⊕Δ=h(r0)⊕Δ;
[0148] f=h(r0)⊕h(r1)⊕x[0]Δ⊕x[1]Δ=h(r0)⊕h(r1)⊕0Δ⊕1Δ=h(r0)⊕h(r1)⊕Δ.
[0149] Since a=0, the first computing device calculates L x[a] =h(r i )=h(r0).
[0150] (2) Assume that the first logic gate is a logic gate that performs an XOR calculation, and the first input data a=1, the second input data b=0, x[0]=0, x[1]=1, and the first computing device runs the random OT protocol to obtain a random number i=0, and the random value r i =r0.
[0151] The first computing device calculates: e=i⊕a=0⊕1=1;
[0152] The second computing device calculates:
[0153] L0=h(r e )⊕x[0]Δ=h(r1)⊕0Δ=h(r1);
[0154] L1=L0⊕Δ=h(r1)⊕Δ;
[0155] f=h(r0)⊕h(r1)⊕x[0]Δ⊕x[1]Δ=h(r0)⊕h(r1)⊕0Δ⊕1Δ=h(r0)⊕h(r1)⊕Δ.
[0156] Since a=1, the first computing device calculates L x[a] =h(r i )⊕f=h(r0)⊕h(r0)⊕h(r1)⊕Δ=h(r1)⊕Δ.
[0157] (3) Assume that the first logic gate is a logic gate that performs an XOR calculation, and the first input data a=0, the second input data b=0, x[0]=0, x[1]=1, and the first computing device runs the random OT protocol to obtain a random number i=1, and the random value r i =r1.
[0158] The first computing device calculates: e=i⊕a=1⊕0=1;
[0159] The second computing device calculates:
[0160] L0=h(r e )⊕x[0]Δ=h(r1)⊕0Δ=h(r1);
[0161] L1=L0⊕Δ=h(r1)⊕Δ;
[0162] f=h(r0)⊕h(r1)⊕x[0]Δ⊕x[1]Δ=h(r0)⊕h(r1)⊕0Δ⊕1Δ=h(r0)⊕h(r1)⊕Δ.
[0163] Since a=0, the first computing device calculates L x[a] =h(r i )=h(r1).
[0164] In an illustrated embodiment, the entire calculation process of the YSOT protocol described in the above steps S401-S404 can be recorded as YSOT(a, g(0, b), g(1, b)), where x[0]=g(0, b), x[1]=g(1, b). The obfuscation circuit executor and the obfuscation circuit generator execute YSOT(a, g(0, b), g(1, b)), and finally the obfuscation circuit executor directly obtains the obfuscated value of the actual output data that is consistent with the true value of the input data a among the two expected output data (i.e., g(0, b) and g(1, b)) calculated by the obfuscation circuit generator based on the input data a it holds, that is, obtains L x[a] .
[0165] In some possible implementations, the x[0] and x[1] held by the obfuscated circuit executor may be just a set of data, rather than the expected output data of the logic gate, and x[0] and x[1] as array elements may constitute an array. Figure 4 and Figure 5 The calculation process described in the corresponding embodiment can enable the obfuscation circuit executor to obtain the obfuscation value (i.e., label) corresponding to the data selected from the array composed of x[0] and x[1] according to the array index indicated by the first input data a held by itself, and so on. This specification does not make specific limitations on this.
[0166] In some possible implementations, the first input data a held by the obfuscated circuit executor and the second input data b held by the obfuscated circuit generator may be a Boolean slice held by each party in the secret sharing. Figure 4 and Figure 5 The calculation process described in the corresponding embodiment can realize the conversion of the Boolean slice of the secret share into the obfuscated value of the obfuscated circuit, etc., which is not specifically limited in this specification.
[0167] In some possible implementations, there may be multiple sets of first input data a and second input data b, that is, the obfuscation circuit executor and the obfuscation circuit generator may perform multiple obfuscation circuit calculations, and accordingly, there may also be multiple sets of x[0] and x[1]. For each set of x[0] and x[1], the above-mentioned Figure 4 and Figure 5 The calculation process described in the corresponding embodiment enables the execution party of the obfuscation circuit to obtain the obfuscation value of the actual output data corresponding to the first input data a held by it in each group of x[0] and x[1], etc., which is not specifically limited in this specification. For example, the original X[0] and X[1] can be 1 bit respectively, and can be further expanded to X[0] and X[1] are t bits respectively (equivalent to t groups of 1 bit X[0] and X[1]). At this time, the above X[0]Δ represents each bit of X[0] multiplied by Δ, and the length of the multiplication result is t times the length of Δ. The same is true for X[1]Δ. Correspondingly, the data length output by the above hash function h() is t times the length of Δ, etc., which is not specifically limited in this specification.
[0168] See also Figure 6 , Figure 6 is a flowchart of a method for calculating a confusion circuit provided by an exemplary embodiment. The method can be applied to Figure 3 The system architecture shown can be applied to Figure 3 The computing device 200 corresponding to the garbled circuit generator in the system architecture shown. Figure 6 As shown, the garbled circuit calculation method may specifically include the following steps S601 to S602.
[0169] Step S601: The second computing device obtains a first random value and a second random value, and calculates an intermediate calculation result corresponding to an output result of the first logic gate based on the first random value, the second random value, and first output data and second output data corresponding to a first logic gate included in the obfuscation circuit held by the second computing device.
[0170] In an embodiment shown, the specific implementation of step S601 can refer to the above Figure 4 and Figure 5 The description of the corresponding embodiments will not be repeated here.
[0171] Step S602: Send the intermediate calculation result to the first computing device, so that when the value of the first input data corresponding to the first logic gate held by the first computing device is 0, the first computing device calculates the random value r corresponding to the random number i based on the obtained random value r. i, calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
[0172] In an embodiment shown, the specific implementation of step S602 can refer to the above Figure 4 and Figure 5 The description of the corresponding embodiments will not be repeated here.
[0173] In summary, the present application proposes a new type of OT protocol, which can be called "two-choice obfuscation value OT protocol" or YSOT protocol. The difference from the ordinary two-choice OT protocol is that in the ordinary two-choice OT protocol, the receiver of the protocol (i.e., the obfuscation circuit executor) can only obtain one of the two secret inputs of the sender of the protocol (i.e., the obfuscation circuit generator), while in the present application, the receiver of the protocol (i.e., the obfuscation circuit executor) can directly obtain the obfuscation value of one of the two secret inputs of the sender of the protocol (i.e., the obfuscation circuit generator).
[0174] Furthermore, the two secret inputs of the protocol in this application can also be two expected output data of the pre-calculated logic gate. In this way, through the YSOT protocol proposed in this application, the calculation of a logic gate in the obfuscated circuit is directly completed without generating an obfuscated truth table, which saves a lot of time and greatly improves the calculation efficiency of the obfuscated circuit.
[0175] Corresponding to the implementation of the above method flow, the embodiment of this specification also provides a confusion circuit calculation device, which is applied to a first computing device corresponding to the confusion circuit executor, and the confusion circuit includes a plurality of logic gates; the first computing device holds a first input data corresponding to the first logic gate included in the confusion circuit, and the first input data is a 1-bit data with a value of 0 or 1. The second computing device corresponding to the confusion circuit generator holds a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data includes the first output data calculated when the value of the first input data is 0, and the second output data calculated when the value of the first input data is 1. Please refer to Figure 7 , Figure 7 FIG. 1 is a schematic diagram of a structure of a garbled circuit calculation device provided by an exemplary embodiment. Figure 7 As shown, the device 70 includes:
[0176] The first acquisition unit 701 is used to acquire a random number i, and a random value r randomly selected from an array consisting of the first random value and the second random value acquired from the second computing device as array elements and corresponding to the array index indicated by the random number i i ; The value of the random number i is 0 or 1;
[0177] a second acquisition unit 702, configured to acquire, in response to an execution instruction for the first logic gate, an intermediate calculation result corresponding to an output result of the first logic gate, which is calculated by a second computing device based on the first random value, the second random value, the first output data, and the second output data; and
[0178] The calculation unit 703 is used for calculating the value of the first input data based on the random value r when the value of the first input data is 0. i Calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
[0179] In an illustrated embodiment, the second computing device also holds second input data corresponding to the first logic gate and a target function, and the first logic gate is used to use the first input data and the second input data as input data of the target function to calculate a calculation result of the target function.
[0180] In an illustrated embodiment, the first acquisition unit 701 is specifically configured to:
[0181] Run a random oblivious transfer protocol, and obtain a random number i generated by running the random oblivious transfer protocol, and a random value r randomly selected from an array consisting of a first random value and a second random value generated by running the random oblivious transfer protocol on the second computing device as array elements and corresponding to the array index indicated by the random number i i .
[0182] In an illustrated embodiment, the calculation unit 703 is specifically configured to:
[0183] If the value of the first input data is 0, the random value r i The obfuscation value corresponding to the first output data is determined.
[0184] In an illustrated embodiment, the calculation unit 703 is specifically configured to:
[0185] Based on the preset hash function, calculate the random value r i The corresponding hash value h(r i );
[0186] The hash value h(r i ) is determined as an obfuscation value corresponding to the first output data.
[0187] In an illustrated embodiment, the calculation unit 703 is specifically configured to:
[0188] If the value of the first input data is 1, the random value r is calculated i and the XOR result of the intermediate calculation result;
[0189] The XOR result is determined as a confusion value corresponding to the second output data.
[0190] In an illustrated embodiment, the calculation unit 703 is specifically configured to:
[0191] Based on the preset hash function, calculate the random value r i The corresponding hash value h(r i );
[0192] Calculate the hash value h(r i ) and the XOR result of the intermediate calculation result.
[0193] In an illustrated embodiment, the intermediate calculation result is a result obtained by the second computing device performing an XOR calculation on the first random value, the second random value, the first output data, and the second output data held by the second computing device in sequence.
[0194] In one illustrated embodiment, the intermediate calculation result is a result obtained by the second computing device performing an XOR calculation on a hash value of a preset length corresponding to the first random value, a hash value of a preset length corresponding to the second random value, a first multiplication result of the first output data and a random bit string of a preset length, and a second multiplication result of the second output data and the random bit string.
[0195] In an illustrated embodiment, the apparatus 70 further includes a sending unit 704, configured to:
[0196] Calculate an XOR result e of the random number i and the first input data, and send the XOR result e to the second computing device, so that the second computing device calculates an obfuscation value corresponding to the first output data and an obfuscation value corresponding to the second output data based on the XOR result e;
[0197] The obfuscation value corresponding to the first output data and the obfuscation value corresponding to the second output data are used by the second computing device to construct an obfuscation truth table corresponding to the second logic gate included in the obfuscation circuit; the obfuscation truth table is used to perform a logic calculation corresponding to the second logic gate with the output result of the first logic gate as input data.
[0198] In an illustrated implementation manner, the sending unit 704 is specifically configured to:
[0199] The XOR result e is sent to the second computing device, so that the second computing device randomly selects a random value r corresponding to the array index indicated by the XOR result e from the array composed of the first random value and the second random value as array elements. e ;
[0200] Based on the preset hash function, calculate the random value r e The corresponding hash value h(r e );
[0201] Calculate the hash value h(r e ) and an XOR result L0 of the first multiplication result, and determining the XOR result L0 as a confusion value corresponding to the first output data; and
[0202] An XOR result L1 of the XOR result L0 and the random bit string is calculated, and the XOR result L1 is determined as a confusion value corresponding to the second output data.
[0203] Correspondingly, an embodiment of the present specification also provides a confusion circuit calculation device, which is applied to a second computing device corresponding to a confusion circuit generator, wherein the confusion circuit includes a plurality of logic gates; a first computing device corresponding to a confusion circuit executor holds first input data corresponding to a first logic gate included in the confusion circuit, and the first input data is 1-bit data with a value of 0 or 1. The second computing device holds a plurality of expected output data corresponding to the first logic gate; wherein the plurality of expected output data includes the first output data calculated when the value of the first input data is 0, and the second output data calculated when the value of the first input data is 1. Please refer to Figure 8 , Figure 8 FIG. 1 is a schematic diagram of a structure of a garbled circuit calculation device provided by an exemplary embodiment. Figure 8 As shown, the device 80 includes:
[0204] an acquisition unit 801, configured to acquire a first random value and a second random value, and calculate an intermediate calculation result corresponding to an output result of the first logic gate according to the first random value, the second random value, the first output data, and the second output data;
[0205] The sending unit 802 is configured to send the intermediate calculation result to the first computing device, so that the first computing device calculates the intermediate calculation result based on the random value r corresponding to the random number i when the value of the first input data is 0. i , calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i Calculate an obfuscation value corresponding to the second output data using the intermediate calculation result, and use the obfuscation value as an output result of the first logic gate;
[0206] The random number i is 0 or 1, and the random value r is i It is a random value corresponding to the array subscript indicated by the random number i, randomly selected from an array consisting of the first random value and the second random value as array elements.
[0207] The implementation process of the functions and effects of each unit in the above-mentioned device 70 and device 80 is specifically described in the above-mentioned embodiment, and will not be repeated here. It should be understood that the above-mentioned device 70 and device 80 can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the CPU (Central Process Unit, processor) of the device where it is located reading the corresponding computer program instructions into the memory and running them. From the hardware level, in addition to the CPU and memory, the device where the above-mentioned device is located usually also includes other hardware such as chips for wireless signal transmission and reception, and / or other hardware such as boards and cards for realizing network communication functions.
[0208] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the units or modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Those of ordinary skill in the art may understand and implement it without creative work.
[0209] The devices, units, and modules described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0210] Corresponding to the above method embodiment, the embodiment of this specification also provides a computing device. Fig. 9 , Fig. 9 It is a structural diagram of a computing device provided by an exemplary embodiment. Fig. 9 The computing device shown may be a first computing device corresponding to the obfuscation circuit execution party (eg Figure 3 The computing device 100 in the system architecture shown in the figure may be a second computing device corresponding to the obfuscated circuit generator (eg Figure 3 The computing device 200 in the system architecture shown in FIG. Fig. 9 As shown, the computing device includes a processor 1001 and a memory 1002, and may further include an input device 1004 (such as a keyboard, etc.) and an output device 1005 (such as a display, etc.). The processor 1001, the memory 1002, the input device 1004, and the output device 1005 may be connected via a bus or other means. Fig. 9 As shown, the memory 1002 includes a computer-readable storage medium 1003, which stores a computer program that can be executed by the processor 1001. The processor 1001 can be a general-purpose CPU, a microprocessor, or an integrated circuit for controlling the execution of the above method embodiment. When the processor 1001 runs the stored computer program, it can execute the various steps of the garbled circuit calculation method in the embodiment of this specification. For details, please refer to the previous content, which will not be repeated here.
[0211] Corresponding to the above method embodiment, the embodiment of this specification also provides a computer-readable storage medium, on which a computer program is stored. When these computer programs are executed by a processor, they execute the various steps of the garbled circuit calculation method in the embodiment of this specification. For details, please refer to the description of the above embodiment, which will not be repeated here.
[0212] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
[0213] In a typical configuration, a terminal device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0214] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash memory (fLash RAM). The memory is an example of a computer-readable medium.
[0215] Computer readable media include permanent and non-permanent, removable and non-removable media and can store information by any method or technology. The information can be computer readable instructions, data structures, program modules or other data.
[0216] Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0217] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0218] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, the embodiments of this specification may take the form of complete hardware embodiments, complete software embodiments or embodiments combining software and hardware. Moreover, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
Claims
1. A method for calculating a garbled circuit, characterized in that: The method is applied to a first computing device corresponding to an executor of an obfuscation circuit, wherein the obfuscation circuit includes a plurality of logic gates; the first computing device holds first input data corresponding to a first logic gate included in the obfuscation circuit, wherein the first input data is 1-bit data with a value of 0 or 1; and a second computing device corresponding to a generator of the obfuscation circuit holds a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1; The method comprises: Obtain a random number i, and a random value r randomly selected from an array consisting of a first random value and a second random value obtained from the second computing device as array elements and corresponding to the array index indicated by the random number i i ; The value of the random number i is 0 or 1; Obtaining an intermediate calculation result corresponding to an output result of the first logic gate calculated by the second calculation device based on the first random value, the second random value, the first output data, and the second output data; When the value of the first input data is 0, based on the random value r i Calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
2. The method according to claim 1, characterized in that The second computing device also holds second input data corresponding to the first logic gate and a target function. The first logic gate is used to use the first input data and the second input data as input data of the target function to calculate a calculation result of the target function.
3. The method according to claim 1, characterized in that The random number i is obtained, and a random value r corresponding to the array index indicated by the random number i is randomly selected from an array composed of the first random value and the second random value obtained from the second computing device as array elements. i ,include: Run a random oblivious transfer protocol, and obtain a random number i generated by running the random oblivious transfer protocol, and a random value r randomly selected from an array consisting of a first random value and a second random value generated by running the random oblivious transfer protocol on the second computing device as array elements and corresponding to the array index indicated by the random number i i .
4. The method according to claim 1, characterized in that When the value of the first input data is 0, based on the random value r i Calculating an obfuscation value corresponding to the first output data includes: When the value of the first input data is 0, the random value r i The obfuscation value corresponding to the first output data is determined.
5. The method according to claim 4, characterized in that The random value r i Determining an obfuscation value corresponding to the first output data includes: Based on the preset hash function, calculate the random value r i The corresponding hash value h(r i ); The hash value h(r i ) is determined as an obfuscation value corresponding to the first output data.
6. The method according to claim 1, characterized in that When the value of the first input data is 1, based on the random value r i Calculating an obfuscation value corresponding to the second output data with the intermediate calculation result, comprising: If the value of the first input data is 1, the random value r is calculated i and the XOR result of the intermediate calculation result; The XOR result is determined as a confusion value corresponding to the second output data.
7. The method according to claim 6, characterized in that The length of the intermediate calculation result is a preset length; the calculation of the random value r i and the XOR result of the intermediate calculation result, including: Based on the preset hash function, calculate the random value r i The corresponding hash value h(r i ); Calculate the hash value h(r i ) and the XOR result of the intermediate calculation result.
8. The method according to claim 7, characterized in that The intermediate calculation result is a result obtained by the second computing device performing an XOR calculation on the first random value, the second random value, the first output data, and the second output data held by the second computing device in sequence.
9. The method according to claim 8, characterized in that The intermediate calculation result is a result obtained by the second computing device performing an XOR calculation on a hash value of a preset length corresponding to the first random value, a hash value of a preset length corresponding to the second random value, a first multiplication result of the first output data and a random bit string of a preset length, and a second multiplication result of the second output data and the random bit string.
10. The method according to claim 9, characterized in that The method further comprises: Calculate an XOR result e of the random number i and the first input data, and send the XOR result e to the second computing device, so that the second computing device calculates an obfuscation value corresponding to the first output data and an obfuscation value corresponding to the second output data based on the XOR result e; The obfuscation value corresponding to the first output data and the obfuscation value corresponding to the second output data are used by the second computing device to construct an obfuscation truth table corresponding to the second logic gate included in the obfuscation circuit; the obfuscation truth table is used to perform a logic calculation corresponding to the second logic gate with the output result of the first logic gate as input data.
11. The method according to claim 10, characterized in that The sending the XOR result e to the second computing device so that the second computing device calculates the obfuscation value corresponding to the first output data and the obfuscation value corresponding to the second output data based on the XOR result e, comprises: The XOR result e is sent to the second computing device, so that the second computing device randomly selects a random value r corresponding to the array index indicated by the XOR result e from the array composed of the first random value and the second random value as array elements. e ; Based on the preset hash function, calculate the random value r e The corresponding hash value h(r e ); Calculate the hash value h(r e ) and an XOR result L0 of the first multiplication result, and determining the XOR result L0 as a confusion value corresponding to the first output data; and An XOR result L1 of the XOR result L0 and the random bit string is calculated, and the XOR result L1 is determined as a confusion value corresponding to the second output data.
12. A method for calculating a garbled circuit, characterized in that: The method is applied to a second computing device corresponding to a confusion circuit generator, wherein the confusion circuit includes a plurality of logic gates; a first computing device corresponding to a confusion circuit executor holds first input data corresponding to a first logic gate included in the confusion circuit, wherein the first input data is 1-bit data with a value of 0 or 1; and the second computing device holds a plurality of expected output data corresponding to the first logic gate; wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1; The method comprises: Obtaining a first random value and a second random value, and calculating an intermediate calculation result corresponding to an output result of the first logic gate according to the first random value, the second random value, the first output data, and the second output data; The intermediate calculation result is sent to the first computing device, so that when the value of the first input data is 0, the first computing device obtains the random value r corresponding to the random number i. i , calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i Calculate an obfuscation value corresponding to the second output data using the intermediate calculation result, and use the obfuscation value as an output result of the first logic gate; The random number i is 0 or 1, and the random value r is i It is a random value corresponding to the array subscript indicated by the random number i, randomly selected from an array consisting of the first random value and the second random value as array elements.
13. A garbled circuit calculation device, characterized in that: The method is applied to a first computing device corresponding to an executor of an obfuscation circuit, wherein the obfuscation circuit includes a plurality of logic gates; the first computing device holds first input data corresponding to a first logic gate included in the obfuscation circuit, wherein the first input data is 1-bit data with a value of 0 or 1; and a second computing device corresponding to a generator of the obfuscation circuit holds a plurality of expected output data corresponding to the first logic gate, wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1; The device comprises: a first acquisition unit, configured to acquire a random number i, and a random value r randomly selected from an array consisting of the first random value and the second random value acquired from the second computing device as array elements and corresponding to the array index indicated by the random number i; i ; The value of the random number i is 0 or 1; a second acquisition unit, configured to acquire an intermediate calculation result corresponding to an output result of the first logic gate, which is calculated by the second calculation device based on the first random value, the second random value, the first output data, and the second output data; and A calculation unit, configured to calculate, when the value of the first input data is 0, a value based on the random value r i Calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i The obfuscation value corresponding to the second output data is calculated using the intermediate calculation result, and the obfuscation value is used as the output result of the first logic gate.
14. A garbled circuit calculation device, characterized in that: The method is applied to a second computing device corresponding to a confusion circuit generator, wherein the confusion circuit includes a plurality of logic gates; a first computing device corresponding to a confusion circuit executor holds first input data corresponding to a first logic gate included in the confusion circuit, wherein the first input data is 1-bit data with a value of 0 or 1; and the second computing device holds a plurality of expected output data corresponding to the first logic gate; wherein the plurality of expected output data includes first output data calculated when the value of the first input data is 0, and second output data calculated when the value of the first input data is 1; The device comprises: an acquisition unit, configured to acquire a first random value and a second random value, and calculate an intermediate calculation result corresponding to an output result of the first logic gate according to the first random value, the second random value, the first output data, and the second output data; The sending unit is configured to send the intermediate calculation result to the first computing device, so that the first computing device calculates the intermediate calculation result based on the obtained random value r corresponding to the random number i when the value of the first input data is 0. i , calculate the obfuscation value corresponding to the first output data, and use the obfuscation value as the output result of the first logic gate; or, when the value of the first input data is 1, based on the random value r i Calculate an obfuscation value corresponding to the second output data using the intermediate calculation result, and use the obfuscation value as an output result of the first logic gate; The random number i is 0 or 1, and the random value r is i It is a random value corresponding to the array subscript indicated by the random number i, randomly selected from an array consisting of the first random value and the second random value as array elements.
15. A computing device, characterized in that: include: Memory and processor; The memory stores a computer program executable by the processor; When the processor runs the computer program, it executes the method according to any one of claims 1 to 11, or executes the method according to claim 12.
16. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented, or the method according to claim 12 is implemented.
17. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 11 is implemented, or the method according to claim 12 is implemented.
Citation Information
Patent Citations
Privacy-preserving machine learning
CN110537191A
Business processing method and device based on obfuscation circuit
CN114239089A
Multi-party secure computing method, device and system
CN114499845A
Secure multi-party computing method and device
CN116318640A
Random number generation system for threshold signature scheme and method thereof
TW202349241A
