CN114238222A - Hybrid storage method and system based on HASH algorithm - Google Patents
Hybrid storage method and system based on HASH algorithm Download PDFInfo
- Publication number
- CN114238222A CN114238222A CN202111540437.0A CN202111540437A CN114238222A CN 114238222 A CN114238222 A CN 114238222A CN 202111540437 A CN202111540437 A CN 202111540437A CN 114238222 A CN114238222 A CN 114238222A
- Authority
- CN
- China
- Prior art keywords
- resource
- hash algorithm
- file
- information
- storage
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000004422 calculation algorithm Methods 0.000 title claims abstract description 43
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000005192 partition Methods 0.000 claims abstract description 31
- 238000004590 computer program Methods 0.000 claims description 17
- 238000012795 verification Methods 0.000 claims description 12
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 7
- 230000010365 information processing Effects 0.000 claims description 3
- 230000002452 interceptive effect Effects 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000004519 manufacturing process Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
- G06F16/137—Hash-based
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a hybrid storage method and a hybrid storage system based on HASH algorithm, wherein the HASH algorithm is used for calculating to obtain a target directory partition of file resources, files are mixed and scattered into groups according to the rules of the HASH algorithm, each group corresponds to a storage directory, so that the divided-directory storage is realized, the file resources are prevented from being stored in the same directory in a centralized manner, the stored files are mixed and scattered for storage, and are quickly addressed according to the HASH algorithm during retrieval, so that the system can be regularly circulated and identified, but is difficult to be manually identified, and the aims of efficiently storing and retrieving the files are fulfilled.
Description
Technical Field
The invention relates to the technical field of data storage, in particular to a hybrid storage method and a hybrid storage system based on a HASH algorithm.
Background
In the existing file storage system, the file storage technology generally stores files in a mode of sequentially storing or generating a globally unique file identifier through a specific method, and when a file object is read, the file is addressed and retrieved according to the globally unique file identifier generated in the sequential or specific mode; the method has low retrieval efficiency, and the files cannot be scattered and stored in a plurality of directories, so that the file resources of a certain directory are excessive, and the retrieval efficiency of the file resources is further influenced.
Due to the fact that efficiency is too low during file addressing retrieval, the quantity of file resources of a certain directory is difficult to control, the quantity of files of the certain directory is too large, and retrieval efficiency is affected; meanwhile, in the sequential storage object mode, the security of stored file resources is hidden, and certain types of storage files are stored together in a centralized manner, so that corresponding use scenes and intentions are easily exposed.
Disclosure of Invention
In order to solve the defects of the prior art, the invention provides a hybrid storage method and a hybrid storage system based on HASH algorithm, files are obfuscated and scattered into groups according to the rules of the HASH algorithm, each group corresponds to a storage directory, so that the storage in the directories is realized, the centralized storage of file resources in the same directory is avoided, the stored files are obfuscated and scattered for storage, and the files are quickly addressed according to the HASH algorithm during retrieval, so that the system is regularly and circularly identifiable, but is difficult to be manually identified, and the aims of efficiently storing and retrieving the files are fulfilled.
In order to achieve the above purpose, the technical scheme adopted by the invention comprises the following steps:
a hybrid storage method based on HASH algorithm is characterized by comprising the following steps:
s1, receiving file resources;
s2, coding and confusing the name of the file resource to obtain first information;
s3, performing binary conversion on the first information to obtain second information, wherein the second information is in a binary digital format;
s4, calculating a target directory partition of the file resource according to the second information by using a HASH algorithm;
and S5, storing the file resource to the corresponding directory partition by using the target directory partition as a partition index for storing the file resource.
Further, the method further comprises:
s6, receiving the resource use request, and extracting a request resource name corresponding to the resource use request;
s7, performing binary conversion on the request resource name to obtain third information, wherein the third information is in a binary digital format;
s8, calculating to obtain a target directory partition corresponding to the request resource according to the third information by using a HASH algorithm;
and S9, calling the required file resource from the corresponding target directory partition and feeding back the file resource.
Further, the HASH algorithm includes any one of a division HASH algorithm or a multiplication HASH algorithm.
Further, the step S5 further includes:
and adding an identification mark corresponding to the first information in a corresponding directory partition of the file resource storage.
Further, the step S7 further includes:
and matching the request resource name with the first information to obtain a corresponding verification identifier.
Further, the step S9 further includes:
and checking the verification identification and the identification, and calling and feeding back the required file resource from the corresponding target directory partition when the verification identification is matched with the identification.
The invention also relates to a hybrid storage system based on HASH algorithm, which is characterized by comprising:
the interactive module is used for receiving the resource use request and feeding back the required file resource;
the information processing module is used for executing code obfuscation operation and binary conversion operation;
the HASH operation module is used for executing HASH algorithm calculation;
and the database is used for storing file resources.
The invention also relates to a computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the above-mentioned method.
The invention also relates to an electronic device, characterized in that it comprises a processor and a memory;
the memory is used for storing file resources;
the processor is used for executing the method by calling the file resource.
The invention also relates to a computer program product comprising a computer program and/or instructions, characterized in that the computer program and/or instructions, when executed by a processor, implement the steps of the above-mentioned method.
The invention has the beneficial effects that:
by adopting the hybrid storage method and the hybrid storage system based on the HASH algorithm, files are mixed, scattered and grouped according to the rules of the HASH algorithm, each group corresponds to one storage directory, so that the storage in the directories is realized, the file resources are prevented from being stored in the same directory in a centralized manner, the stored files are mixed, scattered and stored, and the files are quickly addressed according to the HASH algorithm during retrieval, so that the system can be regularly and identifiably but is not easily identified manually, and the purposes of efficiently storing and retrieving the files are achieved. .
Drawings
Fig. 1 is a schematic flow chart of the hybrid storage method based on the HASH algorithm of the present invention.
Fig. 2 is a schematic structural diagram of a hybrid storage system based on a HASH algorithm according to the present invention.
Detailed Description
For a clearer understanding of the contents of the present invention, reference will be made to the accompanying drawings and examples.
The first aspect of the present invention relates to a hybrid storage method based on a HASH algorithm, which has a step flow shown in fig. 1, and comprises:
and S1, receiving the file resource. In the process of uploading the files, the files can be automatically stored in a sequence in a general form or in a mixed storage form.
And S2, carrying out coding confusion on the name of the file resource to obtain first information.
And S3, performing binary conversion on the first information to obtain second information, wherein the second information is in a binary digital format. The generated second information in binary digital format is used for subsequent operation, and at this time, the corresponding file resource cannot be directly identified by manpower.
And S4, calculating the target directory partition of the file resource according to the second information by using a HASH algorithm. The HASH algorithm used includes any one of a division HASH algorithm or a multiplication HASH algorithm. For example, the binary digits are calculated by using a division HASH algorithm, which can be performed by the formula shown in formula 1:
hash (key) mod M formula 1
The key is a binary number generated by the name of the file resource, the M is the directory partition number of the file storage system, and the result obtained according to the formula 1 is the target directory partition index required to be stored by the file resource.
And S5, storing the file resource to the corresponding directory partition by using the target directory partition as a partition index for storing the file resource. Preferably, an identification mark corresponding to the first information may be added to a corresponding directory partition of the file resource storage for a verification process for subsequent use.
When the file resource is called, the following steps can be correspondingly executed:
s6, receiving the resource using request, and extracting the request resource name corresponding to the resource using request.
And S7, performing binary conversion on the request resource name to obtain third information, wherein the third information is in a binary digital format. Particularly preferably, the resource name of the request is matched with the first information to obtain a corresponding verification identifier, and the verification identifier can be used for comparison and matching, so that the problem that matching cannot be performed completely caused by the HASH operation code is avoided.
And S8, calculating to obtain the target directory partition corresponding to the request resource according to the third information by using a HASH algorithm.
And S9, calling the required file resource from the corresponding target directory partition and feeding back the file resource. And when the identification mark and the verification mark are used, the verification mark and the identification mark are checked, and when the verification mark is matched with the identification mark, the required file resource is called from the corresponding target directory partition and fed back.
In practical use, for projects with a lot of data form maintenance, production service planning flow and production operation flow needing to upload files, pictures, audio and video media resources and other files, the file resources all need to support uploading storage, downloading and real-time preview viewing, and with long-term use of the system, the file resources become huge, and the requirements for sub-directory storage and efficient retrieval of the files become higher and higher. By using the method for mixed storage, the storage efficiency of uploading file resources is greatly improved, the safety is guaranteed, and the addressing retrieval of downloading and browsing is very efficient.
Specifically, for the uploading process of a certain specific file, the following steps may be sequentially performed to implement the hybrid storage as described above:
opening a page capable of uploading file resources in a software application system, and selecting the file resources to be uploaded after clicking an upload button;
submitting a file resource uploading request to a software application system server, and after receiving the file resource, the server encodes and confuses the name of the file resource;
calculating the directory partition position stored by the file resource according to the confused file resource name by using a HASH algorithm; the specific calculation process is that firstly, binary conversion is carried out on the file resource name to obtain a binary digit, and then the division HASH algorithm is used for calculating the binary digit, wherein the calculation formula is as follows:
the formula: hash (key) mod M, where key is a binary number generated by a file resource name, and M is a directory partition number of the file storage system;
and finally, writing the file resource into the corresponding directory partition by the system.
When the file resource needs to be downloaded or viewed, firstly, binary conversion is carried out on the name of the file resource to obtain a binary digit, then, the binary digit is calculated by using a division HASH algorithm, the calculation process is the same as the calculation process in the storage process to obtain a file storage directory partition, and finally, the target file resource is read.
Another aspect of the present invention also relates to a hybrid storage system based on the HASH algorithm, whose structure is shown in fig. 2, including:
and the interaction module is used for receiving the resource use request and feeding back the required file resource.
And the information processing module is used for executing the code obfuscation operation and the binary conversion operation.
The HASH operation module is used for executing HASH algorithm calculation.
And the database is used for storing file resources.
By using this system, the above-described arithmetic processing method can be executed and a corresponding technical effect can be achieved.
Embodiments of the present invention also provide a computer-readable storage medium capable of implementing all the steps of the method in the above embodiments, the computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements all the steps of the method in the above embodiments.
Embodiments of the present invention further provide an electronic device for executing the method, as an implementation apparatus of the method, the electronic device at least includes a processor and a memory, in particular, the memory stores data required for executing the method and related computer programs, such as file resources, and the like, and all steps of the implementation method are executed by calling the data and programs in the memory by the processor, and corresponding technical effects are obtained.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a system for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction system which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. A hybrid storage method based on HASH algorithm is characterized by comprising the following steps:
s1, receiving file resources;
s2, coding and confusing the name of the file resource to obtain first information;
s3, performing binary conversion on the first information to obtain second information, wherein the second information is in a binary digital format;
s4, calculating a target directory partition of the file resource according to the second information by using a HASH algorithm;
and S5, storing the file resource to the corresponding directory partition by using the target directory partition as a partition index for storing the file resource.
2. The method of claim 1, wherein the method further comprises:
s6, receiving the resource use request, and extracting a request resource name corresponding to the resource use request;
s7, performing binary conversion on the request resource name to obtain third information, wherein the third information is in a binary digital format;
s8, calculating to obtain a target directory partition corresponding to the request resource according to the third information by using a HASH algorithm;
and S9, calling the required file resource from the corresponding target directory partition and feeding back the file resource.
3. The method of claim 2, wherein the HASH algorithm comprises any one of a division HASH algorithm or a multiplication HASH algorithm.
4. The method of claim 2, wherein the step S5 further comprises:
and adding an identification mark corresponding to the first information in a corresponding directory partition of the file resource storage.
5. The method of claim 4, wherein the step S7 further comprises:
and matching the request resource name with the first information to obtain a corresponding verification identifier.
6. The method of claim 5, wherein the step S9 further comprises:
and checking the verification identification and the identification, and calling and feeding back the required file resource from the corresponding target directory partition when the verification identification is matched with the identification.
7. A hybrid storage system based on a HASH algorithm, comprising:
the interactive module is used for receiving the resource use request and feeding back the required file resource;
the information processing module is used for executing code obfuscation operation and binary conversion operation;
the HASH operation module is used for executing HASH algorithm calculation;
and the database is used for storing file resources.
8. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 6.
9. An electronic device comprising a processor and a memory;
the memory is used for storing file resources;
the processor is configured to execute the method of any one of claims 1 to 6 by calling a file resource.
10. A computer program product comprising a computer program and/or instructions, characterized in that the computer program and/or instructions, when executed by a processor, implement the steps of the method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111540437.0A CN114238222A (en) | 2021-12-16 | 2021-12-16 | Hybrid storage method and system based on HASH algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111540437.0A CN114238222A (en) | 2021-12-16 | 2021-12-16 | Hybrid storage method and system based on HASH algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114238222A true CN114238222A (en) | 2022-03-25 |
Family
ID=80756825
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111540437.0A Pending CN114238222A (en) | 2021-12-16 | 2021-12-16 | Hybrid storage method and system based on HASH algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114238222A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080033927A1 (en) * | 2006-08-07 | 2008-02-07 | Bea Systems, Inc. | Dynamic repartitioning for distributed search |
CN105893864A (en) * | 2015-12-10 | 2016-08-24 | 乐视网信息技术(北京)股份有限公司 | Data file confusion method and system, and client side |
CN109657497A (en) * | 2018-12-21 | 2019-04-19 | 北京思源互联科技有限公司 | Secure file system and its method |
CN112632129A (en) * | 2020-12-31 | 2021-04-09 | 联想未来通信科技(重庆)有限公司 | Code stream data management method, device and storage medium |
-
2021
- 2021-12-16 CN CN202111540437.0A patent/CN114238222A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080033927A1 (en) * | 2006-08-07 | 2008-02-07 | Bea Systems, Inc. | Dynamic repartitioning for distributed search |
CN105893864A (en) * | 2015-12-10 | 2016-08-24 | 乐视网信息技术(北京)股份有限公司 | Data file confusion method and system, and client side |
CN109657497A (en) * | 2018-12-21 | 2019-04-19 | 北京思源互联科技有限公司 | Secure file system and its method |
CN112632129A (en) * | 2020-12-31 | 2021-04-09 | 联想未来通信科技(重庆)有限公司 | Code stream data management method, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103034389B (en) | The other mark of share level | |
CN108874379B (en) | Page processing method and device | |
CN103460707A (en) | Multimedia content editing server, multimedia content editing method, program, and integrated circuit | |
CN111797061B (en) | Multimedia file processing method and device, electronic equipment and storage medium | |
CN104461826B (en) | The method, apparatus and system of Object flow monitoring | |
CN109949054B (en) | Key code determination method, device, equipment and storage medium | |
CN111400170B (en) | Data authority testing method and device | |
CN111273942A (en) | Code generation method, storage medium, electronic device and system | |
CN102510519A (en) | Streaming media data processing method, playing method and device | |
CN108370449A (en) | Segmenting video content stores | |
US20140136807A1 (en) | Method and system for secure access to data files copied onto a second storage device from a first storage device | |
CN104778252A (en) | Index storage method and index storage device | |
CN114676418B (en) | Operation request processing method, device, equipment, storage medium and program product | |
CN114238222A (en) | Hybrid storage method and system based on HASH algorithm | |
CN113436699A (en) | Method, system, electronic device and storage medium for generating new corona nucleic acid detection report | |
CN116644250B (en) | Page detection method, page detection device, computer equipment and storage medium | |
CN105975567B (en) | Method and device for processing internal file of application program | |
CN112163036A (en) | Block chain information construction and query method and related device | |
CN111400269B (en) | IPFS file processing method, node, medium and equipment | |
US20120173489A1 (en) | Attribute selectable file operation | |
CN109446827A (en) | Data encryption and decryption method and system | |
CN111898013B (en) | Website monitoring method and device | |
CN112035482B (en) | Service table partitioning method and device | |
US20130232144A1 (en) | Managing storyboards | |
CN118964335B (en) | A training data set version management method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |