Ciphertext index construction method and data retrieval method

By interpolation sorting and hash encryption processing on the original data, the ciphertext index is constructed, which solves the problem of high computational complexity in ciphertext retrieval by homomorphic encryption technology, and achieves efficient data privacy protection and improvement of retrieval efficiency.

CN120196794AActive Publication Date: 2025-06-24INTERNET TIME (BEIJING) INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510677287.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-06-24
Estimated Expiration
2045-05-26

AI Technical Summary

Technical Problem

The existing homomorphic encryption technology has high computational complexity in ciphertext search, resulting in high resource consumption and low retrieval efficiency.

Method used

The original index is generated by interpolation sorting of the original data, and hash encryption is performed on the data in the initial index to build a ciphertext index. Then, the search keyword is hashed and encrypted, and data is retrieved using the ciphertext index.

Benefits of technology

It effectively avoids the risk of plain text leakage, realizes data privacy protection, and reduces calculation steps and resource consumption, and improves retrieval efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196794A_ABST
    Figure CN120196794A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computers, and aims to provide a ciphertext index construction method and a data retrieval method. The ciphertext index construction method comprises the following steps: receiving original data, and performing interpolation sorting processing on the original data according to the data type of the original data to obtain an initial index; and performing hash encryption processing on the original data in the initial index, and deleting the original data in the initial index to obtain a ciphertext index. The data retrieval method comprises the following steps: receiving a retrieval request bound with a retrieval keyword; wherein the retrieval keyword is character type data or numeric type data; and performing hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and performing data retrieval in the ciphertext index according to the keyword ciphertext so as to obtain a retrieval result. According to the method, on the premise that the safety is guaranteed, unnecessary complex operation is reduced, calculation steps and resource consumption are remarkably reduced, and the retrieval efficiency is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and particularly relates to a method for constructing a ciphertext index and a method for data retrieval. Background Art

[0002] Ciphertext retrieval technology can perform direct search operations on encrypted data without exposing the plaintext information. Among them, homomorphic encryption is one of the main technologies currently supporting range retrieval. It allows direct calculations (such as addition / multiplication) to be performed on ciphertexts without decrypting the data. This feature enables homomorphic encryption to perform useful computational operations while protecting data privacy. However, in the process of using existing homomorphic encryption technologies, the inventors found that it has at least the following problems: The computational complexity of homomorphic encryption technology is high, resulting in a large amount of computational resources being consumed when performing ciphertext retrieval based on homomorphic encryption technology, and at the same time, the retrieval efficiency is low. Summary of the Invention

[0003] The present invention aims to solve the above technical problems to at least a certain extent, and provides a method for constructing a ciphertext index and a method for data retrieval.

[0004] To achieve the above object, the present invention adopts the following technical solutions: In a first aspect, the present invention provides a method for constructing a ciphertext index, including: Receiving original data, and performing interpolation sorting processing on the original data according to the data type of the original data to obtain an initial index; wherein, the original data includes character data and numerical data, and the initial index includes a character initial index corresponding to the character data and a numerical initial index corresponding to the numerical data; Performing hash encryption processing on the original data in the initial index, and deleting the original data in the initial index to obtain a ciphertext index; wherein, the index branches of the ciphertext index include a character ciphertext index corresponding to the character data and a numerical ciphertext index corresponding to the numerical data.

[0005] In a possible design, when the data type of the original data is character data, performing interpolation sorting processing on the original data to obtain an initial index includes: Extracting the first letter corresponding to the original data, and performing interpolation sorting processing on the original data in a preset character sequence according to the order of its first letter to obtain a character initial index; When the data type of the original data is numerical data, performing interpolation sorting processing on the original data to obtain an initial index includes: Extracting the integer part and the decimal part of the original data; Insert the integer part of the original data into a preset ordered integer sequence in ascending order, and insert the decimal part of the original data into the corresponding decimal subsequence corresponding to the integer part of the original data to obtain a numerical initial index.

[0006] In a possible design, performing hash encryption processing on the original data in the initial index includes: Obtain an interference factor, and splice the original data in the initial index with the interference factor to obtain spliced data; Perform hash encryption processing on the spliced data to obtain an index ciphertext corresponding to the original data in the initial index.

[0007] In a second aspect, the present invention provides a data retrieval method, including: Receive a retrieval request bound with a retrieval keyword; wherein, the retrieval keyword is character-type data or numerical-type data; Perform hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and perform data retrieval in the ciphertext index according to the keyword ciphertext to obtain a retrieval result.

[0008] In a possible design, when the data type of the retrieval keyword is character-type data, the keyword ciphertext includes character encrypted data; correspondingly, performing hash encryption processing on the retrieval keyword to obtain a keyword ciphertext includes: performing hash encryption processing on the retrieval keyword to obtain character encrypted data; When the data type of the retrieval keyword is numerical-type data and the retrieval keyword is single-valued data, the keyword ciphertext includes integer encrypted data and decimal encrypted data; correspondingly, performing hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and performing data retrieval in the ciphertext index according to the keyword ciphertext to obtain a retrieval result includes: Extract the integer part and the decimal part of the retrieval keyword; Perform hash encryption processing on the integer part of the retrieval keyword to obtain integer encrypted data, and perform data retrieval in the ciphertext index according to the integer encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to the next step; if not, determine that the retrieval result is empty; Perform hash encryption processing on the decimal part of the retrieval keyword to obtain decimal encrypted data, and perform data retrieval in the decimal ciphertext subsequence corresponding to any integer ciphertext according to the decimal encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain a ciphertext retrieval result matching the retrieval keyword; if not, determine that the retrieval result is empty.

