File search method and apparatus
By considering file length and keyword weights, and combining differential privacy perturbation technology, a search index is generated, which solves the problem of low accuracy in relevance score calculation in existing technologies and achieves efficient and accurate file search.
Patent Information
- Application Number
- CN202211567229.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-07
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-12-07
AI Technical Summary
Existing file search methods do not take into account file length and keyword weight, resulting in low accuracy of relevance score calculation, which affects file search efficiency and success rate.
The relevance score is determined by calculating the length of the document set and the normalized keyword frequency. The relevance score is then processed using differential privacy perturbation technology to generate a search index. Finally, documents related to the search keyword are searched within the document set.
It improves the accuracy of relevance scores, enhances the efficiency and success rate of document searches, and ensures the privacy protection and accuracy of search results.
Smart Images

Figure CN116909993B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a file search method and apparatus. Background Technology
[0002] Searchable encryption technology allows cloud servers to perform keyword searches on encrypted databases, but after the search is complete, it returns all matching results, which can impose a significant unnecessary network load. Furthermore, users need to decrypt all returned files to obtain the ones most relevant to their interests, resulting in substantial computational overhead. In contrast, ranking search allows cloud servers to optimize search results by finding and returning the top few most relevant files based on the relevance score between the query keywords and the files. This is considered one of the most promising methods for implementing keyword search, saving significant computational and communication costs.
[0003] However, most current relevance score calculation methods use the Term Frequency-Inverse Document Frequency (TF-IDF) algorithm, which does not consider issues such as file length and keyword weight. In reality, keywords often appear more frequently in longer documents. Also, although the weight of a keyword should increase with the frequency of the term, the importance of a keyword cannot increase linearly with the frequency of the term. Therefore, the accuracy of the relevance score between keywords and documents calculated without considering file length and keyword weight is low, which affects the efficiency and success rate of document search. Summary of the Invention
[0004] This application provides a file search method and apparatus to solve the technical problem that the accuracy of the relevance score between keywords and files calculated without considering file length and keyword weight is low, which affects the efficiency and success rate of file search.
[0005] In a first aspect, embodiments of this application provide a file search method, including:
[0006] Based on the length of the document set, the length of the documents in the document set, and the normalized keyword frequency, the relevance score between the keyword to be searched and any document in the document set is obtained.
[0007] Differential privacy perturbation is applied to the correlation score to obtain the perturbed score;
[0008] A search index is generated based on the perturbed score;
[0009] The search index is used to search for files in the file set that are related to the keyword to be searched.
[0010] In one embodiment, the step of performing differential privacy perturbation on the correlation score to obtain the perturbed score includes:
[0011] The correlation score is converted to binary to obtain the binary score;
[0012] Differential privacy perturbation is applied to each bit of the binary fraction to obtain the perturbed fraction.
[0013] In one embodiment, obtaining the perturbed score includes:
[0014] Sort all perturbed scores in descending order to obtain the top K files; where K is an integer greater than or equal to 1.
[0015] Perform a hash encryption operation on any one of the K files to obtain a first hash value;
[0016] XOR the K first hash values to obtain the first XOR value;
[0017] A verification index is generated based on the first XOR value.
[0018] In one embodiment, generating a search index based on the perturbed score includes:
[0019] A linked list is generated based on the search keyword; each node in the linked list corresponds to a related file, and the related file is a file in the file set that contains the search keyword;
[0020] The perturbation score between the search keyword and the related files is stored in the corresponding node information;
[0021] The keyword to be searched is double-encrypted using a first pseudo-random function and a second pseudo-random function to obtain the value of the first pseudo-random function.
[0022] The first pseudo-random function value is XORed with the node to obtain a second XOR value, which is then used as the content of the corresponding node address.
[0023] The identifier of the relevant file is hashed to obtain a second hash value, which is then used as the identifier of the node address corresponding to the relevant file.
[0024] The keyword to be searched is encrypted using a third pseudo-random function to obtain the value of the second pseudo-random function;
[0025] The second pseudo-random function value is XORed with the node address to obtain the third XOR value;
[0026] Store the content of the node address and the identifier of the node address in a lookup table, and store the third XOR value in the search table;
[0027] A search index is generated based on the lookup table and the search table.
[0028] In one embodiment, searching the file set for files related to the keyword to be searched based on the search index includes:
[0029] Generate a search trap for the keyword to be searched, and broadcast the search trap through a blockchain network;
[0030] Receive the random key to the search trapdoor;
[0031] Set the head node of the linked list as the current node;
[0032] The search table is searched according to the search index to obtain the third XOR value, and the address of the current node in the lookup table is obtained according to the third XOR value.
[0033] Based on the address of the current node in the lookup table, the content of the current node's address is obtained according to the search index;
[0034] The content of the current node address is parsed and XORed to obtain the node information of the current node;
[0035] After replacing the current node with the next node in the linked list, return to the step of searching the search table according to the search index until the node information of all nodes in the linked list is obtained;
[0036] Sort the perturbed scores of all nodes from largest to smallest to obtain the top K relevant files.
[0037] In one embodiment, after obtaining the top K most relevant files, the process includes:
[0038] The result proof is generated based on the identifiers of the node addresses corresponding to the K related files;
[0039] The certificate from the random key is introduced into the verification index to obtain the verification index to be compared;
[0040] If the value of the index to be compared and verified is equal to the value of the result proof, then the relevant file search corresponding to the result proof is determined to be correct.
[0041] In one embodiment, after generating the search index based on the perturbed score, the process includes:
[0042] The files in the file set are encrypted using an encryption algorithm to obtain the ciphertext files.
[0043] The search index and the encrypted file are sent to the cloud server.
[0044] In one embodiment, after generating the verification index based on the first XOR value, the process includes:
[0045] Write the verification index into the blockchain.
[0046] Secondly, embodiments of this application provide a file search device, comprising:
[0047] The relevance score calculation module is used to: obtain the relevance score between the keyword to be searched and any file in the document set based on the length of the document set, the length of the files in the document set, and the normalized keyword frequency;
[0048] The differential privacy perturbation module is used to: perform differential privacy perturbation on the correlation score to obtain the perturbed score;
[0049] The search index generation module is used to: generate a search index based on the perturbed score;
[0050] The file search module is used to: search the file set for files related to the keyword to be searched, based on the search index.
[0051] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the steps of the file search method described in the first aspect.
[0052] The document search method and apparatus provided in this application first obtain a relevance score between the keyword to be searched and any file in the document set based on the length of the document set, the length of the files in the document set, and the normalized keyword frequency. Then, differential privacy perturbation is applied to the relevance score to obtain a perturbed score. A search index is then generated based on the perturbed score, and files related to the keyword to be searched are searched in the document set according to the search index. This application incorporates the length of the document set and the length of the files when calculating the relevance score, considering the impact of length on the relevance score. Simultaneously, keyword frequency is normalized to avoid the problem of keyword importance increasing linearly with frequency, thereby improving the accuracy of the relevance score and thus improving document search efficiency and success rate. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is one of the flowcharts illustrating the file search method provided in the embodiments of this application;
[0055] Figure 2 This is a second schematic flowchart of the file search method provided in the embodiments of this application;
[0056] Figure 3 This is the third flowchart illustrating the file search method provided in the embodiments of this application;
[0057] Figure 4 This is the fourth flowchart illustrating the file search method provided in the embodiments of this application;
[0058] Figure 5 This is the fifth flowchart illustrating the file search method provided in the embodiments of this application;
[0059] Figure 6 This is the sixth flowchart illustrating the file search method provided in the embodiments of this application;
[0060] Figure 7 A schematic diagram of the structure of the file search device provided in the embodiments of this application;
[0061] Figure 8 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0063] Figure 1 This is one of the flowcharts illustrating the file search method provided in this application. (Refer to...) Figure 1 This application provides a file search method, which may include:
[0064] 101. Based on the length of the document set, the length of the documents in the document set, and the normalized keyword frequency, obtain the relevance score between the keyword to be searched and any document in the document set;
[0065] 102. Apply differential privacy perturbation to the correlation scores to obtain the perturbed scores;
[0066] 103. Generate a search index based on the perturbed scores;
[0067] 104. Search the document set for documents related to the search keywords based on the search index.
[0068] In step 101, the correlation score can be calculated using the following formula:
[0069]
[0070] Among them, Score(F i ,w j ) represents the i-th file F in the file set F. i With the j-th keyword in the keyword set w j The correlation score between them, q is the proportion of long files in the file set F, TF ij For the j-th keyword in the i-th file F i Frequency of occurrence in ATF i For all keywords in the keyword set in the i-th file F i The average frequency of occurrences in the dataset, where L(F) is the length of the dataset F, and L(F) is the average frequency of occurrences in the dataset F. i ) represents the i-th file F in the file set F. i The length.
[0071] It should be noted that you can define long files according to the actual situation, and the proportion of long files can be measured based on the number and size of long files, or other aspects. There are no restrictions here.
[0072] The correlation score calculation method first performs a TF test. ij Take the logarithm of the value, then TF ij Using ATF i Normalization was performed to prevent the importance of keywords from varying with term frequency (TF). ij The problem of linear growth with increasing L(F); simultaneously utilizing L(F) and L(F) i ) to replace the total number of files and the total number of files containing keywords in traditional TF-IDF rules, respectively, and because Prefer to choose short files (because L(F) i When )→∞, The preference is to choose long files (because for long files, ln(1+ATF) i→1, while TF ij (Usually quite large), therefore, combined and It can fully consider the impact of file length on word frequency.
[0073] The file search method provided in this embodiment first obtains a relevance score between the keyword to be searched and any file in the file set based on the length of the file set, the length of the files in the file set, and the normalized keyword frequency. Then, differential privacy perturbation is applied to the relevance score to obtain a perturbed score. A search index is then generated based on the perturbed score, and files related to the keyword to be searched are searched in the file set according to the search index. This embodiment incorporates the length of the file set and the length of the files when calculating the relevance score, considering the impact of length on the relevance score. Simultaneously, keyword frequency normalization avoids the problem of keyword importance increasing linearly with frequency, thereby improving the accuracy of the relevance score and thus improving file search efficiency and success rate.
[0074] Figure 2 This is a second schematic flowchart of the file search method provided in the embodiments of this application. (Refer to...) Figure 2 In one embodiment, differential privacy perturbation is applied to the correlation score to obtain the perturbed score, which may include:
[0075] 201. Convert the correlation score to binary to obtain the binary score;
[0076] 202. Perform differential privacy perturbation on each bit of the binary fraction to obtain the perturbed fraction.
[0077] In step 202, each bit can be perturbed using random response techniques, and the resulting perturbed score is a permanent random response score.
[0078] make:
[0079]
[0080] Where P(S=x) is the probability of S=x, S is the perturbation score in this embodiment, ε is the privacy parameter, W is the keyword set, and B n This is the perturbation of the nth bit of the binary fraction in this embodiment.
[0081] but It satisfies differential privacy.
[0082] To prevent the leakage of privacy information through plaintext relevance scores, these scores need to be encrypted for protection. A common technique is order-preserving encryption. Order-preserving encryption maintains the plaintext order after encryption, but it is not secure and is vulnerable to security attacks, such as inference attacks and leak / abuse attacks. Furthermore, while order-preserving encryption protects plaintext content from leakage, the fact that the encrypted data still retains its plaintext order allows malicious actors to use known background knowledge, such as trending search rankings, to infer the plaintext content, which also poses a threat to data privacy and security.
[0083] Differential privacy technology primarily achieves privacy protection by perturbing relevant information. It can effectively resist known background attacks. No matter how strong the background knowledge of a malicious party is, they cannot deduce the plaintext information. At the same time, although the relevant information is perturbed, the original first few search results can still exist in the result set by adjusting the privacy parameters, only the ranking order is disrupted, thus ensuring the accuracy of the search results.
[0084] The classic differential privacy implementation algorithm, RAPPOR (Randomized Aggregatable Privacy-Preserving Ordinal Response), uses a Bloom filter to encode the data and then perform a secondary perturbation to achieve differential privacy. This process not only suffers from Bloom filter encoding position conflicts, but also has a cumbersome perturbation process.
[0085] This embodiment avoids the encoding conflict problem caused by using a Bloom filter by first encoding the relevance score into binary and then subjecting it to random perturbation. At the same time, it can achieve differential privacy protection, protect the privacy of the search result order, and solve the privacy problem caused by the leakage of plaintext order.
[0086] Figure 3 This is the third flowchart illustrating the file search method provided in this application's embodiments. (Refer to...) Figure 3 In one embodiment, after obtaining the perturbed score, the following may be included:
[0087] 301. Sort all perturbed scores from largest to smallest to obtain the top K files;
[0088] Where K is an integer greater than or equal to 1;
[0089] 302. Perform a hash encryption operation on any one of the K files to obtain the first hash value;
[0090] 303. XOR the K first hash values to obtain the first XOR value;
[0091] 304. Generate a verification index based on the first XOR value.
[0092] The verification index generated in this embodiment contains information about the K files with the highest scores after perturbation. This index can be used to verify the correctness of the returned search results. If any file in the returned search results is incorrect, its hash value will be different, resulting in inconsistency with the information in the verification index. Therefore, this verification index can correctly verify the correctness of the returned search results.
[0093] Figure 4 This is the fourth flowchart illustrating the file search method provided in this application's embodiments. (Refer to...) Figure 4 In one embodiment, generating a search index based on the perturbed score may include:
[0094] 401. Generate a linked list based on the keywords to be searched;
[0095] Each node in the linked list corresponds to a related file, which is a file in the file set that contains the keyword to be searched;
[0096] 402. Store the perturbed scores between the search keywords and related documents in the corresponding node information;
[0097] 403. Use the first pseudo-random function and the second pseudo-random function to perform double encryption on the keywords to be searched, and obtain the value of the first pseudo-random function;
[0098] 404. Perform an XOR operation between the first pseudo-random function value and the node to obtain the second XOR value, and use the second XOR value as the content of the corresponding node address;
[0099] 405. Perform a hash encryption operation on the identifier of the relevant file to obtain a second hash value, and use the second hash value as the identifier of the node address corresponding to the relevant file;
[0100] 406. Use the third pseudo-random function to encrypt the keywords to be searched, and obtain the value of the second pseudo-random function;
[0101] 407. Perform an XOR operation between the second pseudo-random function value and the node address to obtain the third XOR value;
[0102] 408. Store the content of the node address and the identifier of the node address in the lookup table, and store the third XOR value in the search table;
[0103] 409. Generate a search index based on the lookup table and the search table.
[0104] In step 402, the perturbed score between the keyword to be searched and any related file is stored in the node information corresponding to that related file.
[0105] In step 405, the identifier of the relevant file is pre-stored in the corresponding node information.
[0106] In step 407, the third XOR value is equal to the value after performing an encrypted pseudo-random permutation on the keyword to be searched.
[0107] In practical applications, there is no strict timing relationship between steps 403, 405 and 406; that is, they can be executed simultaneously or any one step can be executed first, depending on the actual needs. No restrictions are made here, but step 404 must be executed after step 403 and step 407 must be executed after step 406.
[0108] This embodiment stores the encrypted node information, file information, and search keywords in a value search index, which allows users to easily and quickly find the required information.
[0109] Figure 5 This is the fifth flowchart illustrating the file search method provided in this application's embodiments. (Refer to...) Figure 5 In one embodiment, searching a file set for files related to the search keyword based on a search index may include:
[0110] 501. Generate a search trap for the keyword to be searched and broadcast the search trap through the blockchain network;
[0111] 502. Receive the random key to the search trapdoor;
[0112] 503. Set the head node of the linked list as the current node;
[0113] 504. Search the search table according to the search index to obtain the third XOR value, and use the third XOR value to obtain the address of the current node in the lookup table;
[0114] 505. Based on the address of the current node in the lookup table, obtain the content of the current node's address according to the search index;
[0115] 506. Parse and XOR the content of the current node address to obtain the node information of the current node;
[0116] 507. Replace the current node with the next node in the linked list, and return to step 504 until the node information of all nodes in the linked list is obtained.
[0117] 508. Sort the perturbed scores in all node information from largest to smallest to obtain the top K related files.
[0118] In step 501, when a user wants to search for a file containing a certain keyword, they first obtain authorization from the data owner and receive a key set. This key set includes keys used to encrypt various types of data. The user can use the key set sent by the data owner to generate a search trap for the keyword and broadcast the search trap through the blockchain network.
[0119] In step 502, the random key includes a certificate for subsequent verification of the search results.
[0120] In step 507, the address of the next node can be stored in each node of the keyword list to be searched. After obtaining the node information of the current node, the next node can be found directly based on the address of the next node stored in the current node, and the node information can be obtained from it, which is convenient and fast.
[0121] This embodiment uses a search index in conjunction with a list of keywords to be searched to easily and quickly retrieve K relevant files that are highly relevant to the keywords to be searched.
[0122] Figure 6 This is the sixth flowchart illustrating the file search method provided in this application. (Refer to...) Figure 6 In one embodiment, after obtaining the top K relevant files, the process may include:
[0123] 601. Generate a proof of the result based on the identifiers of the node addresses corresponding to the K related files;
[0124] 602. Input the certificate from the random key into the verification index to obtain the verification index to be compared;
[0125] 603. If the value of the index to be compared and verified is equal to the value of the result proof, then the relevant file search corresponding to the result proof is correct.
[0126] In step 601, the result proof can be generated according to the following formula:
[0127]
[0128] Where Q represents the result proof, A represents the lookup table, and addr(N) k Let A[addr(N) be the node address of the kth related file among K related files, where k is an integer greater than or equal to 1 and less than or equal to K. k The tag is the identifier of the node address corresponding to the k-th related file in lookup table A.
[0129] The result is proven by determining Q that satisfies formula (6-1).
[0130] Before step 601, the top K related files can also be stored as a result set.
[0131] In step 603, the index to be compared and verified can be compared with the results of the K related files to determine whether each of the K related files was searched correctly.
[0132] This embodiment can verify the search results through result proof and verification index, and can promptly identify, locate and correct search errors.
[0133] In one embodiment, after generating the search index and validation index based on the perturbed scores, the following may be included:
[0134] The files in the file set are encrypted using an encryption algorithm to obtain the ciphertext of the files. The search index and the ciphertext of the files are sent to the cloud server, and the verification index is written to the blockchain.
[0135] Furthermore, the SM4 encryption algorithm can be used to encrypt the files in the file set, and the verification index can be written into the blockchain smart contract. Before generating the search trap, the data owner can add the user who needs to perform the search operation to the list of legitimate users in the smart contract. After generating the search trap, the search() function in the smart contract is called to broadcast the search trap through the blockchain network. During the search result verification stage, the cloud server and the smart contract interact with each other to verify the results.
[0136] Given that data is a crucial factor of production, data privacy breaches often lead to serious and dangerous consequences. Blockchain technology, with its immutable and traceable characteristics, allows for the storage of all operations and results on the chain. If problems arise during the process, the results can be traced back to find the source of the problem.
[0137] This embodiment utilizes blockchain technology to store the verification index in the blockchain, which can ensure the correctness of the verification results of the cloud service provider.
[0138] The document search apparatus provided in the embodiments of this application is described below. The document search apparatus described below can be referred to in correspondence with the document search method described above.
[0139] Figure 7 A schematic diagram of the structure of the file search device provided in an embodiment of this application. (Refer to...) Figure 7 This application provides a file search device, which may include:
[0140] The relevance score calculation module 701 is used to: obtain the relevance score between the keyword to be searched and any file in the document set based on the length of the document set, the length of the files in the document set, and the normalized keyword frequency;
[0141] The differential privacy perturbation module 702 is used to: perform differential privacy perturbation on the correlation score to obtain the perturbed score;
[0142] Search index generation module 703 is used to: generate a search index based on the perturbed score;
[0143] The file search module 704 is used to: search the file set for files related to the keyword to be searched, according to the search index.
[0144] The file search device provided in this embodiment first obtains a relevance score between the keyword to be searched and any file in the file set based on the length of the file set, the length of the files in the file set, and the normalized keyword frequency. Then, it applies differential privacy perturbation to the relevance score to obtain a perturbed score. Finally, it generates a search index based on the perturbed score and searches the file set for files related to the keyword to be searched based on the search index. This embodiment incorporates the length of the file set and the length of the files when calculating the relevance score, considering the impact of length on the relevance score. Simultaneously, it normalizes the keyword frequency, avoiding the problem of keyword importance increasing linearly with frequency, thereby improving the accuracy of the relevance score and thus improving the efficiency and success rate of file search.
[0145] In one embodiment, the differential privacy perturbation module 702 is specifically used for:
[0146] The correlation score is converted to binary to obtain the binary score;
[0147] Differential privacy perturbation is applied to each bit of the binary fraction to obtain the perturbed fraction.
[0148] In one embodiment, a verification index generation module (not shown in the figure) is further included, for:
[0149] Sort all perturbed scores from largest to smallest to obtain the top K files.
[0150] Perform a hash encryption operation on any one of the K files to obtain a first hash value; where K is an integer greater than or equal to 1;
[0151] XOR the K first hash values to obtain the first XOR value;
[0152] A verification index is generated based on the first XOR value.
[0153] In one embodiment, the search index generation module 703 is specifically used for:
[0154] A linked list is generated based on the search keyword; each node in the linked list corresponds to a related file, and the related file is a file in the file set that contains the search keyword;
[0155] The perturbation score between the search keyword and the related files is stored in the corresponding node information;
[0156] The keyword to be searched is double-encrypted using a first pseudo-random function and a second pseudo-random function to obtain the value of the first pseudo-random function.
[0157] The first pseudo-random function value is XORed with the node to obtain a second XOR value, which is then used as the content of the corresponding node address.
[0158] The identifier of the relevant file is hashed to obtain a second hash value, which is then used as the identifier of the node address corresponding to the relevant file.
[0159] The keyword to be searched is encrypted using a third pseudo-random function to obtain the value of the second pseudo-random function;
[0160] The second pseudo-random function value is XORed with the node address to obtain the third XOR value;
[0161] Store the content of the node address and the identifier of the node address in a lookup table, and store the third XOR value in the search table;
[0162] A search index is generated based on the lookup table and the search table.
[0163] In one embodiment, the file search module 704 is specifically used for:
[0164] Generate a search trap for the keyword to be searched, and broadcast the search trap through a blockchain network;
[0165] Receive the random key to the search trapdoor;
[0166] Set the head node of the linked list as the current node;
[0167] The search table is searched according to the search index to obtain the third XOR value, and the address of the current node in the lookup table is obtained according to the third XOR value.
[0168] Based on the address of the current node in the lookup table, the content of the current node's address is obtained according to the search index;
[0169] The content of the current node address is parsed and XORed to obtain the node information of the current node;
[0170] After replacing the current node with the next node in the linked list, return to the step of searching the search table according to the search index until the node information of all nodes in the linked list is obtained;
[0171] Sort the perturbed scores of all nodes from largest to smallest to obtain the top K relevant files.
[0172] In one embodiment, the file verification module (not shown in the figure) is used for:
[0173] The result proof is generated based on the identifiers of the node addresses corresponding to the K related files;
[0174] The certificate from the random key is introduced into the verification index to obtain the verification index to be compared;
[0175] If the value of the index to be compared and verified is equal to the value of the result proof, then the relevant file search corresponding to the result proof is determined to be correct.
[0176] In one embodiment, the first data processing module (not shown in the figure) is used for:
[0177] The files in the file set are encrypted using an encryption algorithm to obtain the ciphertext files.
[0178] The search index and the encrypted file are sent to the cloud server.
[0179] In one embodiment, the second data processing module (not shown in the figure) is used for:
[0180] Write the verification index into the blockchain.
[0181] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call a computer program in the memory 830 to execute the steps of a file search method, such as including:
[0182] Based on the length of the document set, the length of the documents in the document set, and the normalized keyword frequency, the relevance score between the keyword to be searched and any document in the document set is obtained.
[0183] Differential privacy perturbation is applied to the correlation score to obtain the perturbed score;
[0184] A search index is generated based on the perturbed score;
[0185] The search index is used to search for files in the file set that are related to the keyword to be searched.
[0186] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0187] On the other hand, embodiments of this application also provide a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the file search methods provided in the above embodiments, such as including:
[0188] Based on the length of the document set, the length of the documents in the document set, and the normalized keyword frequency, the relevance score between the keyword to be searched and any document in the document set is obtained.
[0189] Differential privacy perturbation is applied to the correlation score to obtain the perturbed score;
[0190] A search index is generated based on the perturbed score;
[0191] The search index is used to search for files in the file set that are related to the keyword to be searched.
[0192] On the other hand, embodiments of this application also provide a processor-readable storage medium storing a computer program for causing a processor to perform the steps of the methods provided in the above embodiments, such as including:
[0193] Based on the length of the document set, the length of the documents in the document set, and the normalized keyword frequency, the relevance score between the keyword to be searched and any document in the document set is obtained.
[0194] Differential privacy perturbation is applied to the correlation score to obtain the perturbed score;
[0195] A search index is generated based on the perturbed score;
[0196] The search index is used to search for files in the file set that are related to the keyword to be searched.
[0197] The processor-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical memory (e.g., CD, DVD, BD, HVD), and semiconductor memory (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).
[0198] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0199] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0200] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A file search method, characterized in that, include: Based on the length of the document set, the length of the documents in the document set, and the normalized keyword frequency, the relevance score between the keyword to be searched and any document in the document set is obtained. Differential privacy perturbation is applied to the correlation score to obtain the perturbed score; Generate a search index based on the perturbed score, including: A linked list is generated based on the search keyword; each node in the linked list corresponds to a related file, and the related file is a file in the file set that contains the search keyword; The perturbation score between the search keyword and the related files is stored in the corresponding node information; The keyword to be searched is double-encrypted using a first pseudo-random function and a second pseudo-random function to obtain the value of the first pseudo-random function. The first pseudo-random function value is XORed with the node to obtain a second XOR value, which is then used as the content of the corresponding node address. The identifier of the relevant file is hashed to obtain a second hash value, which is then used as the identifier of the node address corresponding to the relevant file. The keyword to be searched is encrypted using a third pseudo-random function to obtain the value of the second pseudo-random function; The second pseudo-random function value is XORed with the node address to obtain the third XOR value; Store the content of the node address and the identifier of the node address in a lookup table, and store the third XOR value in the search table; Generate a search index based on the lookup table and the search table; The search index is used to search for files in the file set that are related to the keyword to be searched.
2. The file search method according to claim 1, characterized in that, The step of performing differential privacy perturbation on the correlation score to obtain the perturbed score includes: The correlation score is converted to binary to obtain the binary score; Differential privacy perturbation is applied to each bit of the binary fraction to obtain the perturbed fraction.
3. The file search method according to claim 1, characterized in that, After obtaining the perturbed score, the following is included: Sort all perturbed scores in descending order to obtain the top K files; where K is an integer greater than or equal to 1. Perform a hash encryption operation on any one of the K files to obtain a first hash value; XOR the K first hash values to obtain the first XOR value; A verification index is generated based on the first XOR value.
4. The file search method according to claim 3, characterized in that, The step of searching the file set for files related to the keyword to be searched based on the search index includes: Generate a search trap for the keyword to be searched, and broadcast the search trap through a blockchain network; Receive the random key to the search trapdoor; Set the head node of the linked list as the current node; The search table is searched according to the search index to obtain the third XOR value, and the address of the current node in the lookup table is obtained according to the third XOR value. Based on the address of the current node in the lookup table, the content of the current node address is obtained according to the search index; The content of the current node address is parsed and XORed to obtain the node information of the current node; After replacing the current node with the next node in the linked list, return to the step of searching the search table according to the search index until the node information of all nodes in the linked list is obtained; Sort the perturbed scores of all nodes from largest to smallest to obtain the top K relevant files.
5. The file search method according to claim 4, characterized in that, After obtaining the top K most relevant files, the process includes: The result proof is generated based on the identifiers of the node addresses corresponding to the K related files; The certificate from the random key is introduced into the verification index to obtain the verification index to be compared; If the value of the index to be compared and verified is equal to the value of the result proof, then the relevant file search corresponding to the result proof is determined to be correct.
6. The file search method according to claim 1, characterized in that, After generating the search index based on the perturbed score, the process includes: The files in the file set are encrypted using an encryption algorithm to obtain the ciphertext files. The search index and the encrypted file are sent to the cloud server.
7. The file search method according to claim 3, characterized in that, After generating the verification index based on the first XOR value, the process includes: Write the verification index into the blockchain.
8. A file search device, characterized in that, For performing the file search method of claim 1, comprising: The relevance score calculation module is used to: obtain the relevance score between the keyword to be searched and any file in the document set based on the length of the document set, the length of the files in the document set, and the normalized keyword frequency; The differential privacy perturbation module is used to: perform differential privacy perturbation on the correlation score to obtain the perturbed score; The search index generation module is used to: generate a search index based on the perturbed score; The file search module is used to: search the file set for files related to the keyword to be searched, based on the search index.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the file search method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for searching file
CN101996200A
Searchable encryption method, device and equipment and readable storage medium
CN110851481A