Code table storage system and method based on MD5 encryption algorithm
By building a decision matrix and using the MD5 encryption algorithm, the existing storage system lacks flexibility and scientific decision-making when choosing a storage solution, and realizes efficient code table storage and security guarantees for important code tables.
Patent Information
- Application Number
- CN202411875802.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-19
AI Technical Summary
Existing storage systems lack flexibility and scientific decision-making basis when choosing storage solutions, making it difficult to quickly adapt to changes in storage requirements, resulting in waste of resources or performance degradation.
The code table storage system and method based on the MD5 encryption algorithm are adopted to determine whether encryption processing is required by building a decision matrix, standardizing and weighting processing, generating positive and negative ideal solutions, calculating the preferred values of the storage scheme, selecting the optimal scheme, and determining whether encryption processing is required based on the importance index of the code table.
It realizes the selection of the best storage solution based on real-time storage needs, improves the storage efficiency of code tables, and ensures the security of important code tables through encryption processing.
Smart Images

Figure CN119323044B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of code table storage, and in particular to a code table storage system and method based on an MD5 encryption algorithm. Background Art
[0002] Code tables refer to tables that store common data mappings, data categories, data values, and their descriptions in business systems. They are usually limited and relatively fixed sets. They are usually used to store and manage enumeration types, configuration parameters, status codes, regional information, industry classifications, and other information, and are provided to applications and business logic. The Code-Table-Storage-System is a data management system specifically used to store, manage, and query code tables.
[0003] The prior art has the following deficiencies:
[0004] Currently, many storage systems are often designed for a specific scenario or data type when selecting storage solutions. They lack flexibility, rely on experience or manual configuration, and lack scientific decision-making basis. For different storage requirements (such as query speed, storage space, data security, etc.), the selection of storage solutions usually lacks comprehensive evaluation. When storage requirements change (such as changes in the type of stored data, or changes in the storage system load), existing storage solutions may not be able to adapt quickly, resulting in waste of storage resources or degradation of storage performance.
[0005] Based on this, the present invention proposes a code table storage system and method based on the MD5 encryption algorithm, which can select the best solution according to real-time storage needs without relying on a fixed storage method, thereby improving the storage efficiency of the code table. Summary of the invention
[0006] The purpose of the present invention is to provide a code table storage system and method based on the MD5 encryption algorithm to solve the shortcomings of the background technology.
[0007] In order to achieve the above object, the present invention provides the following technical solution: a code table storage method based on the MD5 encryption algorithm, the storage method comprising the following steps:
[0008] The storage system obtains all the code table information that needs to be stored at present, obtains all the storage schemes through the big database, retains the storage scheme that matches the current code table information, builds a decision matrix for each storage scheme, and obtains the final matrix after standardization and weighting of the decision matrix;
[0009] Generate positive ideal solutions and negative ideal solutions based on the maximum and minimum values of each storage solution in each evaluation indicator in the final matrix. After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, generate a preferred value for each storage solution. Sort all storage solutions according to the preferred value, and select the storage solution with the largest preferred value as the optimal solution.
[0010] After obtaining the importance index of the code table, determine whether the code table needs to be encrypted. If necessary, generate a salt value for the code table that needs to be encrypted, concatenate the salt value with the code table entry to obtain a string, calculate the hash value for the string through the MD5 encryption algorithm, store all strings with calculated hash values through the optimal solution, and generate a loss value for the optimal solution based on the actual storage status, and generate a subsequent storage solution selection strategy based on the loss value.
[0011] In a preferred embodiment, a decision matrix is constructed for each storage solution, comprising the following steps:
[0012] Obtain all the information of the retained storage solutions and obtain the scores of the storage solutions on the evaluation indicators. The decision matrix is expressed as: , where Indicates The storage scheme is in The scores on the evaluation indicators are Indicates the number of storage solutions, Indicates the number of evaluation metrics.
[0013] In a preferred embodiment, the decision matrix is standardized and weighted to obtain a final matrix, which includes the following steps:
[0014] The decision matrix is standardized and the expression is: , where Indicates The storage scheme is in The scores on the evaluation indicators are Indicates the number of evaluation indicators;
[0015] Perform weighted processing on the standardized decision matrix to obtain the final matrix , the expression is: , where Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are Indicates The storage scheme is in The standardized scores on the evaluation indicators are Indicates The weight of the evaluation indicator.
[0016] In a preferred embodiment, generating positive ideal solutions and negative ideal solutions according to the maximum and minimum values of each storage scheme in the final matrix on each evaluation index includes the following steps:
[0017] The evaluation indicators include query index, occupied storage capacity and hash collision index. The query index of the storage solution is maximized, while the occupied storage capacity and hash collision index of the storage solution are minimized.
[0018] The generated positive and negative ideal solutions are: , where is a positive ideal solution, is a negative ideal solution, Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are Indicates taking the maximum value, Indicates taking the minimum value, is a set of query index evaluation criteria, is a set of storage capacity evaluation criteria, A collection of criteria for evaluating hash collision indexes.
[0019] In a preferred embodiment, after calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, a preferred value is generated for each storage solution, all storage solutions are sorted according to the preferred value, and the storage solution with the largest preferred value is selected as the optimal solution, including the following steps:
[0020] Calculate the distance between each storage solution and the positive ideal solution and the negative ideal solution. After obtaining the distance between the storage solution and the positive ideal solution and the negative ideal solution, calculate the optimal value of the storage solution. The expression is: , where is the preferred value, represents the distance from the positive ideal solution, represents the distance from the negative ideal solution;
[0021] Sort all storage solutions from large to small according to their preferred values, obtain a solution list, and select the storage solution with the largest preferred value in the solution list as the optimal solution.
[0022] In a preferred embodiment, the distance between each storage solution and the positive ideal solution and the negative ideal solution is calculated, and the expression is: , where represents the distance from the positive ideal solution, represents the distance to the negative ideal solution, represents the number of evaluation indicators, Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are It means that the positive ideal solution is The weighted normalized scores on the evaluation indicators are Indicates that the negative ideal solution is The weighted normalized scores on the evaluation indicators.
[0023] In a preferred embodiment, after obtaining the importance index of the code table, determining whether the code table needs to be encrypted includes the following steps:
[0024] Obtain the number of associated services and the update frequency of the code table, normalize the number of associated services and the update frequency, map the value range of the number of associated services and the update frequency to [0,1], obtain the normalized value of the number of associated services and the normalized value of the update frequency, and sum the normalized value of the number of associated services and the normalized value of the update frequency to obtain the importance index;
[0025] The obtained importance index is compared with the preset importance threshold. The importance threshold is used to determine whether the code table needs to be encrypted. If the importance index is less than the importance threshold, it is determined that the code table does not need to be encrypted. If the importance index is greater than or equal to the importance threshold, it is determined that the code table needs to be encrypted.
[0026] In a preferred embodiment, a loss value is generated for the optimal solution according to the actual storage condition, and a subsequent storage solution selection strategy is generated based on the loss value, including the following steps:
[0027] Obtain the actual query index, actual occupied storage capacity, and actual hash collision index after storage according to the optimal solution;
[0028] Obtain a query index difference by subtracting the expected query index from the actual query index, obtain an occupied storage capacity difference by subtracting the expected occupied storage capacity from the actual occupied storage capacity, and obtain a hash collision index difference by subtracting the expected hash collision index from the actual hash collision index;
[0029] The loss value is obtained by comprehensively calculating the query index difference, the occupied storage capacity difference, and the hash collision index difference. The expression is: , where is the loss value, To query the index difference, is the difference in occupied storage capacity, is the hash collision index difference, , , is the adjustment coefficient, and , , All are greater than 0;
[0030] When selecting a storage solution later, after obtaining the optimal value of the storage solution, the optimal value is dynamically corrected by the loss value. The expression is: , where is the optimal value after dynamic correction, is the optimal value before dynamic correction, is the loss value;
[0031] The generated storage scheme selection strategy is: after sorting all storage schemes according to the optimal value after dynamic correction, the storage scheme with the largest optimal value after dynamic correction is selected as the optimal scheme.
[0032] In a preferred embodiment, the calculation expression of the query index is: , where To query the index, is the database page size, is the total number of records stored, For index search efficiency, is the number of records required to scan, The efficiency of full table scan;
[0033] The calculation expression of the hash collision index is: , where is the hash collision index, is the number of buckets in the hash table.
[0034] The code table storage system based on MD5 encryption algorithm includes a matrix construction module, a scheme selection module, an encryption module, and a storage decision module;
[0035] Matrix construction module: obtain all the code table information that needs to be stored at present, obtain all the storage schemes through the big database, retain the storage scheme that matches the current code table information, build a decision matrix for each storage scheme, and obtain the final matrix after standardization and weighting of the decision matrix;
[0036] Solution selection module: Generate positive ideal solutions and negative ideal solutions based on the maximum and minimum values of each storage solution in the final matrix on each evaluation indicator. After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, generate a preferred value for each storage solution, sort all storage solutions according to the preferred value, and select the storage solution with the largest preferred value as the optimal solution.
[0037] Encryption module: After obtaining the importance index of the code table, determine whether the code table needs to be encrypted. If necessary, generate a salt value for the code table that needs to be encrypted, concatenate the salt value with the code table entry to obtain a string, and calculate the hash value for the string using the MD5 encryption algorithm;
[0038] Storage decision module: All strings with calculated hash values are stored through the optimal solution, and a loss value is generated for the optimal solution based on the actual storage status, and a subsequent storage solution selection strategy is generated based on the loss value.
[0039] In the above technical solution, the technical effects and advantages provided by the present invention are:
[0040] 1. The present invention constructs a decision matrix for each storage scheme, standardizes and weights the decision matrix to obtain a final matrix, generates positive ideal solutions and negative ideal solutions according to the maximum and minimum values of each storage scheme in each evaluation index in the final matrix, calculates the distance between each storage scheme and the positive ideal solution and the negative ideal solution, generates a preferred value for each storage scheme, sorts all storage schemes according to the preferred value, and selects the storage scheme with the largest preferred value as the optimal solution, obtains the importance index of the code table, determines whether the code table needs to be encrypted, and if necessary, generates a salt value for the code table that needs to be encrypted, concatenates the salt value with the code table entry to obtain a string, calculates a hash value for the string through the MD5 encryption algorithm, and stores all strings with completed hash values through the optimal solution. The storage system can select the best solution according to real-time storage needs without relying on a fixed storage method, thereby improving the storage efficiency of the code table.
[0041] 2. After obtaining the importance index of the code table, the present invention determines whether the code table needs to be encrypted. If necessary, a salt value is generated for the code table that needs to be encrypted, and the salt value is concatenated with the code table entry to obtain a string. The hash value is calculated for the string through the MD5 encryption algorithm, and all strings with completed hash values are stored through the optimal solution, and a loss value is generated for the optimal solution based on the actual storage status, and a subsequent storage solution selection strategy is generated based on the loss value. The storage system can firstly analyze the importance of the code table, thereby ensuring that the important code table can be encrypted, ensuring the security of the code table storage and avoiding the waste of computing resources, and can generate a loss value in combination with the actual use of the storage solution, thereby providing a decision basis for the next storage solution selection. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0043] Figure 1 The present invention is a flow chart of the method. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] Example 1: Please refer to Figure 1 As shown, the code table storage method based on the MD5 encryption algorithm described in this embodiment includes the following steps:
[0046] The storage system obtains all the code table information that needs to be stored at present, obtains all the storage schemes through the big database (the big database can be the big database of the enterprise or the big database related to the code table storage), retains the storage scheme that matches the current code table information, builds a decision matrix for each storage scheme, and obtains the final matrix after standardization and weighting of the decision matrix. According to the maximum and minimum values of each storage scheme on each evaluation indicator in the final matrix, the positive ideal solution and the negative ideal solution are generated. After calculating the distance between each storage scheme and the positive ideal solution and the negative ideal solution, a preferred value is generated for each storage scheme, all storage schemes are sorted according to the preferred value, and the storage scheme with the largest preferred value is selected as the optimal solution. After obtaining the importance index of the code table, it is determined whether the code table needs to be encrypted. If necessary, a salt value is generated for the code table that needs to be encrypted, and the salt value is concatenated with the code table entry to obtain a string. The hash value is calculated for the string through the MD5 encryption algorithm, and all the strings with completed hash values are stored through the optimal solution, and a loss value is generated for the optimal solution according to the actual storage status, and a subsequent storage scheme selection strategy is generated based on the loss value.
[0047] This application constructs a decision matrix for each storage scheme, standardizes and weights the decision matrix to obtain the final matrix, generates positive ideal solutions and negative ideal solutions according to the maximum and minimum values of each storage scheme in each evaluation index in the final matrix, calculates the distance between each storage scheme and the positive ideal solution and the negative ideal solution, generates a preferred value for each storage scheme, sorts all storage schemes according to the preferred value, and selects the storage scheme with the largest preferred value as the optimal solution. After obtaining the importance index of the code table, it is determined whether the code table needs to be encrypted. If necessary, a salt value is generated for the code table that needs to be encrypted, and the salt value is concatenated with the code table entry to obtain a string. The hash value is calculated for the string through the MD5 encryption algorithm, and all strings with completed hash values are stored through the optimal solution. The storage system can select the best solution according to real-time storage needs without relying on a fixed storage method, thereby improving the storage efficiency of the code table.
[0048] After obtaining the importance index of the code table, this application determines whether the code table needs to be encrypted. If necessary, a salt value is generated for the code table that needs to be encrypted, and the salt value is concatenated with the code table entry to obtain a string. The hash value is calculated for the string through the MD5 encryption algorithm, and all strings with completed hash values are stored through the optimal solution, and a loss value is generated for the optimal solution based on the actual storage status, and a subsequent storage solution selection strategy is generated based on the loss value. The storage system can firstly analyze the importance of the code table, thereby ensuring that important code tables can be encrypted, ensuring the security of code table storage and avoiding waste of computing resources, and secondly, it can generate a loss value based on the actual use of the storage solution, thereby providing a decision basis for the next storage solution selection.
[0049] Embodiment 2: The storage system obtains all code table information that needs to be stored currently, obtains all storage solutions through a big database (the big database can be a big database of an enterprise or a big database related to code table storage), and retains the storage solution that matches the current code table information, including the following steps:
[0050] First, the system needs to obtain all the code table information that needs to be stored. This information may come from code table data generated in real time, or from database records that already exist in the system. Each code table entry contains the original data, identifiers (such as ID or unique key value), possible field types, etc. Query the system or obtain all the code table data that currently needs to be stored in real time. Preprocess the code table data (such as deduplication, cleaning, standardization, etc.) to ensure the accuracy of the data. Ensure that the acquired code table information is the latest data and can be stored as needed.
[0051] By accessing the enterprise's big database or the big database related to code table storage, the system obtains all available storage solutions. These storage solutions may include database storage solutions, memory storage solutions, distributed storage solutions, etc. Connect to the big database and query the storage solution. The storage solutions in the big database may include: storage type (such as SQL database, NoSQL database, file system, etc.), performance indicators (such as response time, capacity limit, scalability, etc.), security requirements, etc.
[0052] Extract all storage solution information and classify them according to multiple factors such as storage method, cost, security, performance, etc. Obtain all possible storage solutions from the big database and ensure the integrity and diversity of the solutions. Filter out qualified storage solutions based on the information characteristics of the current code table (such as data type, storage requirements, security requirements, etc.). The "matching" here refers to selecting the storage method that can best meet the storage needs of the current code table. For example, the data type of the current code table (text, numeric, binary), the expected query frequency, storage space requirements, whether encrypted storage is required, etc. The storage solution extracted from the big database will be matched with the current code table according to the following criteria:
[0053] Data type support: Whether the storage solution can efficiently support the data type of the current code table.
[0054] Storage performance: Whether the storage solution can meet the current code table's requirements for storage space, read and write speed, etc.
[0055] Security requirements: If the code table contains sensitive data, does it require encrypted storage or backup support?
[0056] Scalability requirements: Whether the storage solution supports expansion as the amount of data increases.
[0057] Cost-effectiveness: Whether the cost of the storage solution fits the enterprise budget.
[0058] Objective: To select the storage solution that best matches the current code table data characteristics and requirements from all storage solutions.
[0059] Storage solution 1: Relational database storage solution (traditional storage):
[0060] Storage method: Create a table in a relational database (such as MySQL, PostgreSQL) to store unencrypted raw data. The table contains at least two columns: a data column (to store raw data) and an identifier column (to identify each piece of data).
[0061] Data column: stores the unencrypted original data of the code table, which can be a string, number, or other types of content.
[0062] Identifier column: Each piece of data has a unique identifier (such as an ID) to distinguish each data record.
[0063] Query method:
[0064] When querying, use the identifier column (such as ID) for indexing to locate the corresponding original data.
[0065] Query steps:
[0066] The client provides an identifier (such as an ID).
[0067] The system searches for the corresponding record in the database by ID and obtains the original data.
[0068] advantage:
[0069] Easy to manage: Relational databases provide powerful query capabilities that make it easy to add, delete, modify, and query data.
[0070] High availability: Data can be ensured to be highly available through database backup and recovery mechanisms.
[0071] Scalability: Relational databases support vertical expansion and can adapt to the growth of enterprise data volume.
[0072] shortcoming:
[0073] Storage capacity: As the amount of data increases, storage and query costs will increase.
[0074] Query performance: For large amounts of data, queries may be performance-limited, especially when there is no encryption and security is weak.
[0075] Storage solution 2: Memory hash table storage solution (cache storage):
[0076] Storage method: Use a memory cache system (such as Redis, Memcached) to store unencrypted raw data. Each entry stores a mapping between the raw data and a unique identifier (such as an ID).
[0077] Data entries are stored as key-value pairs, where the key is a unique identifier (such as an ID) and the value is the original unencrypted data.
[0078] Query method:
[0079] When querying, the data is read directly from memory using the unique identifier as the key.
[0080] Query steps:
[0081] The client provides an identifier (such as an ID).
[0082] The system uses the identifier to quickly find the corresponding original data from the memory cache.
[0083] advantage:
[0084] Fast query speed: Data is stored in memory, and query latency is extremely low, which is suitable for data that needs to be accessed frequently.
[0085] Fast response: Especially suitable for cache and session data storage, suitable for high-frequency query requests.
[0086] Low latency: In-memory storage provides extremely low query latency and is much faster than traditional disk storage.
[0087] shortcoming:
[0088] Limited storage capacity: Memory resources are limited and are limited when storing large amounts of data.
[0089] Data loss risk: Data in memory is easily lost, especially when the system crashes or restarts.
[0090] Storage solution 3: File storage solution (distributed file system):
[0091] Storage method: Use a distributed file storage system (such as Amazon S3, HDFS) to store unencrypted raw data. Data is stored in files in a certain format (such as JSON, CSV, XML, etc.), and each file contains multiple data entries.
[0092] Data Format: You can choose a common data format (such as CSV, JSON, or XML), and each data entry contains the original data and a unique identifier (such as an ID).
[0093] Query method:
[0094] When querying, you can search through the API provided by the file system. You can search based on file content or organize data by file name.
[0095] Query steps:
[0096] The client provides an identifier (such as an ID).
[0097] The system queries the distributed file system, locates the file containing the identifier, and reads the corresponding raw data.
[0098] advantage:
[0099] High scalability: Distributed storage systems support horizontal expansion of data and are suitable for large-scale data storage.
[0100] Strong fault tolerance: Data can be backed up on multiple nodes to improve data reliability.
[0101] Flexible storage methods: data in different formats can be stored to meet various data needs.
[0102] shortcoming:
[0103] Low query efficiency: Compared with memory storage and relational databases, query speed is slow, especially when the amount of data is large.
[0104] Management complexity: The distributed file system needs to be maintained and data integrity and consistency ensured.
[0105] Construct a decision matrix for each storage option, including the following steps:
[0106] Get all the information of the reserved storage solutions and get the scores of the storage solutions on the evaluation indicators, then the decision matrix It is expressed as: , where Indicates The storage scheme is in The scores on the evaluation indicators are Indicates the number of storage solutions, Indicates the number of evaluation metrics.
[0107] The decision matrix is standardized and weighted to obtain the final matrix, which includes the following steps:
[0108] The decision matrix is standardized and the expression is: , where Indicates The storage scheme is in The standardized scores on the evaluation indicators are Indicates The storage scheme is in The scores on the evaluation indicators are Indicates the number of evaluation indicators;
[0109] Perform weighted processing on the standardized decision matrix to obtain the final matrix , the expression is: , where Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are Indicates The storage scheme is in The standardized scores on the evaluation indicators are Indicates The weight of the evaluation indicator.
[0110] According to the maximum and minimum values of each storage scheme in each evaluation index in the final matrix, the positive ideal solution and the negative ideal solution are generated, including the following steps:
[0111] The evaluation indicators include query index, occupied storage capacity and hash collision index, and in this application, it is necessary to maximize the query index of the storage solution and minimize the occupied storage capacity and hash collision index of the storage solution;
[0112] Therefore, the generated positive and negative ideal solutions are: , where is a positive ideal solution, is a negative ideal solution, Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are Indicates taking the maximum value, Indicates taking the minimum value, is a set of query index evaluation criteria, is a set of storage capacity evaluation criteria, A collection of evaluation criteria for hash collision index;
[0113] That is, in the ideal solution, the maximum query index, the minimum occupied storage capacity and the minimum hash collision index are selected; in the negative ideal solution, the minimum query index, the maximum occupied storage capacity and the maximum hash collision index are selected.
[0114] The calculation expression of the query index is: , where To query the index, is the database page size, is the total number of records stored, For index search efficiency, is the number of records required to scan, The efficiency of full table scan.
[0115] The calculation expression of hash collision index is: , where is the hash collision index, is the total number of records stored, is the number of buckets in the hash table.
[0116] The occupied storage capacity is directly obtained through the storage device management system.
[0117] In this application, the query index of the storage scheme is obtained through the storage scheme historical storage code table, the occupied storage capacity of the storage scheme is obtained through the storage scheme historical storage code table, and the hash collision index of the storage scheme is obtained through the storage scheme historical storage code table.
[0118] 1) Relationship between query efficiency and storage solution priority
[0119] Query efficiency usually refers to the storage solution's response time to data queries. Generally, the higher the query efficiency (the shorter the response time), the higher the priority. The query efficiency directly affects the performance of the system, especially under high load or large data volume.
[0120] The higher the query efficiency, the higher the priority: the storage solution should respond to query requests as quickly as possible. In scenarios that require query efficiency (such as real-time query, large-scale data query, etc.), storage solutions with fast response (such as memory storage, index-optimized databases, etc.) have a higher priority.
[0121] Low query efficiency and low priority: If the storage solution has a long query response time or slow query operation (such as a disk-based storage system, or a hash table with many hash collisions), it will be given a low priority.
[0122] Priority relationship of query efficiency:
[0123] High query efficiency (e.g. in-memory storage, index-optimized databases, etc.) → high priority;
[0124] Medium query efficiency (such as ordinary relational databases, inefficient hash tables, etc.) → Medium priority;
[0125] Low query efficiency (such as databases that do not use indexes, large-scale file storage, etc.) → low priority;
[0126] 2) Relationship between occupied storage capacity and storage solution priority
[0127] Occupied storage capacity is another important factor in evaluating storage solutions, especially when the amount of data is huge or storage resources are limited. The efficient use of storage capacity directly affects the performance and cost of the storage system.
[0128] The smaller the storage capacity, the higher the priority: For scenarios with limited storage capacity or the requirement to save storage costs, storage solutions with small capacity have higher priority. For example, using technologies such as data compression and optimized storage structure can reduce storage usage and increase the priority of storage solutions.
[0129] Large storage capacity, low priority: If the storage solution occupies a large amount of storage space, especially when there are restrictions on storage resources, it has a low priority. For example, some solutions with too much redundancy or not optimizing storage space may result in high storage costs or inefficient storage use.
[0130] The priority relationship of occupying storage capacity is:
[0131] Low capacity usage (such as compressed storage, deduplication storage, etc.) → high priority;
[0132] Medium capacity usage (such as general database storage) → Medium priority;
[0133] High capacity usage (such as redundant storage, large file storage, etc.) → low priority;
[0134] 3) Relationship between hash collision rate and storage scheme priority
[0135] The hash collision rate refers to the probability that different data entries are mapped to the same location (bucket) in the hash table. A high collision rate will reduce the search efficiency, so it is closely related to the query efficiency.
[0136] The lower the hash collision rate, the higher the priority: a low collision rate means that the data in the hash table is distributed more evenly, and the probability of collision during query is lower, thereby improving query efficiency. Storage solutions with low collision rates usually have higher priority, especially for frequently queried data tables.
[0137] High hash collision rate, low priority: High collision rate will cause hash conflicts and increase query time, so storage solutions with higher collision rate have lower priority, especially in scenarios that require fast query.
[0138] The priority relationship of hash collision rate:
[0139] Low collision rate (such as low load factor, optimized hash function, etc.) → high priority;
[0140] Medium crash rate (like regular load factor) → Medium priority;
[0141] High collision rate (such as high load factor or uneven hash function) → low priority;
[0142] Query efficiency: Prioritize solutions with high query efficiency (memory storage, optimized hash tables, index-optimized databases, etc.). Solutions with low query efficiency, such as inefficient hash tables or index-free queries, have a lower priority.
[0143] Storage capacity occupied: Prioritize solutions that occupy less storage capacity (such as compressed storage, deduplication storage, etc.). Solutions that occupy more capacity, such as redundant storage, non-compressed storage, etc., have a lower priority.
[0144] Hash collision rate: Prioritize storage solutions with low collision rates (such as optimized hash functions, hash tables with low load factors, etc.). Solutions with high collision rates, such as excessively high load factors or uneven hash function performance, have lower priority.
[0145] Consider the priority:
[0146] When choosing a storage solution, you need to strike a balance between query efficiency, storage capacity, and hash collision rate. The ideal storage solution should be:
[0147] High query efficiency: able to respond to query requests quickly.
[0148] Low storage capacity usage: save storage resources and reduce costs.
[0149] Low hash collision rate: Avoid performance bottlenecks during query.
[0150] Among these factors, the requirements of different scenarios need to be comprehensively considered. If query efficiency is the most critical, query response speed and hash collision rate will be the top priority factors; if storage resources are limited, storage capacity optimization needs to be given a higher priority.
[0151] After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, a preferred value is generated for each storage solution, all storage solutions are sorted according to the preferred value, and the storage solution with the largest preferred value is selected as the optimal solution, including the following steps:
[0152] Calculate the distance between each storage solution and the positive ideal solution and the negative ideal solution. The expression is: , where represents the distance from the positive ideal solution, represents the distance to the negative ideal solution, represents the number of evaluation indicators, Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are It means that the positive ideal solution is The weighted normalized scores on the evaluation indicators are Indicates that the negative ideal solution is Weighted standardized scores on the evaluation indicators;
[0153] After obtaining the distance between the storage solution and the positive ideal solution and the negative ideal solution, the optimal value of the storage solution is calculated. The expression is: , where is the preferred value, represents the distance from the positive ideal solution, represents the distance from the negative ideal solution;
[0154] The larger the preference value, the better the overall performance of the storage solution. All storage solutions are sorted from large to small according to the preference value, and a solution list is obtained. The storage solution with the largest preference value in the solution list is selected as the optimal solution.
[0155] After obtaining the importance index of the code table, determining whether the code table needs to be encrypted includes the following steps:
[0156] The number of associated services and the update frequency of the code table are obtained, and the number of associated services and the update frequency are normalized so that the value range of the number of associated services and the update frequency is mapped to [0, 1], and the normalized value of the number of associated services and the normalized value of the update frequency are obtained. The normalized value of the number of associated services and the normalized value of the update frequency are summed to obtain the importance index. The larger the importance index is, the more important the code table is, and the more encryption processing is required;
[0157] The obtained importance index is compared with the preset importance threshold. The importance threshold is used to determine whether the code table needs to be encrypted. If the importance index is less than the importance threshold, it is determined that the code table does not need to be encrypted. If the importance index is greater than or equal to the importance threshold, it is determined that the code table needs to be encrypted.
[0158] If necessary, generate a salt value for the code table that needs to be encrypted, concatenate the salt value with the code table entry to obtain a string, calculate a hash value for the string using the MD5 encryption algorithm, and store all strings with completed hash values through the optimal solution, including the following steps:
[0159] Get the code table data that needs to be encrypted. Each code table entry contains the original data and a unique identifier (such as ID, etc.). Generate a unique salt value for each entry that needs to be encrypted. The salt value can be generated using a random number generator, timestamp, or other high entropy data source. Example generation method: Use the current timestamp, random number, or user-specific information to generate the salt value. Ensure that the salt value of each entry is unique and unpredictable. The salt value should be long enough, usually at least 16-32 bytes, to improve security;
[0160] The generated salt value is concatenated with the data of each entry. The concatenated string thus generated contains the combination of the original data and the salt value, which has higher security because the same original data uses a different salt value to calculate the hash value each time, and the concatenated string is subjected to MD5 hash calculation to obtain the hash value. The MD5 hash algorithm maps input of any length to an output of a fixed length (128 bits); this hash value is stored as encrypted data, while the original data and salt value are not stored directly, thereby improving data security;
[0161] Stored Procedure:
[0162] Relational database: Store the MD5 hash value as the unique identifier of the entry (such as the ID field) in the database table.
[0163] NoSQL storage: If using NoSQL storage, such as MongoDB, the hash value can be stored as the unique key of the document.
[0164] In-memory storage (such as Redis): If you choose Redis, you can store MD5 hashes in key-value pairs for fast access.
[0165] The above encryption steps belong to the prior art and will not be elaborated in this application.
[0166] Generate a loss value for the optimal solution based on the actual storage status, and generate a subsequent storage solution selection strategy based on the loss value, including the following steps:
[0167] Obtain the actual query index, actual occupied storage capacity, and actual hash collision index after storage according to the optimal solution;
[0168] Obtain a query index difference by subtracting the expected query index from the actual query index, obtain an occupied storage capacity difference by subtracting the expected occupied storage capacity from the actual occupied storage capacity, and obtain a hash collision index difference by subtracting the expected hash collision index from the actual hash collision index;
[0169] The loss value is obtained by comprehensively calculating the query index difference, the occupied storage capacity difference, and the hash collision index difference. The expression is: , where is the loss value, To query the index difference, is the difference in occupied storage capacity, is the hash collision index difference, , , is the adjustment coefficient, and , , All are greater than 0;
[0170] The larger the loss value, the worse the actual performance of the storage solution;
[0171] When selecting a storage solution later, after obtaining the optimal value of the storage solution, the optimal value is dynamically corrected by the loss value. The expression is: , where is the optimal value after dynamic correction, is the optimal value before dynamic correction, is the loss value;
[0172] The generated storage scheme selection strategy is: after sorting all storage schemes according to the optimal value after dynamic correction, the storage scheme with the largest optimal value after dynamic correction is selected as the optimal scheme.
[0173] Embodiment 3: The code table storage system based on the MD5 encryption algorithm described in this embodiment includes a matrix construction module, a scheme selection module, an encryption module, and a storage decision module;
[0174] Matrix construction module: obtain all the code table information that needs to be stored at present, obtain all storage solutions through the big database (the big database can be the big database of the enterprise or the big database related to the code table storage), retain the storage solution that matches the current code table information, build a decision matrix for each storage solution, standardize and weight the decision matrix to obtain the final matrix, and send the final matrix to the solution selection module;
[0175] Solution selection module: Generate positive ideal solutions and negative ideal solutions based on the maximum and minimum values of each storage solution in the final matrix on each evaluation indicator. After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, generate a preferred value for each storage solution, sort all storage solutions according to the preferred value, and select the storage solution with the largest preferred value as the optimal solution. The optimal solution is sent to the storage decision module.
[0176] Encryption module: After obtaining the importance index of the code table, determine whether the code table needs to be encrypted. If necessary, generate a salt value for the code table that needs to be encrypted, concatenate the salt value with the code table entry to obtain a string, calculate the hash value for the string through the MD5 encryption algorithm, and send the encryption result to the storage decision module;
[0177] Storage decision module: All strings with calculated hash values are stored through the optimal solution, and a loss value is generated for the optimal solution based on the actual storage status, and a subsequent storage solution selection strategy is generated based on the loss value.
[0178] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0179] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.
[0180] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0181] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0182] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A code table storage method based on the MD5 encryption algorithm, characterized in that: The storage method comprises the following steps: The storage system obtains all the code table information that needs to be stored at present, obtains all the storage schemes through the big database, retains the storage scheme that matches the current code table information, builds a decision matrix for each storage scheme, and obtains the final matrix after standardization and weighting of the decision matrix; Generate positive ideal solutions and negative ideal solutions based on the maximum and minimum values of each storage solution in each evaluation indicator in the final matrix. After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, generate a preferred value for each storage solution. Sort all storage solutions according to the preferred value, and select the storage solution with the largest preferred value as the optimal solution. After obtaining the importance index of the code table, determine whether the code table needs to be encrypted. If necessary, generate a salt value for the code table that needs to be encrypted, concatenate the salt value with the code table entry to obtain a string, calculate the hash value for the string using the MD5 encryption algorithm, store all strings with calculated hash values through the optimal solution, generate a loss value for the optimal solution based on the actual storage status, and generate a subsequent storage solution selection strategy based on the loss value; Construct a decision matrix for each storage option, including the following steps: Obtain all the information of the retained storage solutions and obtain the scores of the storage solutions on the evaluation indicators. The decision matrix is expressed as: , where Indicates The storage scheme is in The scores on the evaluation indicators are Indicates the number of storage solutions, Indicates the number of evaluation metrics.
2. The code table storage method based on the MD5 encryption algorithm according to claim 1, characterized in that: The decision matrix is standardized and weighted to obtain the final matrix, which includes the following steps: The decision matrix is standardized and the expression is: , where Indicates The storage scheme is in The scores on the evaluation indicators are Indicates the number of evaluation indicators; Perform weighted processing on the standardized decision matrix to obtain the final matrix , the expression is: , where Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are Indicates The storage scheme is in The standardized scores on the evaluation indicators are Indicates The weight of the evaluation indicator.
3. The code table storage method based on the MD5 encryption algorithm according to claim 2 is characterized in that: According to the maximum and minimum values of each storage scheme in each evaluation index in the final matrix, the positive ideal solution and the negative ideal solution are generated, including the following steps: The evaluation indicators include query index, occupied storage capacity and hash collision index. The query index of the storage solution is maximized, while the occupied storage capacity and hash collision index of the storage solution are minimized. The generated positive and negative ideal solutions are: , where is a positive ideal solution, is a negative ideal solution, Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are Indicates taking the maximum value, Indicates taking the minimum value, is a set of query index evaluation criteria, is a set of storage capacity evaluation criteria, A collection of criteria for evaluating hash collision indexes.
4. The code table storage method based on the MD5 encryption algorithm according to claim 3 is characterized in that: After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, a preferred value is generated for each storage solution, all storage solutions are sorted according to the preferred value, and the storage solution with the largest preferred value is selected as the optimal solution, including the following steps: Calculate the distance between each storage solution and the positive ideal solution and the negative ideal solution. After obtaining the distance between the storage solution and the positive ideal solution and the negative ideal solution, calculate the optimal value of the storage solution. The expression is: , where is the preferred value, represents the distance from the positive ideal solution, represents the distance from the negative ideal solution; Sort all storage solutions from large to small according to their preferred values, obtain a solution list, and select the storage solution with the largest preferred value in the solution list as the optimal solution.
5. The code table storage method based on the MD5 encryption algorithm according to claim 4 is characterized in that: Calculate the distance between each storage solution and the positive ideal solution and the negative ideal solution. The expression is: , where represents the distance from the positive ideal solution, represents the distance to the negative ideal solution, represents the number of evaluation indicators, Indicates The storage scheme is in The weighted normalized scores on the evaluation indicators are It means that the positive ideal solution is The weighted normalized scores on the evaluation indicators are Indicates that the negative ideal solution is The weighted normalized scores on the evaluation indicators.
6. The code table storage method based on the MD5 encryption algorithm according to claim 5 is characterized in that: After obtaining the importance index of the code table, determining whether the code table needs to be encrypted includes the following steps: Obtain the number of associated services and the update frequency of the code table, normalize the number of associated services and the update frequency, map the value range of the number of associated services and the update frequency to [0,1], obtain the normalized value of the number of associated services and the normalized value of the update frequency, and sum the normalized value of the number of associated services and the normalized value of the update frequency to obtain the importance index; The obtained importance index is compared with the preset importance threshold. The importance threshold is used to determine whether the code table needs to be encrypted. If the importance index is less than the importance threshold, it is determined that the code table does not need to be encrypted. If the importance index is greater than or equal to the importance threshold, it is determined that the code table needs to be encrypted.
7. The code table storage method based on the MD5 encryption algorithm according to claim 6 is characterized in that: Generate a loss value for the optimal solution based on the actual storage status, and generate a subsequent storage solution selection strategy based on the loss value, including the following steps: Obtain the actual query index, actual occupied storage capacity, and actual hash collision index after storage according to the optimal solution; Obtain a query index difference by subtracting the expected query index from the actual query index, obtain an occupied storage capacity difference by subtracting the expected occupied storage capacity from the actual occupied storage capacity, and obtain a hash collision index difference by subtracting the expected hash collision index from the actual hash collision index; The loss value is obtained by comprehensively calculating the query index difference, the occupied storage capacity difference, and the hash collision index difference. The expression is: , where is the loss value, To query the index difference, is the difference in occupied storage capacity, is the hash collision index difference, , , is the adjustment coefficient, and , , All are greater than 0; When selecting a storage solution later, after obtaining the optimal value of the storage solution, the optimal value is dynamically corrected by the loss value. The expression is: , where is the optimal value after dynamic correction, is the optimal value before dynamic correction, is the loss value; The generated storage scheme selection strategy is: after sorting all storage schemes according to the optimal value after dynamic correction, the storage scheme with the largest optimal value after dynamic correction is selected as the optimal scheme.
8. The code table storage method based on the MD5 encryption algorithm according to claim 7, characterized in that: The calculation expression of the query index is: , where To query the index, is the database page size, is the total number of records stored, For index search efficiency, is the number of records required to scan, The efficiency of full table scan; The calculation expression of the hash collision index is: , where is the hash collision index, is the number of buckets in the hash table.
9. A code table storage system based on the MD5 encryption algorithm, used to implement the storage method according to any one of claims 1 to 8, characterized in that: It includes matrix construction module, scheme selection module, encryption module and storage decision module; Matrix construction module: obtain all the code table information that needs to be stored at present, obtain all the storage schemes through the big database, retain the storage scheme that matches the current code table information, build a decision matrix for each storage scheme, and obtain the final matrix after standardization and weighting of the decision matrix; Solution selection module: Generate positive ideal solutions and negative ideal solutions based on the maximum and minimum values of each storage solution in the final matrix on each evaluation indicator. After calculating the distance between each storage solution and the positive ideal solution and the negative ideal solution, generate a preferred value for each storage solution, sort all storage solutions according to the preferred value, and select the storage solution with the largest preferred value as the optimal solution. Encryption module: After obtaining the importance index of the code table, determine whether the code table needs to be encrypted. If necessary, generate a salt value for the code table that needs to be encrypted, concatenate the salt value with the code table entry to obtain a string, and calculate the hash value for the string using the MD5 encryption algorithm; Storage decision module: All strings with calculated hash values are stored through the optimal solution, and a loss value is generated for the optimal solution based on the actual storage status, and a subsequent storage solution selection strategy is generated based on the loss value.
Citation Information
Patent Citations
Data storage optimization method and system for consistency test platform of demand response equipment
CN117312257A
Equipment energy consumption prediction method and device, storage medium and computer equipment
CN118468121A