[0009] In a possible design, when the data type of the retrieval keyword is numerical data and the retrieval keyword is range value data, perform hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and perform data retrieval in the ciphertext index according to the keyword ciphertext to obtain a retrieval result, including: Perform hash encryption processing on the lower limit value of the retrieval keyword to obtain an encrypted lower limit value, and perform data retrieval in the ciphertext index according to the encrypted lower limit value to obtain a lower limit retrieval result; Perform hash encryption processing on the upper limit value of the retrieval keyword to obtain an encrypted upper limit value, and perform data retrieval in the ciphertext index according to the encrypted upper limit value to obtain an upper limit retrieval result; Take the data between the lower limit retrieval result and the upper limit retrieval result in the ciphertext index as the retrieval result.

[0010] In a possible design, the encrypted lower limit value includes an encrypted integer data of the lower limit value and an encrypted decimal data of the lower limit value; correspondingly, perform hash encryption processing on the lower limit value of the retrieval keyword to obtain an encrypted lower limit value, and perform data retrieval in the ciphertext index according to the encrypted lower limit value to obtain a lower limit retrieval result, including: c1. Extract the integer part and the decimal part of the lower limit value in the retrieval keyword; c2. Perform hash encryption processing on the integer part of the lower limit value to obtain an encrypted integer data of the lower limit value, and perform data retrieval in the ciphertext index according to the encrypted integer data of the lower limit value. If any integer ciphertext in the ciphertext index is hit, go to step c3. If not, perform an incremental approximation retrieval process on the integer part of the lower limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty; c3. Perform hash encryption processing on the decimal part of the lower limit value to obtain an encrypted decimal data of the lower limit value, and perform data retrieval in the decimal ciphertext subsequence corresponding to the any integer ciphertext according to the encrypted decimal data of the lower limit value. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain a lower limit retrieval result that matches the lower limit value. If not, perform an incremental approximation retrieval process on the decimal part of the lower limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty.

[0011] In a possible design, in step c2, performing an incremental approximation retrieval process on the integer part of the lower limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty includes: Incrementally calculate the integer part of the lower limit value to obtain an incremental calculation result, and when the incremental calculation result is less than the upper limit value, perform hash encryption processing on the incremental calculation result to obtain incremental encrypted data; According to the incremental encrypted data, perform data retrieval in the ciphertext index. If any integer ciphertext in the ciphertext index is hit, go to step c3; if not, incrementally calculate the integer part of the lower limit value again until any integer ciphertext in the ciphertext index is hit, or determine that the retrieval result is empty when the incremental calculation result is not less than the upper limit value; In step c3, perform an incremental approximation retrieval process on the decimal part of the lower limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or determine that the retrieval result is empty, including: Add a counting unit to the decimal part of the lower limit value to obtain the accumulated data; Determine whether the accumulated data is less than 1; If so, perform hash encryption processing on the accumulated data to obtain accumulated encrypted data, and perform data retrieval in the decimal ciphertext subsequence corresponding to the any integer ciphertext according to the accumulated encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain a lower limit retrieval result matching the lower limit value; if not, use the accumulated data as the decimal part of the new lower limit value and add a counting unit to it; If not, take the nearest integer greater than the accumulated data as the lower limit retrieval result matching the lower limit value or determine that the retrieval result is empty.

[0012] In a possible design, the encrypted upper limit value includes upper limit integer encrypted data and upper limit decimal encrypted data; correspondingly, perform hash encryption processing on the upper limit value of the retrieval keyword to obtain the encrypted upper limit value, and perform data retrieval in the ciphertext index according to the encrypted upper limit value to obtain the upper limit retrieval result, including: d1. Extract the integer part and decimal part of the upper limit value in the retrieval keyword; d2. Perform hash encryption processing on the integer part of the upper limit value to obtain upper limit integer encrypted data, and perform data retrieval in the ciphertext index according to the upper limit integer encrypted data. If any integer ciphertext in the ciphertext index is hit, go to step d3; if not, perform a decremental approximation retrieval process on the integer part of the upper limit value until any integer ciphertext in the ciphertext index is hit or determine that the retrieval result is empty; d3. Perform hash encryption processing on the decimal part of the upper limit value to obtain upper limit value decimal encrypted data, and perform data retrieval within the decimal ciphertext subsequence corresponding to any integer ciphertext according to the upper limit value decimal encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, an upper limit retrieval result matching the upper limit value is obtained. If not, perform a decremental approximation retrieval process on the decimal part of the upper limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty.

