Method and System for Dynamic Compression and Secure Transmission of Power Line Carrier Dual-Mode Data

Through the hybrid compression and dynamic blocking encryption methods of adaptive LZ4 and Huffman coding algorithms, the compression efficiency and safety problems in power line carrier dual-mode equipment are solved, and efficient and safe power high-frequency data processing is achieved.

CN120034588BActive Publication Date: 2025-07-25BEIJING TENGINEER AIOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510476052.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-07-25
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

In the power line carrier dual-mode equipment, the compression efficiency is insufficient, the data signal-to-noise ratio is low, and the encryption security is poor, making it difficult to meet the real-time and security requirements of high-frequency power data.

Method used

The hybrid compression method of adaptive LZ4 compression algorithm and adaptive Huffman coding algorithm is adopted to denoising the power high-frequency data stream and lightweight hybrid compression is carried out, and the encrypted data stream is generated through dynamic block encryption.

Benefits of technology

It improves the compression rate and real-time compression speed of high-frequency power data, enhances the robustness and adaptability of the algorithm, and significantly improves the security of data encryption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120034588B_ABST
    Figure CN120034588B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for dynamically compressing and securely transmitting power line carrier dual-mode data. After collecting power high-frequency data streams, it first performs denoising processing on them, optimizing the signal-to-noise ratio of the compressed data. And it uses a lightweight hybrid compression algorithm to compress the denoised data streams, combining the advantages of the fast compression speed of the LZ4 compression algorithm and the high compression efficiency of the Huffman coding algorithm. It not only effectively improves the compression ratio and real-time compression speed of low-information-density power data, but also can adaptively adjust compression parameters according to the characteristics of power high-frequency data streams, adaptively and dynamically adjust the compression process, improving the robustness and adaptability of the algorithm. Finally, dynamic block encryption processing is carried out on the compressed data streams. Compared with the existing static encryption method, it realizes high-strength protection of data keys, significantly increasing the cost of brute-force cracking keys, thereby improving the security of data encryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power line carrier dual-mode data processing, and in particular, to a method and system for dynamically compressing and securely transmitting power line carrier dual-mode data, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the rapid development of smart grid and Internet of Things technologies, as a core device for power grid data perception, power line carrier dual-mode needs to collect dynamic signals such as voltage, current, and power in real time at frequencies ranging from kilohertz to megahertz. The amount of data generated by a single device per day can reach hundreds of gigabits. Such data has the following significant characteristics: low information density, high redundancy between adjacent sampling points due to power grid load fluctuations and periodic changes; significant volatility and noise interference, and the data exhibits non-stationary random characteristics and is mixed with high-frequency noise due to factors such as electromagnetic environment and equipment aging; strict real-time requirements, and scenarios such as fault recording and harmonic analysis require local storage and remote transmission of data within seconds. In the face of massive high-frequency data, the traditional embedded systems installed on power line carrier dual-mode adopt direct storage of raw data or simple compression combined with static encryption schemes, resulting in a short lifespan of storage media, a sharp increase in communication bandwidth pressure, and difficulty in meeting the requirements of efficient data utilization and long-term archiving. Therefore, how to achieve efficient compression and secure storage of high-frequency power data under low computing power requirements and limited capacity has become the core bottleneck restricting the intelligent upgrade of power terminals.

[0003] Currently, the processing solutions for high-frequency power data have multiple limitations: 1) Insufficient compression efficiency. Traditional algorithms rely on the detection of continuous repetition patterns and have poor adaptability to power data with low information density and random fluctuations, resulting in a low compression ratio; 2) Although some existing lightweight compression algorithms have a relatively fast compression speed, they lack a noise filtering mechanism, resulting in a decrease in the signal-to-noise ratio of the compressed data and affecting the subsequent analysis accuracy; 3) Imbalance between security and performance. Existing encryption schemes mostly use a single algorithm to statically encrypt data streams, and the encryption keys are fixedly stored on the terminal side, which is easily extracted by physical attacks. If multiple layers of encryption are introduced, the computational load will be significantly increased, making it difficult to meet the real-time requirements. Summary of the Invention

[0004] The present invention provides a method and system for dynamically compressing and securely transmitting power line carrier dual-mode data, an electronic device, and a computer-readable storage medium, which can optimize the signal-to-noise ratio of the compressed data, effectively improve the compression ratio and real-time compression speed of low-information-density power data, enhance the robustness and adaptability of the algorithm, and improve the security of data encryption.

[0005] According to one aspect of the present invention, a method for dynamically compressing and securely transmitting power line carrier dual-mode data is provided, including the following content:

