Homomorphic encryption operation method, device and electronic device
By introducing the exponentiation result cache table in homomorphic encryption to quickly calculate the exponentiation results, the problem of slow calculation speed of homomorphic encryption is solved, and efficient privacy protection and computing performance improvement are achieved.
Patent Information
- Application Number
- CN202210397418.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-15
AI Technical Summary
The calculation speed of existing homomorphic encryption technology is slow, causing the data modeling task to take dozens of hours to complete, making it difficult to meet the needs of privacy protection and efficient computing.
By introducing a power operation result cache table, the number of multiplication calculations in the power operation is reduced, and the cache table is used to quickly calculate the power operation results, thereby improving the calculation speed of homomorphic encryption.
It significantly reduces the time required for power operations and improves the performance of homomorphic encryption, making homomorphic encryption technology more practical in privacy protection and efficient computing scenarios.
Smart Images

Figure CN114584284B_ABST
Abstract
Description
[Technical field]
[0001] The embodiments of this specification relate to the field of Internet technology, and in particular, to a homomorphic encryption operation method, device, and electronic device. [Background technology]
[0002] In existing technologies, institutions often have business needs such as joint marketing and / or joint risk control. The traditional solution is to centralize the data of all institutions and then perform centralized modeling tasks. However, with the introduction of various privacy protection laws, cross-institutional data transactions and flows have been prohibited. How to complete joint computing and / or joint modeling tasks while protecting user privacy data has become a research hotspot in academia and industry.
[0003] Among the many privacy protection technologies, homomorphic encryption is a widely used technology. Homomorphic encryption technology allows organizations to perform operations on ciphertext and is a technology with wide applicability. However, homomorphic encryption also has a disadvantage, that is, the calculation speed is very slow, so that typical data modeling tasks take dozens of hours to complete.
[0004] Therefore, it is necessary to provide a solution to improve the calculation speed of homomorphic encryption. [Summary of the invention]
[0005] The embodiments of this specification provide a homomorphic encryption operation method, device and electronic device to reduce the time of power operations and improve the calculation speed of homomorphic encryption.
[0006] In a first aspect, an embodiment of the present specification provides a homomorphic encryption operation method, which is applied to an electronic device participating in a homomorphic encryption operation, the method comprising: determining a homomorphic encryption operation to be performed on specified business data, the homomorphic encryption operation being used to provide privacy protection for the business data; obtaining a base parameter and an exponent parameter of a power operation included in the homomorphic encryption operation; according to the exponent parameter, querying a power operation result cache table corresponding to the base parameter to obtain a result of the power operation; and completing the homomorphic encryption operation according to the result of the power operation.
[0007] In the above homomorphic encryption operation method, after determining the homomorphic encryption operation to be performed on the specified business data, the base parameter and exponent parameter of the power operation contained in the above homomorphic encryption operation are obtained, and then according to the above exponent parameter, the power operation result cache table corresponding to the above base parameter is queried to obtain the result of the above power operation, and finally, according to the result of the above power operation, the homomorphic encryption operation is completed, so that the number of multiplication calculations in the power operation can be greatly reduced through the power operation result cache table, which greatly reduces the time required for the power operation, thereby improving the performance of homomorphic encryption.
[0008] In one possible implementation, obtaining the base parameter of the exponentiation operation included in the homomorphic encryption operation includes: obtaining the public key used in the homomorphic encryption operation; and obtaining the base parameter of the exponentiation operation included in the homomorphic encryption operation from the public key.
[0009] In one possible implementation, querying the power operation result cache table corresponding to the base parameter according to the exponent parameter to obtain the result of the power operation includes: obtaining the exponent parameter in the current operation cycle and the number of query rows of the power operation result cache table in the current operation cycle, and obtaining the number of power operation results included in each row of the power operation result cache table; when the obtained exponent parameter is not equal to a first value, if the result of the AND operation of the obtained exponent parameter and the number is greater than the first value, querying the power operation result cache table according to the number of query rows and the result of the AND operation; multiplying the power operation result obtained by the query by the power operation result of the previous operation cycle as the power operation result of the current operation cycle.
[0010] In one possible implementation, after obtaining the exponential parameter in the current operation cycle, the method further includes: when the obtained exponential parameter is equal to a first value, exiting the current operation cycle; and using the power operation result of the previous operation cycle as the final power operation result.
[0011] In one possible implementation, after multiplying the power operation result obtained by the query with the power operation result of the previous operation cycle as the power operation result of the current operation cycle, it also includes: taking the quotient of the exponent parameter in the current operation cycle and the width of the power operation result cache table as the exponent parameter in the next operation cycle; and increasing the number of query rows by a predetermined step size.
[0012] In one possible implementation, querying the power operation result cache table based on the query row number and the AND operation result includes: obtaining the difference between the result of the AND operation and a second value; and querying, in the power operation result cache table, obtaining the power operation result based on the row corresponding to the query row number and the column corresponding to the difference.
[0013] In one possible implementation, the method further includes: generating a power operation result cache table corresponding to the base parameter based on the base parameter of the power operation contained in the homomorphic encryption operation and a predetermined width, before querying the power operation result cache table corresponding to the base parameter based on the exponent parameter.
[0014] In a second aspect, an embodiment of the present specification provides a homomorphic encryption operation device, which is arranged in an electronic device participating in a homomorphic encryption operation, and the device includes: a determination module, used to determine the homomorphic encryption operation to be performed on specified business data, and the homomorphic encryption operation is used to provide privacy protection for the business data; an acquisition module, used to obtain the base parameter and exponent parameter of the power operation included in the homomorphic encryption operation; a query module, used to query the power operation result cache table corresponding to the base parameter according to the exponent parameter, and obtain the result of the power operation; an encryption module, used to complete the homomorphic encryption operation according to the result of the power operation.
[0015] In one possible implementation, the acquisition module is specifically used to obtain a public key used in the homomorphic encryption operation, and obtain a base parameter of the exponentiation operation included in the homomorphic encryption operation from the public key.
[0016] In one possible implementation, the query module includes: a parameter acquisition submodule, used to obtain the exponential parameter in the current operation cycle and the number of query rows of the power operation result cache table in the current operation cycle, and to obtain the number of power operation results included in each row of the power operation result cache table; a result query submodule, used to query the power operation result cache table according to the number of query rows and the result of the AND operation when the exponential parameter obtained by the parameter acquisition submodule is not equal to a first numerical value and the result of the AND operation of the exponential parameter obtained by the parameter acquisition submodule and the number is greater than the first numerical value; a calculation submodule, used to multiply the power operation result obtained by the query of the result query submodule by the power operation result of the previous operation cycle as the power operation result of the current operation cycle.
[0017] In one possible implementation method, the calculation submodule is also used to exit the current operation cycle after the parameter acquisition submodule acquires the exponential parameter in the current operation cycle, when the exponential parameter acquired by the parameter acquisition submodule is equal to a first numerical value; and use the power operation result of the previous operation cycle as the final power operation result.
[0018] In one possible implementation, the query module also includes: a parameter setting submodule, which is used to multiply the power operation result obtained by the query by the power operation result of the previous operation cycle in the calculation submodule as the power operation result of the current operation cycle, and then use the quotient of the exponent parameter in the current operation cycle and the width of the power operation result cache table as the exponent parameter in the next operation cycle; and increase the number of query rows by a predetermined step size.
[0019] In one possible implementation, the result query submodule is specifically used to obtain the difference between the result of the AND operation and the second value, and in the power operation result cache table, query and obtain the power operation result according to the row corresponding to the query row number and the column corresponding to the difference.
[0020] In one possible implementation method, the device also includes: a generation module, which is used to query the power operation result cache table corresponding to the base parameter according to the exponent parameter in the query module, and before obtaining the result of the power operation, generate the power operation result cache table corresponding to the base parameter according to the base parameter of the power operation included in the homomorphic encryption operation and a predetermined width.
[0021] In a third aspect, an embodiment of the present specification provides an electronic device, comprising: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the method provided in the first aspect.
[0022] In a fourth aspect, an embodiment of the present specification provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method provided in the first aspect.
[0023] It should be understood that the second to fourth aspects of the embodiments of this specification are consistent with the technical solutions of the first aspect of the embodiments of this specification, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here.
Brief Description of the Drawings
[0024] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 A schematic diagram of a power operation algorithm provided for the existing related technology;
[0026] Figure 2 A flowchart of a homomorphic encryption operation method provided for one embodiment of this specification;
[0027] Figure 3 A flowchart of a homomorphic encryption operation method provided in another embodiment of this specification;
[0028] Figure 4 A flowchart of a homomorphic encryption operation method provided in yet another embodiment of this specification;
[0029] Figure 5 A schematic diagram of the structure of a homomorphic encryption operation device provided in one embodiment of this specification;
[0030] Figure 6 A schematic diagram of the structure of a homomorphic encryption operation device provided in another embodiment of this specification;
[0031] Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of this specification. [Specific implementation method]
[0032] In order to better understand the technical solution of this specification, the embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0033] It should be clear that the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0034] The terms used in the embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit this specification. The singular forms "a", "said" and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0035] Homomorphic encryption: A form of encryption that allows people to perform a specific form of algebraic operations on ciphertext to obtain a result that is still encrypted, and the result obtained by decrypting it is the same as the result of the same operation on the plaintext. In other words, this technology allows people to perform algebraic calculations on encrypted data and obtain correct results without decrypting the data during the entire process. Homomorphic encryption includes fully homomorphic encryption and semi-homomorphic encryption:
[0036] 1) Fully homomorphic encryption: Homomorphic encryption algorithms that support both addition and multiplication on ciphertext. Such algorithms satisfy the following conditions: Enc(a)+Enc(b)=Enc(a+b) and Enc(a)*Enc(b)=Enc(a*b).
[0037] 2) Semi-homomorphic encryption: a homomorphic encryption algorithm that only supports one operation on the ciphertext. For example, the Paillier algorithm and the Okamoto-Uchiyama (hereinafter referred to as OU) algorithm are additive homomorphic algorithms that satisfy Enc(a)+Enc(b)=Enc(a+b); RSA is a multiplicative homomorphic encryption algorithm that satisfies Enc(a)*Enc(b)=Enc(a*b). This type of algorithm only supports one type of homomorphic calculation and is collectively referred to as a semi-homomorphic encryption algorithm.
[0038] Homomorphic encryption is a relatively new cryptographic technology. Homomorphic encryption allows people to perform specific forms of algebraic operations on ciphertexts to obtain encrypted results. The decrypted results are the same as the results of the same operations on plaintext. For example, organization A has data a and organization B has data b. Organization A can homomorphically encrypt all data a to obtain Enc(a). Then organization A sends the ciphertext Enc(a) to organization B. Organization B directly calculates Enc(a)+b=Enc(a+b) on the ciphertext. The calculation result obtained by organization B is still the ciphertext, so organization B cannot perceive the original data a of organization A. Finally, organization B sends the calculation result Enc(a+b) back to organization A. Organization A decrypts it with its own private key to obtain the final calculation result a+b. In this process, organizations A and B cannot infer each other's data, but obtain the calculation results, which achieves the effect of "available but invisible" data and meets business needs well. (Note: In the above addition example, mechanism A can infer b based on the summation result, but if mechanism B performs a more complex calculation, then mechanism A cannot infer the data of mechanism B.)
[0039] Although homomorphic encryption has good cryptographic properties, its disadvantage is also obvious, that is, the calculation is very slow. The ciphertext calculation is about 5000 times slower than the plaintext calculation. This makes homomorphic encryption lose a lot of practical value and can only be applied to some very simple computing scenarios.
[0040] The reason why homomorphic encryption is slow is that it requires frequent calculation of g m The power operation in the existing related technology is to divide m into two and then calculate g m , a common exponentiation algorithm can be expressed as Figure 1 As shown, Figure 1 A schematic diagram of a power operation algorithm provided by the existing related technology.
[0041] To calculate g 283 For example, A*=S in line 2.1 performs 9 multiplications in total, and S*=S in line 2.3 performs 8 multiplications in total, which together perform 17 multiplications. The calculation speed is relatively slow.
[0042] In order to solve the above problems, the embodiments of this specification provide a homomorphic encryption operation method, which can greatly improve the performance of the homomorphic encryption algorithm. Tests on the Paillier algorithm and the OU algorithm show that after using the homomorphic encryption operation method provided by the embodiments of this specification, the algorithm performance is greatly improved compared with the original algorithm performance without using the above method.
[0043] The homomorphic encryption operation method provided in the embodiments of this specification is applicable to the OU algorithm and the Paillier algorithm. The OU algorithm and the Paillier algorithm are both relatively popular homomorphic encryption algorithms in the industry, and their core calculation processes are similar. Therefore, both can use the homomorphic encryption operation method provided in the embodiments of this specification. The embodiments of this specification take the OU algorithm as an example for introduction. The main operations of the OU algorithm include encryption, decryption, ciphertext + ciphertext, ciphertext + plaintext, and ciphertext * plaintext. The method provided in the embodiments of this specification has a great acceleration effect on encryption operations and "ciphertext + plaintext" operations. The method and principle are now introduced as follows.
[0044] (I) Original algorithm
[0045] 1) The key of the OU algorithm is divided into a public key and a private key. The key generation algorithm is as follows:
[0046] Step 1, generate two large prime numbers p and q;
[0047] Step 2, calculate n = p 2 q;
[0048] Step 3, randomly select g to satisfy g<n and g p-1 ≠1 mod p 2 ;
[0049] Step 4, calculate h = g n mod n.
[0050] In this way, the public key is (n, g, h) and the private key is (p, q).
[0051] 2) The encryption operation in the OU algorithm can be:
[0052] Enter plaintext m<p, and then perform the following steps:
[0053] Step 1, randomly select a positive integer r, satisfying r<n;
[0054] Step 2, calculate c = g m h r mod n
[0055] In this way, c is the ciphertext obtained by encrypting the plaintext m.
[0056] 3) The ciphertext + plaintext operation in the OU algorithm can be:
[0057] Given ciphertext c1=Enc(m1) and plaintext m2, perform the following steps:
[0058] Step 1, calculate
[0059] Among them, the decrypted c3 is equal to m1+m2, which is equivalent to the operation of ciphertext c1+plaintext m2.
[0060] From the above description, we can see that the "encryption" and "ciphertext + plaintext" operations in the OU algorithm both involve the exponentiation operation g m Since g is an element in the public key, once the public key is determined, the value of g is fixed. Based on this feature, g can be m The calculation is optimized to improve the calculation speed of homomorphic encryption.
[0061] (II) Homomorphic encryption method provided in the embodiments of this specification
[0062] In homomorphic encryption operations, the public key is public, and each participant will send its own public key to other participants. Assuming that there are two participants in the homomorphic encryption operation, A and B, after A and B generate their own public-private key pairs, they broadcast their own public keys to each other, that is, A sends its public key A to B, and B sends its public key B to A.
[0063] In view of the above-mentioned scenario of "fixed base and variable exponent", the embodiment of this specification introduces the concept of cache table. When the participants of the homomorphic encryption operation receive the public key, the embodiment of this specification calculates a cache table for g in the public key. The cache table can be used to quickly calculate g. m purpose.
[0064] For example, assuming that the base number is g and the cache table width is 8, the cache table calculated in the embodiment of this specification can be:
[0065] g 1 ,g 2 ,g 3 ,g 4 ,g 5 ,g 6 ,g 7
[0066] g 8 ,g 16 ,g 24 ,g 32 ,g 40 ,g 48 ,g 56
[0067] g64 ,g 128 ,g 192 ,g 256 ,…
[0068] g 512 ,…
[0069] …
[0070] In specific implementation, for each participant, a cache table must be calculated for each public key. Taking the participants A and B as an example, since A has two public keys, public key A and public key B, A needs to calculate cache tables for public key A and public key B respectively.
[0071] Public keys are used for encryption and ciphertext operations. For A, there are two scenarios:
[0072] 1) A encrypts its own data and sends it to B, using public key A. During this process, the cache table corresponding to public key A can be searched to obtain the result of the power operation;
[0073] 2) A receives the encrypted data from B and needs to perform operations on the ciphertext, so public key B is needed. During this process, the cache table corresponding to public key B can be searched to obtain the result of the power operation.
[0074] The cache table only needs to be calculated once during initialization and will not change later. The width of the cache table is an adjustable configuration. The larger the width, the more elements in the cache table, the better the acceleration effect on the calculation, but it will take up more storage space. The width of the cache table meets the requirement of 2 to the power of N. In actual use, the width can be set to 128 or 256.
[0075] So, how does the cache table speed up the calculation? 283 For example, g 283 =1·g 3 ·g 24 ·g 256 , while the latter 3 , g 24 , g 256 They are already in the cache table, so we can get them by looking them up directly. In this way, we only need 3 multiplications to calculate g. 283 Compared with the existing related technologies, the number of multiplications is reduced from 17 to 3, which greatly reduces the time required for power calculation.
[0076] In general, for any g m , the method of using cache table calculation can be as follows:
[0077] Input:g,m
[0078] Fixed Input: Table (cache table), w (cache table width)
[0079] Output:g m
[0080]
[0081] By using the homomorphic encryption method provided in the embodiments of this specification, g can be quickly obtained. m As a result, the "encryption" operation in the OU algorithm and the "ciphertext + plaintext" operation can be completed quickly, thereby improving the performance of homomorphic encryption. Since the Paillier algorithm is similar to the OU algorithm, the homomorphic encryption method provided in the embodiments of this specification is also applicable to the Paillier algorithm.
[0082] Figure 2 The flowchart of the homomorphic encryption operation method provided in one embodiment of the present specification, the homomorphic encryption operation method can be applied to electronic devices participating in homomorphic encryption operations, such as Figure 2 As shown, the above homomorphic encryption operation method may include:
[0083] Step 202, determine the homomorphic encryption operation to be performed on the specified business data, and the above homomorphic encryption operation is used to provide privacy protection for the above business data.
[0084] In one or more embodiments of the present specification, business data may be data provided by users in application scenarios such as cloud service computing, outsourced computing, and / or federated learning. Such data often involve the privacy of users or their customers and therefore require privacy protection through homomorphic encryption.
[0085] Step 204, obtain the base parameter and exponent parameter of the power operation included in the above homomorphic encryption operation.
[0086] For example, suppose the exponentiation operation included in the above homomorphic encryption operation is g m , then the base parameter is g and the exponent parameter is m.
[0087] Specifically, obtaining the base parameter of the exponentiation operation included in the above homomorphic encryption operation can be: obtaining the public key used in the above homomorphic encryption operation, and obtaining the base parameter of the exponentiation operation included in the above homomorphic encryption operation from the above public key.
[0088] In homomorphic encryption operations, the public key is public, and each participant will send its own public key to other participants. The base parameter is an element in the public key. Therefore, after obtaining the public key, the participants in the homomorphic encryption operation can obtain the above base parameter from the above public key.
[0089] Step 206: According to the exponent parameter, query the power operation result cache table corresponding to the base parameter to obtain the power operation result.
[0090] Specifically, assume that the power operation result cache table is:
[0091] g 1 ,g 2 ,g 3 ,g 4 ,g 5 ,g 6 ,g 7
[0092] g 8 ,g 16 ,g 24 ,g 32 ,g 40 ,g 48 ,g 56
[0093] g 64 ,g 128 ,g 192 ,g 256 ,…
[0094] g 512 ,…
[0095] …
[0096] Then, according to the specific value of m, by querying the above power operation result cache table, you can get g m result.
[0097] Step 208, completing the homomorphic encryption operation according to the result of the above power operation.
[0098] In the above homomorphic encryption operation method, after determining the homomorphic encryption operation to be performed on the specified business data, the base parameter and exponent parameter of the power operation contained in the above homomorphic encryption operation are obtained, and then according to the above exponent parameter, the power operation result cache table corresponding to the above base parameter is queried to obtain the result of the above power operation, and finally, according to the result of the above power operation, the homomorphic encryption operation is completed, so that the number of multiplication calculations in the power operation can be greatly reduced through the power operation result cache table, which greatly reduces the time required for the power operation, thereby improving the performance of homomorphic encryption.
[0099] Figure 3 A flowchart of a homomorphic encryption operation method provided in another embodiment of this specification is as follows: Figure 3 As shown in this manual Figure 2 In the illustrated embodiment, step 206 may include:
[0100] Step 302: Obtain the exponential parameter in the current operation cycle and the number of query rows in the power operation result cache table in the current operation cycle, and obtain the number of power operation results included in each row in the power operation result cache table.
[0101] The number of power operation results included in each row of the power operation result cache table can be determined according to the cache table width, which is generally the cache table width minus 1. For example, when the cache table width is 8, the number can be 7.
[0102] Step 304, when the obtained exponential parameter is not equal to the first value, if the result of the AND operation of the obtained exponential parameter and the number is greater than the first value, query the power operation result cache table according to the query row number and the result of the AND operation.
[0103] The size of the first value may be set during specific implementation according to system performance and / or implementation requirements. This embodiment does not limit the size of the first value. For example, the first value may be 0.
[0104] Specifically, based on the above-mentioned query row number and the result of the AND operation, querying the above-mentioned power operation result cache table can be: obtaining the difference after subtracting the second value from the result of the AND operation; in the above-mentioned power operation result cache table, querying to obtain the power operation result according to the row corresponding to the above-mentioned query row number and the column corresponding to the above-mentioned difference.
[0105] The size of the second value may be set during specific implementation according to system performance and / or implementation requirements. This embodiment does not limit the size of the second value. For example, the second value may be 1.
[0106] Step 306: multiply the exponentiation result obtained by the query by the exponentiation result of the previous operation cycle to obtain the exponentiation result of the current operation cycle.
[0107] Furthermore, after step 306, the following steps may also be included:
[0108] Step 308: taking the quotient of the exponential parameter in the current operation cycle and the width of the power operation result cache table as the exponential parameter in the next operation cycle; and increasing the query row number by a predetermined step length.
[0109] The predetermined step size may be set during specific implementation according to system performance and / or implementation requirements. This embodiment does not limit the size of the predetermined step size. For example, the predetermined step size may be 1.
[0110] The above steps 302 to 308 can be executed in a loop. In this way, during the loop execution, if the exponential parameter in the current operation cycle obtained in step 302 is equal to the first value, the current operation cycle is exited and the power operation result of the previous operation cycle is used as the final power operation result.
[0111] Figure 4 A flowchart of a homomorphic encryption operation method provided in another embodiment of this specification is as follows: Figure 4 As shown in this manual Figure 2 In the illustrated embodiment, before step 206, the following may also be included:
[0112] Step 402: Generate a cache table of power operation results corresponding to the base parameters of the power operation included in the homomorphic encryption operation and a predetermined width.
[0113] In the specific implementation, for each participant, a cache table must be calculated for each public key. For example, if the participants include A and B, A and B will generate their own public and private key pairs and broadcast their own public keys to each other, that is, A sends its own public key A to B, and B sends its own public key B to A. In this way, for A, since A has two public keys, public key A and public key B, A needs to calculate the power operation result cache table for public key A and public key B respectively.
[0114] The cache table only needs to be calculated once during initialization and will not change later. The above-mentioned predetermined width is the width of the cache table, which is an adjustable configuration. The larger the width, the more elements in the cache table, the better the acceleration effect on the calculation, but it will take up more storage space. The width of the cache table needs to meet the N-power requirement of 2. In actual use, the width can be set to 128 or 256.
[0115] The above homomorphic encryption operation method can greatly reduce the number of multiplication calculations in power operations by introducing the concept of a cache table, thereby significantly reducing the time required for power operations, greatly improving the performance of homomorphic encryption, and enabling homomorphic encryption technology to be applied to actual scenarios, which is of great help to the promotion and implementation of privacy protection technology.
[0116] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0117] Figure 5The schematic diagram of the structure of a homomorphic encryption operation device provided in one embodiment of the present specification is provided in an electronic device participating in the homomorphic encryption operation, such as Figure 5 As shown, the above homomorphic encryption operation device may include: a determination module 51, an acquisition module 52, a query module 53 and an encryption module 54;
[0118] The determination module 51 is used to determine the homomorphic encryption operation to be performed on the specified business data, and the homomorphic encryption operation is used to provide privacy protection for the business data;
[0119] An acquisition module 52 is used to obtain a base parameter and an exponent parameter of the power operation included in the above homomorphic encryption operation;
[0120] A query module 53 is used to query the power operation result cache table corresponding to the base parameter according to the exponent parameter to obtain the result of the power operation;
[0121] The encryption module 54 is used to complete the above homomorphic encryption operation according to the result of the above power operation.
[0122] Figure 5 The homomorphic encryption operation device provided in the embodiment shown can be used to execute the present specification Figure 2 The technical solution of the method embodiment shown, its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0123] Figure 6 A schematic diagram of a homomorphic encryption operation device provided in another embodiment of this specification, Figure 5 Compared with the homomorphic encryption operation shown, Figure 6 In the homomorphic encryption operation device shown, the acquisition module 52 is specifically used to obtain the public key used in the above homomorphic encryption operation, and obtain the base parameter of the exponentiation operation included in the above homomorphic encryption operation from the above public key.
[0124] In this embodiment, the query module 53 may include: a parameter acquisition submodule 531, a result query submodule 532 and a calculation submodule 533;
[0125] The parameter acquisition submodule 531 is used to acquire the exponential parameter in the current operation cycle and the number of query rows of the power operation result cache table in the current operation cycle, and to acquire the number of power operation results included in each row of the power operation result cache table;
[0126] A result query submodule 532 is used for querying the power operation result cache table according to the query row number and the result of the AND operation when the exponential parameter obtained by the parameter acquisition submodule 531 is not equal to the first value and if the result of the AND operation between the exponential parameter obtained by the parameter acquisition submodule 531 and the number is greater than the first value;
[0127] The calculation submodule 533 is used to multiply the power operation result obtained by querying the result query submodule 532 with the power operation result of the previous operation cycle to obtain the power operation result of the current operation cycle.
[0128] Furthermore, the calculation submodule 533 is also used to exit the current operation cycle after the parameter acquisition submodule 531 acquires the exponential parameter in the current operation cycle, when the exponential parameter acquired by the parameter acquisition submodule 531 is equal to the first value; and use the power operation result of the previous operation cycle as the final power operation result.
[0129] Furthermore, the query module 53 may also include: a parameter setting submodule 534;
[0130] The parameter setting submodule 534 is used to multiply the power operation result obtained by the query by the power operation result of the previous operation cycle after the calculation submodule 533 takes the power operation result of the current operation cycle as the power operation result, and then use the quotient of the exponent parameter in the current operation cycle and the width of the above-mentioned power operation result cache table as the exponent parameter in the next operation cycle; and increase the above-mentioned query row number by a predetermined step size.
[0131] In this embodiment, the result query submodule 532 is specifically used to obtain the difference after subtracting the second value from the result of the above-mentioned AND operation. In the above-mentioned power operation result cache table, the power operation result is queried according to the row corresponding to the above-mentioned query row number and the column corresponding to the above-mentioned difference.
[0132] Furthermore, the above homomorphic encryption operation device may also include: a generation module 55;
[0133] The generation module 55 is used to query the power operation result cache table corresponding to the above-mentioned base parameter according to the above-mentioned exponent parameter in the query module 53, and before obtaining the result of the above-mentioned power operation, generate the power operation result cache table corresponding to the above-mentioned base parameter according to the base parameter of the power operation included in the above-mentioned homomorphic encryption operation and the predetermined width.
[0134] Figure 6 The homomorphic encryption operation device provided in the embodiment shown can be used to execute the present specification Figure 2 to Figure 4 The technical solution of the method embodiment shown, its implementation principle and technical effects can be further referred to the relevant description in the method embodiment.
[0135] Figure 7A schematic diagram of the structure of an electronic device provided in one embodiment of this specification, such as Figure 7 As shown, the electronic device may include at least one processor; and at least one memory connected to the processor in communication, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the instructions of this specification. Figure 2 to Figure 4 The illustrated embodiment provides a homomorphic encryption operation method.
[0136] Among them, the above-mentioned electronic device can be a device participating in homomorphic encryption operations, and this embodiment does not limit the form of the above-mentioned electronic device.
[0137] Figure 7 A block diagram of an exemplary electronic device suitable for implementing the embodiments of the present description is shown. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of this specification.
[0138] like Figure 7 As shown, the electronic device is in the form of a general computing device. The components of the electronic device may include, but are not limited to: one or more processors 410, a communication interface 420, a memory 430, and a communication bus 440 connecting different components (including the memory 430, the communication interface 420 and the processor 410).
[0139] The communication bus 440 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, or a local bus using any of a variety of bus structures. For example, the communication bus 440 may include, but is not limited to, an industry standard architecture (ISA) bus, a micro channel architecture (MCA) bus, an enhanced ISA bus, a video electronics standards association (VESA) local bus, and a peripheral component interconnection (PCI) bus.
[0140] Electronic devices typically include a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device, including volatile and non-volatile media, removable and non-removable media.
[0141] The memory 430 may include a computer system readable medium in the form of a volatile memory, such as a random access memory (RAM) and / or a cache memory. The memory 430 may include at least one program product having a set (e.g., at least one) of program modules configured to execute the instructions of the present invention. Figure 2 to Figure 4 Functionality of the illustrated embodiment.
[0142] A program / utility having a set (at least one) of program modules may be stored in the memory 430, such program modules including - but not limited to - an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment. The program modules generally execute the instructions in this specification. Figure 2 to Figure 4 The functions and / or methods in the described embodiments.
[0143] The processor 410 executes various functional applications and data processing by running the programs stored in the memory 430, such as implementing the present specification. Figure 2 to Figure 4 The illustrated embodiment provides a homomorphic encryption operation method.
[0144] The embodiment of the present specification provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions enable the computer to execute the present specification. Figure 2 to Figure 4 The illustrated embodiment provides a homomorphic encryption operation method.
[0145] The above-mentioned non-transient computer-readable storage medium can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, - but not limited to - electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive lists) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (read only memory, ROM), erasable programmable read-only memories (erasable programmable read only memory, EPROM) or flash memory, optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing programs, which can be used by instruction execution systems, devices or devices or used in combination with them.
[0146] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0147] The program code embodied on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
[0148] Computer program code for performing the operations of the present specification may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0149] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0150] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0151] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this specification, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0152] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of this specification includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of this specification belong.
[0153] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0154] It should be noted that the terminals involved in the embodiments of this specification may include but are not limited to personal computers (PCs), personal digital assistants (PDAs), wireless handheld devices, tablet computers, mobile phones, MP3 players, MP4 players, etc.
[0155] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0156] In addition, each functional unit in each embodiment of this specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0157] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.
[0158] 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.
Claims
1. A homomorphic encryption operation method, applied to an electronic device participating in a homomorphic encryption operation, the method comprising: Determining a homomorphic encryption operation to be performed on specified business data, wherein the homomorphic encryption operation is used to provide privacy protection for the business data; Obtaining a base parameter and an exponent parameter of a power operation included in the homomorphic encryption operation; According to the exponent parameter, query the power operation result cache table corresponding to the base parameter to obtain the power operation result; According to the result of the power operation, the homomorphic encryption operation is completed; The step of querying the power operation result cache table corresponding to the base parameter according to the exponent parameter to obtain the power operation result includes: Obtaining an exponential parameter in a current operation cycle and the number of query rows of the power operation result cache table in the current operation cycle, and obtaining the number of power operation results included in each row of the power operation result cache table; When the acquired exponential parameter is not equal to the first value, if the result of performing an AND operation on the acquired exponential parameter and the quantity is greater than the first value, querying the power operation result cache table according to the query row number and the result of the AND operation; The exponentiation result obtained by the query is multiplied by the exponentiation result of the previous operation cycle to obtain the exponentiation result of the current operation cycle.
2. The method according to claim 1, wherein: The obtaining of the base parameter of the exponentiation operation included in the homomorphic encryption operation includes: Obtaining a public key used in the homomorphic encryption operation; A base parameter of the exponentiation operation included in the homomorphic encryption operation is obtained from the public key.
3. The method according to claim 1, wherein: After obtaining the exponential parameter in the current operation cycle, the method further includes: When the acquired index parameter is equal to the first value, exit the current operation cycle; The power calculation result of the previous calculation cycle is used as the final power calculation result.
4. The method according to claim 1, wherein: After multiplying the power operation result obtained by the query with the power operation result of the previous operation cycle to obtain the power operation result of the current operation cycle, the method further includes: The quotient of the exponential parameter in the current operation cycle and the width of the power operation result cache table is used as the exponential parameter in the next operation cycle; and the number of query rows is increased by a predetermined step length.
5. The method according to claim 1, wherein: The querying the power operation result cache table according to the query row number and the AND operation result comprises: Obtaining a difference between the result of the AND operation and the second value; In the power operation result cache table, the power operation result is obtained by querying according to the row corresponding to the query row number and the column corresponding to the difference.
6. The method according to any one of claims 1 to 5, wherein: Before querying the power operation result cache table corresponding to the base parameter according to the exponent parameter to obtain the power operation result, the method further includes: According to the base parameter of the exponentiation operation included in the homomorphic encryption operation and a predetermined width, a cache table of exponentiation results corresponding to the base parameter is generated.
7. A homomorphic encryption operation device, the homomorphic encryption operation device is arranged in an electronic device participating in a homomorphic encryption operation, the device comprising: A determination module, used to determine a homomorphic encryption operation to be performed on specified business data, wherein the homomorphic encryption operation is used to provide privacy protection for the business data; An acquisition module, used to obtain a base parameter and an exponent parameter of the power operation included in the homomorphic encryption operation; A query module, configured to query a power operation result cache table corresponding to the base parameter according to the exponent parameter, and obtain a result of the power operation; An encryption module, used to complete the homomorphic encryption operation according to the result of the exponentiation operation; Wherein, the query module includes: A parameter acquisition submodule, used to obtain the exponential parameter in the current operation cycle and the number of query rows of the power operation result cache table in the current operation cycle, and to obtain the number of power operation results included in each row of the power operation result cache table; A result query submodule, for querying the power operation result cache table according to the query row number and the result of the AND operation, when the exponent parameter obtained by the parameter acquisition submodule is not equal to the first value and if the result of the AND operation between the exponent parameter obtained by the parameter acquisition submodule and the quantity is greater than the first value; The calculation submodule is used to multiply the power operation result obtained by the query of the result query submodule with the power operation result of the previous operation cycle to obtain the power operation result of the current operation cycle.
8. The device according to claim 7, wherein: The acquisition module is specifically used to obtain the public key used in the homomorphic encryption operation, and obtain the base parameter of the exponentiation operation included in the homomorphic encryption operation from the public key.
9. The device according to claim 7, wherein: The calculation submodule is also used to exit the current operation cycle after the parameter acquisition submodule acquires the exponential parameter in the current operation cycle, when the exponential parameter acquired by the parameter acquisition submodule is equal to the first value; and use the power operation result of the previous operation cycle as the final power operation result.
10. The device according to claim 7, wherein: The query module also includes: A parameter setting submodule is used to multiply the power operation result obtained by the query by the power operation result of the previous operation cycle in the calculation submodule as the power operation result of the current operation cycle, and then use the quotient of the exponent parameter in the current operation cycle and the width of the power operation result cache table as the exponent parameter in the next operation cycle; and increase the number of query rows by a predetermined step size.
11. The device according to claim 7, wherein: The result query submodule is specifically used to obtain the difference between the result of the AND operation and the second value, and in the power operation result cache table, query and obtain the power operation result according to the row corresponding to the query row number and the column corresponding to the difference.
12. The device according to any one of claims 7 to 11, wherein: Also includes: A generation module is used to query the power operation result cache table corresponding to the base parameter according to the exponent parameter in the query module, and before obtaining the result of the power operation, generate the power operation result cache table corresponding to the base parameter according to the base parameter of the power operation included in the homomorphic encryption operation and a predetermined width.
13. An electronic device comprising: at least one processor; as well as at least one memory in communication with the processor, wherein: The memory stores program instructions executable by the processor, and the processor can execute the method according to any one of claims 1 to 6 by calling the program instructions.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions enable the computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and encryption node for encrypting message
CN107852324A
Data processing method and device in finite field and decoder
CN111384971A
Floating-point number multiplication method and computer readable storage medium
CN112181360A
Data processing method and device, processor and data searching method and device
CN113296732A
Homomorphic encryption method and device, medium and computer program product
CN113746620A