[0013] In a possible design, in step d2, performing a decremental approximation retrieval process on the integer part of the upper limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty includes: Perform a decremental calculation on the integer part of the upper limit value to obtain a decremental calculation result, and when the decremental calculation result is less than the lower limit value, perform hash encryption processing on the decremental calculation result to obtain decremental encrypted data; Perform data retrieval in the ciphertext index according to the decremental encrypted data. If any integer ciphertext in the ciphertext index is hit, go to step d3. If not, perform a decremental calculation on the integer part of the upper limit value again until any integer ciphertext in the ciphertext index is hit, or it is determined that the retrieval result is empty when the decremental calculation result is not less than the lower limit value; In step d3, performing a decremental approximation retrieval process on the decimal part of the upper limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty includes: Subtract a counting unit from the decimal part of the upper limit value to obtain a data after cumulative subtraction; Judge whether the data after cumulative subtraction is less than 0; If so, perform hash encryption processing on the data after cumulative subtraction to obtain cumulative subtraction encrypted data, and perform data retrieval within the decimal ciphertext subsequence corresponding to any integer ciphertext according to the cumulative subtraction encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, an upper limit retrieval result matching the upper limit value is obtained. If not, use the cumulative subtraction encrypted data as the decimal part of the new upper limit value and subtract a counting unit from it; If not, take the nearest integer less than the cumulative subtraction encrypted data as the upper limit retrieval result matching the upper limit value or determine that the retrieval result is empty.

[0014] The beneficial effects of the present invention are: The present invention discloses a method for constructing a ciphertext index. By using a hash encryption algorithm to construct the ciphertext index, due to the one-way property of the hash function, the risk of plaintext leakage can be effectively avoided, realizing the privacy protection of data, and at the same time meeting the ciphertext retrieval requirements. In addition, the ciphertext index constructed based on the present invention can realize the retrieval of numerical data and character data, with a wider application range.

[0015] The present invention also discloses a data retrieval method based on the ciphertext index. When performing data retrieval based on the ciphertext index, only the retrieval keywords in the retrieval request need to be subjected to hash encryption processing to obtain the keyword ciphertext, and data retrieval is performed within the ciphertext index according to the keyword ciphertext, thereby obtaining the retrieval result. In this process, the present invention only needs to use the hash encryption algorithm to perform encryption calculation on the keywords, and perform data retrieval within the ciphertext index with the encrypted keyword ciphertext. It can reduce unnecessary complex operations on the premise of ensuring security, significantly reduce the calculation steps and resource consumption, and has high retrieval efficiency.

[0016] Other beneficial effects of the present invention will be further described in the specific embodiments. Description of the Drawings

[0017] Figure 1 is the flowchart of the ciphertext index construction method in Embodiment 1; Figure 2 is the structural schematic diagram of the ciphertext index in Embodiment 1; Figure 3 is the flowchart of the data retrieval method in Embodiment 3; Figure 4 is the flowchart of the lower limit retrieval processing in Embodiment 3; Figure 5 is the flowchart of the upper limit retrieval processing in Embodiment 3. Specific Embodiments

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the present invention in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. It should be noted here that the description of these embodiment modes is used to help understand the present invention, but does not constitute a limitation to the present invention.

[0019] Embodiment 1: This embodiment discloses a method for constructing a ciphertext index, which can be, but is not limited to, executed by a computer device or virtual machine with certain computing resources, such as an electronic device like a personal computer, smartphone, personal digital assistant, or wearable device, or by a virtual machine.

[0020] As Figure 1 shown, a method for constructing a ciphertext index can, but is not limited to, include the following steps: A1. Receive the original data, and perform interpolation sorting on the original data according to the data type of the original data to obtain an initial index; wherein, the original data includes character data and numerical data, and the initial index includes a character initial index corresponding to the character data and a numerical initial index corresponding to the numerical data; it should be noted that in this embodiment, the original data includes the fields to be encrypted in the original database, which are the original information to be encrypted and stored, such as names, ages, prices, etc., and there is no limitation here.

[0021] Specifically, when the data type of the original data is character data, performing interpolation sorting on the original data to obtain an initial index includes: Extract the first letter corresponding to the original data, and perform interpolation sorting on the original data in a preset character sequence according to the order of its first letter to obtain a character initial index; specifically, if the original data is Chinese data, then perform pinyin conversion on the original data in advance, and take the first letter of its pinyin as the first letter of the original data.

[0022] In this embodiment, when performing interpolation sorting on the original data, it is implemented by using the character sorting function sortChar( ), that is, using the character sorting function sortChar( ) to insert the original data into the character sequence.

[0023] When the data type of the original data is numerical data, performing interpolation sorting on the original data to obtain an initial index includes: Extract the integer part and decimal part of the original data; it should be noted that in this embodiment, the extraction of the integer part and decimal part of the original data is implemented by using integer-taking operations; specifically, use the floor function " " to extract the integer part of the original data, and obtain the decimal part of the original data by subtracting the integer part from the original data; as an example, for the original data x, the result obtained by using integer-taking operations can be expressed as: , where represents the integer part of the original data x, and represents the decimal part of the original data x.

[0024] Insert the integer part of the original data into a preset ordered integer sequence in ascending order, and insert the decimal part of the original data into a decimal subsequence corresponding to the integer part of the original data in ascending order to obtain a numerical initial index. Specifically, in this embodiment, both the integer part and the decimal part of the original data are subjected to interpolation sorting in ascending order.