[0006] Collect high-frequency power data streams and perform denoising processing on them;

[0007] Perform lightweight hybrid compression processing on the denoised high-frequency power data streams based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain compressed data streams;

[0008] Perform dynamic block encryption processing on the compressed data streams and output encrypted data streams.

[0009] Furthermore, the process of performing lightweight hybrid compression processing on the denoised high-frequency power data streams based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain compressed data streams includes the following:

[0010] Obtain the statistical characteristics of the input data stream and adaptively adjust the sliding window size of the LZ4 compression algorithm according to the statistical characteristics;

[0011] Perform LZ4 compression processing on the input data stream based on the set sliding window size to obtain compressed matching sequences and uncompressed residual data, and count the occurrence frequencies of each symbol in the residual data to obtain symbol frequency statistical information;

[0012] Perform secondary compression processing on the residual data based on the symbol frequency statistical information using the adaptive Huffman coding algorithm to obtain Huffman code table representations and Huffman residual encodings;

[0013] Concatenate the matching sequences, Huffman code table representations, and Huffman residual encodings and output them as compressed data streams.

[0014] Furthermore, the process of obtaining the statistical characteristics of the input data stream and adaptively adjusting the sliding window size of the LZ4 compression algorithm according to the statistical characteristics includes the following:

[0015] Calculate the entropy value of the data stream. If the entropy value is greater than the first preset threshold, then reduce the sliding window. If the entropy value is less than the second preset threshold, then increase the sliding window, where the first preset threshold is greater than the second preset threshold.

[0016] Furthermore, the process of obtaining the statistical characteristics of the input data stream and adaptively adjusting the sliding window size of the LZ4 compression algorithm according to the statistical characteristics further includes the following:

[0017] Calculate the repetition rate of the data in the data stream. If the repetition rate is greater than the third preset threshold, then increase the sliding window. If the repetition rate is less than the fourth preset threshold, then reduce the sliding window, where the third preset threshold is greater than the fourth preset threshold.

[0018] Further, during the LZ4 compression process, if the number of search matching failures reaches a preset threshold, the step size parameter for the next search matching is increased until a successful match is made, and then the step size parameter is restored to the initial value.

[0019] Further, the process of using the adaptive Huffman coding algorithm to perform secondary compression processing on the residual data based on the symbol frequency statistical information includes the following:

[0020] Before officially starting the dynamic Huffman coding, the above symbol frequency statistical information is input into the Huffman tree initialization module. For each symbol in the frequency statistical table S i , according to its occurrence frequency, perform a "simulated insertion" operation. Each "simulated insertion" operation is regarded as the symbol appearing and being encoded once, triggering weight increment and tree structure update. If the symbol S i has not appeared in the Huffman tree, first perform NYT node splitting to generate a new NYT node and S i the corresponding leaf node, and then perform increment.

[0021] Further, the process of performing dynamic block encryption processing on the compressed data stream and outputting the encrypted data stream includes the following:

[0022] Perform uniform block processing on the compressed data stream to obtain multiple data blocks of the same size;

[0023] Obtain the device unique fingerprint, calculate the hash value of each data block, and generate a corresponding temporary symmetric key for each data block based on the device unique fingerprint and the hash value of each data block;

[0024] Set the initial value of the counter corresponding to the hash value of each data block, and perform block encryption on each data block using the corresponding temporary symmetric key and the initial value of the counter.

[0025] In addition, the present invention also provides a dynamic compression and secure transmission system for power line carrier dual-mode data, including:

[0026] A data denoising module for collecting power high-frequency data streams and denoising them;

[0027] A data compression module for performing lightweight hybrid compression processing on the denoised power high-frequency data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain a compressed data stream;

[0028] A block encryption module for performing dynamic block encryption processing on the compressed data stream and outputting an encrypted data stream.

[0029] In addition, the present invention also provides an electronic device, including a processor and a memory. A computer program is stored in the memory, and the processor is configured to execute the steps of the method described above by calling the computer program stored in the memory.

[0030] In addition, the present invention also provides a computer-readable storage medium for storing a computer program for dynamically compressing and securely transmitting high-frequency power data. When the computer program runs on a computer, it executes the steps of the method described above.

[0031] The present invention has the following beneficial effects:

[0032] In the method for dynamically compressing and securely transmitting power line carrier dual-mode data of the present invention, after collecting the high-frequency power data stream, noise reduction processing is first performed on it, optimizing the signal-to-noise ratio of the compressed data. Then, a lightweight hybrid compression algorithm based on the fusion of the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm is used to compress the denoised data stream, combining the advantages of the fast compression speed of the LZ4 compression algorithm and the high compression efficiency of the Huffman coding algorithm. It not only effectively improves the compression ratio and real-time compression speed of low-information-density power data, but also can adaptively adjust the compression parameters according to the characteristics of the high-frequency power data stream, adaptively and dynamically adjust the compression process, improving the robustness and adaptability of the algorithm. Finally, dynamic block encryption processing is performed on the compressed data stream. Compared with the existing static encryption method, it realizes high-strength protection of the data key, significantly increases the cost of brute-force cracking the key, thereby improving the security of data encryption.

[0033] In addition, the system for dynamically compressing and securely transmitting power line carrier dual-mode data of the present invention also has the above advantages.

[0034] In addition to the purposes, features, and advantages described above, the present invention has other purposes, features, and advantages. The following will refer to the drawings for a more detailed description of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:

[0036] Figure 1 is a flowchart of the method for dynamically compressing and securely transmitting power line carrier dual-mode data according to a preferred embodiment of the present application;

[0037] Figure 2 is Figure 1 a sub-flowchart of step S2 in

[0038] Figure 3 isFigure 1 Schematic diagram of the sub - process of step S3

[0039] Figure 4 It is a schematic diagram of the module structure of the dynamic compression and secure transmission system for power - line carrier dual - mode data according to another embodiment of the present application. Detailed implementation manners

[0040] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0041] Refer to Figure 1 , a preferred embodiment of the present application provides a method for dynamic compression and secure transmission of power - line carrier dual - mode data, including the following:

[0042] Step S1: Collect the power high - frequency data stream and perform denoising processing on it;

[0043] Step S2: Perform lightweight hybrid compression processing on the denoised power high - frequency data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain a compressed data stream;

[0044] Step S3: Perform dynamic block encryption processing on the compressed data stream and output an encrypted data stream.

[0045] It can be understood that for the method of dynamic compression and secure transmission of power - line carrier dual - mode data in this embodiment, after collecting the power high - frequency data stream, denoising processing is first performed on it, which optimizes the signal - to - noise ratio of the compressed data. Then, a lightweight hybrid compression algorithm that combines the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm is used to compress the denoised data stream. This combines the advantages of the fast compression speed of the LZ4 compression algorithm and the high compression efficiency of the Huffman coding algorithm. It not only effectively improves the compression ratio and real - time compression speed of low - information - density power data, but also can adaptively adjust the compression parameters according to the characteristics of the power high - frequency data stream, and adaptively and dynamically adjust the compression process, improving the robustness and adaptability of the algorithm. Finally, dynamic block encryption processing is performed on the compressed data stream. Compared with the existing static encryption method, it realizes high - strength protection of the data key, significantly increases the cost of brute - force cracking the key, and thus improves the security of data encryption.

[0046] Among them, in the step S1, the power - line carrier dual - mode collects analog signals such as voltage and current in real - time at a frequency of kHz level. The signals collected by the power - line carrier dual - mode are converted by an analog - to - digital converter to obtain digital signals, generating an original data stream , the original data stream contains data streams collected by n power - line carrier dual - modes, d n denotes then A high-frequency data stream for dual-mode power line carrier acquisition.

[0047] Then, for the original data stream D raw Wavelet transform denoising is adopted. The wavelet threshold denoising method is a classical signal denoising method. It divides the signal into various frequency bands with different widths through wavelet transform, and then realizes denoising by threshold processing of wavelet coefficients under different frequency bands. Compared with other commonly used algorithms, the advantage of wavelet denoising is that it can retain the characteristics of the original signal and has a relatively small computational amount. Its formula can be expressed as: , where represents the j th k wavelet at the scale before the threshold function processing, M represents the signal (i.e., wavelet coefficient) after being processed by the threshold function, α represents the preset threshold, α represents the adjustment factor, and its value ranges from 0 to 1. When the signal-to-noise ratio of the noisy signal is low, appropriately increasing the α value helps to more effectively remove the wavelet coefficients related to noise. When the signal-to-noise ratio of the noisy signal is high, reducing the M value helps to retain more wavelet coefficients of weak signals. In addition, the calculation formula of the preset threshold is: N represents the time length of the input signal, δ represents the standard deviation value of the wavelet coefficient after threshold processing. It can be understood that after the original data stream D raw removes high-frequency noise through wavelet threshold denoising, the preprocessed data stream D ped is obtained.

[0048] In addition, as Figure 2 shown, in the step S2, the process of performing lightweight hybrid compression processing on the denoised high-frequency power data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain the compressed data stream includes the following contents:

[0049] Step S21: Obtain the statistical characteristics of the input data stream and adaptively adjust the sliding window size of the LZ4 compression algorithm according to the statistical characteristics;

[0050] Step S22: Perform LZ4 compression processing on the input data stream based on the set sliding window size to obtain the compressed matching sequence and the uncompressed residual data, and count the occurrence frequency of each symbol in the residual data to obtain the symbol frequency statistical information;

[0051] Step S23: Use the adaptive Huffman coding algorithm to perform secondary compression processing on the residual data based on the symbol frequency statistical information to obtain the Huffman code table representation and the Huffman residual coding;

[0052] Step S24: Concatenate the matching sequence, the Huffman code table representation, and the Huffman residual coding to output the compressed data stream.

[0053] Specifically, the sliding window size of the existing LZ4 compression algorithm is fixed. However, for power data, due to its strong random volatility, the sliding matching efficiency during data compression is low and the compression effect is poor. Therefore, the present invention adaptively adjusts the sliding window size of the LZ4 compression algorithm according to the statistical characteristics of the input data stream, which can effectively improve the sliding matching efficiency and thus improve the compression effect. Specifically, first calculate the entropy value of each data stream segment based on the following formula: , where H ( X ) represents the entropy value of the input data stream X , represents the probability that the symbol x i appears in the data stream. If the entropy value is greater than the first preset threshold, the sliding window is reduced; if the entropy value is less than the second preset threshold, the sliding window is increased, where the first preset threshold is greater than the second preset threshold.

[0054] It can be understood that when the entropy value of the input data stream is high, it indicates that the data changes greatly and has low redundancy, and the data is poorly compressible. At this time, the fixed sliding window of the traditional LZ4 compression algorithm is relatively large, which may lead to matching failures or too high computational complexity. Therefore, in order to improve the compression speed and reduce the computational burden, the present invention reduces the sliding window to reduce the matching range, thereby improving the matching speed and reducing the amount of calculation. When the entropy value of the input data stream is low, it indicates that there are a large number of repeated patterns or regularities in the data, and the data is highly compressible. At this time, increasing the sliding window can increase the matching depth and find more repeated patterns, thereby increasing the compression ratio. Therefore, the present invention increases the sliding window to adapt to the matching requirements of the redundant information in the data. In addition, during the input process of the data stream, whenever a certain length (such as 1KB or 4KB) of data is processed, the present invention will calculate the entropy value of the input data stream in real time and adaptively and dynamically adjust the size of the sliding window according to the calculated entropy value. If the entropy value is high, the window is reduced; if the entropy value is low, the window is increased.

[0055] Optionally, the present invention also detects duplicate patterns in the input data stream in real time. Especially when multiple identical byte sequences are found, by calculating the duplication rate of the data in the data stream, if the duplication rate is greater than a third preset threshold, the sliding window is enlarged to capture longer matching patterns and enhance the compression effect. If the duplication rate is less than a fourth preset threshold, the sliding window is reduced to improve the compression speed, where the third preset threshold is greater than the fourth preset threshold.

[0056] In addition, the adaptive adjustment of the sliding window is performed in real time throughout the compression process, that is, for each data block (i.e., the input data stream of a preset length), the size of the sliding window is dynamically adjusted according to the characteristics of the data block. The adjusted size of the sliding window will immediately affect the sliding window matching process of the data block. The adjustment and matching of the sliding window will continue until the LZ4 compression process ends.

[0057] It can be understood that the present invention calculates the entropy value or duplication rate of the input data stream and adaptively and dynamically adjusts the size of the sliding window of the LZ4 compression algorithm according to the statistical results. The size of the sliding window can be adjusted between multiple levels according to the data characteristics, so as to achieve differential compression of high-redundancy and high-variation data regions, improve the compression effect and speed of the data, and have strong robustness and adaptability.

[0058] Then, for each input data stream segment that reaches the preset length, it is subjected to LZ4 compression processing based on the adaptively adjusted sliding window size to obtain a compressed matching sequence and uncompressed residual data. Among them, the specific LZ4 compression algorithm belongs to the prior art, and its specific principle will not be elaborated here. Only a brief introduction to the general process is given here. For example, the compression process of the LZ4 compression algorithm includes the following steps:

[0059] (1). Load a 4-byte data unit from the input data stream and calculate its corresponding hash value index based on the hash function;

[0060] (2). Query the hash table according to the hash index to obtain the historical data pointer ref, and write the current data address to the corresponding position in the hash table to complete the record update;

