Fully homomorphic encrypted ciphertext comparison method for large integer, electronic equipment and computer storage medium

The most significant bits of large integer ciphertext are extracted through the LMSB algorithm, which solves the problem of low ciphertext comparison performance, and realizes ciphertext comparison with longer bit lengths, adapts to the query requirements of encrypted databases, and improves time performance.

CN120449174APending Publication Date: 2025-08-08BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510431982.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the prior art, ciphertext performance is relatively low, and the supported plaintext data length is limited, making it difficult to meet the encrypted database query requirements.

Method used

The most significant bit extraction algorithm of large integers (LMSB algorithm) based on programmable bootstrap is used to obtain the ciphertext result through homomorphic subtraction, and homomorphic logic operations are performed to determine whether the comparison operation is true.

Benefits of technology

Expand the processing length of plaintext data bits, suitable for diverse queries in encrypted databases, and improve time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120449174A_ABST
    Figure CN120449174A_ABST
Patent Text Reader

Abstract

The invention provides a fully homomorphic encrypted ciphertext comparison method for a large integer, electronic equipment and a computer storage medium, and the method comprises the steps: determining a comparison parameter; performing homomorphic subtraction on the to-be-compared ciphertext according to the comparison parameters to obtain a homomorphic subtraction ciphertext result; according to the homomorphic subtraction ciphertext result, obtaining a most significant bit ciphertext result through a large integer most significant bit extraction algorithm based on programmable bootstrap; and determining whether comparison operation of the two ciphertexts is established or not according to a most significant bit ciphertext result. According to the method, the ciphertext comparison method can meet the query requirement of a fully homomorphic encryption database, large integer ciphertexts with relatively long bit lengths are supported, and the time performance is better.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of fully homomorphic encryption databases, and more specifically to a fully homomorphic encryption ciphertext comparison method for large integers, an electronic device, and a computer storage medium. Background Art

[0002] In a fully homomorphic encryption database, query processing of encrypted data usually involves comparison operations between ciphertexts. Existing technical solutions for implementing comparison between ciphertexts mainly include two categories. The first category is to implement comparison by high-order polynomial approximation calculation, such as formula (1). Formula (1) is as follows:

[0003]

[0004] When the value of k is 2 d When formula (1) is used, it can be initialized to a←a / (a+b), b←b / (a+b) and adopt a←a 2 / (a 2 +b 2 ), b←b 2 / (a 2 +b 2 ) for iterative calculation. After d rounds of iteration, we can get However, this calculation method has many limitations. For example, the calculation accuracy of this iterative method is affected by k. Only when the exponent k is very large can the comparison result be obtained within a small error. This means that the accuracy of the algorithm is affected by the number of iterations d. And as the number of iterations d increases, the required calculation time will also increase significantly. n} n≥1 , through d times f n The calculation of is used to approximate the symbolic function and implement the comparison operation, that is, However, when applied to encrypted databases, this approach faces a problem: the depth of the polynomial calculation must be pre-set, as it determines the choice of encryption parameters. If a query on the encrypted database requires a polynomial deeper than the preset maximum depth, the entire database must be re-encrypted using new encryption parameters that meet the required depth. This imposes significant computational and communication overhead on protocol participants, especially clients.

[0005] Another type of technical solution shares the same basic concept as determining magnitude using the sign bit in traditional plaintext comparisons. In plaintext computing environments, two numbers are typically compared by subtracting them and then determining magnitude based on the sign of the result. The sign of the subtraction result is determined by the most significant bit (sign bit). For homomorphically encrypted ciphertext, while the most significant bit of the encrypted plaintext cannot be directly accessed, the magnitude relationship between ciphertexts can be identified by homomorphically extracting the most significant bit of the plaintext data within the ciphertext. However, this approach still has certain limitations: a core bottleneck lies in the fact that the programmable bootstrapping technique used to homomorphically extract the most significant bit of the plaintext data from the ciphertext imposes a limit on the size of the plaintext data. Typically, the most significant bit can only be successfully extracted from the ciphertext when the plaintext length is less than 6 bits. While some comparison algorithms circumvent this limitation by encrypting the binary data bit by bit, this also introduces a new problem: every bit of the plaintext must be encrypted into a ciphertext, requiring more storage space for the ciphertext, resulting in lower performance and higher communication costs. Therefore, it is necessary to design a ciphertext comparison method that supports longer plaintext bit length, adapts to the requirements of encrypted database queries, and has better time performance. Summary of the Invention

