Method and device for fuzzy query of encrypted data, processor and readable storage medium

By converting search keywords into search fields and matching and decrypting based on the search fields in the encrypted database, the problem of large memory usage in fuzzy queries on encrypted data is solved, and more efficient fuzzy queries are achieved.

CN120653690APending Publication Date: 2025-09-16ZHONGLIAN SMART AGRI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410300821.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-15
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

The existing technology has the problem of occupying a large amount of memory when performing fuzzy queries on encrypted data.

Method used

By converting search keywords into search fields and matching and decrypting them based on the search fields in the pre-built encrypted database, fuzzy query results can be obtained and memory usage can be reduced.

Benefits of technology

Without changing the data encryption method, the memory usage is reduced and the efficiency of fuzzy query is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653690A_ABST
    Figure CN120653690A_ABST
Patent Text Reader

Abstract

The invention discloses an encrypted data fuzzy query method and device, a processor and a readable storage medium, and belongs to the technical field of data query. Converting the search keyword into a search field according to a set operation rule; on the basis of a pre-constructed encrypted database, corresponding target encrypted data is determined according to the search field, the encrypted database comprises multiple pieces of encrypted data, and the corresponding search field is stored in each piece of encrypted data in an associated mode; and decrypting the target encrypted data to obtain a fuzzy query result corresponding to the search keyword. In the embodiment of the invention, the length of the search field is the same as that of the retrieval field. The memory occupancy rate can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a method, device, processor, and readable storage medium for fuzzy query of encrypted data. Background Art

[0002] With the increasing informatization of society, a large amount of sensitive data is stored in databases. When data is stored in databases, it is often encrypted to prevent leakage. While encrypted data effectively prevents data leakage, it introduces difficulties in querying the data. Because databases store encrypted data, and users perform fuzzy queries on the original data by entering plaintext, direct plaintext searches are not possible. Furthermore, when sensitive data is encrypted and stored, the entire data is usually encrypted, rather than segmented, making it impossible to search directly using ciphertext.

[0003] To address this issue, existing techniques implement fuzzy queries on encrypted databases by changing the data encryption method. These techniques encrypt the plaintext byte by byte and then concatenate and store the encrypted ciphertexts, allowing fuzzy queries to be performed directly on the ciphertext. However, when the plaintext is long, encrypting the plaintext byte by byte and then concatenating and storing the encrypted ciphertexts takes up a lot of storage space. Consequently, existing techniques require a large amount of memory. Summary of the Invention

[0004] The purpose of the embodiments of the present application is to provide a method, device, processor and machine-readable storage medium for fuzzy query of encrypted data, so as to solve the problem of large memory usage in the prior art.

[0005] To achieve the above objectives, the first aspect of the embodiments of the present application provides a method for fuzzy querying encrypted data, the method comprising:

[0006] Get search keywords;

[0007] Convert search keywords into search fields according to the set operation rules;

[0008] Based on a pre-built encrypted database, determining corresponding target encrypted data according to the search field, wherein the encrypted database includes multiple pieces of encrypted data, each piece of encrypted data is associated with and stored with a corresponding search field;

[0009] Decrypt the target encrypted data to obtain the fuzzy query results corresponding to the search keywords.

[0010] In the embodiment of the present application, the search field and the retrieval field have the same field length.

[0011] In an embodiment of the present application, the method also includes: upon receiving newly inserted data, encrypting the newly inserted data according to set encryption rules to obtain encrypted data; determining the search field of the newly inserted data according to set operation rules; and associating the encrypted data and the search field of the newly inserted data into an encrypted database to update the encrypted database.

[0012] In an embodiment of the present application, converting the search keyword into a search field according to the set operation rules includes: converting the search keyword into a byte array; obtaining an initial identification array, the length of the initial identification array being a preset length; performing a modulo operation on each byte in the byte array and the value of the preset length to obtain an operation result data set; and assigning a value to the initial identification array according to the operation result data set to obtain a search field.

[0013] In an embodiment of the present application, the initial identification array is assigned a value according to the operation result data set to obtain a search field, including: updating the operation result data set based on a preset value to obtain an updated operation result data set; matching each data in the operation result data set with each element subscript in the initial identification array; updating the element corresponding to the successfully matched element subscript to the set value to obtain the search field.

[0014] In an embodiment of the present application, based on a pre-built encrypted database, the corresponding target encrypted data is determined according to the search field, including: matching the search field with multiple search fields in the encrypted database respectively; obtaining the encrypted data corresponding to all successfully matched search fields to obtain the target encrypted data.