[0025] It should be understood that in this embodiment, the numerical ciphertext index of the ciphertext index includes an integer ciphertext sequence corresponding to the ordered integer sequence and a decimal ciphertext subsequence corresponding to each integer ciphertext in the integer ciphertext sequence, that is, each integer ciphertext in the integer ciphertext sequence is provided with a decimal ciphertext subsequence.

[0026] In this embodiment, when performing interpolation sorting on the integer part and the decimal part of the original data, the numerical sorting function sortNum( ) is used to implement.

[0027] A2. Perform hash encryption processing on the original data in the initial index, and delete the original data in the initial index to obtain a ciphertext index; wherein, the index branches of the ciphertext index include a character ciphertext index corresponding to the character-type data and a numerical ciphertext index corresponding to the numerical-type data. It should be noted that in this embodiment, the ciphertext index adopts a multi-way tree structure, as Figure 2 shown, the character ciphertext index and the numerical ciphertext index constitute the index branches of the ciphertext index.

[0028] In step A2, performing hash encryption processing on the original data in the initial index includes: A201. Obtain an interference factor, and splice the original data in the initial index with the interference factor to obtain spliced data; A202. Perform hash encryption processing on the spliced data to obtain an index ciphertext corresponding to the original data in the initial index. Specifically, in this embodiment, for the original data x in the initial index, the index ciphertext obtained by encryption calculation is: h(x)=SM3(x||s), where s is a preset interference factor, || represents the string splicing symbol, and SM3( ) represents the national cipher SM3 algorithm.

[0029] It should be noted that in this embodiment, when performing hash encryption processing on the original data in the initial index, the anti-collision property is enhanced by splicing the interference factor s, and reverse derivation is isolated, thereby further enhancing the data privacy protection ability of this embodiment.

[0030] In this embodiment, a ciphertext index is constructed by using a hash encryption algorithm. Due to the one-way property of the hash function, the risk of plaintext leakage can be effectively avoided, realizing the privacy protection of data, and at the same time, the ciphertext retrieval requirement can be met. In addition, the ciphertext index constructed based on this embodiment can realize the retrieval of numerical data and character data, with a wider application range.

[0031] Embodiment 2: This embodiment discloses a ciphertext index construction system for implementing the ciphertext index construction method in Embodiment 1; the ciphertext index construction system includes: An initial index generation module, configured to receive the original data, and perform interpolation sorting processing on the original data according to the data type of the original data to obtain an initial index; wherein, the original data includes character data and numerical data, and the initial index includes a character type initial index corresponding to the character data and a numerical type initial index corresponding to the numerical data; A ciphertext index construction module, communicatively connected to the initial index generation module, configured to perform hash encryption processing on the original data in the initial index, and delete the original data in the initial index to obtain a ciphertext index; wherein, the index branches of the ciphertext index include a character type ciphertext index corresponding to the character data and a numerical type ciphertext index corresponding to the numerical data.

[0032] It should be noted that for the working process, working details and technical effects of the ciphertext index construction system provided in this Embodiment 2, reference can be made to Embodiment 1, which will not be elaborated here.

[0033] Embodiment 3: This embodiment discloses a data retrieval method, which can be but is not limited to being executed by a computer device or virtual machine with certain computing resources, such as being executed by an electronic device such as a personal computer, a smart phone, a personal digital assistant or a wearable device, or being executed by a virtual machine.

[0034] As Figure 3 shown, a data retrieval method, retrieves based on the ciphertext index obtained by the ciphertext index construction method described in any one of Embodiments 1 or 2, and the data retrieval method can be but is not limited to including the following steps: B1. Receive a retrieval request bound with a retrieval keyword; wherein, the retrieval keyword is character data or numerical data; B2. Perform hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and perform data retrieval in the ciphertext index according to the keyword ciphertext to obtain a retrieval result.

[0035] Specifically, in this embodiment, the Boolean function match( ) is used for data retrieval. If the keyword ciphertext meets the retrieval requirements, the retrieval results that match it are returned, indicating that the data corresponding to the retrieval keyword is matched in the ciphertext index. Otherwise, it is determined that the retrieval result is empty, and a retrieval failure message is returned, indicating that the data corresponding to the retrieval keyword is not matched in the ciphertext index.