[0006] The purpose of this application is to address the deficiencies in the above-mentioned prior art and propose a fully homomorphic encryption ciphertext comparison method, electronic device, and computer storage medium for large integers, so as to solve the problems in the prior art of low ciphertext comparison performance, limited supported plaintext data length, and difficulty in adapting to encrypted database query requirements.

[0007] To achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:

[0008] In a first aspect, an embodiment of the present application provides a fully homomorphic encryption ciphertext comparison method for large integers, the method comprising: determining a comparison parameter; performing homomorphic subtraction on the ciphertext to be compared according to the comparison parameter to obtain a homomorphic subtraction ciphertext result; obtaining a most significant bit ciphertext result according to the homomorphic subtraction ciphertext result through a large integer most significant bit extraction algorithm based on programmable bootstrapping; and determining whether the comparison operation of the two ciphertexts is valid according to the most significant bit ciphertext result.

[0009] In the following, the key algorithm in the fully homomorphic encryption ciphertext comparison method for large integers formed by this technical solution, the large integer most significant bit extraction algorithm based on programmable bootstrapping, is named the LMSB algorithm.

[0010] In one possible implementation, determining the comparison parameters includes determining a comparison operator and determining the ciphertext to be compared. The comparison operators include ">," ≥," <," ≤," =," and ≠." Determining the ciphertext to be compared includes determining the ciphertext to the left of the comparison operator, determining the ciphertext to the right of the comparison operator, and determining the bit length of the encrypted plaintext.

[0011] In a possible implementation, homomorphic subtraction is performed on the compared ciphertexts according to the comparison parameters to obtain a homomorphic subtraction ciphertext result, including: for comparison operators "<" and "≥", the ciphertext on the left side of the comparison operator is homomorphically subtracted from the ciphertext on the right side of the comparison operator to obtain the homomorphic subtraction ciphertext result; for comparison operators ">" and "≤", the ciphertext on the right side of the comparison operator is homomorphically subtracted from the ciphertext on the left side of the comparison operator to obtain the homomorphic subtraction ciphertext result; for comparison operators "=" and "≠", both the ciphertext on the left side of the comparison operator is homomorphically subtracted from the ciphertext on the right side of the comparison operator and the ciphertext on the right side of the comparison operator are homomorphically subtracted from the ciphertext on the left side of the comparison operator to obtain two homomorphic subtraction ciphertext results.

[0012] In one possible implementation, obtaining the most significant bit ciphertext result using the LMSB algorithm based on the homomorphic subtraction ciphertext result includes determining the bit length of the plaintext data in the ciphertext and extracting the most significant bit based on the determination result. Extracting the most significant bit based on the determination result includes directly using the LMSB algorithm to extract the ciphertext whose bit length of the plaintext data is less than k; constructing an equivalent ciphertext whose bit length of the plaintext data is n (n≥k) in which the most significant bit of the plaintext remains unchanged but the most significant k bits are not all 1, and homomorphically extracting the most significant bit of the equivalent ciphertext using the LMSB algorithm, wherein the steps of constructing the equivalent ciphertext are as follows:

[0013] Given n (n ≥ k) bits of plaintext data, the encrypted ciphertext is ct long , ct long After homomorphic left shift of n-k+1 bits, the ciphertext ct1 is obtained. The most significant bit extracted from ct1 by the LMSB algorithm is encoded at the bit position before the left shift to obtain ct2. long Homomorphically subtract ct2 to obtain ct3. If n-k+1<k, then ct3 is an equivalent ciphertext; otherwise, the bit length of the plaintext data in ct3 is set to n-k+1, and the equivalent ciphertext construction steps are used for ct3. The bit length of the plaintext data in ct1 is k-1 bits; ct2 is equivalent to ct long The n-k+2th bit of the plaintext (counting from the most significant bit) is homomorphically extracted.