[0015] In an embodiment of the present application, matching the search field with multiple search fields in the encrypted database includes: for any search field in the multiple search fields, comparing the values ​​of each element in the search field with the values ​​of the elements with the same subscript in any search field; if the values ​​of each element in the search field are less than or equal to the values ​​of the elements corresponding to the same subscript in any search field, the match is determined to be successful.

[0016] A second aspect of the present application provides a processor configured to execute the above-mentioned method for fuzzy query of encrypted data.

[0017] A third aspect of the present application provides a device for fuzzy query of encrypted data, the device comprising:

[0018] Data acquisition module, used to obtain search keywords;

[0019] The data conversion module is used to convert the search keywords into search fields according to the set operation rules;

[0020] A data query module is used to determine the corresponding target encrypted data according to the search field based on the pre-built encryption database;

[0021] The data decryption module is used to decrypt the target encrypted data to obtain the fuzzy query results corresponding to the search keywords.

[0022] A fourth aspect of the present application provides a machine-readable storage medium, which stores a program or instruction. When the program or instruction is executed by a processor, the above-mentioned method of fuzzy query of encrypted data is implemented.

[0023] The above technical solution first obtains the search keyword, then converts the search keyword into a search field according to the set operation rules, and then determines the corresponding target encrypted data based on the search field based on a pre-built encrypted database. The encrypted database includes multiple encrypted data, each of which is associated with a corresponding search field. Finally, the target encrypted data is decrypted to obtain the fuzzy query result corresponding to the search keyword. This application can reduce memory usage.

[0024] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following detailed description, they are used to explain the embodiments of the present application but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0026] Figure 1 A flowchart of a method for fuzzy query of encrypted data provided in an embodiment of the present application;

[0027] Figure 2 This is a structural block diagram of a device for fuzzy query of encrypted data provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] To make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0029] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the various components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indications will also change accordingly.

[0030] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the fact that they can be implemented by ordinary technicians in this field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0031] Figure 1 A flowchart of a method for fuzzy query of encrypted data provided by an embodiment of the present application. Figure 1 As shown, an embodiment of the present application provides a method for fuzzy query of encrypted data, which is described by taking the application of the method to a processor as an example. The method may include the following steps.

[0032] Step S101: Obtain search keywords.

[0033] Step S102: converting the search keyword into a search field according to the set operation rules.

[0034] Step S103: Based on the pre-built encryption database, the corresponding target encrypted data is determined according to the search field. The encryption database includes multiple pieces of encrypted data, and each piece of encrypted data is associated with and stored with a corresponding search field.

[0035] Step S104: decrypt the target encrypted data to obtain the fuzzy query result corresponding to the search keyword.

[0036] In the embodiments of this application, a search keyword refers to textual data entered by a user for a fuzzy query. A search field refers to the data corresponding to the search keyword used to query the encrypted database. The search field and the retrieval field associated with each encrypted data item in the encrypted database are derived using the same set operation rules. Therefore, fuzzy queries can be performed on the encrypted database based on the search field and the retrieval field.

[0037] Specifically, after the processor obtains the search keyword input by the user, it can convert the search keyword into a search field according to the set operation rules. The function of the set operation rules is to first convert a piece of text data into a byte array, that is, to represent the text data in the form of an array, and then convert the byte array into an identification array of a set length through the set calculation rules. Among them, the set calculation rules can be determined according to actual development needs, and its purpose is to convert the byte array into an identification array of a set length for subsequent data matching during fuzzy queries. It can be understood that the identification array obtained by processing the search keyword through the set operation rules is the search keyword, and the identification array obtained by processing the data to be encrypted through the set operation rules is the retrieval field of the data to be encrypted. The retrieval field can be associated with the encrypted data obtained after encrypting the data to be encrypted and stored in the encryption database.

[0038] It is understood that a pre-built encrypted database refers to a database that encrypts sensitive data that requires encryption. Unlike traditional encrypted databases, in this embodiment, the encrypted database not only stores encrypted data but also associates each encrypted data item with a corresponding search field to facilitate subsequent fuzzy queries. It should be noted that the memory occupied by the search field is much lower than the memory occupied by the encrypted data.

