Compact state data parallel sorting method and system based on fully homomorphic encryption
By adopting BGV scheme and SIMD parallel computing in full homomorphic encryption, combined with parallel prefix comparator and exponential encoding technology, the problems of low efficiency and noise accumulation of existing full homomorphic encryption sorting algorithms are solved, and efficient parallel sorting and polynomials are realized Coefficient extraction.
Patent Information
- Application Number
- CN202411408274.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-10-10
AI Technical Summary
Existing all-homomorphic encryption sorting algorithms are less efficient, especially when processing large-scale data, where computational complexity and noise accumulation problems lead to decryption errors.
Using algebraic structure based on the BGV scheme and SIMD parallel computing capabilities, parallel prefix comparator and exponential encoding technology are designed, comparison matrix is constructed through masking technology and plaintext slot rotation technology, and polynomial coefficient extraction is realized using Frobenius autoisomorphism.
It realizes efficient parallel sorting of dense data, reduces computational complexity, improves throughput and reduces operation delay, and improves compatibility and scalability.
Smart Images

Figure CN119496603A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a method and system for parallel sorting of secret data based on fully homomorphic encryption. Background Art
[0002] As important fields such as healthcare, education and finance are rapidly moving towards informatization, digitization and intelligence, cutting-edge information technologies such as cloud computing, the Internet of Things and artificial intelligence have been deeply integrated into daily work and life. More and more corporate and personal data are processed and transmitted in real time on the Internet, and protecting sensitive data from threats has become increasingly critical.
[0003] Fully homomorphic encryption is one of the key technologies of privacy computing. It can perform arbitrary calculations on secret data without access to private keys. At present, the widely used fully homomorphic encryption schemes can be divided into two categories: hierarchical fully homomorphic encryption and bootstrap fully homomorphic encryption. Hierarchical fully homomorphic encryption includes BGV, BFV and CKKS schemes, while bootstrap fully homomorphic encryption includes FHEW and TFHE schemes. These schemes rely on the (R)LWE difficulty assumption and prevent algebraic attacks by introducing noise into the ciphertext. However, as the calculation process proceeds, the noise will gradually accumulate and may eventually lead to decryption errors. The bootstrap fully homomorphic encryption scheme uses bootstrapping technology to clean up the noise. Its throughput is low and it is not suitable for scenarios that process large-scale data. Hierarchical fully homomorphic encryption uses the RLWE public key encryption algorithm and controls the noise growth by modulus switching. An important feature is that hierarchical fully homomorphic encryption supports homomorphic operations of the SIMD paradigm, which can package multiple data into a single ciphertext. By performing a single homomorphic operation on the ciphertext, parallel operations on multiple encrypted data can be achieved.
[0004] At present, the efficiency of fully homomorphic sorting algorithms is still low, and designing dedicated homomorphic algorithms for different computing tasks is an important research topic. Sorting algorithms are a crucial class of algorithms in the field of computer science. They allow software engineers to arrange data sets in order, thereby optimizing the efficiency of data retrieval and management. In practical applications, efficient sorting algorithms such as quick sort, merge sort, and heap sort are widely used in database systems, search engines, file processing, and big data processing frameworks. They meet the performance requirements in different scenarios by minimizing time complexity and space complexity. However, sorting algorithms often require a variety of complex operations: first, comparison operations, which cannot be written as low-order interpolation polynomials and are usually calculated using Boolean circuits; second, data permutation, which places data in the appropriate position according to the comparison results. These complex operations have high computational complexity under fully homomorphic encryption. As the size of the array increases, the amount of computation required increases superlinearly, further leading to a decrease in computational efficiency. At the same time, since the sorting results are not extracted from the polynomial coefficients, their input and output formats do not match, making it difficult to be compatible with other homomorphic computing tasks.
[0005] Therefore, there is an urgent need for a parallel sorting method and system for secret data based on fully homomorphic encryption to solve the above problems. Summary of the invention
[0006] In view of the problems existing in the prior art, the present invention provides a method and system for parallel sorting of secret data based on fully homomorphic encryption.
[0007] The present invention provides a method for parallel sorting of secret data based on fully homomorphic encryption, comprising: Generate public parameters, public keys and private keys through security parameters, and publish the public parameters and the public keys; Based on the private key, encode and package the plaintext array into a plurality of ciphertexts, and publish the ciphertexts, so that the server can perform homomorphic comparison on the ciphertexts of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; Based on the public parameters and the public key, the plaintext array is homomorphically sorted according to the comparison matrix to obtain a ciphertext of the ordered array; Based on the private key, the ciphertext of the ordered array is decrypted and decoded to obtain a plaintext calculation result.
[0008] According to a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention, the plaintext array is , the length is , each integer Bit, satisfied and ,in, is the number of plaintext slots, is the plaintext slot dimension; The plaintext array is encoded and packaged into several ciphertexts, including: Perform binary decomposition on each integer in the plaintext array: ; Pack and encrypt in a vertical manner to calculate , to output the ciphertext .
[0009] According to a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention, the method further includes: The comparison matrix construction method is as follows: Input encrypted array The ciphertext , using masking technology and plaintext slot rotation technology, the ciphertext is calculated:
[0010] in, , respectively encrypt the cyclic rotation of the array ; Using masking technology and plaintext slot rotation technology, Ciphertext Pack into a single ciphertext and Broadcast Copy Second-rate; Using the parallel prefix homomorphic comparison algorithm, the packaged and Comparison results ,get The ciphertext of the comparison matrix is formed into half elements of the comparison matrix in a diagonal manner. Using the plaintext slot rotation technique, copy the ciphertext of the remaining half of the elements and output the comparison matrix Packed ciphertext.
[0011] According to a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention, the parallel prefix homomorphic comparison algorithm includes: Enter the ciphertext of the first operand , the ciphertext of the second operand , calculate the ciphertext of the initial signal , ,as well as ; Define the signal as a pair , the corresponding merge operation is:
[0012] Based on the binary tree algorithm, the signal merging operation is performed and the homomorphic calculation is obtained. ; calculate , the output is the ciphertext , the corresponding plaintext is and The comparison results.
[0013] According to a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention, the method further includes: The sorting based on index coding specifically includes: Input encrypted array The ciphertext , using the comparison matrix construction method, calculate the comparison matrix The ciphertext of each diagonal line , corresponding to the plaintext ; Encode the elements of the comparison matrix onto the exponents,
[0014] ; Use the SIMD paradigm to calculate the continuous product and get the ciphertext: ; in, is an integer The sorting order of Ciphertext and ciphertext Multiplication, specifically: ; Based on the plaintext slot rotation technology, the binary-add algorithm is used to merge the contents of each plaintext slot to obtain the ciphertext:
[0015] Output ciphertext array , the corresponding plaintext slot is encrypted with the polynomial The binary factorization of the polynomial The coefficients in the standard basis are the ordered arrangement of the original plaintext array.
[0016] According to a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention, the method further includes: Perform polynomial coefficient extraction, wherein the polynomial coefficient extraction algorithm includes: Enter ciphertext , the corresponding plaintext is a polynomial ; Calculate each projection function The corresponding linear combination coefficients ; Calculate ciphertext Results under different Frobenius mappings ; According to each projection function The coefficient of , linear combination of projection results The ciphertext ; Using the plaintext slot rotation technology, the ciphertext Package as ; Output the ciphertext , corresponding to the plaintext is an ordered array.
[0017] According to a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention, the method further includes: Using BGV hierarchical fully homomorphic encryption, define The subcircular integer ring , the plaintext space in the BGV hierarchical fully homomorphic encryption method is the quotient ring ,in, for Subcyclotomic polynomial, is a prime number; Based on the Ring-LWE assumption, the symmetric version of the BGV ciphertext is ,in, is the ciphertext modulus, Secret and noise respectively. is plaintext, and the decryption algorithm is , the upper bound of the noise norm is .
[0018] The present invention also provides a secret data parallel sorting system based on fully homomorphic encryption, comprising: A parameter generation module, used to generate public parameters, public keys and private keys through security parameters, and publish the public parameters and the public keys; A homomorphic comparison module is used to encode and package the plaintext array into a plurality of ciphertexts based on the private key, and publish the ciphertexts so that the server can perform homomorphic comparison on the ciphertexts of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; A homomorphic sorting module, used to perform homomorphic sorting on the plaintext array based on the public parameter and the public key according to the comparison matrix to obtain a ciphertext of the ordered array; The result output module is used to decrypt and decode the ciphertext of the ordered array based on the private key to obtain a plaintext calculation result.
[0019] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for parallel sorting of secret data based on fully homomorphic encryption as described above is implemented.
[0020] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for parallel sorting of secret data based on fully homomorphic encryption.
[0021] The method and system for parallel sorting of encrypted data based on fully homomorphic encryption provided by the present invention make full use of the algebraic structure and SIMD parallel computing capabilities of the BGV scheme, and use appropriate basic homomorphic operations to simulate the required Boolean operations and arithmetic addition, so as to achieve higher efficiency. The present invention designs a homomorphic comparison algorithm based on a parallel prefix comparator, which reduces the asymptotic computational complexity by a logarithmic factor. Based on the algebraic structure of the BGV scheme, a parallel homomorphic sorting algorithm with better compatibility and scalability is implemented by using Frobenius automorphism. By using SIMD encoding technology and multi-threaded acceleration technology, the acceleration of the homomorphic sorting algorithm is achieved, the throughput is improved, and the operation delay is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 A schematic diagram of a flow chart of a method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention; Figure 2 A flow chart for generating public and private keys provided by the present invention; Figure 3 The packaging encoding flow chart provided by the present invention; Figure 4 A flow chart of the parallel homomorphic sorting algorithm provided by the present invention; Figure 5 A schematic diagram of a parallel prefix comparator provided by the present invention; Figure 6 A schematic diagram of the polynomial sorting algorithm provided by the present invention; Figure 7 A schematic diagram of the structure of a secret data parallel sorting system based on fully homomorphic encryption provided by the present invention; Figure 8 This is a schematic structural diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] In order to clearly explain the contents of each embodiment of the present invention, the present invention explains the conceptual technical terms appearing therein. Specifically, SIMD packing technology is a technology that can encode several plaintexts into a single polynomial and encrypt them into a single FHE ciphertext. Each plaintext is abstractly stored in a structure called a plaintext slot. Plaintext slot rotation technology uses Galois automorphism and Benes permutation network to abstractly organize all plaintext slots into a one-dimensional array and realize the shift or cyclic rotation of the array. Frobenius mapping technology is a technology that can realize any linear mapping of plaintext slots to their base rings.
[0026] Figure 1 The flowchart of the method for parallel sorting of secret data based on fully homomorphic encryption provided by the present invention is as follows: Figure 1 As shown, including: Step 101, generating public parameters, a public key and a private key through security parameters, and publishing the public parameters and the public key; Step 102: Encode and package the plaintext array into a plurality of ciphertexts based on the private key, and publish the ciphertexts so that the server can perform homomorphic comparison on the ciphertexts of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; Step 103, based on the public parameters and the public key, the plaintext array is homomorphically sorted according to the comparison matrix to obtain a ciphertext of the ordered array; Step 104: Based on the private key, decrypt and decode the ciphertext of the ordered array to obtain a plaintext calculation result.
[0027] It is understandable that the present invention is mainly used in the following outsourced computing application scenarios: users need to outsource the server to sort some private data. In fact, the process can be divided into several stages. The first stage is the stage of user generating private key and public key in step 101, the stage of user packaging encrypted plaintext array in step 102, the stage of server homomorphic sorting in step 103, and the last stage of user decryption in step 104.
[0028] Specifically, when the user generates the public key and private key, Figure 2 The flow chart of generating public and private keys provided by the present invention is as follows: Figure 2 As shown, first, according to the input security parameters Generate public parameters according to the needs of the scene ,in It is a ring-shaped order. is the ciphertext modulus, is the plaintext space feature, is the Hensel factor, is the plaintext slot dimension, is the number of plaintext slots; Then randomly sample short ring elements As a private key, uniform sampling , sampling noise ,calculate , set the public key to ; Finally, keep the private key confidential , publish public parameters and the public key .
[0029] In the user packaging encrypted plaintext array stage, Figure 3 The packaging encoding flow chart provided by the present invention is as follows: Figure 3 As shown, first enter: indivual Bit Integer ,satisfy and , decompose each integer into binary. , packed and encrypted in a vertical manner, and calculated , and finally output: ciphertext .
[0030] In the stage where the server performs homomorphic sorting on the ciphertext, Figure 4 The parallel homomorphic sorting algorithm flow chart provided by the present invention is as follows: Figure 4 As shown, first enter the ciphertext .
[0031] Using masking technology and plaintext slot rotation technology, the following ciphertext is calculated:
[0032] Brief Notes ; Then, using masking technology and plaintext slot rotation technology, Ciphertext Pack into a single ciphertext and Broadcast Copy Second-rate; And use the proposed parallel prefix homomorphic comparison method to calculate the above packaged and Comparison results , and then formed a comparison matrix The packed ciphertext of the middle half of the diagonal; Then, the plaintext slot rotation technique is used to copy the ciphertext of the remaining half of the elements; Then, the elements of the comparison matrix are encoded into the index using the following formula:
[0033] ; Use the SIMD paradigm to calculate the continuous product and get the ciphertext: ; in, is an integer The sorting order of Ciphertext and ciphertext Multiplication, specifically:
[0034] Finally, based on the plaintext slot rotation technology, the binary-accumulation algorithm is used to merge the contents of each plaintext slot to obtain the following ciphertext:
[0035] Among them, the ciphertext Encrypted polynomial ; Calculate each projection function The corresponding linear combination coefficients ; Calculate ciphertext Results under different Frobenius mappings ; According to each projection function The coefficient of , linear combination of projection results The ciphertext ; Using the plaintext slot rotation technology, the ciphertext Package as ; Finally output the ciphertext , its plain text is the input array The orderly arrangement of .
[0036] Specifically, the user decryption phase includes inputting the ciphertext .
[0037] From the ciphertext Decrypted ; Restore through binary combination ; The final output is an ordered array .
[0038] It can be understood that in order to implement the above solution, the present invention mainly uses the parameters The BGV scheme uses the algebraic structure of plaintext slots. , using the base ring The addition and multiplication on the emulate XOR logic and AND logic respectively, using the extended domain The polynomial multiplication on emulates the arithmetic addition of multi-bit integers, realizing an efficient homomorphic sorting algorithm.
[0039] For the stage of constructing the comparison matrix in the sorting algorithm, the present invention uses a parallel prefix comparator, whose asymptotic complexity is reduced by a logarithmic factor compared with the commonly used linear comparator. The present invention makes full use of the SIMD parallel computing capability of the BGV scheme and uses the plaintext slot rotation technology to convert the Comparison operations are packed into several ciphertexts in a diagonal manner, and each homomorphic comparison can be processed simultaneously In addition, by utilizing the antisymmetric property of the comparison matrix, the present invention saves half of the computational overhead.
[0040] In the stage of homomorphically sorting the plaintext array according to the comparison matrix, the present invention adopts exponential coding technology, and the Hamming weight of the rows / columns of the comparison matrix is used as the sorting order. , calculate the polynomial , the coefficients in the standard basis are naturally the array The present invention utilizes Frobenius mapping to construct a trace function, realizes the coefficient extraction of the polynomial in the plaintext slot, and uses the "lifting" technique to optimize its performance.
[0041] In summary, the secret data parallel sorting method based on fully homomorphic encryption provided by the present invention can implement the sorting task for integer arrays in a secret state. The method makes full use of the algebraic structure and SIMD parallel computing capabilities of the BGV scheme, and uses appropriate basic homomorphic operations to simulate the required Boolean operations and arithmetic addition, so the implementation efficiency is higher. The present invention adopts a parallel prefix comparator, whose asymptotic computational complexity is reduced by a logarithmic factor compared to the commonly used linear comparator, and thus supports homomorphic sorting tasks for larger arrays. The present invention uses Frobenius mapping to ensure that the input and output ciphertexts have exactly the same encoding format, so it is easy to be used in combination with other homomorphic algorithms, and has better flexibility and scalability.
[0042] Based on the above embodiment, the plaintext array is , the length is , each integer Bit, satisfied and ,in, is the number of plaintext slots, is the plaintext slot dimension; The plaintext array is encoded and packaged into several ciphertexts, including: Perform binary decomposition on each integer in the plaintext array: ; Pack and encrypt in a vertical manner to calculate , to output the ciphertext .
[0043] The specific decomposition basis is as follows: Assumptions The multiplication order of is ,So In the plain area can be decomposed into irreducible factors, such as , and their times all satisfy Given an integral ring Ideal , defining the ideal generated by irreducible factors , then there is , according to the CRT (Chinese Remainder Theorem), there are the following ring homomorphisms:
[0044] because is irreducible, so , they are the same finite field in the sense of isomorphism. This structure is abbreviated as , then we get the ring isomorphism , which allows Independent news Expressed as A vector in , and then maps it to a ring Because this encoding process is ring isomorphic, The polynomial addition and multiplication operations on Independent addition and multiplication operations are performed on the components of the vector. This encoding process is called SIMD packing technology (such as Figure 3 The present invention is provided as well as , the plaintext space is a polynomial ring ,in It is a binary domain of Second expansion area.
[0045] Specifically, the input plaintext array is , the length is , each integer Bit, satisfied and .
[0046] Decompose each integer into binary. ; Pack and encrypt in a vertical manner and calculate: ; Output ciphertext .
[0047] The decryption operation is the reverse process of the encryption process. First, the bits at each position are decrypted, and then these bits are combined into corresponding integers.
[0048] Based on the above embodiment, the method further includes: The comparison matrix construction method is as follows: Input encrypted array The ciphertext , using masking technology and plaintext slot rotation technology, the ciphertext is calculated:
[0049] in, , respectively encrypt the cyclic rotation of the array ; Using masking technology and plaintext slot rotation technology, Ciphertext Pack into a single ciphertext and Broadcast Copy Second-rate; Using the parallel prefix homomorphic comparison algorithm, the packaged and Comparison results ,get The ciphertext of the comparison matrix is formed into half elements of the comparison matrix in a diagonal manner. Using the plaintext slot rotation technique, copy the ciphertext of the remaining half of the elements and output the comparison matrix Packed ciphertext.
[0050] In the present invention, after executing the above-mentioned packaging encryption, indivual The array of bit integers is encrypted as In the form of Encrypted all The integer bits, and its The plaintext slot is encrypted The corresponding bits of the integer . Using SIMD parallel computing paradigm, ciphertext The homomorphic addition and homomorphic multiplication between them is to perform corresponding addition and multiplication on the data in the same plaintext slots in parallel. In particular, because each bit is stored in the plaintext slot Base ring Therefore, homomorphic addition and homomorphic multiplication actually perform XOR and AND operations on the encrypted bits.
[0051] The present invention uses parallel prefix comparators to construct a comparison matrix of a plaintext array. The signal is defined as a binary , define the merge operation as:
[0052] Among them, the symbol " " and the symbol " ” are OR logic and AND logic respectively. is the merging operation of the final signal. Representation calculation The initial signal setting is: , ,as well as . Then there exists the following equation: .
[0053] It can be proved that The operator satisfies the associative law, Figure 5 A schematic diagram of a parallel prefix comparator provided by the present invention, referring to Figure 5 As shown, the signals can be merged in parallel using a binary tree.
[0054] Based on the above embodiment, the parallel prefix homomorphic comparison algorithm includes: Enter the ciphertext of the first operand , the ciphertext of the second operand , calculate the ciphertext of the initial signal , ,as well as ; Define the signal as a pair , the corresponding merge operation is:
[0055] It can be shown that this operation satisfies the associative law; Based on the binary tree algorithm, the signal merging operation is performed and the homomorphic calculation is obtained. ; calculate , the output is the ciphertext , the corresponding plaintext is and The comparison results.
[0056] In the homomorphic sorting algorithm, it is necessary to calculate when constructing the comparison matrix In order to obtain lower computational latency, the present invention makes full use of the SIMD parallel computing paradigm of the BGV scheme and packs the operations required for the comparison matrix into a single homomorphic comparison. In addition, by using the antisymmetric property of the comparison matrix, the present invention only calculates comparison task, the remaining comparison results can be easily recovered.
[0057] The comparison matrix construction method proposed by the present invention is as follows: Input encrypted array The ciphertext .
[0058] Using masking technology and plaintext slot rotation technology, the following ciphertext is calculated:
[0059] Brief Notes , respectively encrypt the cyclic rotation of the array ; Continue to use masking technology and plaintext slot rotation technology to Ciphertext Pack into a single ciphertext and Broadcast Copy Second-rate; Using the proposed parallel prefix homomorphic comparison algorithm, the above packaged and Comparison results ,get The ciphertext of , where these comparison results form half of the elements of the comparison matrix in a diagonal manner; Using the plaintext slot rotation technique, copy the ciphertext of the remaining half of the elements; Output: comparison matrix Packed ciphertext.
[0060] Based on the above embodiment, the method further includes: The sorting based on index coding specifically includes: Input encrypted array The ciphertext , using the comparison matrix construction method, calculate the comparison matrix The ciphertext of each diagonal line , corresponding to the plaintext ; Encode the elements of the comparison matrix onto the exponents using the formula: ; Use the SIMD paradigm to calculate the continuous product and get the ciphertext: ; in, is an integer The sorting order of Ciphertext and ciphertext Multiplication, specifically: ; Based on the plaintext slot rotation technology, the binary-add algorithm is used to merge the contents of each plaintext slot to obtain the ciphertext: ; Output ciphertext array , the corresponding plaintext slot is encrypted with the polynomial The binary factorization of the polynomial The coefficients in the standard basis are the ordered arrangement of the original plaintext array.
[0061] It should be noted that since the BGV scheme is a hierarchical fully homomorphic encryption, the size of its cryptographic parameters increases in direct proportion to the increase in multiplication depth. In order to improve computational efficiency, the design principle of the present invention is to reduce the multiplication depth of the homomorphic sorting algorithm as much as possible. The present invention adopts a direct sorting algorithm, which first calculates a reusable comparison matrix, and then places the data in the appropriate order according to the Hamming weight of the row / column of the comparison matrix.
[0062] for indivual bit unsigned integer , whose comparison matrix is defined as: ; The elements are The result of comparing two integers. .
[0063] By observing the comparison matrix, we can find that: No. The Hamming weight of the row is exactly equal to the number of rows in the input array. A larger number of elements; while the matrix No. The Hamming weight of the column is also exactly equal to the ratio of smaller number of elements. Therefore, as long as the matrix is calculated homomorphically No. Hamming weight of the row , we get the order from largest to smallest The correct order. Put the integer By placing it at the appropriate position in the output ciphertext, the sorting task can be completed.
[0064] The present invention adopts an exponential coding method and uses polynomial multiplication to quickly calculate the arithmetic addition of multi-bit integers. Under the set parameters, the plaintext slot of the BGV scheme is ,in is a For Boolean operations, data is stored in plaintext slots Base ring In the arithmetic operation, data is stored in an exponentially coded format, specifically, for integers , which are encoded as . Then arithmetic addition on integers Transformed into a finite field Polynomial multiplication on , so only one homomorphic multiplication is needed to complete arithmetic addition on integers.
[0065] Figure 6 A schematic diagram of the polynomial sorting algorithm provided by the present invention is shown in FIG. Figure 6 As shown, the calculation steps are as follows: Input: Encrypted array The ciphertext .
[0066] Step 1: Calculate the comparison matrix using the comparison matrix construction method The ciphertext of each diagonal line , whose plain text is ; Step 2: Encode the elements of the comparison matrix into the index using the following formula: ; Step 3: Use SIMD paradigm to calculate the continuous product and get the ciphertext: ; in, is an integer The sorting order of Step 4: Pass the ciphertext and ciphertext Multiplication, specifically: ; Step 5: Based on the plaintext slot rotation technology, use the binary accumulation algorithm to merge the contents of each plaintext slot to obtain the following ciphertext: ; Final output: ciphertext , whose corresponding plaintext slot is encrypted with the polynomial The binary decomposition of the polynomial, the coefficients of the polynomial in the standard basis are the ordered arrangement of the original plaintext array.
[0067] Based on the above embodiments,
[0068] The method further comprises: Perform polynomial coefficient extraction, wherein the polynomial coefficient extraction algorithm includes: Enter ciphertext , the corresponding plaintext is a polynomial ; Calculate each projection function The corresponding linear combination coefficients ; Calculate ciphertext Results under different Frobenius mappings ; According to each projection function The coefficient of , linear combination of projection results The ciphertext ; Using the plaintext slot rotation technology, the ciphertext Package as ; Output the ciphertext , corresponding to the plaintext is an ordered array.
[0069] The polynomial coefficient homomorphic extraction algorithm proposed in the present invention is to extract the polynomial coefficient from the polynomial The ordered ciphertext is extracted from the ciphertext. This project uses Frobenius mapping to construct trace functions, and uses trace functions to perform linear functions on finite fields. The algebraic structure of the plaintext slot is , its base ring It is a feature The prime domain. Considered as on dimensional linear space, then coefficient extraction requires the following projection function:
[0070] ; They are According to number theory, Any linear function on can be expressed using the trace function, ,in, Yes and The trace function is defined as ,in The automorphisms in , known as the Frobenius map.
[0071] The present invention adopts the "lifting" technique. Specifically, it is observed that all the projection functions All work on the same Now, make the following transformation: ; because is a linear function The related constants, are some certain automorphism mappings that can be Considered as a constant, then that is A linear combination of is with The specific steps are as follows: Input: Ciphertext , whose plaintext is a polynomial .
[0072] Calculate each projection function The corresponding linear combination coefficients ; Calculate ciphertext Results under different Frobenius mappings ; According to each projection function The coefficient of , linear combination of projection results The ciphertext ; Using the plaintext slot rotation technology, the ciphertext Package as ; Output: Ciphertext , its plain text Is an ordered array.
[0073] In summary, the method further comprises: Using BGV hierarchical fully homomorphic encryption, define The subcircular integer ring , the plaintext space in the BGV hierarchical fully homomorphic encryption method is the quotient ring ,in, for Subcyclotomic polynomial, is a prime number; Based on the Ring-LWE assumption, the symmetric version of the BGV ciphertext is ,in, is the ciphertext modulus, Secret and noise respectively. is plaintext, and the decryption algorithm is , the upper bound of the noise norm is ,definition is the L2 norm, is an infinite norm.
[0074] For the more general case, the plaintext modulus is no longer prime , but prime powers ,in is the Hensel lifting factor. In the present invention, setting as well as , so the ciphertext in general and its impact on homomorphic operations are not considered.
[0075] The following is a description of the secret data parallel sorting system based on fully homomorphic encryption provided by the present invention. The secret data parallel sorting system based on fully homomorphic encryption described below and the secret data parallel sorting method based on fully homomorphic encryption described above can correspond to each other.
[0076] Figure 7 The schematic diagram of the structure of the secret data parallel sorting system based on fully homomorphic encryption provided by the present invention is as follows: Figure 7 As shown, the present invention provides a parallel sorting system for secret data based on fully homomorphic encryption, including a parameter generation module 701, a homomorphic comparison module 702, a homomorphic sorting module 703 and a result output module 704, wherein the parameter generation module 701 is used to generate public parameters, public keys and private keys through security parameters, and publish the public parameters and the public key; the homomorphic comparison module 702 is used to encode the plaintext array and package and encrypt it into several ciphertexts based on the private key, and publish the ciphertext, so that the server can perform homomorphic comparison on the ciphertext of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; the homomorphic sorting module 703 is used to perform homomorphic sorting on the plaintext array according to the comparison matrix based on the public parameters and the public key to obtain the ciphertext of the ordered array; the result output module 704 is used to decrypt and decode the ciphertext of the ordered array based on the private key to obtain the plaintext calculation result.
[0077] The secret data parallel sorting system based on fully homomorphic encryption provided by the present invention makes full use of the algebraic structure and SIMD parallel computing capabilities of the BGV scheme, and uses appropriate basic homomorphic operations to simulate the required Boolean operations and arithmetic addition, so as to achieve higher efficiency. The present invention designs a homomorphic comparison algorithm based on a parallel prefix comparator, which reduces the asymptotic computational complexity by a logarithmic factor. Based on the algebraic structure of the BGV scheme, a parallel homomorphic sorting algorithm with better compatibility and scalability is implemented by utilizing Frobenius automorphism. By using SIMD encoding technology and multi-threaded acceleration technology, the acceleration of the homomorphic sorting algorithm is achieved, the throughput is improved, and the operation delay is reduced.
[0078] The secret data parallel sorting system based on fully homomorphic encryption provided in the embodiments of the present invention is used to execute the above-mentioned method embodiments. Please refer to the above-mentioned embodiments for the specific process and detailed contents, which will not be repeated here.
[0079] Figure 8 A schematic diagram of the structure of an electronic device provided by the present invention, such as Figure 8 As shown, the electronic device may include: a processor (Processor) 801, a communication interface (Communications Interface) 802, a memory (Memory) 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804. The processor 801 may call the logic instructions in the memory 803 to execute a method for parallel sorting of secret data based on fully homomorphic encryption, the method comprising: generating public parameters, public keys and private keys through security parameters, and publishing the public parameters and the public keys; encoding and packaging a plaintext array into a plurality of ciphertexts based on the private key, and publishing the ciphertexts, so that the server performs homomorphic comparison on the ciphertext of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; based on the public parameters and the public key, homomorphically sorting the plaintext array according to the comparison matrix to obtain the ciphertext of the ordered array; based on the private key, decrypting and decoding the ciphertext of the ordered array to obtain the plaintext calculation result.
[0080] In addition, the logic instructions in the above-mentioned memory 803 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.
[0081] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the parallel sorting method of secret data based on fully homomorphic encryption provided by the above methods, the method including: generating public parameters, public keys and private keys through security parameters, and publishing the public parameters and the public key; based on the private key, encoding and packaging a plaintext array into a plurality of ciphertexts, and publishing the ciphertexts, so that the server can perform homomorphic comparison on the ciphertext of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; based on the public parameters and the public key, homomorphically sorting the plaintext array according to the comparison matrix to obtain the ciphertext of the ordered array; based on the private key, decrypting and decoding the ciphertext of the ordered array to obtain the plaintext calculation result.
[0082] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the parallel sorting method for secret data based on fully homomorphic encryption provided in the above-mentioned embodiments, the method comprising: generating public parameters, public keys and private keys through security parameters, and publishing the public parameters and the public key; encoding and packaging a plaintext array into a plurality of ciphertexts based on the private key, and publishing the ciphertexts, so that the server performs homomorphic comparison on the ciphertext of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; based on the public parameters and the public key, homomorphically sorting the plaintext array according to the comparison matrix to obtain the ciphertext of the ordered array; based on the private key, decrypting and decoding the ciphertext of the ordered array to obtain the plaintext calculation result.
[0083] 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 units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for parallel sorting of secret data based on fully homomorphic encryption, characterized in that: include: Generate public parameters, public keys and private keys through security parameters, and publish the public parameters and the public keys; Based on the private key, encode and package the plaintext array into a plurality of ciphertexts, and publish the ciphertexts, so that the server can perform homomorphic comparison on the ciphertexts of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; Based on the public parameters and the public key, the plaintext array is homomorphically sorted according to the comparison matrix to obtain a ciphertext of the ordered array; Based on the private key, the ciphertext of the ordered array is decrypted and decoded to obtain a plaintext calculation result.
2. The method for parallel sorting of secret data based on fully homomorphic encryption according to claim 1 is characterized in that: The plaintext array is , the length is , each integer Bit, satisfied and ,in, is the number of plaintext slots, is the plaintext slot dimension; The plaintext array is encoded and packaged into several ciphertexts, including: Perform binary decomposition on each integer in the plaintext array: ; Pack and encrypt in a vertical manner to calculate , to output the ciphertext .
3. The method for parallel sorting of secret data based on fully homomorphic encryption according to claim 1 is characterized in that: The method further comprises: The comparison matrix construction method is as follows: Input encrypted array The ciphertext , using masking technology and plaintext slot rotation technology, the ciphertext is calculated: in, , respectively encrypt the cyclic rotation of the array ; Using masking technology and plaintext slot rotation technology, Ciphertext Pack into a single ciphertext and Broadcast Copy Second-rate; Using the parallel prefix homomorphic comparison algorithm, the packaged and Comparison results ,get The ciphertext of the comparison matrix is formed into half elements of the comparison matrix in a diagonal manner. Using the plaintext slot rotation technique, copy the ciphertext of the remaining half of the elements and output the comparison matrix Packed ciphertext.
4. The method for parallel sorting of secret data based on fully homomorphic encryption according to claim 3 is characterized in that: The parallel prefix homomorphic comparison algorithm comprises: Enter the ciphertext of the first operand , the ciphertext of the second operand , calculate the ciphertext of the initial signal , ,as well as ; Define the signal as a pair , the corresponding merge operation is: Based on the binary tree algorithm, the signal merging operation is performed and the homomorphic calculation is obtained. ; calculate , the output is the ciphertext , the corresponding plaintext is and The comparison results.
5. The method for parallel sorting of secret data based on fully homomorphic encryption according to claim 3 is characterized in that: The method further comprises: The sorting based on index coding specifically includes: Input encrypted array The ciphertext , using the comparison matrix construction method, calculate the comparison matrix The ciphertext of each diagonal line , corresponding to the plaintext ; Encode the elements of the comparison matrix onto the exponents, ; Use the SIMD paradigm to calculate the continuous product and get the ciphertext: ; in, is an integer The sorting order of Ciphertext and ciphertext Multiplication, specifically: ; Based on the plaintext slot rotation technology, the binary-add algorithm is used to merge the contents of each plaintext slot to obtain the ciphertext: Output ciphertext array , the corresponding plaintext slot is encrypted with the polynomial The binary factorization of the polynomial The coefficients in the standard basis are the ordered arrangement of the original plaintext array.
6. The method for parallel sorting of secret data based on fully homomorphic encryption according to claim 3 is characterized in that: The method further comprises: Perform polynomial coefficient extraction, wherein the polynomial coefficient extraction algorithm includes: Enter ciphertext , the corresponding plaintext is a polynomial ; Calculate each projection function The corresponding linear combination coefficients ; Calculate ciphertext Results under different Frobenius mappings ; According to each projection function The coefficient of , linear combination of projection results The ciphertext ; Using the plaintext slot rotation technology, the ciphertext Package as ; Output the ciphertext , corresponding to the plaintext is an ordered array.
7. The method for parallel sorting of secret data based on fully homomorphic encryption according to any one of claims 1 to 6, characterized in that: The method further comprises: Using BGV hierarchical fully homomorphic encryption, define The subcircular integer ring , the plaintext space in the BGV hierarchical fully homomorphic encryption method is the quotient ring ,in, for Subcyclotomic polynomial, is a prime number; Based on the Ring-LWE assumption, the symmetric version of the BGV ciphertext is ,in, is the ciphertext modulus, Secret and noise respectively. is plaintext, and the decryption algorithm is , the upper bound of the noise norm is .
8. A secret data parallel sorting system based on fully homomorphic encryption, characterized in that: include: A parameter generation module, used to generate public parameters, public keys and private keys through security parameters, and publish the public parameters and the public keys; A homomorphic comparison module is used to encode and package the plaintext array into a plurality of ciphertexts based on the private key, and publish the ciphertexts so that the server can perform homomorphic comparison on the ciphertexts of the plaintext array based on the public parameters and the public key to obtain the ciphertext of the comparison matrix of the plaintext array; A homomorphic sorting module, used to perform homomorphic sorting on the plaintext array according to the comparison matrix based on the public parameter and the public key to obtain a ciphertext of the ordered array; The result output module is used to decrypt and decode the ciphertext of the ordered array based on the private key to obtain a plaintext calculation result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method for parallel sorting of secret data based on fully homomorphic encryption as described in any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the method for parallel sorting of secret data based on fully homomorphic encryption as described in any one of claims 1 to 7.
Citation Information
Patent Citations
System, apparatus and method for generating a loop alignment count or a loop alignment mask
CN103946795A
Encryption and similarity measurement method, terminal and server
CN105447361A
Optimized automatic bilinear pairing encryption method and device based on point blinding process
CN106100844A
Fully-homomorphic encryption method and device and computer readable storage medium
CN108718231A
Apparatuses, methods, and systems for element sorting of vectors
CN109313549A
Cited By
Data encryption and decryption method and device, equipment and storage medium
CN120342580A
Fully homomorphic encrypted ciphertext transmission method and system based on linear calculation
CN122247763A