[0014] In one possible implementation, determining whether the comparison operation of two ciphertexts is valid based on the most significant ciphertext result includes performing a homomorphic logic operation on the most significant ciphertext result obtained based on the comparison operator and making a judgment based on the operation result. The performing a homomorphic logic operation on the most significant ciphertext result obtained based on the comparison operator includes not performing additional operations in the “>” and “<” comparison operations; performing a homomorphic logic operation on the most significant ciphertext result obtained based on the “≥” and “≤” comparison operations. msb Perform homomorphic NOT operation; in the “=” comparison operation, the most significant bit of the ciphertext result ct msb1 ,ct msb2 Perform homomorphic negation and homomorphic AND operations respectively; in the “≠” comparison operation, the most significant bit of the ciphertext result ct msb1 ,ct msb2 Perform homomorphic NOT operation, then homomorphic AND operation, and finally homomorphic NOT operation. According to the operation results, the judgment includes that if the operation result is ciphertext 1, then for the ciphertext ct on the left side of the comparison operator L , the ciphertext ct on the right side of the comparison operator R , comparison operator cmp, resulting in expression ct L cmp ct R The judgment is established; the result of the operation is the ciphertext 0, then the ciphertext ct on the left side of the comparison operator L , the ciphertext ct on the right side of the comparison operator R , comparison operator cmp, resulting in expression ct L cmp ct R Invalid judgment.

[0015] In the second aspect, another embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of any method described in the first aspect above.

[0016] In a third aspect, another embodiment of the present application provides a storage medium device, wherein a computer program is stored on the storage medium, and when the computer program is executed by a processor, the steps of any method described in the first aspect are executed.

[0017] The beneficial effects of this application are as follows: by determining the ciphertext to be compared and the comparison operator, performing homomorphic subtraction on the ciphertext to be compared according to the comparison operator to obtain a homomorphic subtraction ciphertext result, extracting the most significant bit of the plaintext data in the homomorphic subtraction ciphertext result, and then performing homomorphic logical operations on this basis to obtain the final result and indicate whether the comparison formula holds. This ciphertext comparison method can meet the requirements of fully homomorphic encryption database queries, support large integer ciphertexts with longer bit lengths, and have better time performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 Schematic diagram of the process of comparing ciphertexts for large integers using fully homomorphic encryption provided in the embodiment of the present application

[0019] Figure 2 A schematic diagram of a homomorphic subtraction ciphertext result obtained by performing homomorphic subtraction on the ciphertext to be compared according to comparison parameters in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0020] Figure 3 A flowchart of obtaining the most significant bit ciphertext result through the LMSB algorithm based on the homomorphic subtraction ciphertext result in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0021] Figure 4 A schematic diagram of an equivalent ciphertext constructed for n (n≥k)-bit plaintext data in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application, in which the most significant bit of the plaintext remains unchanged but the most significant k bits are not all 1.

[0022] Figure 5 A flowchart of determining whether a comparison operation between two ciphertexts is valid based on the most significant bit ciphertext result in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0023] Figure 6 A schematic diagram of performing homomorphic logical operations on the most significant bit ciphertext results according to a comparison operator in a fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0024] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of illustration and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowcharts can be implemented out of sequence, and steps without logical context can be reversed or implemented simultaneously. In addition, those skilled in the art, under the guidance of the contents of this application, can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.

[0026] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.

[0027] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0028] In order to balance the privacy security and processability of database-stored data, fully homomorphic encrypted databases have been proposed and applied. When querying and analyzing fully homomorphic encrypted data, comparison operations between ciphertexts are widely used. In the prior art, Ilaria Chillotti et al. used programmable bootstrapping technology to extract the most significant bits of plaintext data from ciphertexts. Based on this, comparison between two ciphertexts can be achieved, but the bit length of plaintext data applicable to this method is limited. Cheon et al. implemented comparison operations between ciphertexts by utilizing the ideas of function approximation and iterative calculation. However, the accuracy of this method is affected by the number of iterations, and the computational time overhead is very high, making it difficult to adapt to the requirements of encrypted database queries. Therefore, it is necessary to design a ciphertext comparison method that can handle ciphertexts with larger integers of longer bit lengths, has better time performance, and is adapted to the requirements of encrypted database queries.