[0039] Furthermore, after the processor converts the search keyword into a search field, it can use the search field to perform a fuzzy query on the encrypted database to obtain the target encrypted data corresponding to the search field. In one example, the processor can match the search fields one by one with the search fields in the encrypted database, and determine the encrypted data stored in association with the successfully matched search fields as the target encrypted data. It can be understood that the target encrypted data can be one or more. Finally, the processor can decrypt the target encrypted data according to the set decryption rules, thereby obtaining the fuzzy query result corresponding to the search keyword entered by the user. It should be noted that the embodiment of the present application does not limit the encryption and decryption rules of the data. It only needs to correspond to the encryption and decryption rules, and any encryption rules can be used.

[0040] Thus, compared to the prior art method of performing fuzzy queries after encrypting data in segments, the present embodiment employs a set of operation rules to perform fuzzy queries based on the search field and the retrieval field. This does not change the data encryption method and only requires more memory for the retrieval field. The memory occupied by the retrieval field is much smaller than the total memory occupied by the encrypted data, thus saving more memory space than the segmented data encryption method. In addition, the present embodiment only requires the conversion of search keywords during the fuzzy query stage, which also improves the efficiency of fuzzy queries.

[0041] The above technical solution first obtains a search keyword, then converts the search keyword into a search field according to a set operation rule, and then determines the corresponding target encrypted data based on the search field based on a pre-built encrypted database, wherein the encrypted database includes multiple encrypted data, each of which is associated with and stores a corresponding search field. Finally, the target encrypted data is decrypted to obtain a fuzzy query result corresponding to the search keyword. This application can obtain a fuzzy query result for a fuzzy query using the search keyword by adding a search field in the database and combining it with the search field obtained by converting the search keyword. This is beneficial for improving the efficiency of fuzzy queries on encrypted data while reducing memory usage.

[0042] In the embodiment of the present application, the search field and the retrieval field have the same field length.

[0043] It is understood that since the embodiments of the present application require fuzzy queries based on search and retrieval fields, in order to further improve the efficiency of fuzzy queries, the processor can use the same set operation rules to obtain the search and retrieval fields. Both are essentially identifier arrays, so the search and retrieval fields have the same length and occupy the same memory size. Preferably, the length of the identifier array can be manually set. The longer the identifier array, the higher the accuracy of subsequent model queries.

[0044] In an embodiment of the present application, converting the search keyword into a search field according to the set operation rules may include: converting the search keyword into a byte array; obtaining an initial identification array, the length of the initial identification array being a preset length; performing a modulo operation on each byte in the byte array and the value of the preset length to obtain an operation result data set; and assigning a value to the initial identification array according to the operation result data set to obtain a search field.

[0045] Specifically, first convert the search keyword into a byte array, that is, convert the search keyword into the form of a corresponding binary array. Then, obtain the initial identification array, that is, the array length is the preset length, that is, the number of bits occupied is the set number of bits, and the array elements are all binary arrays of set values; for example, the number of bits occupied by the identification array is 64 bits, and the elements in the array are all 0. Then, each byte in the byte array is respectively modulo-operated with the value of the length of the identification array, that is, remainder operation, and the operation result is stored in the operation result data set. It can be understood that since it is a modulo operation performed on the set length, each data in the operation result data set is less than or equal to the set length. Further, the initial identification array is assigned according to the operation result data set, and the assigned identification array is determined as the search field of the search keyword.

[0046] In an embodiment of the present application, the initial identification array is assigned a value according to the operation result data set to obtain a search field, which may include: updating the operation result data set based on a preset value to obtain an updated operation result data set; matching each data in the operation result data set with each element subscript in the initial identification array; updating the element corresponding to the successfully matched element subscript to the set value to obtain the search field.

[0047] Specifically, the method for assigning values ​​to the initial identification array based on the calculation result data set to obtain the search field corresponding to the search keyword can be performed based on the subscript of the initial identification array. Since the length of the initial identification array is the set length, the subscript range of the initial identification array is 0 to length-1, while the value range of the data in the calculation result data set is 1 to length. Therefore, it is necessary to first update the calculation result data set by subtracting 1 from all data in the calculation result data set to obtain an updated calculation result data set. Furthermore, based on the data in the updated calculation result data set, the elements with the same subscript in the initial identification array are assigned values, and the elements corresponding to the element subscripts are updated to the set values. The updated identification array is then determined as the search field for the search keyword. For example, if a certain data in the updated calculation result data set is a, the element with subscript a in the initial identification array is assigned a value. If the initial identification array is addrFlag, addrFlag[a] is assigned a value. Based on this, all data in the updated calculation result data set are used to assign values ​​to the initial identification array to obtain the assigned identification array.