[0061] (3). If ref points to the initial marker value (i.e., there is no historical matching item), or the position corresponding to ref exceeds the current sliding window range, return to the first step to re-read the next 4-byte data; if ref is within the valid window range and not the initial value, compare the historical data corresponding to ref with the content of the current data unit. If they are the same, continue with the next operation; otherwise, return to the first step to re-read the next 4-byte data;

[0062] (4) After finding a match, starting from the match start point, compare the data content byte by byte backward until a difference is detected or the end of the data stream is reached, record the number of continuously matched bytes, generate a compression marker tuple, and output it to the compressed data stream;

[0063] (5) After completing the output of the current sequence, re - execute step (1) for loop operation calculation. When there are only the last 5 bytes left to be compressed, stop the matching calculation. Whether it matches the previous data or not, it is regarded as an unmatchable string and output as the last sequence. The matching length of the last sequence is 0 and the offset is also 0.

[0064] Among them, after the input data stream undergoes LZ4 compression processing, a compressed matching sequence D LZ and uncompressed residual data D res .

[0065] Optionally, during the LZ4 compression process, if the number of failed search matches reaches a preset threshold, increase the step parameter step of the next search match until a successful match is made, and then restore the step parameter step to the initial value. It can be understood that the improved LZ4 compression algorithm of the present invention controls the step parameter step, that is, the size of the current pointer step, to achieve the control of the forward size of the sliding window. The step parameter step may change during the compression process, which depends on the number of search matches. Once the search fails multiple times and reaches the preset search number threshold, it is considered that the current data information may be difficult to compress. Then, in the next search match process, increase the step parameter step, that is, increase the pointer search step, so as to exchange a smaller compression rate loss for a faster compression speed. Until a successful match is found, the step parameter step is reset to the initial value 1. Therefore, the present invention sets a step dynamic adjustment mechanism during the LZ4 compression process, which is beneficial to dynamically balance the compression speed and compression ratio during the compression process and can well meet the dual requirements of the embedded system for "lightweight + real - time".

[0066] In addition, the traditional LZ4 compression algorithm has the advantage of fast compression speed, but its compression ratio is not high. When some content in the data stream cannot find a matching pattern through the sliding window, these parts will be directly output as "literals". If these "literals" are directly encrypted later, the processing volume is still large, making it difficult to meet the lightweight requirements of embedded systems. Therefore, after obtaining the compressed matching sequence and uncompressed residual data through fast compression using the LZ4 compression algorithm, the present invention further compresses the uncompressed residual data using the Huffman coding algorithm. The lightweight hybrid compression algorithm of the present invention combines the advantages of the fast compression speed of the LZ4 compression algorithm and the high compression efficiency of the Huffman coding algorithm, which can simultaneously improve the compression ratio and compression speed of power high-frequency data, and can meet the lightweight and real-time requirements of embedded systems.

[0067] Moreover, in the traditional LZ4 compression algorithm, when some content in the data stream cannot find a matching pattern through the sliding window, these parts will be directly output as "literals", that is, the unmatched residual data. If the Huffman coding algorithm is directly used to encode and compress these residual data, the compression efficiency is relatively low, especially when the redundancy and symbol frequency of the data change greatly. Therefore, in order to enhance the collaborative compression effect of the LZ4 compression algorithm and the Huffman coding algorithm, the present invention adds a residual data frequency statistics mechanism in the output stage of the LZ4 compression algorithm. Specifically, each time an unmatched residual data block is output by the LZ4 compression, a frequency statistics table will be updated in real time. The frequency statistics table will record the occurrence frequency of each symbol in the currently output residual data block. After the statistics are completed, the frequency statistics table can describe the local frequency distribution of symbols in the unmatched residual data block, serving as the coding basis for the subsequent Huffman coding algorithm. The Huffman coding algorithm will construct a more accurate Huffman tree adapted to the current data characteristics based on this frequency statistics table. When generating the Huffman tree, shorter codes will be preferentially assigned to high-frequency symbols according to the frequency information, thereby improving the compression effect. Therefore, the residual data frequency statistics mechanism set by the present invention can help the Huffman tree structure converge quickly, shorten the average code length in the initial stage, and thus improve the overall compression ratio.

[0068] The adaptive Huffman coding algorithm is an adaptive compression algorithm. Its principle is to dynamically construct and adjust the Huffman tree according to the occurrence frequency of symbols in the data stream, so as to assign shorter codes to symbols with higher occurrence frequencies, thereby improving the compression effect. Before adaptive Huffman coding, the following preprocessing mechanism is further introduced to improve the coding efficiency in cooperation with the LZ4 residual frequency statistics.