[0029] Based on the above problems, the present embodiment proposes a homomorphic encryption ciphertext comparison method for large integers. By determining a comparison parameter, homomorphic subtraction is performed on the compared ciphertext according to the comparison parameter to obtain a homomorphic subtraction ciphertext result; the most significant bit of the plaintext data in the homomorphic subtraction ciphertext result is extracted; and on this basis, a final result is obtained through homomorphic logical operation; the final result indicates whether the comparison relationship between the two ciphertexts holds. This method expands the bit length of the encrypted plaintext data that can be processed, is suitable for diversified queries of encrypted databases, and has good time performance.

[0030] First, the relevant concepts involved in the homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application are defined as follows:

[0031] Definition 1: Let is the set of integers modulo p, express The set of n-dimensional vectors on , where n represents the ciphertext dimension. The ciphertext encrypted as LWE type is:

[0032] LWE(m)=(b,a)=(<-a,s>+Δm+e,a)

[0033] where the vector Generated by random uniform distribution sampling, the key Generated by random uniform distribution sampling, noise e is generated by noise distribution χ sampling, is a scaling factor, where p is the plaintext modulus and q is the ciphertext modulus.

[0034] Definition 2: For a message The corresponding LWE type ciphertext is ct1=LWE(m1), ct2=LWE(m2), and the additive homomorphic property of the ciphertext is:

[0035] ct1±ct2=LWE(m1)±LWE(m2)=LWE(m1±m2)

[0036] Definition 3: Given an input ciphertext LWE(m), a discrete function T(x), and a bootstrap private key bk, the programmable bootstrap PBS(LWE(m),bk,T(x)) outputs a ciphertext LWE(T(m)) with a constant noise level. This means that the function evaluates the input ciphertext while reducing the noise in the ciphertext to a fixed level.

[0037] Definition 4: For a given integer plaintext message m, the corresponding ciphertext is expressed as LWE(m). Extract the most significant bit of the plaintext data m in the ciphertext LWE(m): If m is a negative number, then its most significant bit (sign bit) is 1, and the extracted most significant bit ciphertext result is ciphertext 1, that is, LWE(1); if m is a non-negative number, then its most significant bit (sign bit) is 0, and the extracted most significant bit ciphertext result is ciphertext 0, that is, LWE(0).

[0038] Definition 5: For a given input ciphertext LWE(m), m∈{0,1}, the homomorphic logical NOT operation is denoted as Hom_Not(LWE(m)). When the input is LWE(1), the output is LWE(0); when the input is LWE(0), the output is LWE(1).

[0039] Definition 6: For a given input ciphertext LWE(m1), LWE(m2), m1,m2∈{0,1}. The homomorphic logical AND operation is denoted as Hom_And(LWE(m1), LWE(m2)). If both inputs are LWE(1), the output is LWE(1); otherwise, the output is LWE(0).

[0040] The above describes the relevant concept definitions involved in the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application. It can be understood that the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application can be applied to the query scenario of the fully homomorphic encryption database. By executing the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application, the filtering comparison condition in the ciphertext query statement can be obtained by comparing the ciphertexts to obtain the filtering comparison result.

[0041] The following describes in detail the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiments of the present application in combination with multiple embodiments.

[0042] Figure 1 The flowchart of the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application is shown in FIG. Figure 1 As shown, the execution subject of the method can be any electronic device with processing capabilities, and the method includes:

[0043] S101: Determine comparison parameters.

[0044] Determining the comparison parameters includes determining a comparison operator and determining the ciphertext to be compared.

[0045] It can be understood that determining the comparison operator is to determine the type of comparison operation to be performed between ciphertexts. The comparison operators include ">", "≥", "<", "≤", "=", and "≠", which respectively represent the comparison operations of greater than, greater than or equal to, less than, less than or equal to, equal to, and not equal to on the ciphertexts involved in the comparison.