[0048] In one example, the element corresponding to the element subscript in the initial identification array that is the same as the data in the updated calculation result data set can be assigned a fixed value. For example, if the subscript a has a corresponding a in the updated calculation result data set, addrFlag[a] is set to 1 or other set fixed values. If there are multiple a's in the updated calculation result data set, addrFlag[a] is also only set to 1 or other set fixed values. In another example, the element corresponding to the element subscript in the initial identification array that is the same as the data in the updated calculation result data set can be assigned a cumulative value. For example, if there is one a in the new calculation result data set, addrFlag[a] is set to 1 or other set fixed values. If there are n a's in the updated calculation result data set, addrFlag[a] is set to n or n times of other set fixed values.

[0049] In this way, the above method is used to determine the search field corresponding to the search keyword, and its calculation speed is faster, which is conducive to improving the efficiency of fuzzy query.

[0050] In an embodiment of the present application, the method may further include: upon receiving newly inserted data, encrypting the newly inserted data according to set encryption rules to obtain encrypted data; determining the search field of the newly inserted data according to set operation rules; and associating the encrypted data and the search field of the newly inserted data in an encrypted database to update the encrypted database.

[0051] It is understood that newly inserted data refers to sensitive data to be stored in the encrypted database. If the data type stored in the encrypted database is geological data, the newly inserted data is a new piece of geological information. When storing newly inserted data in the encrypted data, the processor needs to convert the newly inserted data into encrypted data and a search field, respectively, and then associate the encrypted data with the search field and store it in the encrypted database. Specifically, the processor can use set encryption rules to encrypt the newly inserted data to obtain the corresponding encrypted data. At the same time, the processor can determine the search field corresponding to the newly inserted encrypted data by setting an operation rule. The specific operation method is the same as the operation method for converting the search keyword into the search field mentioned above. Finally, the encrypted data and the search field of the newly inserted data can be associated and stored in the encrypted database to obtain the updated encrypted data. It should be noted that the embodiments of the present application do not limit the encryption and decryption rules of the data. It only needs to correspond to the encryption and decryption rules, and any encryption rules can be used. In this way, the encrypted database can be updated as needed.

[0052] In an embodiment of the present application, based on a pre-built encrypted database, determining the corresponding target encrypted data according to the search field can include: matching the search field with multiple search fields in the encrypted database respectively; obtaining the encrypted data corresponding to all successfully matched search fields to obtain the target encrypted data.

[0053] It can be understood that the target encrypted data refers to the encrypted data corresponding to the sensitive data containing the search keyword in the encrypted database before encryption. Because each piece of encrypted data in the encrypted database is associated with a corresponding search field, and the search field and the search field are obtained using the same calculation rules, the search field can be directly matched against the search field in the encrypted database one by one, and all encrypted data corresponding to the search field that successfully matches the search field is determined as the target encrypted data. This allows for rapid fuzzy query results corresponding to the search keyword in the encrypted database, improving the efficiency of fuzzy queries.

[0054] In an embodiment of the present application, matching the search field with multiple search fields in the encrypted database may include: for any search field in the multiple search fields, comparing the values ​​of each element in the search field with the values ​​of the elements with the same subscript in any search field; if the values ​​of each element in the search field are less than or equal to the values ​​of the elements corresponding to the same subscript in any search field, determining that the match is successful.

[0055] It is understood that since both the search field and the search field are in array form, a matching method can be set based on the set operation rules. Since the array lengths of the search field and the search field are the same, elements in corresponding positions can be matched to determine the matching result.

[0056] In one example, if the method of assigning values ​​to the initial identification array in the set operation rules used is to assign set values, then if the subscript corresponding to each element in the search field whose element value is the set value contains the subscript corresponding to each element in the search field whose element value is the set value, it means that the search field and the search field are matched successfully; otherwise, the match fails. In another example, if the method of assigning values ​​to the initial identification array in the set operation rules used is cumulative assignment, then if the element value of each element in the search field is greater than the element value of each element at the corresponding position in the search field, it means that the search field and the search field are matched successfully; otherwise, the match fails. In this way, the target encrypted data corresponding to the search field can be quickly determined.

[0057] In a specific embodiment of the present application, a method for fuzzy query of encrypted data is provided. The method is described by taking the array length of the identification array as 64 bits and the data type bit address data stored in the encrypted database as an example. The specific steps of the method are as follows:

[0058] Step 1: The user enters the search keyword search address keywords.

[0059] Step 2: Calculate the search field corresponding to the search keyword.

[0060] Because the original address text is not stored in the database, it is not possible to perform a fuzzy query directly in the database based on the search keyword. In order to perform a fuzzy query on the address, the search field keywordsFlag needs to be calculated. The calculation process is as follows:

[0061] 1. Save each byte of keywords into the byte array keywordsBytes;

[0062] 2. Set N = 64, where N represents the number of bits occupied by the initial identification array keywordsFlag.

[0063] 3. Initialize keywordsFlag = 0. At this time, each bit in keywordsFlag is 0, as shown in Table 1. Table 1 represents the initial identification array.

[0064] Table 1

[0065] No. 1 No. 2 No. 3 No. 4 No. 5 No. 6 No. 64 0 0 0 0 0 0 … 0

[0066] 4. For each byte keywordsBytes[i] of keywords (keywordsBytes[i] represents the i+1th byte of keywords) (note: in the calculation, one byte occupies 8 bits, so the value range of keywordsBytes[i] is 0-255), modulo N, and get the remainder remainder = keywordsBytes[i]%N, the value range of remainder is 0-63 (because N is 64), and set the remainder+1th bit of keywordsFlag to 1. If remainder is assumed to be 3, then the element value of keywordsFlag is shown in Table 2. Table 2 is the identification array after assignment, that is, the search field.

[0067] Table 2

[0068] No. 1 No. 2 No. 3 No. 4 No. 5 No. 6 No. 64 0 0 0 1 0 0 … 0

[0069] Step 3: Use the search field to perform fuzzy query on the encrypted database.

[0070] The encrypted database user_address stores multiple encrypted data items. Each encrypted data item is associated with a corresponding search field address_flag. The search field address_flag is also determined using the above method. Then, using keywordsFlag, a fuzzy query is performed on the encrypted database. The query method is as follows:

[0071] select*from user_address where address_flag&keywordsFlag>=keywordsFlag

[0072] For example, the element value of a search field in the encrypted database is shown in Table 3, which is a search field in the encrypted database.

[0073] Table 3

[0074] No. 1 No. 2 No. 3 No. 4 No. 5 No. 6 No. 64 1 0 0 0 1 1 … 0

[0075] The encrypted data corresponding to the search field can be queried through the search field.

[0076] By decrypting all the encrypted data found in the query, you can get the fuzzy query results corresponding to the search keyword.

[0077] The above technical solution enables fuzzy queries on encrypted databases. This approach eliminates the need to encrypt plaintext byte by byte, requiring only N additional bits of storage space. Furthermore, fuzzy queries on encrypted data are performed using bitwise operations, resulting in even higher query efficiency than plaintext fuzzy queries. This helps conserve memory space and improves the efficiency of fuzzy queries.

[0078] An embodiment of the present application also provides a processor configured to execute the method for fuzzy query of encrypted data in the above embodiment.

[0079] Figure 2 This is a structural block diagram of a device for fuzzy query of encrypted data provided by an embodiment of the present application. Figure 2 As shown, the embodiment of the present application further provides a device 200 for fuzzy query of encrypted data, the device 200 comprising:

[0080] The data acquisition module 210 is used to acquire search keywords.

[0081] The data conversion module 220 is used to convert the search keyword into a search field according to a set operation rule.

[0082] The data query module 230 is configured to determine corresponding target encrypted data according to a search field based on a pre-built encryption database.

[0083] The data decryption module 240 is used to decrypt the target encrypted data to obtain the fuzzy query result corresponding to the search keyword.

[0084] The device 200 for fuzzy querying encrypted data described above first obtains a search keyword, then converts the search keyword into a search field according to a set operation rule, and then determines the corresponding target encrypted data based on the search field based on a pre-built encrypted database, wherein the encrypted database includes multiple encrypted data, each of which is associated with and stores a corresponding search field. Finally, the target encrypted data is decrypted to obtain a fuzzy query result corresponding to the search keyword. The present application can obtain a fuzzy query result for a fuzzy query using the search keyword by adding a search field in the database and combining it with the search field obtained by converting the search keyword, which is beneficial for improving the efficiency of fuzzy querying of encrypted data while reducing memory usage.

[0085] In one embodiment, the search field and the search field have the same field length.