[0069] Specifically, before officially starting the dynamic Huffman coding, the above symbol frequency statistics information is input into the Huffman tree initialization module. For each symbol in the frequency statistics table Si , according to its occurrence frequency, perform the "simulated insertion" operation. Each "simulated insertion" operation is regarded as the symbol appearing and being encoded once, triggering the weight increase and the tree structure update. If the symbol S i has not appeared in the Huffman tree yet, then first perform the NYT node splitting to generate a new NYT node and S i the corresponding leaf node, and then perform the increment. This process does not produce actual coding output and is only used to optimize the tree structure. After the "simulated insertion" operation is completed, the structure of the Huffman tree has been optimized according to the frequency distribution of the symbols in the residual data, manifested as the nodes of high-frequency symbols being located in the upper layer of the tree with short coding paths, and low-frequency symbols being located in the lower layer with relatively long coding paths. This operation can effectively avoid the long coding caused by unknown frequencies in the initial stage of the original adaptive Huffman tree. When the coding of all characters in the residual data is completed, the Huffman code table representation and the Huffman residual coding can be output.

[0070] It can be understood that when the LZ4 compression outputs the residual data, it actively generates symbol frequency statistical information, providing an accurate initial probability model for the subsequent dynamic Huffman coding. This mechanism avoids the blind traversal of the Huffman tree in the initial stage, enabling the encoder to obtain a near-optimal code length distribution in the initial stage of compression, and significantly reducing the compression loss caused by long codewords in the early stage.

[0071] Optionally, the present invention also designs a frequency sliding window mechanism to dynamically update the Huffman tree. Specifically, set a symbol sliding window with a size of N (for example, 128), and then use the symbol sliding window to slide in the residual data. During the sliding process, each newly added symbol updates the sliding frequency statistics, and only constructs a locally optimal Huffman tree within the symbol sliding window to avoid frequent adjustment of the entire tree. All frequency changes are recursively updated from bottom to top to the parent node to ensure that the overall structure of the Huffman tree is dynamically adjusted with the change of local data. In addition, if it is found that the node and its predecessor sibling section do not satisfy the descending order arrangement, the node positions are automatically exchanged to maintain the orderliness. It can be understood that the present invention restricts the frequency statistical range of the Huffman coding through the sliding window, reduces the frequency of tree reconstruction, improves the compression speed while ensuring the compression efficiency, and can better adapt to the dual requirements of "lightweight + real-time" of the embedded system.

[0072] Optionally, the present invention also splices the Huffman coding paths of each symbol to generate bitstream data. After processing M (for example, 1024) symbols, insert a synchronization mark, such as "0xFFFF", and reset the Huffman tree to the initial state. It can be understood that the present invention enables the Huffman tree structure to be reset periodically through the synchronization mark mechanism, avoiding decoding failures caused by the drift of the coding tree state, and improving the fault tolerance under abnormal or packet loss conditions.

[0073] In addition, as Figure 3 shown, in the step S3, the process of dynamically block-encrypting the compressed data stream and outputting the encrypted data stream includes the following:

[0074] Step S31: Perform uniform block processing on the compressed data stream to obtain multiple data blocks of the same size;

[0075] Step S32: Obtain the device unique fingerprint, calculate the hash value of each data block, and generate a corresponding temporary symmetric key for each data block based on the device unique fingerprint and the hash value of each data block;

[0076] Step S33: Set the initial value of the counter corresponding to the hash value of each data block, and perform block encryption on each data block using the corresponding temporary symmetric key and the initial value of the counter.

[0077] Specifically, first perform block processing on the input compressed data stream. The compressed data stream includes LZ4 matching sequences, Huffman code table representations, and Huffman residual encodings. The compressed data stream is blocked in fixed 4KB sizes, and the insufficient part of the last block is filled with pseudo-random numbers, which can be generated based on a hardware entropy source. The compressed data blocks are marked as , and each block is associated with metadata: block sequence number, padding length, hash value.

[0078] Then, read the device unique fingerprint from the PUF module K PUF , and for each data block B i calculate its SHA3-256 hash value H i , and the calculation formula is: , and generate a temporary symmetric key through the key derivation function KDF based on the unique device fingerprint K PUF and the hash value H i , which can be expressed as: K symi =HKDF( K PUF , H i , Info = "AESKey"), and intercept the K symi first 128 bits as the AES-128 temporary key K AESi . Among them, AES uses 128 bits as a group, encrypts and decrypts using the same key, and adopts a completely symmetric structure, mainly including operations such as exclusive OR, lookup table, and shift, and can be executed efficiently.