[0036] In step B2, when the data type of the retrieval keyword is character data, the keyword ciphertext includes character encrypted data. Correspondingly, performing a hash encryption process on the retrieval keyword to obtain the keyword ciphertext includes: performing a hash encryption process on the retrieval keyword to obtain character encrypted data. In step B2, when the data type of the retrieval keyword is numerical data and the retrieval keyword is a single-value data, the retrieval condition at this time is also a single-value retrieval. The keyword ciphertext includes integer encrypted data and decimal encrypted data. Correspondingly, performing a hash encryption process on the retrieval keyword to obtain the keyword ciphertext, and performing data retrieval in the ciphertext index according to the keyword ciphertext to obtain the retrieval result, including: Extracting the integer part and the decimal part of the retrieval keyword; Performing a hash encryption process on the integer part of the retrieval keyword to obtain integer encrypted data, and performing data retrieval in the ciphertext index according to the integer encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to the next step. If not, it is determined that the retrieval result is empty; Performing a hash encryption process on the decimal part of the retrieval keyword to obtain decimal encrypted data, and performing data retrieval in the decimal ciphertext subsequence corresponding to the any integer ciphertext according to the decimal encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, the ciphertext retrieval result that matches the retrieval keyword is obtained. If not, it is determined that the retrieval result is empty. It should be understood that in this embodiment, when performing data retrieval in the ciphertext index according to the decimal encrypted data, data retrieval is performed from the decimal ciphertext subsequence corresponding to the integer part of the retrieval keyword in the ciphertext index, and the obtained ciphertext retrieval result is composed of the any integer ciphertext and the any decimal ciphertext.

[0037] To meet the requirements of range retrieval, the following further improvements are made in this embodiment: In step B2, when the data type of the retrieval keyword is numerical data and the retrieval keyword is a range value data, the retrieval condition at this time is also a range value retrieval. Performing a hash encryption process on the retrieval keyword to obtain the keyword ciphertext, and performing data retrieval in the ciphertext index according to the keyword ciphertext to obtain the retrieval result, including: Perform hash encryption processing on the lower limit value of the search keyword to obtain the encrypted lower limit value, and perform data retrieval in the ciphertext index according to the encrypted lower limit value to obtain the lower limit retrieval result; Perform hash encryption processing on the upper limit value of the search keyword to obtain the encrypted upper limit value, and perform data retrieval in the ciphertext index according to the encrypted upper limit value to obtain the upper limit retrieval result; Take the data between the lower limit retrieval result and the upper limit retrieval result in the ciphertext index as the retrieval result.

[0038] Specifically, the encrypted lower limit value includes the encrypted data of the integer part of the lower limit value and the encrypted data of the decimal part of the lower limit value; correspondingly, as Figure 4 shown, performing hash encryption processing on the lower limit value of the search keyword to obtain the encrypted lower limit value, and performing data retrieval in the ciphertext index according to the encrypted lower limit value to obtain the lower limit retrieval result includes: c1. Extract the integer part and the decimal part of the lower limit value in the search keyword; c2. Perform hash encryption processing on the integer part of the lower limit value to obtain the encrypted data of the integer part of the lower limit value, and perform data retrieval in the ciphertext index according to the encrypted data of the integer part of the lower limit value. If any integer ciphertext in the ciphertext index is hit, go to step c3. If not, perform incremental approximation retrieval processing on the integer part of the lower limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty; c3. Perform hash encryption processing on the decimal part of the lower limit value to obtain the encrypted data of the decimal part of the lower limit value, and perform data retrieval in the subsequence of decimal ciphertexts corresponding to the any integer ciphertext according to the encrypted data of the decimal part of the lower limit value. If any decimal ciphertext in the subsequence of decimal ciphertexts is hit, obtain the lower limit retrieval result matching the lower limit value. If not, perform incremental approximation retrieval processing on the decimal part of the lower limit value until any decimal ciphertext in the subsequence of decimal ciphertexts is hit or it is determined that the retrieval result is empty.

[0039] In step c2 of this embodiment, performing incremental approximation retrieval processing on the integer part of the lower limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty includes: Perform incremental calculation on the integer part of the lower limit value to obtain the incremental calculation result, and when the incremental calculation result is less than the upper limit value, perform hash encryption processing on the incremental calculation result to obtain the incremental encrypted data; Retrieve data within the ciphertext index according to the incrementally encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to step c3. If not, incrementally calculate the integer part of the lower limit value again until any integer ciphertext in the ciphertext index is hit, or determine that the retrieval result is empty when the incremental calculation result is not less than the upper limit value. In step c3, perform an incremental approximation retrieval process on the fractional part of the lower limit value until any fractional ciphertext in the fractional ciphertext subsequence is hit or determine that the retrieval result is empty, including: Add a counting unit to the fractional part of the lower limit value to obtain the accumulated data. Determine whether the accumulated data is less than 1. If so, perform hash encryption processing on the accumulated data to obtain the accumulated encrypted data, and retrieve data within the fractional ciphertext subsequence corresponding to the any integer ciphertext according to the accumulated encrypted data. If any fractional ciphertext in the fractional ciphertext subsequence is hit, obtain the lower limit retrieval result matching the lower limit value. If not, use the accumulated data as the fractional part of the new lower limit value and add a counting unit to it. If not, take the nearest integer greater than the accumulated data as the lower limit retrieval result matching the lower limit value or determine that the retrieval result is empty. Specifically, in this embodiment, if the accumulated data is not less than 1, take the nearest integer greater than the accumulated data as the previous integer, and further determine whether the previous integer is greater than the upper limit value. If so, determine that the retrieval result is empty. Otherwise, take the previous integer as the lower limit retrieval result matching the lower limit value.