[0086] In one embodiment, when newly inserted data is received, the newly inserted data is encrypted according to the set encryption rules to obtain encrypted data; the search field of the newly inserted data is determined according to the set operation rules; the encrypted data and the search field of the newly inserted data are associated and stored in the encrypted database to update the encrypted database.

[0087] In one embodiment, the data conversion module 220 is also used to: convert the search keyword into a byte array; obtain an initial identification array, the length of the initial identification array being a preset length; perform a modulo operation on each byte in the byte array and the value of the preset length to obtain a calculation result data set; and assign a value to the initial identification array according to the calculation result data set to obtain a search field.

[0088] In one embodiment, the data conversion module 220 is also used to: update the calculation result data set based on a preset value to obtain an updated calculation result data set; match each data in the calculation result data set with each element index in the initial identification array; update the element corresponding to the successfully matched element index to the set value to obtain the search field.

[0089] In one embodiment, the data query module 230 is further configured to: match the search field with multiple search fields in the encrypted database respectively; and obtain the encrypted data corresponding to all successfully matched search fields to obtain target encrypted data.

[0090] In one embodiment, the data query module 230 is also used to: for any search field in multiple search fields, compare the values ​​of each element in the search field with the values ​​of the elements with the same subscript in any search field; if the values ​​of each element in the search field are less than or equal to the values ​​of the elements corresponding to the same subscript in any search field, determine that the match is successful.

[0091] An embodiment of the present application also provides a machine-readable storage medium, which stores a program or instruction. The method of fuzzy query of encrypted data in the above embodiment is implemented when the program or instruction is executed by a processor.

[0092] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0093] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0094] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0095] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0096] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0097] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0098] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0099] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0100] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A method for fuzzy query of encrypted data, characterized in that: The method comprises: Get search keywords; Convert the search keyword into a search field according to a set operation rule; Determining corresponding target encrypted data according to the search field based on a pre-built encrypted database, wherein the encrypted database includes a plurality of encrypted data, each encrypted data being associated with and stored with a corresponding search field; The target encrypted data is decrypted to obtain a fuzzy query result corresponding to the search keyword.

2. The method according to claim 1, characterized in that The search field and the retrieval field have the same field length.

3. The method according to claim 1, characterized in that The method further comprises: When receiving the newly inserted data, encrypt the newly inserted data according to the set encryption rules to obtain encrypted data; Determine the search field of the newly inserted data according to the set operation rules; The encrypted data of the newly inserted data and the search field are associated and stored in the encrypted database to update the encrypted database.

4. The method according to claim 1, wherein The converting the search keyword into a search field according to the set operation rules includes: Convert the search keyword into a byte array; Obtain an initial identification array, where the length of the initial identification array is a preset length; Performing a modulo operation on each byte in the byte array and the value of the preset length to obtain an operation result data set; The initial identification array is assigned a value according to the operation result data set to obtain the search field.

5. The method according to claim 4, characterized in that The assigning process to the initial identification array according to the operation result data set to obtain the search field includes: Updating the calculation result data set based on a preset value to obtain an updated calculation result data set; Matching each data in the operation result data set with each element subscript in the initial identification array respectively; The element corresponding to the successfully matched element index is updated to a set value to obtain the search field.

6. The method according to claim 1, characterized in that The determining of the corresponding target encrypted data according to the search field based on the pre-built encryption database includes: Matching the search field with multiple search fields in the encrypted database respectively; The encrypted data corresponding to all successfully matched search fields are obtained to obtain the target encrypted data.

7. The method according to claim 6, characterized in that The matching of the search field with the plurality of search fields in the encrypted database comprises: For any search field in the plurality of search fields, comparing the value of each element in the search field with the value of the element with the same subscript in the search field; If the values ​​of the elements in the search field are all less than or equal to the values ​​of the elements corresponding to the same subscript in any search field, the match is determined to be successful.

8. A processor, characterized in that: The method is configured to execute the encrypted data fuzzy query method according to any one of claims 1 to 7.

9. A device for fuzzy query of encrypted data, characterized in that: The device comprises: Data acquisition module, used to obtain search keywords; A data conversion module, configured to convert the search keyword into a search field according to a set operation rule; A data query module, configured to determine corresponding target encrypted data according to the search field based on a pre-built encryption database; The data decryption module is used to decrypt the target encrypted data to obtain the fuzzy query result corresponding to the search keyword.

10. A machine-readable storage medium storing a program or instruction, characterized in that: When the program or the instruction is executed by a processor, the method for fuzzy query of encrypted data according to any one of claims 1 to 7 is implemented.