[0046] It can be understood that determining the ciphertext to be compared includes determining the ciphertext on the left side of the comparison operator, determining the ciphertext on the right side of the comparison operator, and determining the bit length of the encrypted plaintext. Specifically, in the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application, the first input ciphertext to be compared is determined to be the ciphertext on the left side of the comparison operator, denoted as ct L ; The second input ciphertext is determined to be the ciphertext on the right side of the comparison operator, denoted as ct R .ct L With ct R For the comparison operator cmp, determine the ciphertext ct on the left side of the comparison operator. L and determine the ciphertext ct on the right side of the comparison operator R Afterwards, ct is formed L cmpct R A comparison operation expression.

[0047] S102. Perform homomorphic subtraction on the compared ciphertext according to the comparison parameter to obtain a homomorphic subtraction ciphertext result.

[0048] It can be understood that determining the comparison parameters means determining the two ciphertexts to be compared and the comparison operator. According to the above parameters, performing homomorphic subtraction between the two ciphertexts includes, for the comparison operators "<" and "≥", homomorphically subtracting the ciphertext on the left side of the comparison operator from the ciphertext on the right side of the comparison operator to obtain the homomorphic subtraction ciphertext result; for the comparison operators ">" and "≤", homomorphically subtracting the ciphertext on the right side of the comparison operator from the ciphertext on the left side of the comparison operator to obtain the homomorphic subtraction ciphertext result; for the comparison operators "=" and "≠", both homomorphically subtracting the ciphertext on the left side of the comparison operator from the ciphertext on the right side of the comparison operator and homomorphically subtracting the ciphertext on the right side of the comparison operator from the ciphertext on the left side of the comparison operator are used to obtain two homomorphic subtraction ciphertext results. For example, Figure 2 Schematic diagram of the homomorphic subtraction ciphertext result obtained by performing homomorphic subtraction on the compared ciphertext according to the comparison parameter under the fully homomorphic encryption ciphertext comparison method for large integers provided in the embodiment of the present application. The ciphertext on the left side of the comparison operator is represented by ct L , the ciphertext on the right side of the comparison operator is represented as ct R .

[0049] S103. Obtain the most significant bit ciphertext result through the LMSB algorithm according to the homomorphic subtraction ciphertext result.

[0050] The method of obtaining the most significant bit ciphertext result by the LMSB algorithm based on the homomorphic subtraction ciphertext result includes determining the bit length of the plaintext data in the ciphertext and extracting the most significant bit according to the determination result. Figure 3 A flowchart of obtaining the most significant bit ciphertext result through the LMSB algorithm based on the homomorphic subtraction ciphertext result in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0051] It can be understood that judging the bit length of the plaintext data in the ciphertext confirms whether the current ciphertext meets the conditions for extracting the most significant bit using the LMSB algorithm: the bit length of the plaintext data is less than k, or the plaintext bit length is n (n≥k), but the highest k bits are not all 1.

[0052] It can be understood that extracting the most significant bit according to the judgment result includes directly using the LMSB algorithm to extract the ciphertext whose bit length of plaintext data is less than k; constructing an equivalent ciphertext whose bit length of plaintext data is n (n≥k) in which the most significant bit of the plaintext remains unchanged but the highest k bits are not all 1, and using the LMSB algorithm to homomorphically extract the most significant bit of the equivalent ciphertext, wherein the steps of constructing the equivalent ciphertext are as follows:

[0053] Given n (n ≥ k) bits of plaintext data, the encrypted ciphertext is ct long , ct long After homomorphic left shift of n-k+1 bits, the ciphertext ct1 is obtained. The most significant bit extracted from ct1 by the LMSB algorithm is encoded at the bit position before the left shift to obtain ct2. long Homomorphically subtract ct2 to obtain ct3. If n-k+1<k, then ct3 is an equivalent ciphertext; otherwise, the bit length of the plaintext data in ct3 is set to n-k+1, and the equivalent ciphertext construction steps are used for ct3. The bit length of the plaintext data in ct1 is k-1 bits; ct2 is equivalent to ct long The n-k+2th bit of the plaintext (counting from the most significant bit) is homomorphically extracted.