[0040] As an example, if the plaintext corresponding to the ciphertext index is: 2.1, 2.3, 2.5, 3, 3.1, 3.2, 3.5, 4, 4.1, 4.2, 5, 6.2, 6.3; When the data type of the retrieval keyword is numerical data, the retrieval keyword is range value data, and the lower limit value of the retrieval keyword is 2.6 and the upper limit value is 6.1, perform an incremental approximation retrieval process on the fractional part of the lower limit value 2.6. No 0.6 is matched within the 2.1, 2.3, 2.5 decimals of the ciphertext index. At this time, take 3 in the ciphertext index as the lower limit retrieval result matching the lower limit value 2.6, and based on this, obtain all data in the ciphertext index that is greater than or equal to 3 and less than or equal to the upper limit retrieval result as the hit data.

[0041] In this embodiment, the encrypted upper limit value includes the upper limit value integer encrypted data and the upper limit value fractional encrypted data; correspondingly, if Figure 5As shown, perform hash encryption processing on the upper limit value of the retrieval keyword to obtain the encrypted upper limit value, and perform data retrieval in the ciphertext index according to the encrypted upper limit value to obtain the upper limit retrieval result, including: d1. Extract the integer part and decimal part of the upper limit value in the retrieval keyword; d2. Perform hash encryption processing on the integer part of the upper limit value to obtain the integer encrypted data of the upper limit value, and perform data retrieval in the ciphertext index according to the integer encrypted data of the upper limit value. If any integer ciphertext in the ciphertext index is hit, go to step d3. If not, perform a decreasing approximation retrieval process on the integer part of the upper limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty; d3. Perform hash encryption processing on the decimal part of the upper limit value to obtain the decimal encrypted data of the upper limit value, and perform data retrieval in the decimal ciphertext subsequence corresponding to the any integer ciphertext according to the decimal encrypted data of the upper limit value. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain the upper limit retrieval result matching the upper limit value. If not, perform a decreasing approximation retrieval process on the decimal part of the upper limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty.

[0042] In step d2 of this embodiment, performing a decreasing approximation retrieval process on the integer part of the upper limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty includes: Perform a decreasing calculation on the integer part of the upper limit value to obtain a decreasing calculation result, and when the decreasing calculation result is less than the lower limit value, perform hash encryption processing on the decreasing calculation result to obtain decreasing encrypted data; Perform data retrieval in the ciphertext index according to the decreasing encrypted data. If any integer ciphertext in the ciphertext index is hit, go to step d3. If not, perform a decreasing calculation on the integer part of the upper limit value again until any integer ciphertext in the ciphertext index is hit, or it is determined that the retrieval result is empty when the decreasing calculation result is not less than the lower limit value; In step d3, performing a decreasing approximation retrieval process on the decimal part of the upper limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty includes: Subtract a counting unit from the decimal part of the upper limit value to obtain a data after cumulative subtraction; Judge whether the data after cumulative subtraction is less than 0; If so, perform hash encryption processing on the data after subtraction to obtain encrypted subtraction data, and perform data retrieval within the fractional ciphertext subsequence corresponding to any integer ciphertext according to the encrypted subtraction data. If any fractional ciphertext in the fractional ciphertext subsequence is hit, an upper limit retrieval result matching the upper limit value is obtained. If not, use the encrypted subtraction data as the fractional part of the new upper limit value and subtract a counting unit from it; If not, take the nearest integer less than the encrypted subtraction data as the upper limit retrieval result matching the upper limit value or determine that the retrieval result is empty. Specifically, in this embodiment, if the data after accumulation is not less than 0, take the nearest integer less than the encrypted subtraction data as the next integer, and further determine whether the next integer is less than the lower limit value. If so, determine that the retrieval result is empty. Otherwise, take the next integer as the upper limit retrieval result matching the upper limit value.

[0043] As an example, if the plaintext corresponding to the ciphertext index is: 2.1, 2.3, 2.5, 3, 3.1, 3.2, 3.5, 4, 4.1, 4.2, 5, 6.2, 6.3; When the data type of the retrieval keyword is numerical data, the retrieval keyword is range value data, and the lower limit value of the retrieval keyword is 2.6 and the upper limit value is 6.1, perform a decreasing approximation retrieval process on the fractional part of the upper limit value 6.1. No 0.1 is matched within the 6.2 and 6.3 decimals of the ciphertext index. At this time, take 5 in the ciphertext index as the upper limit retrieval result matching the upper limit value 6.1, and all data greater than or equal to 3 and less than or equal to 5 in the ciphertext index can be obtained as the hit data based on this.

[0044] The resource consumption of data retrieval in this embodiment is small and the retrieval efficiency is high. Specifically, when performing data retrieval based on the ciphertext index, only perform hash encryption processing on the retrieval keyword in the retrieval request to obtain the keyword ciphertext, and perform data retrieval in the ciphertext index according to the keyword ciphertext to obtain the retrieval result. In this process, this embodiment only needs to use the hash encryption algorithm to perform encryption calculation on the keyword and perform data retrieval in the ciphertext index with the encrypted keyword ciphertext. It can reduce unnecessary complex operations while ensuring security, significantly reducing the calculation steps and resource consumption, and having a high retrieval efficiency.

