A method and system for encrypted fragmentation and distributed storage of a password
The distributed cryptographic storage method optimized by random forest model and genetic algorithm solves the security and performance problems of traditional cryptographic storage methods, and realizes efficient, secure and personalized cryptographic management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA ACADEMY OF INFORMATION & COMM
- Filing Date
- 2025-09-19
- Publication Date
- 2026-05-05
AI Technical Summary
Traditional cryptographic storage methods suffer from problems such as high risk of single point of failure, insufficient security, inability to meet diverse security needs, system complexity and performance degradation, and lack of intelligent adaptability.
A random forest model is used to collect user passwords and behavioral characteristics. A genetic algorithm is used to optimize the sharding strategy. Combined with encryption algorithms and distributed storage, password sharding, encryption, storage and recombination are realized.
It improves the security and efficiency of password storage, provides personalized services, enhances system stability, reduces the risk of single points of failure, and optimizes resource utilization and user experience.
Smart Images

Figure CN121239401B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of cryptographic storage, and particularly relates to a method and system for cryptographic encryption fragmentation and distributed storage. Background Technology
[0002] With the rapid development of information technology, passwords are becoming increasingly important in protecting user information security. They are essential credentials for users to access and operate personal data and conduct online transactions, and are related to the protection of users' privacy, property security, and digital rights.
[0003] However, traditional password storage methods face numerous serious security challenges. Firstly, their centralized storage architecture, storing all user passwords in one location, results in a highly vulnerable single point of failure. If this storage point is compromised by hackers or damaged by natural disasters, passwords are easily leaked, allowing attackers to easily gain access to user accounts and commit malicious acts such as fund theft and privacy breaches, causing significant losses to users. Secondly, traditional methods rely excessively on a single encryption algorithm. With the evolution of cryptographic technology and the increasing diversity of attack methods, this reliance not only makes older algorithms vulnerable to exploitation, but even advanced algorithms can be cracked if not updated regularly. Furthermore, it fails to meet the diverse security needs of different users and scenarios.
[0004] While existing distributed password storage technologies have improved security and reduced the impact of single points of failure to some extent, they still have many shortcomings. On the one hand, distributed storage increases system complexity, leading to performance degradation during password storage, retrieval, and use, impacting user experience, and an ideal solution for balancing security and efficiency has not yet been found. On the other hand, existing systems lack intelligent adaptability, failing to dynamically adjust based on user password usage, changes in security needs, and real-time threats, and also unable to provide personalized security guarantees for different users and business needs.
[0005] In summary, traditional cryptographic storage methods have many security vulnerabilities, while existing distributed cryptographic storage technologies still have significant shortcomings in cryptographic fragmentation generation, storage allocation, and intelligent adaptability. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention proposes a technical solution for cryptographic sharding and distributed storage, thereby resolving these issues.
[0007] The first aspect of this invention discloses a cryptographic sharding and distributed storage method, the method comprising:
[0008] Step S1: Collect user password features and behavioral features; train a random forest model using the password features and behavioral features as input to obtain the password security assessment results and the range of the number of shards;
[0009] Step S2: Based on the range of the number of shards in the password, the sharding strategy is optimized using a genetic algorithm to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes.
[0010] Step S3: Encrypt each password fragment according to the security assessment result of the password;
[0011] Step S4: Store each encrypted cryptographic fragment according to the characteristics of the encrypted cryptographic fragments and the characteristics of the storage nodes;
[0012] Step S5: Obtain the encrypted password fragment, then decrypt the encrypted password fragment, and finally reassemble the decrypted password fragment to obtain the user's password.
[0013] According to the method of the first aspect of the present invention, in step S1, the password features include: the length of the password and the character composition; the character composition is: the ratio of numbers, letters and special characters;
[0014] The behavioral characteristics include: the time and location of login, the type of device used, and the network environment in which login occurred.
[0015] According to the method of the first aspect of the present invention, in step S2, optimizing the sharding strategy using a genetic algorithm based on the range of the number of shards in the cryptography to obtain a sharding strategy including the number of shards, the data size of each shard, and the number of storage nodes includes:
[0016] Based on the range of the number of shards, multiple sharding strategies are randomly generated, which include the number of shards, the data size of each shard, and the number of storage nodes.
[0017] Set the storage node distribution balance function according to the number of storage nodes and the amount of data stored in each storage node;
[0018] Set the data transmission time cost function based on the data size of each fragment and the network transmission speed;
[0019] A complexity coefficient is introduced based on the number of fragments and the number of storage nodes, and then the computational complexity function of cipher reassembly is calculated based on the complexity coefficient and the number of fragments.
[0020] The number of fragments refers to the total number of fragments into which the cipher is divided, denoted by N in the file. It is explicitly defined below: "Introducing a noise coefficient c = N / M, where N is the number of fragments and M is the number of storage nodes." Here, "the number of fragments" refers to the "number of fragments" mentioned earlier (the total number of fragments into which the cipher is divided).
[0021] Calculate the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher recombining computational complexity function.
[0022] Genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual;
[0023] After iteration, the process eventually converges, and the optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population.
[0024] According to the method of the first aspect of the present invention, in step S2, setting the storage node distribution balance function according to the number of storage nodes and the amount of stored data in the storage nodes includes:
[0025]
[0026]
[0027]
[0028]
[0029] in, The function representing the distribution balance of storage nodes; The standard deviation of node load; Indicates the number of storage nodes; Indicates the first j The amount of data stored per storage node; Indicates average load; This represents the numerical stability compensation factor. Its function is to prevent mathematical calculation errors caused by the denominator (standard deviation σ of node load) being zero, and to ensure that the formula can still be calculated effectively in extreme cases (such as when all node loads are perfectly balanced, σ=0). It is an auxiliary parameter to ensure numerical stability. It represents the natural constant, a fixed constant in mathematics with a value of approximately 2.71828, and is widely used in scenarios involving exponential functions, logarithmic functions, etc.
[0030] According to the method of the first aspect of the present invention, in step S2, setting the data transmission time cost function based on the data size of each fragment and the network transmission speed includes:
[0031] Based on the data size of each partition and network transmission speed Calculate transmission time ;
[0032] Based on the transmission time of each fragment The total transmission time cost is calculated, which is the data transmission time cost function.
[0033]
[0034] in, This represents a function representing the time cost of data transmission. Indicates the number of fragments; This represents the maximum transmission time cost calculated under all fragmentation strategies.
[0035] According to the method of the first aspect of the present invention, in step S2, the introduction of a noise factor based on the number of fragments and the number of storage nodes includes:
[0036]
[0037] in, Represents the noise coefficient; Indicates the number of fragments; Indicates the number of storage nodes;
[0038] The computational complexity function for cipher reassembly is then calculated based on the complexity coefficient and the number of fragments, including:
[0039]
[0040] in, A function representing the computational complexity of cipher recombination; The time complexity of the cryptographic reassembly algorithm is linearly related to the number of fragments, as shown in the following formula:
[0041] O(N) = N,
[0042] Based on the principle that "the time complexity of a cryptographic recombination algorithm is linearly related to the number of fragments," meaning that the time complexity of the algorithm is directly proportional to the number of fragments N, we directly use N as the quantitative expression for this linear relationship.
[0043] According to the method of the first aspect of the present invention, in step S2, calculating the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher reassembly computational complexity function includes:
[0044]
[0045] in, Represents the overall fitness function; The function representing the distribution balance of storage nodes; This represents a function representing the time cost of data transmission. A function representing the computational complexity of cipher recombination; , , It is the weighting coefficient.
[0046] A second aspect of this invention discloses a cryptographic sharding and distributed storage system, the system comprising:
[0047] The first processing module is configured to collect the user's password features and behavioral features; train a random forest model using the password features and behavioral features as input to obtain the password security assessment result and the range of the number of shards;
[0048] The second processing module is configured to optimize the sharding strategy using a genetic algorithm based on the range of the number of shards in the password, and obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes.
[0049] The third processing module is configured to encrypt each password fragment based on the security assessment result of the password;
[0050] The fourth processing module is configured to store each encrypted cryptographic fragment based on the characteristics of the encrypted cryptographic fragments and the characteristics of the storage nodes.
[0051] The fifth processing module is configured to obtain the encrypted password fragment, then decrypt the encrypted password fragment, and finally reassemble the decrypted password fragment to obtain the user's password.
[0052] A third aspect of this invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the cryptographic fragmentation and distributed storage method according to any one of the first aspects of this disclosure.
[0053] A fourth aspect of this invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a cryptographic encryption fragmentation and distributed storage method according to any one of the first aspects of this disclosure.
[0054] In summary, the solution proposed in this invention can solve the problems of numerous security vulnerabilities, imperfect cryptographic fragmentation strategies, underoptimized storage allocation, and lack of intelligent adaptability in existing technologies. Attached Figure Description
[0055] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0056] Figure 1 A flowchart illustrating a cryptographic encryption fragmentation and distributed storage method according to an embodiment of the present invention;
[0057] Figure 2 This is a structural diagram of a cryptographic sharding and distributed storage system according to an embodiment of the present invention;
[0058] Figure 3 This is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0060] The first aspect of this invention discloses a cryptographic sharding and distributed storage method. Figure 1 This is a flowchart of a cryptographic encryption fragmentation and distributed storage method according to an embodiment of the present invention, as follows: Figure 1 As shown, the method includes:
[0061] Step S1: Collect user password features and behavioral features; train a random forest model using the password features and behavioral features as input to obtain the password security assessment results and the range of the number of shards;
[0062] Step S2: Based on the range of the number of shards in the password, the sharding strategy is optimized using a genetic algorithm to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes.
[0063] Step S3: Encrypt each password fragment according to the security assessment result of the password;
[0064] Step S4: Store each encrypted cryptographic fragment according to the characteristics of the encrypted cryptographic fragments and the characteristics of the storage nodes;
[0065] Step S5: Obtain the encrypted password fragment, then decrypt the encrypted password fragment, and finally reassemble the decrypted password fragment to obtain the user's password.
[0066] In step S1, user password features and behavioral features are collected; a random forest model is trained using the password features and behavioral features as input to obtain the password security assessment results and the range of the number of shards.
[0067] In some embodiments, in step S1, the password features include: the password length and character composition; the character composition is: the ratio of numbers, letters and special characters;
[0068] The behavioral characteristics include: the time and location of login, the type of device used, and the network environment in which login occurred.
[0069] Specifically, a random forest model is constructed to accurately analyze user password characteristics and usage habits, providing intelligent decision support for subsequent password sharding, encryption, and storage processes, thereby achieving a personalized, secure, and efficient password storage system. Through learning and training on a large amount of relevant data, the model can identify different password security requirements and user behavior characteristics, thus optimizing password management strategies.
[0070] Data Acquisition and Preprocessing
[0071] First, user password characteristics are collected from multiple sources, including password length and character composition (the ratio of numbers, letters, and special characters). User login information is also collected, such as login time, location (approximate location can be obtained through IP address, etc.), device type (e.g., mobile phone, computer model), and network environment (e.g., Wi-Fi name, mobile network operator). Then, the data is normalized, including password length and login time intervals, to ensure their values fall within a reasonable range. This accelerates model training convergence and improves model performance and stability. Character-based data is encoded and converted to numerical form for model processing. Finally, the preprocessed data is divided into training and validation sets in an 8:2 ratio. The training set is used for model learning and parameter tuning, while the validation set is used to evaluate model performance on unseen data, preventing overfitting.
[0072] Build a random forest model for training
[0073] First, determine the model parameters. Setting the number of decision trees to 175 ensures the model's accuracy and stability without excessively increasing training time. Setting the maximum depth to 13 limits the growth of the decision trees and prevents them from overfitting the training data. Based on the characteristics of the dataset, setting the minimum number of splits to 6 allows the decision trees to capture some detail of the data while maintaining stability. Set a fixed random seed of 38. Ensure consistent results are obtained each time the algorithm is run, facilitating model analysis and optimization.
[0074] Then, password features and user behavior features are used as input variables, and the password security assessment results, namely the range of encryption level (single encryption, medium-strength encryption, high-strength encryption), password security risk level (high, medium, low), and number of fragments, are used as output target variables.
[0075] Finally, the random forest model is trained using the training set data. The model learns the mapping relationship between input features and output targets by continuously adjusting the structure and parameters of the decision trees. During training, each decision tree grows based on randomly selected features and sample subsets, ultimately forming a random forest composed of multiple decision trees.
[0076] Establish a real-time model update mechanism
[0077] Users' password usage habits and security environments are constantly changing, with new password patterns and security threats emerging continuously. The purpose of establishing a real-time model update mechanism is to ensure that the random forest model can promptly capture these changes, continuously update the model's decision rules, and thus maintain its ability to accurately identify and adapt to password characteristics and behavioral patterns. This provides continuous and effective intelligent support for the password storage system, ensuring its adaptability.
[0078] In practical implementation, firstly, during system operation, user password operation behavior and related environmental information are monitored in real time. Whenever a user registers, modifies, or logs in with their password, the system promptly records this newly generated data, including the characteristics of the new password, the time, location, and device of the login. Simultaneously, the system's security status is monitored, such as whether new security vulnerabilities or attack patterns are detected. This information also serves as a crucial basis for model updates, enabling the model to adapt to new security situations. Then, a 7-day update interval is set, with the model updated every 7 days. During the update, newly collected data is merged with historical data to form an updated dataset. Finally, this updated dataset is used for incremental training of the random forest model. Incremental training fine-tunes the model using new data, adapting it to new circumstances.
[0079] In step S2, based on the range of the number of password fragments, a genetic algorithm is used to optimize the fragmentation strategy, resulting in a fragmentation strategy that includes the number of fragments, the data size of each fragment, and the number of storage nodes. This improves the security of password storage and the overall performance of the system. By rationally fragmenting, passwords are stored in a distributed manner, reducing the risk of password leakage due to single points of failure. Simultaneously, it provides a solid foundation for subsequent encryption and storage processes, meeting the password security management needs of different users in different scenarios.
[0080] In some embodiments, in step S2, optimizing the sharding strategy using a genetic algorithm based on the range of the number of shards in the cryptography, to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes, includes:
[0081] Based on the range of the number of shards, multiple sharding strategies are randomly generated, which include the number of shards, the data size of each shard, and the number of storage nodes.
[0082] Set the storage node distribution balance function according to the number of storage nodes and the amount of data stored in each storage node;
[0083] Set the data transmission time cost function based on the data size of each fragment and the network transmission speed;
[0084] A complexity coefficient is introduced based on the number of fragments and the number of storage nodes, and then the computational complexity function of cipher reassembly is calculated based on the complexity coefficient and the number of fragments.
[0085] The number of fragments refers to the total number of fragments into which the cipher is divided, denoted by N in the file. It is explicitly defined below: "Introducing a noise coefficient c = N / M, where N is the number of fragments and M is the number of storage nodes." Here, "the number of fragments" refers to the "number of fragments" mentioned earlier (the total number of fragments into which the cipher is divided).
[0086] Calculate the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher recombining computational complexity function.
[0087] Genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual;
[0088] After iteration, the process eventually converges, and the optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population.
[0089] The sharding strategy is represented as an integer vector using integer encoding. Specifically, assuming a cipher is to be sharded, i.e., the number of shards... The size of each data segment (in bytes, let's call it 'data size') ). and sharding in The distribution of storage nodes (represented by the storage node numbers, denoted as ) A partitioning strategy can then be represented as a vector. .
[0090] Let the length of the password entered by the user be . L Randomly generated The initial population consists of several partitioning policy vectors, where the values of each element in the partitioning policy vectors range from: , , , .
[0091] The step of setting the storage node distribution balance function based on the number of storage nodes and the amount of data stored in each storage node includes:
[0092]
[0093]
[0094]
[0095]
[0096] in, The function representing the distribution balance of storage nodes; The standard deviation of node load; Indicates the number of storage nodes; Indicates the first j The amount of data stored per storage node; Indicates average load; This represents the numerical stability compensation factor. Its function is to prevent mathematical calculation errors caused by the denominator (standard deviation σ of node load) being zero, and to ensure that the formula can still be calculated effectively in extreme cases (such as when all node loads are perfectly balanced, σ=0). It is an auxiliary parameter to ensure numerical stability. Represents the natural constant, a fixed constant in mathematics with a value of approximately 2.71828. It is widely used in scenarios involving exponential functions, logarithmic functions, etc., to prevent the denominator from being zero.
[0097] The step of setting the data transmission time cost function based on the data size of each fragment and the network transmission speed includes:
[0098] Based on the data size of each partition and network transmission speed Calculate transmission time ;
[0099] Based on the transmission time of each fragment The total transmission time cost is calculated, which is the data transmission time cost function.
[0100]
[0101] in, This represents a function representing the time cost of data transmission. Indicates the number of fragments; This represents the maximum transmission time cost calculated under all fragmentation strategies.
[0102] The introduction of a noise coefficient based on the number of fragments and the number of storage nodes includes:
[0103]
[0104] in, Represents the noise coefficient; Indicates the number of fragments; Indicates the number of storage nodes;
[0105] The computational complexity function for cipher reassembly is then calculated based on the complexity coefficient and the number of fragments, including:
[0106]
[0107] in, A function representing the computational complexity of cipher recombination; The time complexity of the cryptographic reassembly algorithm is linearly related to the number of fragments, as shown in the following formula:
[0108] O(N) = N,
[0109] Based on the principle that "the time complexity of a cryptographic recombination algorithm is linearly related to the number of fragments," meaning that the time complexity of the algorithm is directly proportional to the number of fragments N, we directly use N as the quantitative expression for this linear relationship.
[0110] The calculation of the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher reassembly computational complexity function includes:
[0111]
[0112] in, Represents the overall fitness function; The function representing the distribution balance of storage nodes; This represents a function representing the time cost of data transmission. A function representing the computational complexity of cipher recombination; , , These are weighting coefficients. , , .
[0113] Specifically, genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual, including:
[0114] The selection process is performed using roulette wheel selection. The fitness value of each individual is calculated. The probability of it being selected is Generate random numbers ,if Then choose the first one. Each individual. Repeat the selection process until one is selected. Individuals serve as parents to reproduce the next generation.
[0115] The selected parent individuals are paired up in pairs, with crossover probability. Perform cross operations.
[0116] For newly generated offspring individuals, use mutation probability 04. Perform a mutation operation. Generate random numbers. ,if This involves modifying the distribution of individual shards. Specifically, a shard can be randomly redistributed to other storage nodes.
[0117] After iteration, the process eventually converges. The optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population. This includes:
[0118] The new individuals obtained through selection, crossover, and mutation are used to form a new population, replacing the original population. This process is repeated iteratively to evolve the population. The population is considered evolved when its average fitness value changes less than a threshold value over multiple iterations. When or when the maximum number of iterations is reached When the iteration stops, the partitioning strategy represented by the individual with the lowest fitness value in the resulting population is the optimal partitioning strategy.
[0119] In some embodiments, the method further includes generating a unique identifier for each cryptographic segment, wherein the identifier adopts the hash value of the SHA1 of each cryptographic segment to prevent the identifier from being forged.
[0120] In step S3, each cryptographic fragment is encrypted based on the security assessment result of the cryptography.
[0121] Specifically, its main function is to ensure the confidentiality and integrity of password fragments during storage and transmission through a series of encryption methods. The aim is to prevent unauthorized access, theft, or tampering of password data, thereby protecting the security of user passwords.
[0122] Select encryption algorithm
[0123] First, obtain the security assessment results of the password from the random forest model, namely the encryption level (single encryption, medium-strength encryption, high-strength encryption) and the password security risk level (high, medium, low), as well as the frequency of password use and the usage environment (such as whether it is frequently used in public network environments, whether it involves multiple device logins, etc.).
[0124] Based on security assessment results, usage frequency, usage environment, and encryption algorithm characteristics, the security requirements of the cryptography are matched with appropriate encryption algorithms. Specifically, for cryptography with a medium to high security assessment level, the AES-256-bit encryption algorithm is selected; for cryptography with a lower security level and higher performance requirements, the AES-128-bit encryption algorithm is selected.
[0125] Generate key
[0126] The key generation method is determined based on the selected encryption algorithm. When the AES-256-bit encryption algorithm is selected, a cryptographically secure random number generator is used to generate a 256-bit (32-byte) random key; when the AES-128-bit encryption algorithm is selected, a cryptographically secure random number generator is used to generate a 128-bit (16-byte) random key.
[0127] After the key is generated, a hierarchical key management system is adopted, and the key is stored in a dedicated key management system. Furthermore, detailed audits are conducted on key usage records, including the key's generation time, usage time, and purpose, so that traceability can be achieved in the event of a security issue.
[0128] Encrypt the cipher fragments individually.
[0129] For each cryptographic fragment, the previously selected AES encryption algorithm and corresponding key are loaded, and encryption is performed according to the algorithm's specifications. Specifically, the AES algorithm requires that the plaintext data length be an integer multiple of its block size (128 bits). If this requirement is not met, PKCS#7 padding mode is used for padding.
[0130] In step S4, each encrypted cryptographic fragment is stored according to the characteristics of the encrypted cryptographic fragment and the characteristics of the storage node.
[0131] Specifically, it securely and efficiently stores encrypted and fragmented cryptographic data. Through reasonable storage strategies and optimization measures, it ensures the integrity and confidentiality of cryptographic data during the storage process, while also considering system performance, such as storage efficiency and access speed, thereby ensuring the reliability and security of the entire cryptographic storage system.
[0132] Storage distribution optimization
[0133] First, the characteristics of password fragmentation are analyzed. The attributes of each password fragment are studied in detail, including but not limited to security level (which may be related to the strength of the encryption algorithm, the importance of the password, and its potential impact on users), data size, access frequency (statistically based on user login and password usage history), and timeliness (some temporary or short-term valid passwords may have different storage requirements).
[0134] Simultaneously, the characteristics of storage nodes are evaluated. A comprehensive understanding of the performance parameters and characteristics of each storage node is required, such as storage capacity (total capacity and current available capacity), storage type (e.g., hard disk drives, solid-state drives; different types affect read and write speeds), network connectivity (bandwidth, latency, packet loss rate, etc., which affect data transmission speed and stability), geographical location (considering the distance between data centers; for distributed storage, this may involve data synchronization costs across different regions), and CPU and memory resources (used for handling storage-related operations, such as encryption / decryption, data indexing, etc.).
[0135] Then, based on the analysis results of cryptographic fragments and storage nodes, storage allocation rules are formulated. Specifically, for cryptographic fragments with extremely high security levels, storage nodes located in high-security protection areas and with high-security storage media (such as using encrypted storage hardware) are prioritized; for cryptographic fragments with large data volumes, nodes with sufficient storage capacity and high network bandwidth are selected to reduce storage and retrieval time. For cryptographic fragments with high access frequency, they are stored near nodes with low network latency and high CPU processing power to improve response speed.
[0136] Finally, a storage mapping table is established based on the user's identity information (such as username, user ID, etc.) and the specific storage path of the password fragments within the storage node, recording the correspondence between each user's password fragments and the storage node and storage path.
[0137] Load balancing and fault-tolerant optimization
[0138] When implementing load balancing, the load on each storage node is continuously monitored. Monitored metrics include, but are not limited to, storage capacity utilization (the percentage of total storage capacity currently in use), network I / O load (network input / output data traffic and request count), CPU utilization (the percentage of current CPU processing power used), and memory utilization (memory resource usage). When a storage node is detected to be overloaded, a least-connections algorithm is used to prioritize allocating new cryptographic shard storage requests to the storage node with the fewest current connections, thus balancing the load across all nodes.
[0139] When implementing fault-tolerant optimization operations, specifically, password fragments are backed up according to their importance and the system's reliability requirements. In particular, when the master password fragment is updated (e.g., a user changes their password), an asynchronous update operation is used (asynchronous updates reduce the impact on system performance), and the update is promptly synchronized to all backup copies.
[0140] In step S5, the encrypted password fragment is obtained, then the encrypted password fragment is decrypted, and finally the decrypted password fragment is reassembled to obtain the user's password.
[0141] Specifically, when users perform authentication operations, the system accurately and securely restores the password and verifies the password entered by the user to ensure that only legitimate users can access the corresponding system or resources.
[0142] Password fragmentation
[0143] When a user initiates login or other operations that require password verification, the system first obtains the user's identity information (such as username, user ID, etc.); then, based on the user's identity, it searches for the corresponding password fragment storage location information in the storage mapping table and obtains the password fragment; finally, the password fragments obtained from each storage node are collected together and organized according to the order in the storage mapping table or other pre-defined rules, in preparation for subsequent decryption and reassembly operations.
[0144] Password decryption and reconstruction
[0145] First, the cryptographic fragments are decrypted. For each obtained cryptographic fragment, the corresponding encryption algorithm module is loaded according to the encryption algorithm identifier stored in the fragment, and the corresponding decryption key is obtained from the key management system. Decryption is then performed on each cryptographic fragment. Specifically, if PKCS#7 padding was used during encryption, the padding process must be reversed to ensure that the decrypted fragment data is the original cryptographic data fragment.
[0146] Then the cipher fragments are reassembled, and the decrypted cipher fragments are reassembled in the order of their numbering.
[0147] Finally, the reconstructed password is compared with the user-entered password using the SHA1 hash value. If they match, the user authentication is successful; otherwise, the authentication fails, and corresponding measures are taken according to the system security policy, such as limiting the number of login attempts or issuing a security warning.
[0148] In summary, the distributed cryptographic storage and encrypted sharding technology of this invention achieves many beneficial effects by employing genetic optimization algorithms and random forest algorithms. The following will elaborate on these effects from the perspectives of improved security, optimized efficiency, personalized services, and enhanced system stability.
[0149] This significantly enhances the security of password storage. By storing passwords in fragments across multiple nodes, risks are effectively dispersed, greatly reducing the possibility of password leakage. Furthermore, the use of a random forest algorithm generates personalized encryption and fragmentation strategies based on user password characteristics and usage habits. This provides a high level of protection for complex and frequently used passwords, while optimizing simple passwords while ensuring security. This approach enhances overall security and allocates resources efficiently.
[0150] It demonstrates excellent efficiency optimization. The use of a genetic optimization algorithm for intelligent adjustment of the cryptographic sharding storage distribution achieves a rational allocation based on storage node performance and cryptographic importance, enabling parallel data storage and retrieval, reducing processing time, and improving the overall system response speed. Furthermore, personalized encryption and sharding strategies avoid the resource waste caused by applying uniform high-strength processing to all cryptography, reducing computational and storage overhead during cryptographic processing, improving resource utilization, and further optimizing system performance.
[0151] It can provide personalized services based on each user's unique needs. Through in-depth analysis of user password characteristics and behavioral patterns using the random forest algorithm, it tailors exclusive encryption and sharding strategies for different users, providing just the right amount of protection for both professional users with extremely high security requirements and ordinary individual users. This personalized service not only improves the targeting and effectiveness of password protection but also optimizes the user experience, reducing the confusion caused by complex password management and making users feel a more convenient and efficient service when using passwords.
[0152] It offers significant advantages in system stability. By balancing the load on storage nodes and implementing redundant backup strategies, it effectively avoids performance degradation or failure risks caused by excessive load on individual nodes, ensuring stable system operation under various conditions. For example, when some nodes fail, the system can quickly recover password data using redundant backups, ensuring uninterrupted user access and greatly reducing system downtime and the possibility of data loss.
[0153] The second aspect of this invention discloses a cryptographic sharding and distributed storage system. Figure 2 This is a structural diagram of a cryptographic sharding and distributed storage system according to an embodiment of the present invention; as shown below. Figure 2 As shown, the system 100 includes:
[0154] The first processing module 101 is configured to collect the user's password features and behavioral features; train a random forest model with the password features and behavioral features as input to obtain the password security assessment result and the range of the number of shards;
[0155] The second processing module 102 is configured to optimize the sharding strategy using a genetic algorithm based on the range of the number of shards in the password, and obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes.
[0156] The third processing module 103 is configured to encrypt each password fragment according to the security assessment result of the password;
[0157] The fourth processing module 104 is configured to store each encrypted cryptographic fragment according to the characteristics of the encrypted cryptographic fragment and the characteristics of the storage node;
[0158] The fifth processing module 105 is configured to obtain the encrypted password fragment, then decrypt the encrypted password fragment, and finally reassemble the decrypted password fragment to obtain the user's password.
[0159] According to the system of the second aspect of the present invention, the first processing module 101 is specifically configured such that the password features include: the length of the password and the character composition; the character composition is: the ratio of numbers, letters and special characters;
[0160] The behavioral characteristics include: the time and location of login, the type of device used, and the network environment in which login occurred.
[0161] Specifically, a random forest model is constructed to accurately analyze user password characteristics and usage habits, providing intelligent decision support for subsequent password sharding, encryption, and storage processes, thereby achieving a personalized, secure, and efficient password storage system. Through learning and training on a large amount of relevant data, the model can identify different password security requirements and user behavior characteristics, thus optimizing password management strategies.
[0162] Data Acquisition and Preprocessing
[0163] First, user password characteristics are collected from multiple sources, including password length and character composition (the ratio of numbers, letters, and special characters). User login information is also collected, such as login time, location (approximate location can be obtained through IP address, etc.), device type (e.g., mobile phone, computer model), and network environment (e.g., Wi-Fi name, mobile network operator). Then, the data is normalized, including password length and login time intervals, to ensure their values fall within a reasonable range. This accelerates model training convergence and improves model performance and stability. Character-based data is encoded and converted to numerical form for model processing. Finally, the preprocessed data is divided into training and validation sets in an 8:2 ratio. The training set is used for model learning and parameter tuning, while the validation set is used to evaluate model performance on unseen data, preventing overfitting.
[0164] Build a random forest model for training
[0165] First, determine the model parameters. Setting the number of decision trees to 175 ensures the model's accuracy and stability without excessively increasing training time. Setting the maximum depth to 13 limits the growth of the decision trees and prevents them from overfitting the training data. Based on the characteristics of the dataset, setting the minimum number of splits to 6 allows the decision trees to capture some detail of the data while maintaining stability. Set a fixed random seed of 38. Ensure consistent results are obtained each time the algorithm is run, facilitating model analysis and optimization.
[0166] Then, password features and user behavior features are used as input variables, and the password security assessment results, namely the range of encryption level (single encryption, medium-strength encryption, high-strength encryption), password security risk level (high, medium, low), and number of fragments, are used as output target variables.
[0167] Finally, the random forest model is trained using the training set data. The model learns the mapping relationship between input features and output targets by continuously adjusting the structure and parameters of the decision trees. During training, each decision tree grows based on randomly selected features and sample subsets, ultimately forming a random forest composed of multiple decision trees.
[0168] Establish a real-time model update mechanism
[0169] Users' password usage habits and security environments are constantly changing, with new password patterns and security threats emerging continuously. The purpose of establishing a real-time model update mechanism is to ensure that the random forest model can promptly capture these changes, continuously update the model's decision rules, and thus maintain its ability to accurately identify and adapt to password characteristics and behavioral patterns. This provides continuous and effective intelligent support for the password storage system, ensuring its adaptability.
[0170] In practical implementation, firstly, during system operation, user password operation behavior and related environmental information are monitored in real time. Whenever a user registers, modifies, or logs in with their password, the system promptly records this newly generated data, including the characteristics of the new password, the time, location, and device of the login. Simultaneously, the system's security status is monitored, such as whether new security vulnerabilities or attack patterns are detected. This information also serves as a crucial basis for model updates, enabling the model to adapt to new security situations. Then, a 7-day update interval is set, with the model updated every 7 days. During the update, newly collected data is merged with historical data to form an updated dataset. Finally, this updated dataset is used for incremental training of the random forest model. Incremental training fine-tunes the model using new data, adapting it to new circumstances.
[0171] According to the system of the second aspect of the present invention, the second processing module 102 is specifically configured to optimize the sharding strategy using a genetic algorithm based on the range of the number of shards in the cryptography, to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes, including:
[0172] Based on the range of the number of shards, multiple sharding strategies are randomly generated, which include the number of shards, the data size of each shard, and the number of storage nodes.
[0173] Set the storage node distribution balance function according to the number of storage nodes and the amount of data stored in each storage node;
[0174] Set the data transmission time cost function based on the data size of each fragment and the network transmission speed;
[0175] A complexity coefficient is introduced based on the number of fragments and the number of storage nodes, and then the computational complexity function of cipher reassembly is calculated based on the complexity coefficient and the number of fragments.
[0176] Calculate the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher recombining computational complexity function.
[0177] Genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual;
[0178] After iteration, the process eventually converges, and the optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population.
[0179] The sharding strategy is represented as an integer vector using integer encoding. Specifically, assuming a cipher is to be sharded, i.e., the number of shards... The size of each data segment (in bytes, let's call it 'data size') ). and sharding in The distribution of storage nodes (represented by the storage node numbers, denoted as ) A partitioning strategy can then be represented as a vector. .
[0180] Let the length of the password entered by the user be . L Randomly generated The initial population consists of several partitioning policy vectors, where the values of each element in the partitioning policy vectors range from: , , , .
[0181] The step of setting the storage node distribution balance function based on the number of storage nodes and the amount of data stored in each storage node includes:
[0182]
[0183]
[0184]
[0185]
[0186] in, The function representing the distribution balance of storage nodes; The standard deviation of node load; Indicates the number of storage nodes; Indicates the first j The amount of data stored per storage node; Indicates average load; This represents the numerical stability compensation factor. Its function is to prevent mathematical calculation errors caused by the denominator (the standard deviation σ of the node load) being zero, ensuring that the formula remains valid even in extreme cases (such as when all node loads are perfectly balanced, σ=0). It is an auxiliary parameter that guarantees numerical stability.
[0187] ; Represents the natural constant, a fixed constant in mathematics with a value of approximately 2.71828. It is widely used in scenarios involving exponential functions, logarithmic functions, etc., to prevent the denominator from being zero.
[0188] The step of setting the data transmission time cost function based on the data size of each fragment and the network transmission speed includes:
[0189] Based on the data size of each partition and network transmission speed Calculate transmission time ;
[0190] Based on the transmission time of each fragment The total transmission time cost is calculated, which is the data transmission time cost function.
[0191]
[0192] in, This represents a function representing the time cost of data transmission. Indicates the number of fragments; This represents the maximum transmission time cost calculated under all fragmentation strategies.
[0193] The introduction of a noise coefficient based on the number of fragments and the number of storage nodes includes:
[0194]
[0195] in, Represents the noise coefficient; Indicates the number of fragments; Indicates the number of storage nodes;
[0196] The computational complexity function for cipher reassembly is then calculated based on the complexity coefficient and the number of fragments, including:
[0197]
[0198] in, A function representing the computational complexity of cipher recombination; The time complexity of the cryptographic reassembly algorithm is linearly related to the number of fragments, as shown in the following formula:
[0199] O(N) = N,
[0200] Based on the principle that "the time complexity of a cryptographic recombination algorithm is linearly related to the number of fragments," meaning that the time complexity of the algorithm is directly proportional to the number of fragments N, we directly use N as the quantitative expression for this linear relationship.
[0201] The calculation of the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher reassembly computational complexity function includes:
[0202]
[0203] in, Represents the overall fitness function; The function representing the distribution balance of storage nodes; This represents a function representing the time cost of data transmission. A function representing the computational complexity of cipher recombination; , , These are weighting coefficients. , , .
[0204] Specifically, genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual, including:
[0205] The selection process is performed using roulette wheel selection. The fitness value of each individual is calculated. The probability of it being selected is Generate random numbers ,if Then choose the first one. Each individual. Repeat the selection process until one is selected. Individuals serve as parents to reproduce the next generation.
[0206] The selected parent individuals are paired up in pairs, with crossover probability. Perform cross operations.
[0207] For newly generated offspring individuals, use mutation probability 04. Perform a mutation operation. Generate random numbers. ,if This involves modifying the distribution of individual shards. Specifically, a shard can be randomly redistributed to other storage nodes.
[0208] After iteration, the process eventually converges. The optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population. This includes:
[0209] The new individuals obtained through selection, crossover, and mutation are used to form a new population, replacing the original population. This process is repeated iteratively to evolve the population. The population is considered evolved when its average fitness value changes less than a threshold value over multiple iterations. When or when the maximum number of iterations is reached When the iteration stops, the partitioning strategy represented by the individual with the lowest fitness value in the resulting population is the optimal partitioning strategy.
[0210] In some embodiments, the method further includes generating a unique identifier for each cryptographic segment, wherein the identifier adopts the hash value of the SHA1 of each cryptographic segment to prevent the identifier from being forged.
[0211] According to the system of the second aspect of the present invention, the third processing module 103 is specifically configured to primarily ensure the confidentiality and integrity of the password fragments during storage and transmission through a series of encryption methods. The purpose is to prevent unauthorized access, theft, or tampering of password data, thereby protecting the security of user passwords.
[0212] Select encryption algorithm
[0213] First, obtain the security assessment results of the password from the random forest model, namely the encryption level (single encryption, medium-strength encryption, high-strength encryption) and the password security risk level (high, medium, low), as well as the frequency of password use and the usage environment (such as whether it is frequently used in public network environments, whether it involves multiple device logins, etc.).
[0214] Based on security assessment results, usage frequency, usage environment, and encryption algorithm characteristics, the security requirements of the cryptography are matched with appropriate encryption algorithms. Specifically, for cryptography with a medium to high security assessment level, the AES-256-bit encryption algorithm is selected; for cryptography with a lower security level and higher performance requirements, the AES-128-bit encryption algorithm is selected.
[0215] Generate key
[0216] The key generation method is determined based on the selected encryption algorithm. When the AES-256-bit encryption algorithm is selected, a cryptographically secure random number generator is used to generate a 256-bit (32-byte) random key; when the AES-128-bit encryption algorithm is selected, a cryptographically secure random number generator is used to generate a 128-bit (16-byte) random key.
[0217] After the key is generated, a hierarchical key management system is adopted, and the key is stored in a dedicated key management system. Furthermore, detailed audits are conducted on key usage records, including the key's generation time, usage time, and purpose, so that traceability can be achieved in the event of a security issue.
[0218] Encrypt the cipher fragments individually.
[0219] For each cryptographic fragment, the previously selected AES encryption algorithm and corresponding key are loaded, and encryption is performed according to the algorithm's specifications. Specifically, the AES algorithm requires that the plaintext data length be an integer multiple of its block size (128 bits). If this requirement is not met, PKCS#7 padding mode is used for padding.
[0220] According to the system of the second aspect of the present invention, the fourth processing module 104 is specifically configured to securely and efficiently store the encrypted and fragmented cryptographic data. Through reasonable storage strategies and optimization measures, the integrity and confidentiality of the cryptographic data are ensured during the storage process, while also considering system performance, such as storage efficiency and access speed, thereby ensuring the reliability and security of the entire cryptographic storage system.
[0221] Storage distribution optimization
[0222] First, the characteristics of password fragmentation are analyzed. The attributes of each password fragment are studied in detail, including but not limited to security level (which may be related to the strength of the encryption algorithm, the importance of the password, and its potential impact on users), data size, access frequency (statistically based on user login and password usage history), and timeliness (some temporary or short-term valid passwords may have different storage requirements).
[0223] Simultaneously, the characteristics of storage nodes are evaluated. A comprehensive understanding of the performance parameters and characteristics of each storage node is required, such as storage capacity (total capacity and current available capacity), storage type (e.g., hard disk drives, solid-state drives; different types affect read and write speeds), network connectivity (bandwidth, latency, packet loss rate, etc., which affect data transmission speed and stability), geographical location (considering the distance between data centers; for distributed storage, this may involve data synchronization costs across different regions), and CPU and memory resources (used for handling storage-related operations, such as encryption / decryption, data indexing, etc.).
[0224] Then, based on the analysis results of cryptographic fragments and storage nodes, storage allocation rules are formulated. Specifically, for cryptographic fragments with extremely high security levels, storage nodes located in high-security protection areas and with high-security storage media (such as using encrypted storage hardware) are prioritized; for cryptographic fragments with large data volumes, nodes with sufficient storage capacity and high network bandwidth are selected to reduce storage and retrieval time. For cryptographic fragments with high access frequency, they are stored near nodes with low network latency and high CPU processing power to improve response speed.
[0225] Finally, a storage mapping table is established based on the user's identity information (such as username, user ID, etc.) and the specific storage path of the password fragments within the storage node, recording the correspondence between each user's password fragments and the storage node and storage path.
[0226] Load balancing and fault-tolerant optimization
[0227] When implementing load balancing, the load on each storage node is continuously monitored. Monitored metrics include, but are not limited to, storage capacity utilization (the percentage of total storage capacity currently in use), network I / O load (network input / output data traffic and request count), CPU utilization (the percentage of current CPU processing power used), and memory utilization (memory resource usage). When a storage node is detected to be overloaded, a least-connections algorithm is used to prioritize allocating new cryptographic shard storage requests to the storage node with the fewest current connections, thus balancing the load across all nodes.
[0228] When implementing fault-tolerant optimization operations, specifically, password fragments are backed up according to their importance and the system's reliability requirements. In particular, when the master password fragment is updated (e.g., a user changes their password), an asynchronous update operation is used (asynchronous updates reduce the impact on system performance), and the update is promptly synchronized to all backup copies.
[0229] According to the system of the second aspect of the present invention, the fifth processing module 105 is specifically configured to accurately and securely restore the password when the user performs authentication or other operations, and to verify the password entered by the user, so as to ensure that only legitimate users can access the corresponding system or resources.
[0230] Password fragmentation
[0231] When a user initiates login or other operations that require password verification, the system first obtains the user's identity information (such as username, user ID, etc.); then, based on the user's identity, it searches for the corresponding password fragment storage location information in the storage mapping table and obtains the password fragment; finally, the password fragments obtained from each storage node are collected together and organized according to the order in the storage mapping table or other pre-defined rules, in preparation for subsequent decryption and reassembly operations.
[0232] Password decryption and reconstruction
[0233] First, the cryptographic fragments are decrypted. For each obtained cryptographic fragment, the corresponding encryption algorithm module is loaded according to the encryption algorithm identifier stored in the fragment, and the corresponding decryption key is obtained from the key management system. Decryption is then performed on each cryptographic fragment. Specifically, if PKCS#7 padding was used during encryption, the padding process must be reversed to ensure that the decrypted fragment data is the original cryptographic data fragment.
[0234] Then the cipher fragments are reassembled, and the decrypted cipher fragments are reassembled in the order of their numbering.
[0235] Finally, the reconstructed password is compared with the user-entered password using the SHA1 hash value. If they match, the user authentication is successful; otherwise, the authentication fails, and corresponding measures are taken according to the system security policy, such as limiting the number of login attempts or issuing a security warning.
[0236] A third aspect of this invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the cryptographic fragmentation and distributed storage method according to any one of the first aspects of this invention.
[0237] Figure 3 This is a structural diagram of an electronic device according to an embodiment of the present invention, such as... Figure 3 As shown, the electronic device includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, Near Field Communication (NFC), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.
[0238] Those skilled in the art will understand that Figure 3 The structure shown is merely a structural diagram of the part related to the technical solution of this disclosure and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0239] A fourth aspect of this invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the cryptographic fragmentation and distributed storage method according to any one of the first aspects of this invention.
[0240] Please note that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. The above embodiments only illustrate several implementation methods of this application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A cryptographic sharding and distributed storage method, characterized in that, The method includes: Step S1: Collect user password features and behavioral features; train a random forest model using the password features and behavioral features as input to obtain the password security assessment results and the range of the number of shards; Step S2: Based on the range of the number of shards in the password, the sharding strategy is optimized using a genetic algorithm to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes. Step S3: Encrypt each password fragment according to the security assessment result of the password; Step S4: Store each encrypted cryptographic fragment according to the characteristics of the encrypted cryptographic fragments and the characteristics of the storage nodes; Step S5: Obtain the encrypted password fragment, then decrypt the encrypted password fragment, and finally reassemble the decrypted password fragment to obtain the user's password. The security assessment results include encryption level, password security risk level, password usage frequency, and usage environment. In step S2, the step of optimizing the sharding strategy using a genetic algorithm based on the range of the number of shards in the cryptography, to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes, includes: Based on the range of the number of shards, multiple sharding strategies are randomly generated, which include the number of shards, the data size of each shard, and the number of storage nodes. Set the storage node distribution balance function according to the number of storage nodes and the amount of data stored in each storage node; Set the data transmission time cost function based on the data size of each fragment and the network transmission speed; A complexity coefficient is introduced based on the number of fragments and the number of storage nodes, and then the computational complexity function of cipher reassembly is calculated based on the complexity coefficient and the number of fragments. Calculate the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher recombining computational complexity function. Genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual; After iteration, the process eventually converges, and the optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population.
2. The cryptographic encryption fragmentation and distributed storage method according to claim 1, characterized in that, In step S1, the password features include: the password length and character composition; the character composition is: the ratio of numbers, letters, and special characters; The behavioral characteristics include: the time and location of login, the type of device used, and the network environment in which login occurred.
3. The cryptographic encryption fragmentation and distributed storage method according to claim 1, characterized in that, In step S2, setting the storage node distribution balance function based on the number of storage nodes and the amount of data stored in each storage node includes: in, The function representing the distribution balance of storage nodes; The standard deviation of node load; Indicates the number of storage nodes; Indicates the first j The amount of data stored per storage node; Indicates average load; Indicates the numerical stability compensation factor; Represents the natural constant.
4. The cryptographic sharding and distributed storage method according to claim 1, characterized in that, In step S2, setting the data transmission time cost function based on the data size of each fragment and the network transmission speed includes: Based on the data size of each partition and network transmission speed Calculate transmission time ; Based on the transmission time of each fragment The total transmission time cost is calculated, which is the data transmission time cost function. in, This represents a function representing the time cost of data transmission. Indicates the number of fragments; This represents the maximum transmission time cost calculated under all fragmentation strategies.
5. The cryptographic sharding and distributed storage method according to claim 1, characterized in that, In step S2, the introduction of a noise factor based on the number of fragments and the number of storage nodes includes: in, Represents the noise coefficient; Indicates the number of fragments; Indicates the number of storage nodes; The computational complexity function for cipher reassembly is then calculated based on the complexity coefficient and the number of fragments, including: in, A function representing the computational complexity of cipher recombination; The time complexity of the cryptographic reassembly algorithm is linearly related to the number of fragments, as shown in the following formula: O(N) = N, The time complexity of the cryptographic recombination algorithm is linearly related to the number of fragments, that is, the time complexity of the algorithm is directly proportional to the number of fragments N.
6. The cryptographic encryption fragmentation and distributed storage method according to claim 1, characterized in that, In step S2, calculating the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher reassembly computational complexity function includes: in, Represents the overall fitness function; The function representing the distribution balance of storage nodes; This represents a function representing the time cost of data transmission. A function representing the computational complexity of cipher recombination; , , It is the weighting coefficient.
7. A cryptographic sharding and distributed storage system, characterized in that, The system includes: The first processing module is configured to collect the user's password features and behavioral features; train a random forest model using the password features and behavioral features as input to obtain the password security assessment result and the range of the number of shards; The second processing module is configured to optimize the sharding strategy using a genetic algorithm based on the range of the number of shards in the password, and obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes. The third processing module is configured to encrypt each password fragment based on the security assessment result of the password; The fourth processing module is configured to store each encrypted cryptographic fragment based on the characteristics of the encrypted cryptographic fragments and the characteristics of the storage nodes. The fifth processing module is configured to obtain the encrypted password fragment, then decrypt the encrypted password fragment, and finally reassemble the decrypted password fragment to obtain the user's password. The security assessment results include encryption level, password security risk level, password usage frequency, and usage environment. In the second processing module, the step of optimizing the sharding strategy using a genetic algorithm based on the range of the number of shards in the cryptography, to obtain a sharding strategy that includes the number of shards, the data size of each shard, and the number of storage nodes, includes: Based on the range of the number of shards, multiple sharding strategies are randomly generated, which include the number of shards, the data size of each shard, and the number of storage nodes. Set the storage node distribution balance function according to the number of storage nodes and the amount of data stored in each storage node; Set the data transmission time cost function based on the data size of each fragment and the network transmission speed; A complexity coefficient is introduced based on the number of fragments and the number of storage nodes, and then the computational complexity function of cipher reassembly is calculated based on the complexity coefficient and the number of fragments. Calculate the comprehensive fitness function based on the storage node distribution balance function, the data transmission time cost function, and the cipher recombining computational complexity function. Genetic operations are performed based on the calculated value of the comprehensive fitness function for each individual; After iteration, the process eventually converges, and the optimal partitioning strategy is the partitioning strategy represented by the individual with the lowest overall fitness function value in the genetic population.
8. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the cryptographic sharding and distributed storage method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the cryptographic sharding and distributed storage method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Print data security verification method and system
CN119127098A
Dynamic optimization updating method of trusted data intelligent detection system
CN120223531A