[0079] Next, initialize and set the counter IV i =First-128-bits( H i ), bits( H i ) represents the hash value H i of, First-128-bits( H i ) represents taking the first 128 bits of the hash value H i as the initial value of the counter to be consistent with the block size of AES. Additionally, the counter step size can be dynamically adjusted according to the match length in the compressed information flow matching sequence. If the match length is greater than or equal to the preset length (e.g., 64 bytes), the timer step size is set to 1; if the match length is less than the preset length, the timer step size is set to 5; a long match segment represents high redundancy, increasing the step size can effectively enhance the randomness of the ciphertext, and a short match segment represents random data, and the normal step size is beneficial to maintaining the streaming characteristics. Finally, perform AES-CTR encryption on each data block, which can be expressed as C datai =AES-CTR-Encrypt( K AESi , IV i , B i ), C datai represents the i th data block B i after encryption. Additionally, the format of the encrypted data block includes ciphertext, padding data, and metadata. Store the encrypted data separately from the key to achieve efficient data storage.

[0080] It can be understood that the present invention dynamically derives segmented encryption keys based on the device unique fingerprint and the hash value of each data block, realizes high-strength protection of the data key, significantly increases the cost of brute-force cracking the key, and thus improves the security of data encryption. Moreover, the step size of the encryption counter is dynamically adjusted according to the length of the matching sequence included in each data block. A large matching sequence length represents strong repeatability, so the step size is enlarged, and the counter jumps faster, which is beneficial to enhancing the variability of the ciphertext.

[0081] Additionally, as Figure 4 shown, another embodiment of the present invention further provides a dynamic compression and secure transmission system for power line carrier dual-mode data, including:

[0082] A data denoising module for collecting high-frequency power data streams and denoising them;

[0083] A data compression module, which is used to perform lightweight hybrid compression processing on the denoised high-frequency power data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain a compressed data stream;

[0084] A block encryption module, which is used to perform dynamic block encryption processing on the compressed data stream and output an encrypted data stream.

[0085] It can be understood that the dynamic compression and secure transmission system for power line carrier dual-mode data in this embodiment first performs denoising processing on the high-frequency power data stream after acquisition, optimizing the signal-to-noise ratio of the compressed data. Then, a lightweight hybrid compression algorithm that combines the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm is used to compress the denoised data stream, combining the advantages of the fast compression speed of the LZ4 compression algorithm and the high compression efficiency of the Huffman coding algorithm. It not only effectively improves the compression ratio and real-time compression speed of low-information-density power data, but also can adaptively adjust the compression parameters according to the characteristics of the high-frequency power data stream, and adaptively and dynamically adjust the compression process, improving the robustness and adaptability of the algorithm. Finally, dynamic block encryption processing is performed on the compressed data stream. Compared with the existing static encryption method, it realizes high-strength protection of the data key, significantly increases the cost of brute-force cracking the key, and thus improves the security of data encryption.

[0086] In addition, another embodiment of the present invention further provides an electronic device, including a processor and a memory. A computer program is stored in the memory, and the processor is configured to execute the steps of the method described above by calling the computer program stored in the memory.

[0087] In addition, another embodiment of the present invention further provides a computer-readable storage medium, which is used to store a computer program for dynamically compressing and securely transmitting high-frequency power data. When the computer program runs on a computer, it executes the steps of the method described above.

[0088] The forms of common computer-readable storage media include: floppy disks, flexible disks, hard disks, magnetic tapes, any other magnetic media, CD-ROMs, any other optical media, punch cards, paper tapes, any other physical media with a pattern of holes, random access memories (RAMs), programmable read-only memories (PROMs), erasable programmable read-only memories (EPROMs), flash erasable programmable read-only memories (FLASH-EPROMs), any other memory chips or cartridges, or any other media readable by a computer. Instructions can further be transmitted or received by a transmission medium. The term transmission medium can include any tangible or intangible medium that can be used to store, encode, or carry instructions for execution by a machine, and includes digital or analog communication signals or the intangible media that facilitate the communication of the above instructions. Transmission media include coaxial cables, copper wires, and optical fibers, which include the wires of a bus used to transmit a computer data signal.

[0089] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages. For example, object-oriented programming languages such as Java and interpreted scripting languages such as JavaScript.

[0090] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0091] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the function specified in one or more of the flows Figure 1 one or more of the flows and / or Figure 1 blocks or a plurality of blocks.

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the function specified in one or more of the flows Figure 1 one or more of the flows and / or Figure 1 blocks or a plurality of blocks.

[0093] Although the preferred embodiments of the present application have been described, additional changes and modifications can be made by those skilled in the art once they learn of the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present application.

[0094] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