[0054] For example, Figure 4 This is a schematic diagram of an equivalent ciphertext for constructing ciphertext of n (n ≥ k) bits of plaintext data in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application, where the most significant bit of the plaintext remains unchanged but the most significant k bits are not all 1. For simplicity and ease of understanding, Figure 4 The binary form of Δm+e in the corresponding LWE ciphertext is shown in FIG. In this example, the plaintext data m has a bit length of 10, k is set to 6, and m is in the LWE ciphertext ct long In the form of Δm+e, it is encoded in the high bit. longHomomorphically shift left by 5 bits to get ct1, the bit length of the plaintext data in ct1 is 5 bits; use the LMSB algorithm to extract the most significant bit of ct1 and encode it to the 6th bit (counting from the highest bit) to get ct2, which is equivalent to ct long The 6th bit of the plaintext in the ct is extracted homomorphically (counting from the highest bit); long Homomorphically subtract ct2 to get ct3, which is the equivalent ciphertext constructed. The most significant bit of the plaintext data in ct3 is the same as ct long The most significant bits of the plaintext data are the same, but the highest k bits are not all 1.

[0055] S104: Determine whether the comparison operation between the two ciphertexts is valid based on the most significant bit ciphertext result.

[0056] The determining whether the comparison operation of the two ciphertexts is established according to the most significant ciphertext result includes: performing the comparison operation on the most significant ciphertext result (denoted as ct msb ) performs homomorphic logic operations and makes judgments based on the operation results. For example, Figure 5 A flowchart of determining whether a comparison operation between two ciphertexts is valid based on the most significant bit ciphertext result in the fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0057] It can be understood that according to the comparison operator ct msb Homomorphic logic operations include: no additional operations are performed in the comparison operations of “>” and “<”; the most significant bit of the ciphertext result ct in the comparison operations of “≥” and “≤” msb Perform homomorphic NOT operation; in the “=” comparison operation, the most significant bit of the ciphertext result ct msb1 ,ct msb2 Perform homomorphic negation and homomorphic AND operations respectively; in the “≠” comparison operation, the most significant bit of the ciphertext result ct msb1 ,ct msb2 Perform homomorphic NOT operation, then homomorphic AND operation, and finally homomorphic NOT operation. For example, Figure 6 A schematic diagram of performing homomorphic logical operations on the most significant bit ciphertext results according to a comparison operator in a fully homomorphic encryption ciphertext comparison method for large integers provided in an embodiment of the present application.

[0058] It can be understood that judging according to the operation result includes that if the operation result is ciphertext 1, the ciphertext ct on the left side of the comparison operator L , the ciphertext ct on the right side of the comparison operator R , comparison operator cmp, resulting in expression ct L cmp ct RIf the result of the operation is ciphertext 0, then the ciphertext ct on the left side of the comparison operator is L , the ciphertext ct on the right side of the comparison operator R , comparison operator cmp, resulting in expression ct L cmp ct R Invalid judgment.

[0059] Assume two 10-bit plaintext data a=500, b=499. a =LWE(a) and ct b = LWE(b) is used as an example for a complete explanation.

[0060] First, determine the comparison parameters, that is, determine the comparison operator and determine the ciphertext to be compared. In this example, let the comparison operator be cmp and the ciphertext on the left side of the comparison operator be ct a , the ciphertext on the right side of the comparison operator is ct b , the bit length of the plaintext data in the ciphertext is 10.

[0061] Next, perform homomorphic subtraction on the ciphertext to be compared based on the comparison parameter to obtain the homomorphic subtraction ciphertext result. The ciphertext on the left side of the comparison operator is homomorphically subtracted from the ciphertext on the right side of the comparison operator to obtain ct sub-LR = LWE(a)-LWE(b)=LWE(ab)=LWE(1). The ciphertext on the right side of the comparison operator is homomorphically subtracted from the ciphertext on the left side of the comparison operator to obtain ct sub-RL =LWE(b)-LWE(a)=LWE(ba)=LWE(-1). If cmp is "<" or "≥", homomorphic subtraction is performed to obtain the ciphertext result ct sub-LR If cmp is “>” or “≤”, homomorphic subtraction is performed to obtain the ciphertext result ct sub-RL If cmp is "=" or "≠", homomorphic subtraction is performed to obtain the ciphertext result ct sub-LR and ct sub-RL .

