A ciphertext comparison method for real number field
Patent Information
- Application Number
- CN202410193146.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-21
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2044-02-21
AI Technical Summary
然而,现有的ORE方案不能让用户任意选择数据类型进行比较、OPE方法存在泄密风险极高的问题,以及使用PPH进行加密操作,存在计算开销极大的问题
[0008]1.以整体符号位、指数部分符号位、指数部分、值部分整数部分和值部分小数部分的形式,表达编码后的实数域的明文消息。这种编码方式可以准确表达任意数据类型的明文消息;并且根据整体符号位和指数部分符号位的实际取值,对编码后的明文消息中的每个部分采用不同的加密方式进行加密,从而确保密文数据的数值大小与明文消息的数值大小成正相关;以及通过对五个部分使用同一个随机加密密钥进行加密的方式,可以避免在后续比较时,需要与密文数据的不同部分进行交互,提高了返回比较结果的效率。
Smart Images

Figure CN117938362B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information security technology, specifically relating to a ciphertext comparison method for real number fields. Background Technology
[0002] The high speed, large capacity, and low latency requirements of next-generation network communication technologies have placed more comprehensive and stringent demands on storage. Cloud storage, as a highly efficient data storage mechanism built on cloud computing, provides convenient business access and data retrieval services. With its superior performance, including on-demand access, pay-as-you-go pricing, and convenient data migration, cloud storage is ideal for large-scale data storage and sharing. Therefore, more and more companies and individuals are choosing to outsource their data storage to cloud servers to solve their storage capacity problems.
[0003] To prevent the leakage of useful data and enhance privacy protection, developing practical methods to protect our personal data in the cloud is particularly important. Encryption can be used to protect sensitive data in cloud environments, making encrypted databases an effective way to solve big data storage and privacy protection issues. However, this sacrifices data availability; once data is encrypted, it is difficult to perform various ranges of queries and searches on data stored in encrypted form on a server without decryption.
[0004] To support various queries in encrypted databases, academia has conducted extensive research, proposing schemes such as order-preserving encryption (OPE), order-revealing encryption (ORE), and property-preserving hash (PPH). However, existing ORE schemes do not allow users to arbitrarily choose data types for comparison, the OPE method has a very high risk of data leakage, and using PPH for encryption operations incurs extremely high computational overhead. Summary of the Invention
[0005] To address the aforementioned problems in related technologies, the present invention provides a solution. The technical problem to be solved by the present invention is achieved through the following technical solution:
[0006] This invention provides a ciphertext comparison method for the real number field, comprising: generating a random encryption key; encoding a plaintext message using a delimited encoding method to generate an encoded plaintext message, wherein the encoded plaintext message includes: an overall sign bit, an exponent sign bit, an exponent part, an integer part of the value part, and a fractional part of the value part; encrypting each part of the encoded plaintext message one by one using the random encryption key to obtain ciphertext data with multiple bits, one plaintext message corresponding to one ciphertext data; the numerical value of the ciphertext data is proportional to the numerical value of the plaintext message; storing the ciphertext data in a ciphertext space; and, in response to a ciphertext value query signal, invoking a comparison algorithm to compare any two ciphertext data in the ciphertext space bit by bit to obtain a comparison result.
[0007] The present invention has the following beneficial technical effects:
[0008] 1. The encoded plaintext message of the real number field is expressed in the form of a global sign bit, an exponent sign bit, an exponent part, an integer part of the value part, and a fractional part of the value part. This encoding method can accurately represent plaintext messages of any data type; and based on the actual values of the global sign bit and the exponent sign bit, each part of the encoded plaintext message is encrypted using a different encryption method, thus ensuring that the value of the ciphertext data is positively correlated with the value of the plaintext message; and by using the same random encryption key to encrypt all five parts, interaction with different parts of the ciphertext data is avoided during subsequent comparisons, improving the efficiency of returning comparison results.
[0009] 2. In response to the ciphertext value query signal, the comparison algorithm is invoked to compare the ciphertext data bit by bit. The comparison result is obtained with minimal data exposure, which can greatly reduce the risk of data leakage of the original plaintext message and ensure data security to the greatest extent. It has the characteristics of low data leakage risk and low computational overhead.
[0010] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0011] Figure 1 This is an application scenario for ciphertext querying in the real number field provided by an embodiment of the present invention;
[0012] Figure 2 This is a flowchart illustrating a ciphertext comparison method for the real number field proposed in an embodiment of the present invention.
[0013] Figure 3 This refers to the encoding time required for different encoded plaintext message lengths provided in the embodiments of the present invention;
[0014] Figure 4This is a schematic diagram illustrating the comparison of ciphertext data lengths generated by multiple ciphertext comparison schemes under different encoded plaintext message lengths, provided by an embodiment of the present invention.
[0015] Figure 5 This is a schematic diagram illustrating the time required to compare two plaintext messages when their lengths are different, provided by an embodiment of the present invention. Detailed Implementation
[0016] The present invention will be further described in detail below with reference to specific embodiments, but the implementation of the present invention is not limited thereto.
[0017] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0018] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0019] Although the invention has been described herein in conjunction with various embodiments, those skilled in the art will understand and implement other variations of the disclosed embodiments by reviewing the accompanying drawings, disclosure, and appended claims in carrying out the claimed invention. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0020] Conventional order-preserving encryption schemes do not allow users to arbitrarily choose data types. Specifically, they only support ciphertext comparisons over the positive integer field and cannot extend their application to the real number field to support comparisons of negative numbers and decimals. Furthermore, order-preserving encryption methods are vulnerable to many inference attacks, posing significant security problems and potentially revealing the original ciphertext order. Additionally, encryption operations using complex cryptographic primitives and property-preserving hash functions incur extremely high computational costs.
[0021] To address the aforementioned problems, this invention proposes a ciphertext comparison method for real number fields. This method not only supports comparisons of arbitrary data types and arbitrary data lengths, but also ensures data security, reduces the risk of data leakage, and has extremely low computational overhead.
[0022] Figure 1 This is an application scenario for ciphertext lookup in the real number field provided by an embodiment of the present invention. For example... Figure 1 As shown, the application scenario includes a data owner, a cloud server, and a data user (client). Due to limitations in local storage or computing power, the data owner encrypts plaintext messages and outsources them to the ciphertext space within the cloud server. The cloud server provides cloud storage and a cloud computing platform, offering storage services to the data owner. When a data user sends a ciphertext value query signal, the cloud server searches the ciphertext space for the size relationship between any two ciphertext data items and sends the comparison result back to the data user. The data user, i.e., the user authorized to query ciphertext data on the cloud server, negotiates a key with the data owner when querying data. After obtaining the ciphertext data, they use the negotiated key to decrypt it and obtain the final plaintext message.
[0023] Figure 2 This is a flowchart illustrating a ciphertext comparison method for real number fields proposed in an embodiment of the present invention. Figure 2 Ciphertext comparison methods for real number fields can be applied to Figure 1 The application scenarios provided. Now combined with Figure 2 The specific implementation process of the present invention will be described below. For example... Figure 1 As shown, the method includes the following steps:
[0024] Step 110: Generate a random encryption key.
[0025] Here, a random encryption key is randomly generated by calling a key generation algorithm (also known as an initialization algorithm). This random encryption key has uniformity. Specifically, a security parameter λ is determined and input into the key generation algorithm, which outputs a uniform random encryption key sk. The security parameter measures the difficulty for an attacker to break an encryption mechanism; the larger the security parameter, the greater the difficulty. The parameter can be selected according to actual needs.
[0026] After obtaining the random encryption key for encryption in step 110, the plaintext message to be encrypted is processed in step 120.
[0027] Step 120: Encode the plaintext message using a delimited encoding method to generate an encoded plaintext message. The encoded plaintext message includes: the overall sign bit, the exponent part sign bit, the exponent part, the integer part of the value part, and the fractional part of the value part.
[0028] The overall sign bit is used to indicate whether the plaintext message is positive; the exponent part sign bit is used to indicate the relationship between the absolute value of the plaintext message and 1; the overall sign bit, the exponent part sign bit, the exponent part, the integer part of the value part, and the fractional part of the value part are the five encoded parts that constitute the encoded plaintext message.
[0029] Furthermore, the overall sign bit includes a positive sign bit and a negative sign bit; the exponent part sign bit includes 0 and 1, wherein 0 is used to indicate that the absolute value of the plaintext message is less than 1, and 1 is used to indicate that the absolute value of the plaintext message is greater than 1.
[0030] Here, an encoding algorithm is invoked to compile any plaintext message selected within the real number domain. The overall sign bit distinguishes the positive or negative sign of the plaintext message as a whole. The sign bit of the exponent part, after clarifying the overall sign, further determines the relationship between the absolute value of the plaintext message and 1. Then, scientific notation is used to represent the numerical part of the plaintext message, which includes an integer part, a fractional part, and an exponent part. The integer and fractional parts are separated by a decimal point. Separate encoding is used to encode each part of the plaintext message and represent it in binary form. The fixed length of the integer part is l1. If the length is less than l1, leading zeros are added until the overall length meets the fixed length l1. Similarly, the fixed lengths of the fractional part and the exponent part are l2 and l3, respectively. If the fixed lengths are not met, leading zeros are added to extend the length. In other words, the total length C of the encoded plaintext message can be expressed as C = 2 + l1 + l2 + l3. Here, the number 2 represents the length of the total sign bit and the sign bit of the exponent portion.
[0031] In one possible implementation, the encoded plaintext message can be represented as:
[0032]
[0033] Where, m x This refers to the xth encoded plaintext message, m s0 This refers to the overall symbol bits of the xth encoded plaintext message, m s1 V refers to the sign bit of the exponent portion of the x-th encoded plaintext message. x1 V refers to the integer part of the value portion of the xth encoded plaintext message. x2 E refers to the fractional part of the value portion of the xth encoded plaintext message. x This refers to the exponent portion of the x-th encoded plaintext message, where d is a preset value; where V x1 V x2 and E x Both are represented in binary, with "·" used to denote m. s0 m s1 and combination.
[0034] For example, 8500 is encoded as 8.5 × 10⁵ in scientific notation. 3The sign bit of the whole number is a positive sign bit, the sign bit of the exponent part is 1, the integer part of the value part is 8 (represented as 0…1000 in binary form), the fractional part of the value part is 5 (represented as 0…101 in binary form), and the exponent part is 3 (represented as 0…11 in binary form).
[0035] Figure 3 This refers to the encoding time required for different encoded plaintext message lengths provided in the embodiments of the present invention. For example... Figure 3 As shown, the encoded plaintext length varies from 8 bits to 64 bits, but the corresponding encoding time is not significantly different, with an overall average encoding time of 1.67 µs. The shortest encoding time is 1.51 µs when the plaintext length is 56 bits, while the longest encoding time is 1.77 µs when the plaintext length is 8 bits.
[0036] In this invention, by using scientific notation to represent any plaintext message in the real number field, users can easily select the data type of the plaintext message according to their actual needs.
[0037] Step 130: Encrypt each part of the encoded plaintext message one by one using the random encryption key to obtain ciphertext data with multiple bits, one plaintext message corresponding to one ciphertext data; the value of the ciphertext data is proportional to the value of the plaintext message.
[0038] Here, a pseudo-random function in the encryption algorithm is invoked, and a random encryption key is used to encrypt each part of the encoded plaintext message, represented in binary form, one by one, generating multiple strings of bits. Each part of the encoded plaintext message corresponds to one string of bits.
[0039] Here, the overall sign bit, the exponent sign bit, the exponent part, the integer part of the value part, and the fractional part of the value part are sequentially connected to form the encoded plaintext message.
[0040] Since the overall sign bit includes both positive and negative cases, and the exponent sign bit also includes both cases, the encryption in step 130 needs to consider four cases: the plaintext message is a positive number but its absolute value is less than 1, the plaintext message is a positive number but its absolute value is greater than 1, the plaintext message is a negative number but its absolute value is less than 1, and the plaintext message is a negative number but its absolute value is greater than 1. These cases are now combined into two major cases for the encryption process: (i) when the plaintext message is a positive number, the absolute value of the plaintext message is less than 1 and the absolute value of the plaintext message is greater than 1; (ii) when the plaintext message is a negative number, the absolute value of the plaintext message is less than 1 and the absolute value of the plaintext message is greater than 1.
[0041] (a) When the plaintext message is a positive number, the absolute value of the plaintext message is less than 1 and the absolute value of the plaintext message is greater than 1.
[0042] When the plaintext message is positive, to ensure that the size of the ciphertext data is positively correlated with the size of the plaintext message, for the first type of encoded part, the ciphertext data of the first type of encoded part is determined by using a pseudo-random function, a random encryption key sk, a sequence combination of encoded parts in the encoded plaintext message that are located before the first type of encoded part, the plaintext value of the first type of encoded part, and addition processing; the first type of encoded part is any one of the overall sign bit, the exponent sign bit, the integer part of the value part, and the fractional part of the value part.
[0043] It should be understood that the "first type of coding part" introduced here is only to distinguish it from the "second type of coding part" mentioned below. The first type of coding part and the second type of coding part constitute the encoded plaintext message.
[0044] Here, the ciphertext data of the first type of encoded part is determined using a pseudo-random function, a random encryption key sk, a sequence combination of encoded parts in the encoded plaintext message preceding the first type of encoded part, the plaintext value of the first type of encoded part, and an addition process. This includes: determining the hash obfuscation value of the first type of encoded part using a pseudo-random function, a random encryption key, and a sequence combination of encoded parts in the encoded plaintext message preceding the first type of encoded part; taking the remainder of the plaintext value of the first type of encoded part; and adding the remainder of the plaintext value of the first type of encoded part to the hash obfuscation value of the first type of encoded part to obtain the ciphertext data of the first type of encoded part.
[0045] Here, taking the remainder of the plaintext value of the first type of coding part can also be understood as solving the modulus of the first type of coding part.
[0046] For example, suppose the encoded plaintext message is m = (b1b2…b ... n ), where b i Represented in binary form, where i ranges from 1 to n, and each part has its own fixed length. The ciphertext data of the first type of encoding part is ct = (u1, u2, ..., u...). l Based on the above steps, the ciphertext data of the first type of encoding part can be represented by the following formula:
[0047] u1=F(sk,(1,0 n-1 ))+b1modM
[0048] =F(sk,(1,0) n-1 ))+b1mod2 λ ;
[0049]
[0050] u i =F(sk,(i,b1b2…b) i-1 ||0 n-i +b i modM
[0051] =F(sk,(i,b1b2…b) i-1 ||0 n-i +b i mod2 λ .
[0052] Where F is a pseudo-random function, sk is a random encryption key, n is the number of each part in the encoded plaintext message, and u i For the i-th part of the ciphertext data in the first type of coding section, b i-1 Let M be the (i-1)th part of the encoded plaintext message, M be the modulus of the first type of encoded part, and λ be the security parameter.
[0053] Here, when the plaintext message is positive and its absolute value is less than 1, to ensure that the size of the ciphertext data is positively correlated with the size of the plaintext message, for the second type of coding part, the ciphertext data of the second type of coding part is determined by using a pseudo-random function, a random encryption key sk, a sequence combination of the coding parts in the encoded plaintext message that are located before the second type of coding part, the plaintext value of the second type of coding part, and subtraction. The second type of coding part is the exponential part.
[0054] Specifically, the ciphertext data of the second type of encoded part is determined using a pseudo-random function, a random encryption key sk, a sequence combination of encoded parts preceding the second type of encoded part in the encoded plaintext message, the plaintext value of the second type of encoded part, and a subtraction process. This includes: determining the hash obfuscation value of the second type of encoded part using a pseudo-random function, a random encryption key sk, and a sequence combination of encoded parts preceding the second type of encoded part in the encoded plaintext message; taking the remainder of the plaintext value of the second type of encoded part; and subtracting the remainder value from the hash obfuscation value of the second type of encoded part to obtain the ciphertext data of the second type of encoded part.
[0055] Here, the absolute value of the plaintext message is less than 1, meaning the sign bit of the exponent is 0, requiring special processing of the exponent. For example, assuming the exponent is b3, preceded by the overall sign bit b1 and the exponent sign bit b2, the ciphertext data of the exponent can be represented as: u3=F(sk,(3,b1b2||0) n-3))-b3modM. The method for hashing the exponent is the same as the method for hashing other parts of the encrypted plaintext message. The only difference is that when hashing other parts of the encrypted plaintext message, the hash obfuscation value of each part is added to the value after each part's region; while when hashing the exponent, the hash obfuscation value corresponding to the exponent is subtracted from the value after the exponent's region. For simplicity, this will not be elaborated further here.
[0056] When the plaintext message is positive and the absolute value of the plaintext message is greater than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using a pseudo-random function, a random encryption key, a sequence combination of the encoded parts in the encoded plaintext message that are located before the second type of encoded part, the plaintext value of the second type of encoded part, and addition processing.
[0057] For example, assuming the exponent is b3, preceded by the overall sign bit b1 and the exponent sign bit b2, the ciphertext data of the exponent can be represented as: u3=F(sk,(3,b1b2||0 n-3 ))+b3modM.
[0058] Here, the other parts of the encrypted plaintext message are processed in exactly the same way as the encrypted exponent. For the sake of brevity, this will not be elaborated further.
[0059] After encrypting each part of the encoded plaintext message one by one, the encrypted data corresponding to each part is summarized to generate a ciphertext data corresponding to each encoded plaintext message.
[0060] (ii) When the plaintext message is negative, the absolute value of the plaintext message is less than 1 and the absolute value of the plaintext message is greater than 1.
[0061] When the plaintext message is negative, for the first type of encoded part, the ciphertext data of the first type of encoded part is determined by using a pseudo-random function, a random encryption key, a sequence combination of encoded parts in the encoded plaintext message that are located before the first type of encoded part, the plaintext value of the first type of encoded part, and subtraction. The first type of encoded part is any one of the overall sign bit, the exponent sign bit, the integer part of the value part, and the fractional part of the value part.
[0062] Here, the specific steps for determining the ciphertext data of the first type of encoding part can be referred to the steps for determining the ciphertext data of the first type of encoding part in (a) above. The only difference between the two is that here, the modulo value of the plaintext value of the first type of encoding part is subtracted from the hash confusion value of the first type of encoding part to obtain the ciphertext data of the first type of encoding part; while in (a) above, the two are added together to obtain the ciphertext data of the first type of encoding part.
[0063] Assume the encoded plaintext message is m = (b1b2…b n ), where in the plaintext message, b i Represented in binary form, where i ranges from 1 to n, and each part has its own fixed length. The ciphertext data of the first type of encoding part is ct = (u1, u2, ..., u...). l Based on the above steps, the ciphertext data of the first type of encoding part can be represented by the following formula:
[0064] u1=F(sk,(1,0 n-1 ))-b1modM=F(sk,(1,0 n-1 ))-b1mod2 λ ;
[0065]
[0066] u i =F(sk,(i,b1b2…b) i-1 ||0 n-i -b i modM = F(sk,(i,b1b2…b) i-1 ||0 n-i -b i mod2 λ .
[0067] Where F is a pseudo-random function, sk is a random encryption key, n is the number of each part in the encoded plaintext message, and u i For the i-th part of the ciphertext data in the first type of coding section, b i-1 Let M be the (i-1)th part of the encoded plaintext message, M be the modulus of the first type of encoded part, and λ be the security parameter.
[0068] When the plaintext message is negative and the absolute value of the plaintext message is less than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using a pseudo-random function, a random encryption key, a sequence combination of encoded parts in the encoded plaintext message that are located before the second type of encoded part, the plaintext value of the second type of encoded part, and addition processing; the second type of encoded part is the exponential part.
[0069] Here, the steps for determining the ciphertext data of the second type of encoding part can be referred to in (I) above. For the sake of brevity, they will not be repeated here.
[0070] For example, assuming the exponent is b3, preceded by the overall sign bit b1 and the exponent sign bit b2, the ciphertext data of the exponent can be represented as: u3=F(sk,(3,b1b2||0 n-3))+b3modM.
[0071] When the plaintext message is negative and the absolute value of the plaintext message is greater than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using the pseudo-random function, the random encryption key, the sequence combination of the encoded part in the encoded plaintext message that is located before the second type of encoded part, the plaintext value of the second type of encoded part, and the subtraction process.
[0072] Here, the steps for determining the ciphertext data of the second type of encoding part can be referred to in (I) above. For the sake of brevity, they will not be repeated here.
[0073] For example, assuming the exponent is b3, preceded by the overall sign bit b1 and the exponent sign bit b2, the ciphertext data of the exponent can be represented as: u3=F(sk,(3,b1b2||0 n-3 ))-b3modM.
[0074] After encrypting each part of the encoded plaintext message one by one, the encrypted data corresponding to each part is summarized to generate a ciphertext data corresponding to each encoded plaintext message.
[0075] Figure 4 This is a schematic diagram comparing the lengths of ciphertext data generated by multiple ciphertext comparison schemes under different encoded plaintext message lengths, as provided in an embodiment of the present invention. The multiple ciphertext comparison schemes include: the classic ORE scheme (represented by purple bars), the EncodeORE scheme (represented by pink bars), and the scheme provided by the present invention (represented by blue bars). The classic ORE scheme and the EncodeORE scheme can only encode and encrypt plaintext messages with positive integer fields, but the scheme provided by the present invention encodes and encrypts plaintext messages with real number fields. Figure 4 It can be seen that the length of the encoded plaintext varies from 8 bits to 64 bits, but the byte lengths generated by the three ciphertext comparison schemes are approximately the same. Specifically, the ciphertext length provided by this invention is only one byte longer than that of the EncodeORE scheme when the plaintext length is between 8 bits and 32 bits, and only two bytes longer than that of the EncodeORE scheme when the plaintext length is between 32 bits and 64 bits. In other words, based on the scheme provided by this invention, a balance can be effectively achieved between data security and ciphertext data length while saving computational overhead.
[0076] Step 140: Store the ciphertext data in the ciphertext space.
[0077] After encrypting the encoded plaintext message in step 130, the ciphertext data is uploaded to the ciphertext space in the cloud server.
[0078] Step 150: In response to the ciphertext value query signal, call the comparison algorithm to compare any two ciphertext data in the ciphertext space bit by bit to obtain the comparison result.
[0079] Here, when a data user queries encrypted data stored on a cloud server, the user requests a random encryption key from the data owner. Based on the query request (e.g., determining the numerical relationship between any two plaintext messages) and the random encryption key, the user generates a encrypted value query signal and sends it to the cloud server. In response, the cloud server invokes a comparison algorithm to query the numerical relationship between the encrypted data corresponding to any two plaintext messages and returns the comparison result to the user. The user then determines the numerical relationship between the two plaintext messages based on the comparison result.
[0080] In step 130, the encoded plaintext message is encrypted. Each part corresponds to a string of bits. The bits corresponding to the five parts are combined sequentially to form ciphertext data consisting of multiple bits. Since all five parts of the encoded plaintext message are encrypted using the same random encryption key, the bits of two ciphertext data can be compared one by one without interaction, until the first different bit is found between the two ciphertext data, at which point the comparison stops.
[0081] Here, the comparison result includes 1 and 0. Since the size of the ciphertext data is proportional to the size of the plaintext message, when the comparison result is 1, in any two ciphertext data, the value of the plaintext message corresponding to the first ciphertext data is less than the value of the plaintext message corresponding to the second ciphertext data; when the comparison result is 0, in any two ciphertext data, the value of the plaintext message corresponding to the first ciphertext data is greater than the value of the plaintext message corresponding to the second ciphertext data.
[0082] By comparing the bits of two ciphertext data one by one, and only revealing the first different bit of a certain part of the ciphertext, the size relationship between the two ciphertext data can be determined. This method can greatly reduce the risk of sequential leakage of ciphertext data.
[0083] Figure 5 This is a schematic diagram illustrating the time required to compare two plaintext messages when their lengths differ, as provided in an embodiment of the present invention. It should be noted that this refers to the encoded plaintext message m1 = (b1b2…b ... n1 The corresponding ciphertext data and the encoded plaintext message m2=(b1b2…b n2The corresponding ciphertext data is compared. m1 and m2 have different lengths. Figure 5 In the x-axis of the graph, n2 represents the encoded plaintext message m2, where b is the value of the input. n2 The subscript is used to indicate the length of the encoded plaintext message m2; n1 is the length of b in the encoded plaintext message m1. n1 The subscript is used to indicate the length of the encoded plaintext message m1. For example... Figure 5 As shown, when the length of a plaintext message m1 is fixed, the comparison time varies (increases or decreases) as the length of another plaintext message m2 increases, but the overall amplitude is very small. Specifically, the comparison time is longest when the length of a plaintext message m1 is 64 bits and the length of another plaintext message m2 is 24 bits; the overall comparison time is shortest when the length of a plaintext message m1 is 64 bits and the length of another plaintext message m2 is 16 bits.
[0084] To address the problem that conventional ciphertext comparison schemes cannot allow users to arbitrarily select data types—specifically, they only support ciphertext comparison over the positive integer field and cannot be extended to the real number field to support the comparison of negative numbers and decimals—this invention provides a ciphertext comparison method for the real number field, which has the following advantages:
[0085] (1) The plaintext message in the real number field is encoded using scientific notation to generate an encoded plaintext message, which includes: a global sign bit, an exponent sign bit, an exponent part, an integer part of the value part, and a fractional part of the value part; wherein, the global sign bit is used to express the positive or negative sign of the plaintext message, and the exponent sign bit is used to determine the relationship between the absolute value of the plaintext message and 1. This encoding method can accurately express any data type while improving the overall encoding efficiency.
[0086] (2) An encryption algorithm is used to encrypt each part of the encoded plaintext message one by one, generating ciphertext data of multiple bits. By using the same random encryption key to encrypt the five parts, it is possible to avoid interacting with different parts of the ciphertext data during subsequent comparisons, thus improving the efficiency of the returned results. Furthermore, by using different encryption methods to encrypt each part of the encoded plaintext message according to the actual values of the overall sign bit and the exponent sign bit, it is possible to ensure that the size of the ciphertext data is positively correlated with the size of the plaintext message.
[0087] (3) In response to the ciphertext value query signal, the comparison algorithm is called to compare the ciphertext data bit by bit. The comparison result is obtained with minimal data exposure, which can greatly reduce the risk of data leakage of the original plaintext message and ensure data security to the greatest extent. It has the characteristics of low data leakage risk and low computational overhead.
[0088] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A ciphertext comparison method for the real number field, characterized in that, The method includes: Generate a random encryption key; The plaintext message is encoded using a delimited encoding method to generate an encoded plaintext message, which includes: an overall sign bit, an exponent sign bit, an exponent part, an integer part of the value part, and a fractional part of the value part. The encoded plaintext message is encrypted one by one using the random encryption key to obtain ciphertext data with multiple bits, with one plaintext message corresponding to one ciphertext data; the value of the ciphertext data is proportional to the value of the plaintext message. The encrypted data is stored in the encrypted space; In response to the ciphertext value query signal, a comparison algorithm is invoked to compare any two ciphertext data in the ciphertext space bit by bit to obtain the comparison result.
2. The ciphertext comparison method for real number fields according to claim 1, characterized in that, The overall sign bit is used to indicate whether the plaintext message is positive; the exponent part sign bit is used to indicate the relationship between the absolute value of the plaintext message and 1; the overall sign bit, the exponent part sign bit, the exponent part, the integer part of the value part, and the fractional part of the value part are the five encoded parts that constitute the encoded plaintext message.
3. The ciphertext comparison method for real number fields according to claim 2, characterized in that, The step of encrypting each part of the encoded plaintext message one by one using the random encryption key to obtain ciphertext data includes: When the plaintext message is positive, for the first type of encoded part, the ciphertext data of the first type of encoded part is determined by using a pseudo-random function, the random encryption key, the sequence combination of the encoded parts in the encoded plaintext message preceding the first type of encoded part, the plaintext value of the first type of encoded part, and addition processing; the first type of encoded part is any one of the overall sign bit, the exponent sign bit, the integer part of the value part, and the fractional part of the value part; When the plaintext message is a positive number and the absolute value of the plaintext message is less than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using the pseudo-random function, the random encryption key, the sequence combination of the encoded part before the second type of encoded part in the encoded plaintext message, the plaintext value of the second type of encoded part, and the subtraction process; the second type of encoded part is the exponential part. When the plaintext message is a positive number and the absolute value of the plaintext message is greater than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using the pseudo-random function, the random encryption key, the sequence combination of the encoded part in the encoded plaintext message that is located before the second type of encoded part, the plaintext value of the second type of encoded part, and the addition process.
4. The ciphertext comparison method for real number fields according to claim 3, characterized in that, The step of determining the ciphertext data of the first type of encoded part by using a pseudo-random function, the random encryption key, the sequence combination of the encoded part preceding the first type of encoded part in the encoded plaintext message, the plaintext value of the first type of encoded part, and addition processing includes: The hash obfuscation value of the first type of encoded part is determined by combining the pseudo-random function, the random encryption key, and the sequence of encoded parts in the encoded plaintext message that precede the first type of encoded part. Take the remainder of the plaintext value of the first type of encoded portion; The ciphertext data of the first type of encoded part is obtained by adding the remainder of the plaintext value of the first type of encoded part to the hash obfuscation value of the first type of encoded part.
5. The ciphertext comparison method for real number fields according to claim 3, characterized in that, The step of determining the ciphertext data of the second type of encoded part using the pseudo-random function, the random encryption key, the sequence combination of the encoded part preceding the second type of encoded part in the encoded plaintext message, the plaintext value of the second type of encoded part, and subtraction processing includes: The hash confusion value of the second type of encoded part is determined by combining the sequence of the encoded part preceding the second type of encoded part in the pseudo-random function, the random encryption key, and the encoded plaintext message. Take the remainder of the plaintext value of the second type of encoded portion; The ciphertext data of the second type of encoded part is obtained by subtracting the remainder of the plaintext value of the second type of encoded part from the hash obfuscation value of the second type of encoded part.
6. The ciphertext comparison method for the real number field according to claim 1, characterized in that, When the plaintext message is negative, for the first type of encoded part, the ciphertext data of the first type of encoded part is determined by using a pseudo-random function, the random encryption key, the sequence combination of the encoded parts in the encoded plaintext message that are located before the first type of encoded part, the plaintext value of the first type of encoded part, and subtraction. The first type of encoding part is any one of the overall sign bit, the exponent sign bit, the integer part of the value part, and the fractional part of the value part; When the plaintext message is negative and the absolute value of the plaintext message is less than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using the pseudo-random function, the random encryption key, the sequence combination of the encoded part in the encoded plaintext message that is located before the second type of encoded part, the plaintext value of the second type of encoded part, and the addition process. The second type of encoding part is the exponent part; When the plaintext message is negative and the absolute value of the plaintext message is greater than 1, for the second type of encoded part, the ciphertext data of the second type of encoded part is determined by using the pseudo-random function, the random encryption key, the sequence combination of the encoded part in the encoded plaintext message that is located before the second type of encoded part, the plaintext value of the second type of encoded part, and the subtraction process.
7. The ciphertext comparison method for real number fields according to claim 1, characterized in that, The encoded plaintext message can be represented as: in, It refers to the first Barcoded plaintext message, This refers to the first The overall symbol bits of the bar-coded plaintext message, This refers to the first The sign bit of the exponent portion of the bar-encoded plaintext message. This refers to the first The integer part of the value portion of the plaintext message after bar encoding. This refers to the first The fractional part of the value portion of the plaintext message after bar encoding. This refers to the first The index portion of the plaintext message after bar encoding, It is a preset value; among which Both are represented in binary. "used to , and combination.
8. The ciphertext comparison method for real number fields according to claim 1, characterized in that, The comparison result is used to characterize the numerical relationship between any two ciphertext data, and the numerical relationship between any two ciphertext data is used to characterize the numerical relationship between the two plaintext messages corresponding to any two ciphertext data.
9. The ciphertext comparison method for real number fields according to claim 8, characterized in that, The comparison results include: 1 and 0; If the comparison result is 1, in any two ciphertext data, the value of the plaintext message corresponding to the first ciphertext data is less than the value of the plaintext message corresponding to the second ciphertext data. When the comparison result is 0, in any two ciphertext data, the value of the plaintext message corresponding to the first ciphertext data is greater than the value of the plaintext message corresponding to the second ciphertext data.
10. The ciphertext comparison method for real number fields according to claim 2, characterized in that, The overall sign bit includes a positive sign bit and a negative sign bit; the exponent part sign bit includes 0 and 1, wherein 0 is used to indicate that the absolute value of the plaintext message is less than 1, and 1 is used to indicate that the absolute value of the plaintext message is greater than 1.
Citation Information
Patent Citations
Multi-data type ciphertext comparison method based on sequence uncovering encryption
CN113254971A
Design method of semi-public key systems in QAP-based homomorphic encryption
JP7257495B1