[0095] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for dynamically compressing and securely transmitting power line carrier dual-mode data, characterized in that, It includes the following: Collect the high-frequency power data stream and perform denoising processing on it; Perform lightweight hybrid compression processing on the denoised high-frequency power data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain a compressed data stream; Perform dynamic block encryption processing on the compressed data stream and output an encrypted data stream; The process of performing lightweight hybrid compression processing on the denoised high-frequency power data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain a compressed data stream includes the following: Obtain the statistical characteristics of the input data stream and adaptively adjust the sliding window size of the LZ4 compression algorithm according to the statistical characteristics; Perform LZ4 compression processing on the input data stream based on the set sliding window size to obtain a compressed matching sequence and uncompressed residual data, and count the occurrence frequency of each symbol in the residual data to obtain symbol frequency statistical information; Perform secondary compression processing on the residual data based on the symbol frequency statistical information using the adaptive Huffman coding algorithm to obtain a Huffman code table representation and Huffman residual coding; Concatenate the matching sequence, Huffman code table representation, and Huffman residual coding and output them as a compressed data stream; The process of performing secondary compression processing on the residual data based on the symbol frequency statistical information using the adaptive Huffman coding algorithm includes the following: Before officially starting dynamic Huffman coding, input the above symbol frequency statistics information into the Huffman tree initialization module. For each symbol S in the frequency statistics table i , according to its occurrence frequency, perform the "simulated insertion" operation. Each "simulated insertion" operation is regarded as the symbol appearing and being encoded once, triggering weight increment and tree structure update. If the symbol S i has not appeared in the Huffman tree yet, first perform NYT node splitting to generate a new NYT node and the leaf node corresponding to S i , and then perform the increment.

2. The dynamic compression and secure transmission method of power line carrier dual-mode data according to claim 1, characterized in that, The process of obtaining the statistical characteristics of the input data stream and adaptively adjusting the sliding window size of the LZ4 compression algorithm according to the statistical characteristics includes the following: Calculate the entropy value of the data stream. If the entropy value is greater than the first preset threshold, reduce the sliding window. If the entropy value is less than the second preset threshold, increase the sliding window, where the first preset threshold is greater than the second preset threshold.

3. The dynamic compression and secure transmission method for power line carrier dual-mode data according to claim 1, characterized in that The process of obtaining the statistical characteristics of the input data stream and adaptively adjusting the sliding window size of the LZ4 compression algorithm further includes the following: Calculate the repetition rate of the data in the data stream. If the repetition rate is greater than the third preset threshold, increase the sliding window. If the repetition rate is less than the fourth preset threshold, reduce the sliding window, where the third preset threshold is greater than the fourth preset threshold.

4. The dynamic compression and secure transmission method for power line carrier dual-mode data according to claim 1, characterized in that During the LZ4 compression processing, if the number of failed search matches reaches the preset threshold, increase the step parameter for the next search match until a successful match is made, and then restore the step parameter to the initial value.

5. The dynamic compression and secure transmission method of power line carrier dual-mode data according to claim 1, characterized in that, The process of performing dynamic block encryption processing on the compressed data stream and outputting an encrypted data stream includes the following: Perform uniform block processing on the compressed data stream to obtain multiple data blocks of the same size; Obtain the device unique fingerprint, calculate the hash value of each data block, and generate a corresponding temporary symmetric key for each data block based on the device unique fingerprint and the hash value of each data block; Based on the hash value of each data block, set the initial value of the counter correspondingly, and perform block encryption on each data block using the corresponding temporary symmetric key and the initial value of the counter.

6. A dynamic compression and secure transmission system for power line carrier dual-mode data, which adopts the dynamic compression and secure transmission method for power line carrier dual-mode data as described in any one of claims 1 to 5, and is characterized in that, It includes: A data denoising module for collecting the high-frequency power data stream and performing denoising processing on it; A data compression module, which is used to perform lightweight hybrid compression processing on the denoised high-frequency power data stream based on the adaptive LZ4 compression algorithm and the adaptive Huffman coding algorithm to obtain a compressed data stream; A block encryption module, which is used to perform dynamic block encryption processing on the compressed data stream and output an encrypted data stream.

7. An electronic device, characterized in that, It includes a processor and a memory. A computer program is stored in the memory. The processor is used to execute the steps of the method according to any one of claims 1 to 5 by calling the computer program stored in the memory.

8. A computer-readable storage medium for storing a computer program for dynamically compressing and securely transmitting high-frequency power data, characterized in that, When the computer program runs on a computer, it executes the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Cache data compression method

    CN115514375A

  • Construction site transportation path optimization method and device, computer equipment and storage medium

    CN119168180A