[0062] Next, the LMSB algorithm is used to obtain the most significant bit ciphertext result based on the homomorphic subtraction ciphertext result. If cmp is "<" or "≥", the ct sub-LR The most significant bit ciphertext obtained by the LMSB algorithm is ct msb =LWE(0). If cmp is ">" or "≤", according to the homomorphic subtraction ciphertext result ct sub-RL The most significant bit ciphertext obtained by the LMSB algorithm is ct msb =LWE(1). If cmp is "=" or "≠", according to ct sub-LR and ct sub-RLThe most significant bit ciphertext obtained by the LMSB algorithm is ct msb1 =LWE(0),ct msb2 =LWE(1).

[0063] Finally, the comparison operation of the two ciphertexts is determined based on the most significant ciphertext result. If cmp is "<", no additional operation is performed on the most significant ciphertext result, and the final operation result is ct msb =LWE(0), judged to be ct a <ct b Not true. If cmp is “>”, no additional operation is performed on the most significant ciphertext result, and the final operation result is ct msb =LWE(1), judged to be ct a >ct b If cmp is "≤", perform a homomorphic NOT operation on the most significant ciphertext result, namely Hom_Not(ct msb ), the final calculation result is LWE(0), and it is judged as ct a ≤ct b If cmp is "≥", perform the homomorphic not operation Hom_Not(ct msb ), the final calculation result is LWE(1), and the judgment is ct a ≥ct b If cmp is "=", perform a homomorphic NOT operation on the most significant ciphertext result and then a homomorphic AND operation, namely Hom_And(Hom_Not(ct msb1 ),Hom_Not(ct msb2 )), the final calculation result is LWE(0), and it is judged as ct a =ct b If cmp is "≠", perform a homomorphic NOT operation on the two most significant ciphertext results, then perform a homomorphic AND operation, and finally perform a homomorphic NOT operation, that is, Hom_Not(Hom_And(Hom_Not(ct msb1 ),Hom_Not(ct msb2 ))), the final calculation result is LWE(1), and the judgment is ct a ≠ct b The above judgment result is completely consistent with the comparison result under the plain text.

[0064] The embodiment of the present application further provides an electronic device 700, such as Figure 7 As shown, Figure 7The structural diagram of the electronic device provided in the embodiment of the present application includes: a processor 701, a memory 702, and optionally, a bus 703. The memory 702 stores machine-readable instructions executable by the processor 701. When the electronic device 700 is running, the processor 701 communicates with the memory 702 via the bus 703, and when the machine-readable instructions are executed by the processor 701, the steps of the fully homomorphic encryption ciphertext comparison method for large integers are performed.

[0065] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the above-mentioned fully homomorphic encryption ciphertext comparison method for large integers are executed.

[0066] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules 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 communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0067] In addition, the functional units in the various embodiments of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially 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, which is stored in a storage medium and includes 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), a random access memory (RAM), a magnetic disk or an optical disk.

[0068] The above is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the protection scope of the present application.

Claims

1. A fully homomorphic encryption ciphertext comparison method for large integers, characterized in that: include: Determine comparison parameters; Perform homomorphic subtraction on the compared ciphertext according to the comparison parameter to obtain the homomorphic subtraction ciphertext result; According to the homomorphic subtraction ciphertext result, the most significant bit ciphertext result is obtained by using the large integer most significant bit extraction algorithm (LMSB algorithm) based on programmable bootstrapping; Determine whether the comparison operation between two ciphertexts is valid based on the most significant ciphertext result.

2. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 1, characterized in that: The determining of the comparison parameters comprises: Determine the comparison operator, which includes ">", "≥", "<", "≤", "=", and "≠"; Determining the ciphertext to be compared includes determining the bit length of the ciphertext on the left side of the comparison operator, the ciphertext on the right side of the comparison operator, and the encrypted plaintext.

3. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 1, characterized in that: The step of performing homomorphic subtraction on the compared ciphertext according to the comparison parameter to obtain the homomorphic subtraction ciphertext result includes: For the comparison operators "<" and "≥", the ciphertext on the left side of the comparison operator is homomorphically subtracted from the ciphertext on the right side of the comparison operator to obtain the homomorphic subtraction ciphertext result; for the comparison operators ">" and "≤", the ciphertext on the right side of the comparison operator is homomorphically subtracted from the ciphertext on the left side of the comparison operator to obtain the homomorphic subtraction ciphertext result; for the comparison operators "=" and "≠", the ciphertext on the left side of the comparison operator is homomorphically subtracted from the ciphertext on the right side of the comparison operator, and the ciphertext on the right side of the comparison operator is homomorphically subtracted from the ciphertext on the left side of the comparison operator to obtain two homomorphic subtraction ciphertext results.

4. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 1, characterized in that: The method of obtaining the most significant bit ciphertext result by using the LMSB algorithm according to the homomorphic subtraction ciphertext result includes: Determine the bit length of the plaintext data in the ciphertext; The most significant bit is extracted based on the judgment result, including directly using the LMSB algorithm to extract the ciphertext whose bit length of plaintext data is less than k; for the ciphertext whose bit length of plaintext data is n (n≥k), an equivalent ciphertext is constructed in which the most significant bit of the plaintext remains unchanged but the highest k bits are not all 1, and the most significant bit of the equivalent ciphertext is homomorphically extracted using the LMSB algorithm.

5. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 4, characterized in that: The method of constructing an equivalent ciphertext in which the most significant bit of the plaintext remains unchanged but the most significant k bits are not all 1 includes: Given n (n ≥ k) bits of plaintext data, the encrypted ciphertext is ct long , ct long After homomorphic left shift of n-k+1 bits, the ciphertext ct1 is obtained. The most significant bit extracted from ct1 by the LMSB algorithm is encoded at the bit position before the left shift to obtain ct2. long Homomorphically subtract ct2 to obtain ct3. If n-k+1<k, then ct3 is an equivalent ciphertext; otherwise, the bit length of the plaintext data in ct3 is set to n-k+1, and the equivalent ciphertext construction steps are used for ct3. The bit length of the plaintext data in ct1 is k-1 bits; ct2 is equivalent to ct long The n-k+2th bit of the plaintext (counting from the most significant bit) is homomorphically extracted.

6. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 1, characterized in that: The determining whether the comparison operation of the two ciphertexts is established according to the most significant bit ciphertext result includes: Perform homomorphic logic operations on the obtained most significant bit ciphertext results according to the comparison operator; Make a judgment based on the operation results.

7. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 6, characterized in that: The performing of a homomorphic logic operation on the obtained most significant bit ciphertext result according to the comparison operator includes: No additional operations are performed in the comparison operations of ">" and "<"; the most significant ciphertext result ct is used in the comparison operations of "≥" and "≤". msb Perform homomorphic negation operation; in the "=" comparison operation, the most significant bit of the ciphertext result ct msb1 ,ct msb2 Perform homomorphic negation and homomorphic AND operations respectively, and the most significant bit of the ciphertext result ct in the "≠" comparison operation msb1 ,ct msb2 Perform homomorphic NOT operation, then homomorphic AND operation, and finally homomorphic NOT operation again.

8. The fully homomorphic encryption ciphertext comparison method for large integers according to claim 6, characterized in that: The judging according to the operation result includes: The result of the operation is the ciphertext 1. For the ciphertext ct on the left side of the comparison operator L , the ciphertext ct on the right side of the comparison operator R , comparison operator cmp, resulting in expression ct L cmp ct R The judgment is established; the result of the operation is the ciphertext 0, then the ciphertext ct on the left side of the comparison operator L , the ciphertext ct on the right side of the comparison operator R , comparison operator cmp, resulting in expression ct L cmp ct R Invalid judgment.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor executes the machine-readable instructions to perform the steps of the fully homomorphic encryption ciphertext comparison method for large integers as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that include: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the fully homomorphic encryption ciphertext comparison method for large integers as claimed in any one of claims 1 to 8.