Electronic book file secondary encryption method based on MD5 encryption and asynchronous request
By introducing a secondary encryption method based on MD5 encryption and asynchronous requests into electronic book encryption technology, combined with dynamic key generation and adaptive load balancing, the shortcomings of key management and task scheduling in the existing technology are solved and more efficient is achieved. and secure encryption and transmission processes.
Patent Information
- Application Number
- CN202411884274.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-01-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing e-book encryption technology, the key management mechanism is fixed and cannot effectively deal with static key leakage or collision attacks; the task scheduling lacks dynamic adaptability, resulting in uneven resource allocation; in complex networks or high-load scenarios, task priority is lacking. Level management leads to inefficient real-time task processing.
Electronic book files based on MD5 encryption and asynchronous requests are used to combine dynamic key generation, adaptive distributed load balancing and intelligent priority scheduling to achieve efficient distribution and transmission optimization of resources.
Through dynamic key generation and intelligent priority scheduling, the security and flexibility of the encryption process is improved; the adaptive load balancing mechanism has optimized the distribution of resource, improved transmission and encryption efficiency, and can flexibly cope with high load and complex network environment.
Smart Images

Figure CN119341844A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of data processing, in particular to a secondary encryption method for electronic book files based on MD5 encryption and asynchronous request. Background Art
[0002] With the acceleration of the digitalization process, the number and scale of e-books, as an important medium for knowledge dissemination, continue to grow. E-books are vulnerable to data leakage, tampering or unauthorized copying during transmission and storage, which puts higher requirements on copyright protection and data security. Therefore, e-book protection schemes based on encryption technology have become a research hotspot.
[0003] At present, common electronic book encryption technologies mainly include two methods: overall encryption and segmented encryption. Overall encryption usually uses a unified fixed key to encrypt and decrypt the entire file, which is easy to operate and has a fast processing speed. The segmented encryption method splits the file into several parts, encrypts them separately to adapt to different application scenarios, and optimizes network resources through segmented transmission.
[0004] The main deficiencies of the existing technology are: the key management mechanism is relatively fixed and cannot effectively deal with the risk of static key leakage or collision attack; the task scheduling lacks dynamic adaptability, resulting in uneven resource allocation, affecting transmission and encryption efficiency; in complex network conditions or high-load scenarios, the existing scheme lacks a flexible task priority management mechanism and cannot effectively handle tasks with high real-time requirements. In response to the above problems, the present invention proposes a secondary encryption method for electronic book files based on MD5 encryption and asynchronous requests, combining dynamic key generation, adaptive distributed load balancing and intelligent priority scheduling to achieve efficient resource allocation and transmission optimization, while improving the security and flexibility of the encryption process. Summary of the invention
[0005] Technical problems to be solved: In view of the problems in the prior art that the fixed key management mechanism is prone to static key leakage or collision attacks, the task scheduling lacks dynamic adaptability resulting in uneven resource allocation, and the lack of task priority management in complex networks or high-load scenarios leads to low efficiency in real-time task processing, the present invention provides an electronic book file secondary encryption method based on MD5 encryption and asynchronous requests to solve the problems raised in the above background technology.
[0006] Technical solution: To achieve the above objectives, the present invention is realized through the following technical solutions: A method for secondary encryption of e-book files based on MD5 encryption and asynchronous requests, including a data collection module for real-time collection of the current timestamp, network status, user request attributes, and system load status. The timestamp is obtained through the system clock, the network status is monitored in real time through a bandwidth monitoring tool, the user request attributes are collected through a user behavior analysis module, and the system load status is obtained through a computing resource monitoring system; MD5 preliminary encryption: Read the binary data of the target e-book file, group the data according to the grouping rules of the MD5 encryption algorithm, and perform multiple rounds of hash operations to generate a 128-bit fixed-length hash value as the first-layer ciphertext to ensure the preliminary encryption and integrity verification of the e-book file content; File segmentation and asynchronous request transmission: Divide the first-layer ciphertext into multiple data segments according to a predetermined size or file characteristics, assign a unique identifier to each data segment, and use the asynchronous request method to transmit each data segment to the encryption module for secondary encryption, supporting parallel processing to improve transmission and encryption efficiency; The encryption module: Monitor the current system load, network bandwidth, computing resources, and data segment byte length through an adaptive distributed load balancing mechanism, and dynamically adjust the resource allocation and task scheduling of encryption tasks; Intelligent request priority scheduling: During the asynchronous request process, evaluate the priority of asynchronous requests according to the urgency of data segments, the byte length of data segments, and preset priority rules, assign them to the corresponding priority queues, and process requests in priority order; Dynamic key generation and encryption: The encryption module generates a dynamic encryption key in real time based on the data collection module and performs independent real-time asynchronous encryption processing on each data segment to ensure the uniqueness and unpredictability of the encryption key.
[0007] Preferably, in the MD5 preliminary encryption stage, first accurately obtain the binary data of the e-book file in the form of a byte stream, group it using the MD5 algorithm specification, with each group being 512 bits. The MD5 algorithm performs four rounds of main loop operations, each round containing 16 steps. Perform logical function operations on the 32-bit sub-groups in the data group, then perform a circular left shift operation, and then perform an addition operation with the link variables A, B, C, and D. The initial value is a specific constant. The formula for updating the value of A is: A = B + ((A + F(B,C,D) + X[k] + T[i])<<<s), where X[k] is the sub-group in the data group, T[i] is an element in the constant table, and s is the number of circular left shift bits. After the operation, a 128-bit hash value is obtained as the first-layer ciphertext.
[0008] Preferably, in the file segmentation and asynchronous request transmission, the first layer ciphertext is segmented according to a predetermined size and according to features; in the segmentation according to a predetermined size, 1024 bytes are set as a basic segmentation unit, starting from the start position of the first layer ciphertext, 1024 bytes are sequentially intercepted to form a data segment, until the remaining data is less than 1024 bytes, this part of the remaining data is taken as the last data segment, assuming that the total number of bytes of the first layer ciphertext is L, and the number of segments is n, then n = [L / 1024], rounded up; in the segmentation according to features, segmentation is performed based on a specific structural marker in the electronic book file data, for example, the specific byte sequence of the chapter separator in the binary data is [marker], then the byte sequence is searched from the start position of the file, and the data between two adjacent markers is taken as a data segment, and the asynchronous transmission mechanism assigns a unique identifier to each data segment, for example, identifier = n + t + r, where n is the data segment sequence number, t is the generated timestamp, accurate to milliseconds, and r is a random number ranging from 0 to a specific maximum value M; use the asynchronous programming interface provided by the programming language to initiate an asynchronous request, such as using the asyncio library in Python to initiate an asynchronous request, pass the data segment and its identifier as parameters to the corresponding function, and the request runs independently in the background without blocking the main thread.
[0009] Preferably, the transmission process of the asynchronous request method adopts hierarchical task queue management, and the tasks to be encrypted are divided into different queue levels according to the byte length, priority and network status of the data segment. The queues of each level are sorted according to preset rules, and tasks with higher priority and larger data segments are transmitted and processed first, while low priority tasks are gradually executed when resources are idle. Through the automatic adjustment and management mechanism of the task queue, task allocation and resource utilization are optimized in the case of large data volume or network congestion; the network status includes indicators of network bandwidth utilization and network delay, and the task allocation is adjusted in real time in combination with the transmission environment. When the network condition is stable, tasks with bandwidth utilization higher than 50% are transmitted first; otherwise, tasks that can be pre-processed locally are processed first to reduce dependence on network transmission. The stable network condition means that the delay range does not exceed 10%.
[0010] Preferably, the dynamic key generation and encryption process performs parallel processing on multiple computing nodes through an adaptive distributed load balancing mechanism. After receiving the encryption request for the data segment, the encryption task is intelligently distributed to the node with lower load for processing according to the current load situation of each computing node. Each node independently completes the encryption task of the data segment, and ensures the coordination of task allocation and execution through the task feedback mechanism, thereby improving the overall encryption processing capability and system scalability.
[0011] Preferably, the adaptive distributed load balancing mechanism includes monitoring system status and resource allocation and task scheduling adjustment. The monitored system status includes system load, network bandwidth and computing resources. In the system load monitoring, key indicators of the system's CPU usage U_cpu, memory occupancy U_memory, and disk I / O operation frequency F_io are obtained every T seconds. The system load status is comprehensively judged based on the key indicators. If U_cpu>80% and U_memory>70% and F_io>threshold F, the system is considered to be in a high load state, otherwise, the system is considered to be in a low load state; in the network bandwidth monitoring, the inbound B_in and outbound B_out data traffic of the network interface are measured in real time, and the current available network bandwidth B_available = B_total - (B_in + B_out) is calculated. The network delay and stability are evaluated by sending ICMP probe packets and measuring the round-trip time RTT and packet loss rate P_loss; if RTT>threshold RTT or P_loss> threshold P_loss, the network condition is not good; in the evaluation of computing resource situation, according to the number of currently running processes N_process, the CPU time slice T_cpu_process[i] and memory space M_memory_process[i] occupied by each process, the current available CPU time slice T_available_cpu = C_total - ∑T_cpu_process[i] and the available memory space M_available_memory = M_total - ∑M_memory_process[i] are calculated; for the specific hardware acceleration resources on which the above encryption module depends, its utilization U_acceleration and the remaining available resource amount A_available are obtained. If U_acceleration> threshold U_acceleration, it means that the resource is tight. In the resource allocation strategy, when the system load is low, the network bandwidth is sufficient and the computing resources are abundant, more resources are allocated to the encryption task, such as increasing the number of CPU cores C_increase allocated to the encryption module. C_increase can be set according to the system configuration and load situation. = min(C_total - N_process, C_max_increase), and at the same time increase the memory space allocation M_increase, M_increase = min(M_available_memory / 2, M_max_increase), on the contrary, when the system is in a high load state, appropriately reduce the resources allocated to the encryption task. In the task scheduling optimization, the task execution order is dynamically adjusted according to the task priority P = W_eE + W_sizeS and resource requirements;For tasks with high priority and low resource requirements, they will be executed first. For tasks with high resource requirements but low priority, they can be delayed or split into multiple subtasks. ;
[0012] Preferably, the priority rule includes priority evaluation factors and priority queue management and scheduling. The priority evaluation factors evaluate the urgency, size and required amount of resources of the data segment and generate a priority identifier. According to the urgency evaluation, if the data segment contains content that is being read or edited in real time, it is rated as high priority; if it is a part that may be accessed in the near future, it is rated as medium priority; if it is a backup or archived part, it is rated as low priority; the data segment byte length is evaluated by setting an intermediate threshold S. When the data segment byte length is lower than S, it is preferentially transmitted and processed; otherwise, it is gradually executed when resources are idle; the required amount of resources is evaluated based on the CPU time and memory space required for the data segment during the encryption process; in the priority queue management and scheduling, requests are assigned to different priority queues according to the priority evaluation results, and queue requests are processed in order from high to low priority. Requests with high priority identifiers are processed first, and low priority tasks are processed when system resources permit, and priority rules are dynamically adjusted according to real-time load and processing progress.
[0013] Preferably, in the dynamic key generation and encryption process, the encryption module will generate a unique dynamic encryption key in real time based on the current timestamp, network status, user request attributes and system load status collected by the data acquisition module. The binary representation of the timestamp is t_bin, which is XORed with the initial key material K_0 to generate K_1. The network status information is collected in combination with the key generation of the network status, including the IP address, subnet mask, gateway address, network bandwidth utilization and network delay. This information is encoded and concatenated to form network status data N, which is hashed with K_1 to generate K_2. The key generation considering the system load status obtains the load indicators of the current CPU usage and memory occupancy of the system, and these load data are hashed again with K_2 to generate K_3. The real-time asynchronous encryption operation selects the AES algorithm to encrypt the data segment, and the encryption mode is configured as the CBC mode. The CBC mode requires a 128-bit initialization vector IV_aes.
[0014] Preferably, the encryption module includes a batch key generation and caching mechanism. When multiple data segments are received, multiple groups of dynamic encryption keys are generated at one time through a batch key generation algorithm, and the generated keys are stored in a key pool. Whenever a new data segment arrives, a suitable dynamic encryption key is retrieved from the key pool for encryption processing, and the key is marked as used or automatically updated after use, thereby reducing the time for repeated key generation and improving encryption efficiency and system response speed.
[0015] Preferably, the batch key generation is based on a multi-factor batch key generation algorithm, which comprehensively considers factors such as timestamp, network status and system load to generate batch keys. Key pool management and retrieval establish a key pool to store the batch-generated keys. The key pool usually uses a hash table as its data structure. Each key has a unique identifier as a key in the hash table. This identifier can be a key generation sequence number, or a complex identifier generated in combination with information such as a timestamp. This design makes the time complexity of retrieving a key from the key pool reach O(1), that is, constant time complexity. Key update and marking: After using the key to encrypt the data segment, the key is marked. If the system sets a limit on the number of times the key is used, the key is automatically updated when the number of times the key is used reaches the limit.
[0016] Preferably, in the process of all the data segments that have been encrypted twice being finally merged into a complete ciphertext file, the encrypted data segments are stored in an ordered list, and the data segments are sorted in a predetermined order according to the unique identifier of each data segment and the timestamp collected in the data acquisition module, and the sorted data segments are checked for consistency one by one; the check content includes whether the hash value of the data segment and the unique identifier match, so as to ensure the integrity and consistency of each data segment; after the merger is completed, the system stores the complete ciphertext file to the target location according to the preset storage strategy, and generates a storage or transmission log for subsequent tracking and verification; the specific operation is that when the data segments are merged, the new data segment is inserted with the unique identifier ID, and is inserted directly when the list is empty. If it is not empty, the ID size is traversed and compared and inserted into the appropriate position. If the IDs are the same, they are sorted according to the timestamp TS, with the smaller one in front; after all the data segments are sorted, they are merged, and the encrypted data content Data[i] is taken from the head of the list in turn. Splice them into a complete ciphertext file, paying attention to processing boundaries to ensure continuity and integrity. In the consistency check standard and method, the data segment byte length check is to check whether the byte length of the received data segment is consistent with the expected length before merging. The expected length is calculated based on the original size and encryption algorithm characteristics, such as the original size S_original, AES encryption and PKCS7 padding, the expected length L_expected = S_original + P, if it is inconsistent, the error handling mechanism is triggered; the encryption checksum check is to generate the data segment checksum Checksum [i] during encryption, and recalculate Checksum_actual [i] during merging and compare it with the original checksum. If it is different, it indicates that the data segment may be tampered with. The system takes corresponding security measures to ensure the integrity and accuracy of the ciphertext file.
[0017] Beneficial effects: The present invention provides a secondary encryption method for electronic book files based on MD5 encryption and asynchronous request. It has the following beneficial effects: The present invention combines hierarchical task queue management with an adaptive load balancing mechanism, and can dynamically adjust the task processing mode according to the byte length, priority and network status of the data segment. The byte length stratification of the data segment significantly improves the processing speed of small data segments, while ensuring the priority of large file data segments in resource allocation; the priority stratification mechanism enables key tasks to be responded to quickly, while low-priority tasks are reasonably postponed under high load; the network status stratification optimizes the task allocation strategy in a complex network environment, gives priority to tasks with high real-time requirements under stable network conditions, and reduces transmission dependence through local preprocessing under network fluctuation conditions. This multi-dimensional combination of stratification and scheduling enables the system to flexibly respond to high loads and complex network environments, and improves task processing efficiency and resource utilization.
[0018] The present invention enhances the security of data encryption and the operating efficiency of the system by combining dynamic key generation with an intelligent request priority scheduling algorithm. The dynamic key generation mechanism ensures that each data segment uses an independent key to avoid security vulnerabilities caused by static keys. At the same time, by combining multi-dimensional parameters such as timestamp, transmission environment and system load, key generation is more random and difficult to predict. Intelligent priority scheduling generates a priority identifier based on the urgency of the task and the byte length of the data segment, and allocates it to different queues for dynamic adjustment. High-priority tasks always take precedence, and low-priority tasks are flexibly scheduled, which effectively reduces resource waste and task blocking. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0020] The technical solutions in the embodiments of the present invention are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. 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.
[0021] Embodiment 1, the embodiment of the present invention provides a secondary encryption method for electronic book files based on MD5 encryption and asynchronous request, the specific operation is: first, by real-time collection of current timestamp, network status, user request attributes and system load status, the timestamp is obtained through the system clock, the network status is monitored in real time by a bandwidth monitoring tool, the user request attributes are collected by a user behavior analysis module, and the system load status is obtained by a computing resource monitoring system; then, a binary data stream is read from the target electronic book file, and the MD5 algorithm is used to perform preliminary encryption on it, the file data is grouped by 512 bits, and the four-round main loop operation of the MD5 algorithm is used to perform logical operations, circular left shifts, and addition operations on each group of data to generate a hash value with a fixed length of 128 bits as the first layer ciphertext, and then the generated first layer ciphertext is segmented into files in two ways: one is segmented according to a predetermined size, for example, each 1024 bytes is a segment; the other is segmented according to file features, for example, with chapter marks as boundaries, each segment is assigned a unique identifier, which is composed of a sequence number, a timestamp and a random number, to ensure that the data source can be accurately identified and traced in the subsequent processing process.
[0022] The segmented data is transmitted to the encryption module through asynchronous requests. Each data segment is transmitted with an independent asynchronous request, and asynchronous programming interfaces are used to implement non-blocking operations, such as Python's asyncio library, to improve parallel transmission performance. The system monitors the CPU utilization, memory occupancy, network bandwidth and other indicators of the computing nodes in real time based on the adaptive distributed load balancing mechanism, and adjusts the task allocation strategy according to the load situation. When the CPU utilization of a computing node is less than 50%, the free memory is greater than 1GB and the bandwidth is sufficient, the system will give priority to assigning encryption tasks to it. If the node is under high load, the task will be postponed or reallocated to avoid resource competition.
[0023] During the transmission process, tasks are sorted and managed through an intelligent request priority scheduling mechanism. The system generates a priority identifier for each data segment based on urgency, size, and content importance, and assigns tasks to high, medium, and low priority queues according to the identifier value. For example, chapter data for real-time reading is marked as high priority, and backup data is marked as low priority. When resources are limited, high-priority tasks are given priority. When resources are idle, medium and low-priority tasks are scheduled to maintain system load balance.
[0024] After the data segment reaches the encryption module, an encryption key is generated in real time through a dynamic key generation mechanism. The key generation is based on dynamic parameters such as the current timestamp, network status, and system load, and combines multiple rounds of hash operations and random number generation to ensure key uniqueness and unpredictability. For example, the timestamp is XORed with the initial key, and the final key is calculated based on the system's current CPU usage and memory occupancy, and stored in the key pool. The encryption module uses the AES algorithm to encrypt the data segment and is configured in CBC mode to generate the corresponding initialization vector to enhance the security of data encryption.
[0025] The encryption module also supports a batch key generation mechanism. Each batch of keys is generated in advance before the task starts and stored in the key pool. When new data segments arrive, the keys are directly assigned, thereby reducing the computational overhead during key generation and improving encryption efficiency. For processed data segments, the encryption module reports the task completion status to the scheduler through the task feedback mechanism, releases occupied system resources and assigns new tasks to the node.
[0026] Finally, after all data segments are encrypted, the system sorts the data segments according to the unique identifier and timestamp and merges them into a complete ciphertext file. During the sorting process, the unique identifiers are arranged from small to large. If the identifiers are the same, they are arranged in order of timestamp. When merging, the encrypted data content is extracted from each data segment and spliced into a complete ciphertext file in sequence to ensure data continuity. To verify data integrity, the system performs consistency checks on each received data segment, including length checks and encryption checks and checks. Any mismatch will trigger an error handling mechanism. The final generated ciphertext file is stored in a specified location or transmitted to the target device as required.
[0027] Embodiment 2, this embodiment is based on embodiment 1: first, the data acquisition module collects the current timestamp, network status, user request attributes and system load status in real time, the timestamp is obtained through the system clock, the network status is monitored in real time by the bandwidth monitoring tool, the user request attributes are collected by the user behavior analysis module, and the system load status is obtained by the computing resource monitoring system.
[0028] Then, in the MD5 preliminary encryption stage, first accurately obtain the binary data of the e-book file in the form of a byte stream, group it according to the MD5 algorithm specification, with each group being 512 bits. The MD5 algorithm performs four rounds of main loop operations, each round containing 16 steps of operations. It performs logical function operations on the 32-bit sub-group in the data group, then performs a circular left shift operation, and then performs an addition operation on the result with the link variables A, B, C, and D. The initial value is a specific constant. The formula for updating the value of A is: A = B + ((A + F(B, C, D) + X[k] + T[i]) <<< s), where X[k] is the sub-group in the data group, T[i] is an element in the constant table, and s is the number of circular left shift bits. After the operation, a 128-bit hash value is obtained as the first-layer ciphertext.
[0029] Then segment the first-layer ciphertext by a predetermined size and by characteristics; in the segmentation by a predetermined size, set 1024 bytes as a basic segmentation unit. Starting from the starting position of the first-layer ciphertext, sequentially intercept 1024 bytes to form a data segment until the remaining data is less than 1024 bytes. This part of the remaining data is used as the last data segment. Let the total number of bytes of the first-layer ciphertext be L and the number of segments be n, then n = [L / 1024], rounded up; in the segmentation by characteristics, segment according to the specific structure markers in the e-book file data. For example, if the specific byte sequence of the chapter separator in the binary data is [marker], then search for this byte sequence starting from the file starting position, and use the data between two adjacent markers as a data segment. The asynchronous transmission mechanism assigns a unique identifier to each data segment. For example, identifier = n + t + r, where n is the data segment sequence number, t is the generated timestamp, accurate to milliseconds, and r is a random number with a value range of 0 to a specific maximum value M; use the asynchronous programming interface provided by the programming language to initiate an asynchronous request. For example, use the asyncio library in Python to initiate an asynchronous request, and pass the data segment and its identifier as parameters to the corresponding function. The request runs independently in the background without blocking the main thread.
[0030] Then, multiple computing nodes are processed in parallel through an adaptive distributed load balancing mechanism of dynamic key generation and encryption process. The adaptive distributed load balancing mechanism includes monitoring system status and resource allocation and task scheduling adjustment. The monitoring system status includes system load, network bandwidth and computing resources. In the system load monitoring, the key indicators of the system's CPU usage U_cpu, memory occupancy U_memory, and disk I / O operation frequency F_io are obtained every T seconds. The system load status is comprehensively judged based on the key indicators. If U_cpu>80% and U_memory>70% and F_io>threshold F, the system is considered to be in a high load state, otherwise, the system is considered to be in a low load state; in the network bandwidth monitoring, the inbound B_in and outbound B_out data traffic of the network interface are measured in real time, and the current available network bandwidth B_available =B_total - (B_in + B_out) is calculated. The network delay and stability are evaluated by sending ICMP detection packets and measuring the round-trip time RTT and packet loss rate P_loss; if RTT>threshold RTT or P_loss> Threshold P_loss, the network condition is not good; in the evaluation of computing resource conditions, according to the number of currently running processes N_process, the CPU time slice T_cpu_process[i] and memory space M_memory_process[i] occupied by each process, the current available CPU time slice T_available_cpu = C_total - ∑T_cpu_process[i] and available memory space M_available_memory = M_total - ∑M_memory_process[i] are calculated;For the specific hardware acceleration resources that the above encryption module relies on, obtain its utilization U_acceleration and the remaining available resource amount A_available. If U_acceleration> threshold U_acceleration, it means that the resource is tight. In the resource allocation strategy, when the system load is low and the network bandwidth is sufficient and the computing resources are abundant, more resources are allocated to the encryption task, for example, the number of CPU cores C_increase allocated to the encryption module is increased. C_increase = min(C_total - N_process, C_max_increase) can be set according to the system configuration and load conditions, and the memory space allocation M_increase is increased at the same time, M_increase = min(M_available_memory / 2, M_max_increase). On the contrary, when the system is in a high load state, the resources allocated to the encryption task are appropriately reduced. In the task scheduling optimization, the task execution order is dynamically adjusted according to the task priority P = W_eE + W_sizeS and resource requirements; for tasks with high priority and small resource requirements, they are given priority for execution, and for tasks with large resource requirements but low priority, they can be delayed or split into multiple subtasks. ;
[0031] During the asynchronous request process, the asynchronous requests are evaluated for priority according to the urgency of the data segments, the byte length of the data segments, and the preset priority rules, and are assigned to the corresponding priority queues, and the requests are processed in the order of priority. The priority rules include the priority evaluation factors and the priority queue management and scheduling. The priority evaluation factors evaluate the urgency, size, and required resource amount of the data segments and generate a priority identifier. The urgency evaluation determines the urgency of the data segments according to the usage scenarios of the e-book files. If the data segment corresponds to the part that is being read or edited by the user in real time, the urgency is the highest, set as E_max. If it is the part that the user may access in the near future, the urgency is the second highest, set as E_medium. If it is for backup or archiving purposes, the urgency is the lowest, set as E_min. The preset priority rules set the priority rules based on user permissions. The encryption requests initiated by the administrator user have the highest priority, set as P_admin. The daily encryption operations of ordinary users have a lower priority, set as P_user. At the same time, the rules are set according to the importance of the data segment content. If the data segment contains key information such as copyright information and user privacy data, the priority is increased, set as P_important. The priority comprehensive scoring formula is P = W_userP_user + W_adminP_admin + W_important*P_important, where the sum of W_user, W_admin, and W_important is equal to 1. In the priority queue management and scheduling, the requests are assigned to different priority queues according to the priority evaluation results. If P > P_high, the request is assigned to the high-priority queue. If P_medium < P < P_high, it is assigned to the medium-priority queue. If P < P_medium, it is assigned to the low-priority queue. The queue requests are processed in the order of priority from high to low. The requests in the high-priority queue are always processed first, and sufficient resources are allocated to it by the system. When there are requests in the medium-priority queue and there are remaining system resources, the medium-priority requests can be processed in parallel. When there are many idle system resources, the low-priority requests can be processed by allocating resources in a certain proportion.
[0032] During the dynamic key generation and encryption process, the encryption module will generate a unique dynamic encryption key in real time based on the current timestamp, network status, user request attributes and system load status collected by the data acquisition module. The binary representation of the timestamp is t_bin, which is XORed with the initial key material K_0 to generate K_1. The network status information is collected in combination with the key generation of the network status, including the IP address, subnet mask, gateway address, network bandwidth utilization and network delay. This information is encoded and concatenated to form network status data N, which is hashed with K_1 to generate K_2. The key generation considering the system load status obtains the load indicators of the current CPU usage and memory occupancy of the system, and these load data are hashed again with K_2 to generate K_3. The real-time asynchronous encryption operation selects the AES algorithm to encrypt the data segment, and the encryption mode is configured as the CBC mode. The CBC mode requires a 128-bit initialization vector IV_aes.
[0033] When the encryption module receives multiple data segments, multiple groups of dynamic encryption keys are generated at one time through a batch key generation algorithm, and the generated keys are stored in a key pool. Whenever a new data segment arrives, a suitable dynamic encryption key is retrieved from the key pool for encryption processing, and the key is marked as used or automatically updated after use, thereby reducing the time for repeated key generation and improving encryption efficiency and system response speed. The batch key generation is based on a multi-factor batch key generation algorithm, which comprehensively considers factors such as timestamp, network status and system load to generate batch keys. Key pool management and retrieval establish a key pool to store the batch generated keys. The key pool usually uses a hash table as its data structure. Each key has a unique identifier as a key in the hash table. This identifier can be a key generation sequence number, or a complex identifier generated in combination with information such as a timestamp. This design makes the time complexity of retrieving a key from the key pool reach O(1), that is, constant time complexity. After the key is used to encrypt the data segment, the key is marked for key update and marking. If the system sets a limit on the number of times the key is used, the key is automatically updated when the number of times the key is used reaches the limit.
[0034] Next, through the asynchronous request step, the asynchronous request adopts hierarchical task queue management. According to the data segment byte length, priority and network status, the tasks to be encrypted are divided into different queue levels. The queues of each level are sorted according to the preset rules. In terms of the data segment byte length stratification, the intermediate threshold is set to S. When the data segment byte length is lower than S, it enters the fast processing queue for priority transmission, because its fast processing can improve the system throughput; when the data segment byte length is higher than S, it enters the large file processing queue for slow transmission, which will obtain more time slices and computing resources. For example, small books, such as short stories or poetry collections, may have a full-text byte range of 100KB to 500KB, so the intermediate threshold S is set to 300KB; medium-sized books, such as ordinary novels, may be between 500KB and 5MB, so the intermediate threshold S is set to 2MB; large books, such as textbooks or professional books containing a large number of images and charts, may exceed 5MB, so the intermediate threshold S is set to 5MB; based on the priority stratification, high-priority data segment requests are entered into the high-priority queue for priority processing, and medium and low priorities are entered into the corresponding queues respectively, and high-priority queue tasks are always given priority. First, execute; in the network status stratification, when the network status is stable, the data segment tasks with high network bandwidth requirements and strong real-time performance enter the fast transmission queue; when the network fluctuates, the data segment tasks with low network dependence or that can be pre-processed locally enter the local processing queue and are transmitted and processed after the network improves; the task queue is sorted and executed according to the task arrival time and priority, and the high-priority queue gives priority to the high-priority task that arrives first. If a new higher-priority task arrives, the current task will be interrupted and given priority; similar resource allocation of medium and low priority queues is dynamically adjusted according to the system load and the execution status of high-priority tasks, to ensure reasonable task allocation and efficient execution, and improve system adaptability and stability.
[0035] When merging data segments, an ordered list is used to store the encrypted data segments. The new data segment is inserted with the unique identifier ID. If the list is empty, it is inserted directly. If it is not empty, the ID size is traversed and compared and inserted into the appropriate position. If the ID is the same, it is sorted according to the timestamp TS, with the smaller one in front. After all data segments are sorted, they are merged, and the encrypted data content Data[i] is taken from the head of the list in turn to splice into a complete ciphertext file. Pay attention to the processing boundary to ensure continuity and integrity. In the consistency verification standard and method, the data segment byte length check is to check whether the byte length of the received data segment is consistent with the expectation before merging. The expected length is calculated according to the original size and encryption algorithm characteristics, such as the original size S_original. When AES encryption and PKCS7 padding, the expected length L_expected = S_original + P. If it is inconsistent, the error handling mechanism is triggered; the encryption checksum check is to generate the data segment checksum Checksum [i] during encryption, and recalculate Checksum_actual [i] during merging. It will be compared with the original checksum. If it is different, it means that the data segment may have been tampered with, and the system will take corresponding security measures. The final merged ciphertext file will be stored or transmitted to the designated device according to the preset strategy to ensure the encryption security and integrity of the file.
[0036] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A secondary encryption method for electronic book files based on MD5 encryption and asynchronous request, comprising the following steps: A data collection module is used to collect the current timestamp, network status, user request attributes and system load status in real time. The timestamp is obtained through the system clock, the network status is monitored in real time through a bandwidth monitoring tool, the user request attributes are collected through a user behavior analysis module, and the system load status is obtained through a computing resource monitoring system; MD5 preliminary encryption, reading the binary data of the target electronic book file, grouping the data according to the grouping rules of the MD5 encryption algorithm and performing multiple rounds of hash operations to generate a 128-bit fixed-length hash value as the first layer of ciphertext to ensure the preliminary encryption and integrity verification of the electronic book file content; File segmentation and asynchronous request transmission: the first layer of ciphertext is divided into multiple data segments according to the predetermined size or file characteristics, a unique identifier is assigned to each data segment, and each data segment is transmitted to the encryption module for secondary encryption using an asynchronous request method, supporting parallel processing and improving transmission and encryption efficiency; The encryption module monitors the current system load, network bandwidth, computing resources and data segment byte length through an adaptive distributed load balancing mechanism, and dynamically adjusts resource allocation and task scheduling of encryption tasks; Intelligent request priority scheduling, in the asynchronous request mode, according to the urgency of the data segment, the byte length of the data segment and the preset priority rules, the asynchronous request is evaluated for priority, and it is assigned to the corresponding priority queue, and the request is processed in priority order; Dynamic key generation and encryption: the encryption module generates a dynamic encryption key in real time based on the data acquisition module, and performs independent real-time asynchronous encryption processing on each data segment to ensure the uniqueness and unpredictability of the encryption key.
2. The electronic book file secondary encryption method based on MD5 encryption and asynchronous request according to claim 1, characterized in that: The encryption module includes a batch key generation and caching mechanism. When receiving multiple data segments, it generates multiple groups of dynamic encryption keys at one time through a batch key generation algorithm, and stores the generated keys in a key pool. Whenever a new data segment arrives, it retrieves a suitable dynamic encryption key from the key pool for encryption processing, and after use, the key is marked as used or automatically updated, thereby reducing the time for repeated key generation and improving encryption efficiency and system response speed.
3. The electronic book file secondary encryption method based on MD5 encryption and asynchronous request according to claim 1, characterized in that: The transmission process of the asynchronous request method adopts hierarchical task queue management, and the tasks to be encrypted are divided into different queue levels according to the byte length, priority and network status of the data segment. The queues at each level are sorted according to preset rules. High-priority tasks are transmitted and processed first, while low-priority tasks are gradually executed when resources are idle. Through the automatic adjustment and management mechanism of the task queue, task allocation and resource utilization are optimized in the case of network congestion; the network status includes indicators of network bandwidth utilization and network delay, and the task allocation is adjusted in real time in combination with the transmission environment. When the network condition is stable, tasks with bandwidth utilization higher than 50% are transmitted first; otherwise, tasks that can be pre-processed locally are processed first to reduce dependence on network transmission. The stable network condition means that the upper and lower ranges of the network delay do not exceed 10%.
4. The electronic book file secondary encryption method based on MD5 encryption and asynchronous request according to claim 1, characterized in that: After receiving the asynchronous encryption request of the data segment, the intelligent request priority scheduling generates a priority identifier according to the preset priority rules. Based on the identifier, the system assigns the request to the corresponding priority queue. Tasks in the high-priority queue are processed first, and low-priority tasks are processed when resources are idle. At the same time, the priority rules are dynamically adjusted according to the real-time system load and processing progress to ensure that the overall encryption efficiency is maximized.
5. The electronic book file secondary encryption method based on MD5 encryption and asynchronous request according to claim 4, characterized in that: The priority rule includes priority evaluation factors and priority queue management and scheduling. The priority evaluation factors evaluate the urgency, size and required amount of resources of the data segment and generate a priority identifier. According to the urgency evaluation, if the data segment contains content that is being read or edited in real time, it is rated as high priority, if it is a part that may be accessed in the near future, it is rated as medium priority, and if it is a backup or archived part, it is rated as low priority; the data segment byte length evaluation is to set an intermediate threshold S, when the data segment byte length is lower than S, it is preferentially transmitted and processed; otherwise, it is gradually executed when resources are idle; the required amount of resources is evaluated based on the CPU time and memory space required for the data segment during the encryption process; in the priority queue management and scheduling, requests are allocated to different priority queues according to the priority evaluation results, and queue requests are processed in order from high to low priority, requests with high priority identifiers are processed first, low priority tasks are processed when system resources permit, and priority rules are dynamically adjusted according to real-time load and processing progress.
6. The method for secondary encryption of electronic book files based on MD5 encryption and asynchronous request according to claim 1, characterized in that: During the dynamic key generation and encryption process, the encryption module will generate a unique dynamic encryption key in real time based on the current timestamp, network status, user request attributes and system load status collected by the data acquisition module. The generation of the dynamic encryption key undergoes multiple rounds of hash calculations and a random number generation mechanism to ensure its high unpredictability. The generated key is bound to the corresponding data segment and is used for real-time encryption processing of the data segment to ensure the independence of the key and the security of the encrypted data.
7. The electronic book file secondary encryption method based on MD5 encryption and asynchronous request according to claim 1, characterized in that: The dynamic key generation and encryption process performs parallel processing on multiple computing nodes through an adaptive distributed load balancing mechanism. After receiving the encryption request of the data segment, the encryption task is intelligently distributed to the node with low load for processing according to the current load situation of each computing node. Each node independently completes the encryption task of the data segment, and ensures the coordination of task allocation and execution through the task feedback mechanism, thereby improving the overall encryption processing capability and system scalability.
8. The electronic book file secondary encryption method based on MD5 encryption and asynchronous request according to claim 1, characterized in that: In the process of finally merging all the data segments that have been encrypted twice into a complete ciphertext file, the data segments are sorted in a predetermined order according to the unique identifier of each data segment and the timestamp collected in the data collection module, and the sorted data segments are checked for consistency one by one; The verification includes whether the hash value and unique identifier of the data segment match, ensuring the integrity and consistency of each data segment; After the merge is completed, the system stores the complete ciphertext file to the target location according to the preset storage strategy, and generates a storage or transmission log for subsequent tracking and verification.
Citation Information
Patent Citations
Ciphertext generation method and device, storage medium and electronic equipment
CN115426174A
Key message processing method and device, storage medium and electronic equipment
CN115459926A
Data file encryption method and device, computing equipment and storage medium
CN115664826A
Task processing method and system for comprehensive resource management of intelligent monitoring system
CN117608840A
Data encryption method and device, data decryption method and device and electronic equipment
CN117675189A
Cited By
Low-delay high-security data transmission method and system for video platform
CN120018123A
A low-latency and high-security data transmission method and system for a video platform
CN120018123B
Hotel intelligent equipment networking method and networking system
CN120455191A
File encryption and decryption system and method based on message queue
CN120512303A
Message queue-based file encryption and decryption system and method
CN120512303B