[0045] Embodiment 4: This embodiment discloses a data retrieval system for implementing the data retrieval method in Embodiment 3; the data retrieval system includes: A request receiving module, configured to receive a retrieval request bound with a retrieval keyword; wherein, the retrieval keyword is character type data or numerical type data; A data retrieval module, communicatively connected to the request receiving module, is configured to perform hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and perform data retrieval in the ciphertext index according to the keyword ciphertext so as to obtain a retrieval result.

[0046] It should be noted that for the working process, working details and technical effects of the data retrieval system provided in Embodiment 4, reference can be made to Embodiment 3, which will not be elaborated herein.

[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features. And these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for constructing a ciphertext index, characterized in that Including: Receiving original data, and performing interpolation sorting processing on the original data according to the data type of the original data to obtain an initial index; wherein, the original data includes character data and numerical data, and the initial index includes a character-type initial index corresponding to the character data and a numerical-type initial index corresponding to the numerical data; Performing hash encryption processing on the original data in the initial index, and deleting the original data in the initial index to obtain a ciphertext index; wherein, the index branches of the ciphertext index include a character-type ciphertext index corresponding to the character data and a numerical-type ciphertext index corresponding to the numerical data.

2. The method for constructing a ciphertext index according to claim 1, wherein When the data type of the original data is character data, performing interpolation sorting processing on the original data to obtain an initial index, including: Extracting the first letter corresponding to the original data, and performing interpolation sorting processing on the original data in a preset character sequence according to the order of its first letter to obtain a character-type initial index; When the data type of the original data is numerical data, performing interpolation sorting processing on the original data to obtain an initial index, including: Extracting the integer part and the decimal part of the original data; Inserting the integer part of the original data into a preset ordered integer sequence in ascending order, and inserting the decimal part of the original data into a decimal subsequence corresponding to the integer part of the original data in ascending order to obtain a numerical-type initial index.

3. A method for constructing a ciphertext index according to claim 1, characterized in that, Performing hash encryption processing on the original data in the initial index, including: Obtaining an interference factor, and splicing the original data in the initial index with the interference factor to obtain spliced data; Performing hash encryption processing on the spliced data to obtain an index ciphertext corresponding to the original data in the initial index.

4. A data retrieval method, characterized in that, Including: Receiving a retrieval request bound with a retrieval keyword; wherein, the retrieval keyword is character data or numerical data; Performing hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and performing data retrieval in the ciphertext index according to the keyword ciphertext to obtain a retrieval result.

5. A data retrieval method according to claim 4, characterized in that, When the data type of the retrieval keyword is character data, the keyword ciphertext includes character encrypted data; correspondingly, performing hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, including: performing hash encryption processing on the retrieval keyword to obtain character encrypted data; When the data type of the retrieval keyword is numerical data and the retrieval keyword is a single-value data, the keyword ciphertext includes integer encrypted data and decimal encrypted data; correspondingly, performing hash encryption processing on the retrieval keyword to obtain a keyword ciphertext, and performing data retrieval in the ciphertext index according to the keyword ciphertext to obtain a retrieval result, including: Extracting the integer part and the decimal part of the retrieval keyword; Perform hash encryption processing on the integer part of the retrieval keyword to obtain integer encrypted data, and perform data retrieval in the ciphertext index according to the integer encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to the next step; if not, determine that the retrieval result is empty. Perform hash encryption processing on the decimal part of the retrieval keyword to obtain decimal encrypted data, and perform data retrieval in the decimal ciphertext subsequence corresponding to the any integer ciphertext according to the decimal encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain the ciphertext retrieval result matching the retrieval keyword; if not, determine that the retrieval result is empty.

6. A data retrieval method according to claim 4, wherein When the data type of the retrieval keyword is numerical data and the retrieval keyword is a range value data, perform hash encryption processing on the retrieval keyword to obtain keyword ciphertext, and perform data retrieval in the ciphertext index according to the keyword ciphertext to obtain the retrieval result, including: Perform hash encryption processing on the lower limit value of the retrieval keyword to obtain the encrypted lower limit value, and perform data retrieval in the ciphertext index according to the encrypted lower limit value to obtain the lower limit retrieval result. Perform hash encryption processing on the upper limit value of the retrieval keyword to obtain the encrypted upper limit value, and perform data retrieval in the ciphertext index according to the encrypted upper limit value to obtain the upper limit retrieval result. Use the data between the lower limit retrieval result and the upper limit retrieval result in the ciphertext index as the retrieval result.

7. A data retrieval method according to claim 6, characterized in that, The encrypted lower limit value includes lower limit integer encrypted data and lower limit decimal encrypted data; correspondingly, perform hash encryption processing on the lower limit value of the retrieval keyword to obtain the encrypted lower limit value, and perform data retrieval in the ciphertext index according to the encrypted lower limit value to obtain the lower limit retrieval result, including: c1. Extract the integer part and decimal part of the lower limit value in the retrieval keyword. c2. Perform hash encryption processing on the integer part of the lower limit value to obtain lower limit integer encrypted data, and perform data retrieval in the ciphertext index according to the lower limit integer encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to step c3; if not, perform incremental approximation retrieval processing on the integer part of the lower limit value until any integer ciphertext in the ciphertext index is hit or determine that the retrieval result is empty. c3. Perform hash encryption processing on the decimal part of the lower limit value to obtain lower limit decimal encrypted data, and perform data retrieval in the decimal ciphertext subsequence corresponding to the any integer ciphertext according to the lower limit decimal encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain the lower limit retrieval result matching the lower limit value; if not, perform incremental approximation retrieval processing on the decimal part of the lower limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or determine that the retrieval result is empty.

8. A data retrieval method according to claim 7, characterized in that, In step c2, perform an incremental approximation retrieval process on the integer part of the lower limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty, including: Perform an incremental calculation on the integer part of the lower limit value to obtain an incremental calculation result, and when the incremental calculation result is less than the upper limit value, perform a hash encryption process on the incremental calculation result to obtain incremental encrypted data; Perform a data retrieval within the ciphertext index based on the incremental encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to step c3. If not, perform an incremental calculation on the integer part of the lower limit value again until any integer ciphertext in the ciphertext index is hit, or it is determined that the retrieval result is empty when the incremental calculation result is not less than the upper limit value; In step c3, perform an incremental approximation retrieval process on the decimal part of the lower limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty, including: Add a counting unit to the decimal part of the lower limit value to obtain an accumulated data; Determine whether the accumulated data is less than 1; If so, perform a hash encryption process on the accumulated data to obtain accumulated encrypted data, and perform a data retrieval within the decimal ciphertext subsequence corresponding to the any integer ciphertext based on the accumulated encrypted data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, obtain a lower limit retrieval result matching the lower limit value. If not, use the accumulated data as the decimal part of the new lower limit value and add a counting unit to it; If not, take the nearest integer greater than the accumulated data as the lower limit retrieval result matching the lower limit value or determine that the retrieval result is empty.

9. A data retrieval method according to claim 6, wherein The encrypted upper limit value includes upper limit integer encrypted data and upper limit decimal encrypted data; correspondingly, perform a hash encryption process on the upper limit value of the retrieval keyword to obtain the encrypted upper limit value, and perform a data retrieval within the ciphertext index based on the encrypted upper limit value to obtain an upper limit retrieval result, including: d1. Extract the integer part and decimal part of the upper limit value in the retrieval keyword; d2. Perform a hash encryption process on the integer part of the upper limit value to obtain upper limit integer encrypted data, and perform a data retrieval within the ciphertext index based on the upper limit integer encrypted data. If any integer ciphertext in the ciphertext index is hit, proceed to step d3. If not, perform a decremental approximation retrieval process on the integer part of the upper limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty; d3. Perform hash encryption on the decimal part of the upper limit value to obtain the encrypted decimal data of the upper limit value, and perform data retrieval within the decimal ciphertext subsequence corresponding to any integer ciphertext according to the encrypted decimal data of the upper limit value. If any decimal ciphertext in the decimal ciphertext subsequence is hit, the upper limit retrieval result matching the upper limit value is obtained. If not, perform a decreasing approximation retrieval process on the decimal part of the upper limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty.

10. A data retrieval method according to claim 9, characterized in that, In step d2, performing a decreasing approximation retrieval process on the integer part of the upper limit value until any integer ciphertext in the ciphertext index is hit or it is determined that the retrieval result is empty includes: Perform a decreasing calculation on the integer part of the upper limit value to obtain a decreasing calculation result, and when the decreasing calculation result is less than the lower limit value, perform hash encryption on the decreasing calculation result to obtain the encrypted decreasing data; Perform data retrieval in the ciphertext index according to the encrypted decreasing data. If any integer ciphertext in the ciphertext index is hit, enter step d3. If not, perform a decreasing calculation on the integer part of the upper limit value again until any integer ciphertext in the ciphertext index is hit, or it is determined that the retrieval result is empty when the decreasing calculation result is not less than the lower limit value; In step d3, performing a decreasing approximation retrieval process on the decimal part of the upper limit value until any decimal ciphertext in the decimal ciphertext subsequence is hit or it is determined that the retrieval result is empty includes: Subtract a counting unit from the decimal part of the upper limit value to obtain the data after cumulative subtraction; Determine whether the data after cumulative subtraction is less than 0; If so, perform hash encryption on the data after cumulative subtraction to obtain the encrypted cumulative subtraction data, and perform data retrieval within the decimal ciphertext subsequence corresponding to any integer ciphertext according to the encrypted cumulative subtraction data. If any decimal ciphertext in the decimal ciphertext subsequence is hit, the upper limit retrieval result matching the upper limit value is obtained. If not, use the encrypted cumulative subtraction data as the decimal part of the new upper limit value and subtract a counting unit from it; If not, take the nearest integer less than the encrypted cumulative subtraction data as the upper limit retrieval result matching the upper limit value or determine that the retrieval result is empty.

Citation Information

Patent Citations

  • Ciphertext data tokenization fuzzy query method and system and storage medium

    CN116611099A

  • Keyword hiding and tracing query method and device based on homomorphic encryption

    CN116756185A

  • Rapid construction and storage method for encrypted file index

    CN118394714A

  • Homomorphic keyword privacy information retrieval method and system based on polynomial link

    CN119918088A

  • Encrypted search

    US20210105138A1