A method for quickly building and storing encrypted file indexes
By dividing encrypted files into data blocks and using distributed storage and encrypted search, combined with public and private keys for encryption processing, the problems of slow index construction and large storage space usage of encrypted files in traditional methods are solved, and rapid retrieval is achieved. and efficient encrypted data processing.
Patent Information
- Application Number
- CN202410835066.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-26
AI Technical Summary
Traditional index construction and storage methods are slow and occupy large storage space when processing encrypted files, making it difficult to meet the demand for fast retrieval.
Divide the file to be encrypted into data blocks, use distributed storage and encrypted search, build an index structure through hash values, use distributed hash tables for storage and retrieval, and combine public and private keys for encryption and decryption.
It improves the construction speed of encrypted file index, reduces time cost, reduces storage space occupation, and achieves fast retrieval and efficient encrypted data processing.
Smart Images

Figure CN118394714B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of index construction and storage, and in particular to a method for quickly constructing and storing an encrypted file index. Background Art
[0002] During the construction of the port gate, there are a large number of documents and drawings. Traditional paper documents are inconvenient to save and index, so the corresponding documents and drawings need to be digitized and stored in a computer system. These data contain sensitive information such as various signatures, design parameters, etc., so they need to be encrypted to ensure confidentiality and security. In practical applications, it is often necessary to index and retrieve encrypted data in order to quickly find the required information. However, due to the characteristics of encryption operations, traditional index construction and storage methods may no longer be applicable. Summary of the invention
[0003] To address this problem, the present invention proposes a method for quickly building and storing an encrypted file index. By combining distributed storage and encrypted search, the speed of building an encrypted file index is improved, the time cost of index construction is reduced, and the storage space occupied by index data is reduced.
[0004] To achieve the above object, the present invention provides a method for quickly constructing and storing an encrypted file index, comprising the following steps:
[0005] S1: Divide the file to be encrypted into original data blocks of a preset number of dimensions, quickly encrypt each original data block to obtain an encrypted data block, and use the hash value of the keyword in the original data block as the index identifier of the corresponding encrypted data block;
[0006] S2: storing the encrypted data block in a distributed network node, using the index identifier as a key and the storage location of the encrypted data block as a value, and constructing an index structure using a distributed hash table, wherein a scheduling strategy based on storage load balancing is the main implementation method of the storage;
[0007] S3: When searching for files, the user enters a keyword, hashes the keyword to obtain a keyword hash value, and performs local sensitive hash matching based on similarity correction on the keyword hash value and the key in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword;
[0008] S4: Obtain the encrypted data block according to the storage location obtained by retrieval, decrypt the encrypted data block to obtain the original data block, reorganize the original data block, and use the reorganized file as the return result of the user's retrieval.
[0009] As a further improvement method of the present invention:
[0010] Optionally, the S1 step includes:
[0011] The file data to be encrypted is obtained, and the file data to be encrypted is divided into original data blocks of a preset dimension number N, wherein the number of characters contained in each original data block is the same, and the characters contained in each original data block are continuous in the file data, and the original data block set obtained by division is:
[0012] ;
[0013] ;
[0014] in:
[0015] Represents the nth original data block obtained by segmentation;
[0016] Represents the original data block The uth character in , U represents the original data block The total number of characters in ;
[0017] Each original data block is quickly encrypted to obtain an encrypted data block, where the original data block The fast encryption process is:
[0018] S11: The original data block Convert the characters in the original data block to decimal ASCII values. The uth character in The corresponding ASCII value is , and calculate the original data block Hash value ,in , Represents the original data block The uth character in The corresponding hash value;
[0019] S12: Calculate the encryption auxiliary parameters :
[0020] ;
[0021] in:
[0022] represents the remainder function, Representation Expression The remainder after division with 16;
[0023] represents the floor function;
[0024] S13: Randomly select a prime number greater than 1000 , calculate encryption auxiliary parameters With prime numbers The product of , ;
[0025] S14: Construct the original data block The public key and private key :
[0026] ;
[0027] ;
[0028] in:
[0029] satisfy , satisfy , express and The remainder after the division operation; in the embodiment of the present invention, the public key of each original data block is broadcast to all users, and users with the permission to use the file data can obtain the private key;
[0030] S15: For the original data block Perform encryption mapping processing, where the encryption mapping formula is:
[0031] ;
[0032] ;
[0033] in:
[0034] Represents the original data block The corresponding encrypted data block;
[0035] Represents the original data block The encrypted mapping result corresponding to the u-th character in ;
[0036] Represents the original data block The encryption result corresponding to the u-th character in ;
[0037] a represents the mapping parameter;
[0038] Indicates converting decimal to binary;
[0039] In the embodiment of the present invention, based on the public key and private key Encrypted data block The decryption process is:
[0040] Combine the mapping parameters to encrypt the data block Perform base conversion and inverse mapping on any encrypted mapping result in the original data block The encryption result corresponding to each character in is based on the public key and private key Decrypt the encrypted result to obtain the decrypted original data block , where the original data block The decryption formula for the encryption result corresponding to the u-th character in is:
[0041] ;
[0042] And the hash value Convert to character to get the original data block The uth character in ;
[0043] The hash value of the keyword in the original data block is used as the index identifier of the corresponding encrypted data block, where the encrypted data block The index identifier is , the method of extracting keywords from the original data block is: segment the original data block, and calculate the word frequency-inverse document frequency value of each segmented phrase in the original data block, and select Num segmented phrases with the largest word frequency-inverse document frequency value as the keywords of the original data block, where Num represents the preset number of keywords.
[0044] Optionally, the original data block is calculated in step S11 Hash value ,include:
[0045] S111: Get the original data block The ASCII value of each character in;
[0046] S112: original data block Perform a hash operation on each character in the data block to obtain the hash value corresponding to the character. The uth character in The corresponding hash value is:
[0047] ;
[0048] in:
[0049] Represents the original data block The uth character in The corresponding hash value;
[0050] is the hash operation parameter;
[0051] Composing the original data block The hash value is: .
[0052] Optionally, the S2 step includes:
[0053] The encrypted data blocks are stored in distributed network nodes, wherein the scheduling strategy based on storage load balancing is the main implementation method of the storage, and the storage process of the encrypted data blocks is:
[0054] S21: Initialize K distributed network nodes, where each distributed network node is used for storage management;
[0055] S22: Calculate and obtain the current storage load balancing capabilities of different distributed network nodes, where the current storage load balancing capability of the kth distributed network node is:
[0056] ;
[0057] in:
[0058] Indicates the current storage load balancing capability of the kth distributed network node;
[0059] Represents the total amount of data that can be stored by the kth distributed network node;
[0060] Indicates the current storage data volume of the kth distributed network node;
[0061] S23: Calculate the balancing coefficients of different distributed network nodes, where the balancing coefficient of the kth distributed network node is :
[0062] ;
[0063] in:
[0064] Indicates the encrypted data block obtained by calculation And key information The total amount of data;
[0065] Represents the current free storage space of the kth distributed network node;
[0066] Represents the median of the total amount of N groups of data;
[0067] S24: Select a distributed network node with a balancing coefficient greater than 1, send part of the storage data in the selected distributed network node to a distributed network node whose current storage load balancing capability is greater than a preset threshold and whose balancing coefficient is greater than 1, and perform storage balancing processing on all distributed network nodes;
[0068] S25: Calculate the current free storage space of each distributed network node after the storage balancing process, sort the distributed network nodes in descending order based on the current free storage space, and store the N groups of encrypted data blocks and the corresponding key information in the N distributed network nodes with the highest sorting order according to the sorting order;
[0069] The index identifier is used as the key and the storage location of the encrypted data block is used as the value to construct the index structure using a distributed hash table, wherein the storage location of the encrypted data block is the number of the distributed network node where the encrypted data block is located.
[0070] Optionally, the index identifier is used as a key, the storage location of the encrypted data block is used as a value, and a distributed hash table is used to construct an index structure, including:
[0071] The representation of the constructed index structure is:
[0072] ;
[0073] in:
[0074] Indicates encrypted data block The index identifier of
[0075] Indicates encrypted data block Storage location of
[0076] Represents a set of indexes, As a key in the index, as the value in the index.
[0077] Optionally, the S3 step includes:
[0078] When searching for files, the user enters a keyword key, and the keyword key is hashed to obtain the keyword hash value:
[0079] ;
[0080] in:
[0081] is the hash operation parameter;
[0082] Indicates the keyword hash value corresponding to the keyword key;
[0083] Indicates the ASCII value corresponding to the keyword key;
[0084] Hash the keyword Perform local sensitive hash matching based on similarity correction with the keys in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword key.
[0085] Optionally, the keyword hash value Perform local sensitive hash matching based on similarity correction with the keys in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword key, including:
[0086] Hash the keyword The process of similarity-corrected locality-sensitive hash matching with the keys in the index structure is:
[0087] S31: Calculate keyword hash value Similarity to any set of keys in the index structure, where the keyword hash value With key The similarity is:
[0088] ;
[0089] in:
[0090] Represents the keyword hash value With key similarity;
[0091] represents the L2 norm;
[0092] S32: Correct the similarity, where the similarity The correction formula is:
[0093] ;
[0094] in:
[0095] Indicates similarity The correction result of
[0096] represents the L1 norm;
[0097] Indicates the preset number of keywords included in the index identifier;
[0098] Indicates index identifier The set of keywords included. , q represents the set Any keyword in ;
[0099] , Indicates the number of times the keyword q appears in the index identifiers of N encrypted data blocks;
[0100] S33: Select a key whose corrected similarity is higher than a preset similarity threshold, and based on the corresponding relationship between the key and the value, obtain the encrypted data block storage location corresponding to the key as the retrieved data block information.
[0101] Optionally, the S4 step includes:
[0102] According to the retrieved data block location information, the encrypted data block and key information are obtained from the distributed network node to detect whether the current user has the use permission of the file corresponding to the encrypted data block. If the user has the use permission, the encrypted data block is decrypted based on the public key and private key of the encrypted data block to obtain the original data block. The original data block set retrieved according to the keyword hash value is:
[0103] ;
[0104] in:
[0105] represents the hth original data block retrieved according to the keyword hash value, and H represents the total number of original data blocks retrieved according to the keyword hash value;
[0106] The original data blocks are reorganized, wherein the reorganization rule is to sort the H original data blocks retrieved according to the order in the file data, reorganize to obtain the file required by the user, and use the reorganized file as the return result of the user's search.
[0107] Compared with the prior art, the present invention proposes a method for quickly constructing and storing an encrypted file index, which has the following advantages:
[0108] 1) The present invention divides the file to be encrypted into multiple data blocks, determines encryption auxiliary parameters based on the overall character encoding distribution of the file, generates private keys and public keys for each data block based on random prime numbers corresponding to different data blocks, and only users with file permissions can extract private key information. Each divided data block is encrypted using the private key and the public key, and the encryption result is mapped using a chaotic mapping method, thereby improving the security of the encryption result and realizing block encryption processing of the file to be encrypted;
[0109] 2) In view of the diversity of port construction documents, drawings, etc., and the difficulties in storage and indexing when digitizing them, the present invention adopts a distributed storage method to store encrypted data blocks and index identifiers in distributed network nodes. During the storage process, the current storage load balancing capabilities and balancing coefficients of different distributed network nodes are combined to migrate the data stored in distributed network nodes with less remaining space and larger loads to achieve storage load balancing of distributed network nodes. The index identifier is used as the key and the storage location of the encrypted data block is used as the value. A distributed hash table is used to build an index structure. According to the user's search keywords, a similarity correction method based on keyword distribution information is used to perform hash matching to obtain encrypted data blocks, decrypt the encrypted data blocks to obtain original data blocks, and reorganize the original data blocks. The reorganized files are used as the return results of the user's search. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] Figure 1 A flowchart of a method for quickly constructing and storing an encrypted file index provided by an embodiment of the present invention.
[0111] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0112] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0113] The embodiment of the present application provides a method for quickly building and storing an encrypted file index. The execution subject of the method for quickly building and storing an encrypted file index includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the method for quickly building and storing an encrypted file index can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0114] Embodiment 1:
[0115] A method for quickly building and storing an encrypted file index comprises the following steps:
[0116] S1: Divide the file to be encrypted into original data blocks of a preset number of dimensions, quickly encrypt each original data block to obtain an encrypted data block, and use the hash value of the keyword in the original data block as the index identifier of the corresponding encrypted data block.
[0117] The S1 step includes:
[0118] The file data to be encrypted is obtained, and the file data to be encrypted is divided into original data blocks of a preset dimension number N, wherein the number of characters contained in each original data block is the same, and the characters contained in each original data block are continuous in the file data, and the original data block set obtained by division is:
[0119] ;
[0120] ;
[0121] in:
[0122] Represents the nth original data block obtained by segmentation;
[0123] Represents the original data block The uth character in , U represents the original data block The total number of characters in ;
[0124] Each original data block is quickly encrypted to obtain an encrypted data block, where the original data block The fast encryption process is:
[0125] S11: The original data block Convert the characters in the original data block to decimal ASCII values. The uth character in The corresponding ASCII value is , and calculate the original data block Hash value ,in , Represents the original data block The uth character in The corresponding hash value;
[0126] S12: Calculate the encryption auxiliary parameters :
[0127] ;
[0128] in:
[0129] represents the remainder function, Representation Expression The remainder after division with 16;
[0130] represents the floor function;
[0131] S13: Randomly select a prime number greater than 1000 , calculate encryption auxiliary parameters With prime numbers The product of , ;
[0132] S14: Construct the original data block The public key and private key :
[0133] ;
[0134] ;
[0135] in:
[0136] satisfy , satisfy , express and The remainder after the division operation; in the embodiment of the present invention, the public key of each original data block is broadcast to all users, and users with the permission to use the file data can obtain the private key;
[0137] S15: For the original data block Perform encryption mapping processing, where the encryption mapping formula is:
[0138] ;
[0139] ;
[0140] in:
[0141] Represents the original data block The corresponding encrypted data block;
[0142] Represents the original data block The encrypted mapping result corresponding to the u-th character in ;
[0143] Represents the original data block The encryption result corresponding to the u-th character in ;
[0144] a represents the mapping parameter;
[0145] Indicates converting decimal to binary;
[0146] Public key based and private key Encrypted data block The decryption process is:
[0147] Combine the mapping parameters to encrypt the data block Perform base conversion and inverse mapping on any encrypted mapping result in the original data block The encryption result corresponding to each character in is based on the public key and private key Decrypt the encrypted result to obtain the decrypted original data block , where the original data block The decryption formula for the encryption result corresponding to the u-th character in is:
[0148] ;
[0149] And the hash value Convert to character to get the original data block The uth character in ;
[0150] The hash value of the keyword in the original data block is used as the index identifier of the corresponding encrypted data block, where the encrypted data block The index identifier is , the method of extracting keywords from the original data block is: segment the original data block, and calculate the word frequency-inverse document frequency value of each segmented phrase in the original data block, and select Num segmented phrases with the largest word frequency-inverse document frequency value as the keywords of the original data block, where Num represents the preset number of keywords.
[0151] The original data block is obtained by calculation in step S11 Hash value ,include:
[0152] S111: Get the original data block The ASCII value of each character in;
[0153] S112: original data block Perform a hash operation on each character in the data block to obtain the hash value corresponding to the character. The uth character in The corresponding hash value is:
[0154] ;
[0155] in:
[0156] Represents the original data block The uth character in The corresponding hash value;
[0157] is the hash operation parameter;
[0158] Composing the original data block The hash value is: .
[0159] S2: Store the encrypted data block in the distributed network node, use the index identifier as the key and the storage location of the encrypted data block as the value, and use a distributed hash table to build the index structure.
[0160] The S2 step includes:
[0161] The encrypted data blocks are stored in distributed network nodes, wherein the scheduling strategy based on storage load balancing is the main implementation method of the storage, and the storage process of the encrypted data blocks is:
[0162] S21: Initialize K distributed network nodes, where each distributed network node is used for storage management;
[0163] S22: Calculate and obtain the current storage load balancing capabilities of different distributed network nodes, where the current storage load balancing capability of the kth distributed network node is:
[0164] ;
[0165] in:
[0166] Indicates the current storage load balancing capability of the kth distributed network node;
[0167] Represents the total amount of data that can be stored by the kth distributed network node;
[0168] Indicates the current storage data volume of the kth distributed network node;
[0169] S23: Calculate the balancing coefficients of different distributed network nodes, where the balancing coefficient of the kth distributed network node is :
[0170] ;
[0171] in:
[0172] Indicates the encrypted data block obtained by calculation And key information The total amount of data;
[0173] Represents the current free storage space of the kth distributed network node;
[0174] Represents the median of the total amount of N groups of data;
[0175] S24: Select a distributed network node with a balancing coefficient greater than 1, send part of the storage data in the selected distributed network node to a distributed network node whose current storage load balancing capability is greater than a preset threshold and whose balancing coefficient is greater than 1, and perform storage balancing processing on all distributed network nodes;
[0176] S25: Calculate the current free storage space of each distributed network node after the storage balancing process, sort the distributed network nodes in descending order based on the current free storage space, and store the N groups of encrypted data blocks and the corresponding key information in the N distributed network nodes with the highest sorting order according to the sorting order;
[0177] The index identifier is used as the key and the storage location of the encrypted data block is used as the value to construct the index structure using a distributed hash table, wherein the storage location of the encrypted data block is the number of the distributed network node where the encrypted data block is located.
[0178] The method uses the index identifier as a key, the storage location of the encrypted data block as a value, and uses a distributed hash table to construct an index structure, including:
[0179] The representation of the constructed index structure is:
[0180] ;
[0181] in:
[0182] Indicates encrypted data block The index identifier of
[0183] Indicates encrypted data block Storage location of
[0184] Represents a set of indexes, As a key in the index, as the value in the index.
[0185] S3: When searching for files, the user enters a keyword, hashes the keyword to obtain a keyword hash value, and performs local sensitive hash matching based on similarity correction on the keyword hash value and the key in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword.
[0186] The S3 step includes:
[0187] When searching for files, the user enters a keyword key, and the keyword key is hashed to obtain the keyword hash value:
[0188] ;
[0189] in:
[0190] Indicates the keyword hash value corresponding to the keyword key;
[0191] Indicates the ASCII value corresponding to the keyword key;
[0192] Hash the keyword Perform local sensitive hash matching based on similarity correction with the keys in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword key.
[0193] The keyword hash value Perform local sensitive hash matching based on similarity correction with the keys in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword key, including:
[0194] Hash the keyword The process of similarity-corrected locality-sensitive hash matching with the keys in the index structure is:
[0195] S31: Calculate keyword hash value Similarity to any set of keys in the index structure, where the keyword hash value With key The similarity is:
[0196] ;
[0197] in:
[0198] Represents the keyword hash value With key similarity;
[0199] represents the L2 norm;
[0200] S32: Correct the similarity, where the similarity The correction formula is:
[0201] ;
[0202] in:
[0203] Indicates similarity The correction result of
[0204] represents the L1 norm;
[0205] Indicates the preset number of keywords included in the index identifier;
[0206] Indicates index identifier The set of keywords included. , q represents the set Any keyword in ;
[0207] , Indicates the number of times the keyword q appears in the index identifiers of N encrypted data blocks;
[0208] S33: Select a key whose corrected similarity is higher than a preset similarity threshold, and based on the corresponding relationship between the key and the value, obtain the encrypted data block storage location corresponding to the key as the retrieved data block information.
[0209] S4: Obtain the encrypted data block according to the storage location obtained by retrieval, decrypt the encrypted data block to obtain the original data block, reorganize the original data block, and use the reorganized file as the return result of the user's retrieval.
[0210] The S4 step includes:
[0211] According to the retrieved data block location information, the encrypted data block and key information are obtained from the distributed network node to detect whether the current user has the permission to use the file corresponding to the encrypted data block. If the user has the permission to use, the encrypted data block is decrypted based on the public key and private key of the encrypted data block to obtain the original data block. The original data block set retrieved according to the keyword hash value is:
[0212] ;
[0213] in:
[0214] represents the hth original data block retrieved according to the keyword hash value, and H represents the total number of original data blocks retrieved according to the keyword hash value;
[0215] The original data blocks are reorganized, wherein the reorganization rule is to sort the H original data blocks retrieved according to the order in the file data, reorganize to obtain the file required by the user, and use the reorganized file as the return result of the user's search.
[0216] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0217] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0218] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for quickly constructing and storing an encrypted file index, characterized in that: The method comprises: S1: Divide the file to be encrypted into original data blocks of a preset number of dimensions, quickly encrypt each original data block to obtain an encrypted data block, and use the hash value of the keyword in the original data block as the index identifier of the corresponding encrypted data block; The file data to be encrypted is obtained, and the file data to be encrypted is divided into original data blocks of a preset dimension number N, wherein the number of characters contained in each original data block is the same, and the characters contained in each original data block are continuous in the file data, and the original data block set obtained by division is: ; ; in: Represents the nth original data block obtained by segmentation; Represents the original data block The uth character in , U represents the original data block The total number of characters in ; Each original data block is quickly encrypted to obtain an encrypted data block, where the original data block The fast encryption process is: S11: The original data block Convert the characters in the original data block to decimal ASCII values. The uth character in The corresponding ASCII value is , and calculate the original data block Hash value ,in , Represents the original data block The uth character in The corresponding hash value; S12: Calculate the encryption auxiliary parameters : ; in: represents the remainder function, Representation Expression The remainder after division with 16; represents the floor function; S13: Randomly select a prime number greater than 1000 , calculate encryption auxiliary parameters With prime numbers The product of , ; S14: Construct the original data block The public key and private key : ; ; in: satisfy , satisfy , express and The remainder after a division operation; S15: original data block Perform encryption mapping processing, where the encryption mapping formula is: ; ; in: Represents the original data block The corresponding encrypted data block; Represents the original data block The encrypted mapping result corresponding to the u-th character in ; Represents the original data block The encryption result corresponding to the u-th character in ; a represents the mapping parameter; Indicates converting decimal to binary; The hash value of the keyword in the original data block is used as the index identifier of the corresponding encrypted data block, where the encrypted data block The index identifier is , the method of extracting keywords from the original data block is: segmenting the original data block, and calculating the word frequency-inverse document frequency value of each segmented word phrase in the original data block, and selecting Num segmented word phrases with the largest word frequency-inverse document frequency value as keywords of the original data block, where Num represents the number of preset keywords; S2: Store the encrypted data block in the distributed network node, use the index identifier as the key and the storage location of the encrypted data block as the value, and use the distributed hash table to build the index structure; S3: When searching for files, the user enters a keyword, hashes the keyword to obtain a keyword hash value, and performs local sensitive hash matching based on similarity correction on the keyword hash value and the key in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword; When searching for files, the user enters a keyword key, and the keyword key is hashed to obtain the keyword hash value: ; in: is the hash operation parameter; Indicates the keyword hash value corresponding to the keyword key; Indicates the ASCII value corresponding to the keyword key; Hash the keyword Perform local sensitive hash matching based on similarity correction with the keys in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword key; The keyword hash value Perform local sensitive hash matching based on similarity correction with the keys in the index structure to obtain the storage location of the encrypted data block corresponding to the keyword key, including: Hash the keyword The process of similarity-corrected locality-sensitive hash matching with the keys in the index structure is: S31: Calculate keyword hash value Similarity to any set of keys in the index structure, where the keyword hash value With key The similarity is: ; in: Represents the keyword hash value With key similarity; represents the L2 norm; S32: Correct the similarity, where the similarity The correction formula is: ; in: Indicates similarity The correction result of represents the L1 norm; Indicates the preset number of keywords included in the index identifier; Indicates index identifier The set of keywords included. , q represents the set Any keyword in ; , Indicates the number of times the keyword q appears in the index identifiers of N encrypted data blocks; S33: Selecting a key whose corrected similarity is higher than a preset similarity threshold, and obtaining a storage location of the encrypted data block corresponding to the key based on a corresponding relationship between the key and the value as the retrieved data block information; S4: Obtain the encrypted data block according to the storage location obtained by retrieval, decrypt the encrypted data block to obtain the original data block, reorganize the original data block, and use the reorganized file as the return result of the user's retrieval.
2. A method for quickly constructing and storing an encrypted file index as claimed in claim 1, characterized in that: The original data block is obtained by calculation in step S11 Hash value ,include: S111: Get the original data block The ASCII value of each character in; S112: original data block Perform a hash operation on each character in the data block to obtain the hash value corresponding to the character. The uth character in The corresponding hash value is: ; in: Represents the original data block The uth character in The corresponding hash value; is the hash operation parameter; Composing the original data block The hash value is: .
3. A method for quickly constructing and storing an encrypted file index as claimed in claim 2, characterized in that: The S2 step includes: The encrypted data blocks are stored in distributed network nodes. The storage process of the encrypted data blocks is as follows: S21: Initialize K distributed network nodes, where each distributed network node is used for storage management; S22: Calculate and obtain the current storage load balancing capabilities of different distributed network nodes, where the current storage load balancing capability of the kth distributed network node is: ; in: Indicates the current storage load balancing capability of the kth distributed network node; Represents the total amount of data that can be stored by the kth distributed network node; Indicates the current storage data volume of the kth distributed network node; S23: Calculate the balancing coefficients of different distributed network nodes, where the balancing coefficient of the kth distributed network node is : ; in: Indicates the encrypted data block obtained by calculation And key information The total amount of data; Represents the current free storage space of the kth distributed network node; Represents the median of the total amount of N groups of data; S24: Select a distributed network node with a balancing coefficient greater than 1, send part of the storage data in the selected distributed network node to a distributed network node whose current storage load balancing capability is greater than a preset threshold and whose balancing coefficient is greater than 1, and perform storage balancing processing on all distributed network nodes; S25: Calculate the current free storage space of each distributed network node after storage balancing, sort the distributed network nodes in descending order based on the current free storage space, and store the N groups of encrypted data blocks and the corresponding key information in the top N distributed network nodes in the sorted order; The index identifier is used as the key and the storage location of the encrypted data block is used as the value to construct the index structure using a distributed hash table, wherein the storage location of the encrypted data block is the number of the distributed network node where the encrypted data block is located.
4. A method for quickly constructing and storing an encrypted file index as claimed in claim 3, characterized in that: The method uses the index identifier as a key, the storage location of the encrypted data block as a value, and uses a distributed hash table to construct an index structure, including: The representation of the constructed index structure is: ; in: Indicates encrypted data block The index identifier of Indicates encrypted data block Storage location of represents a set of indexes, As a key in the index, as the value in the index.
5. A method for quickly constructing and storing an encrypted file index as claimed in claim 4, characterized in that: The S4 step includes: According to the retrieved data block location information, the encrypted data block and key information are obtained from the distributed network node to detect whether the current user has the permission to use the file corresponding to the encrypted data block. If the user has the permission to use, the encrypted data block is decrypted based on the public key and private key of the encrypted data block to obtain the original data block. The original data block set retrieved according to the keyword hash value is: ; in: represents the hth original data block retrieved according to the keyword hash value, and H represents the total number of original data blocks retrieved according to the keyword hash value; The original data blocks are reorganized, wherein the reorganization rule is to sort the H original data blocks retrieved according to the order in the file data, reorganize to obtain the file required by the user, and use the reorganized file as the return result of the user's search.
Citation Information
Patent Citations
Distributed database system, method for building index therein and query method
CN102375853A
Data processing method and device
CN108572958A
Data query method and device, apparatus and storage medium
CN110175174A
Data file processing method and device, equipment, medium and program product
CN116501695A
Encrypted storage method and device
CN117725600A
