Data encryption method for electric energy meter

By using the combination technology of Hoffman tree and chaotic sequence in the data encryption method of the electricity meter, the statistical characteristics of the electric energy data sequence are destroyed, and the problem of data statistical characteristics remain unchanged when encryption based on chaotic mapping is solved, and efficient encryption and security protection of the electric energy data is achieved.

CN119995833AActive Publication Date: 2025-05-13JIANGYIN ZHONGHE POWER METER
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510467770.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-05-13
Estimated Expiration
2045-04-15

AI Technical Summary

Technical Problem

When encrypting the data sequence based on chaotic mapping, the statistical characteristics of the data in the data sequence before and after encryption remain unchanged, resulting in an attacker recovering some or all of the data sequences through statistical analysis, and then inferring the business secrets of the enterprise.

Method used

The Hoffman tree is constructed through the electrical energy data collected by the electric energy meter, and the Hoffman tree is continuously updated with the chaotic sequence, destroying the statistical characteristics of the data sequence, making the encryption results resistant to statistical analysis attacks.

Benefits of technology

It realizes efficient encryption of electrical energy data, destroys the possibility of attackers recovering data through statistical analysis, enhances the security of electrical energy data, and protects the business secrets of enterprises.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119995833A_ABST
    Figure CN119995833A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data encryption, and particularly relates to a data encryption method for an electric energy meter, which comprises the following steps of: acquiring electric energy data through the electric energy meter, obtaining initial frequencies of all basic values according to the electric energy data in an electric energy sequence, and constructing a Huffman tree; the method comprises the following steps: encoding electric energy data in an electric energy sequence through a Huffman tree, and updating the Huffman tree once every time T pieces of electric energy data are encoded: calculating the influence degree on an encryption result when each sub-tree in the Huffman tree updated last time is moved according to the encoded electric energy data, according to the chaos sequence, determining the moved nodes during the next update, and exchanging the positions of the sub-tree with the maximum influence degree and the moved nodes to obtain the Huffman tree after the next update; and obtaining an encryption result of the electric energy sequence until coding of all electric energy data in the electric energy sequence is completed. According to the invention, the electric energy data can be protected from unauthorized access and stealing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data encryption, and more specifically, to a data encryption method for an electric energy meter. Background Art

[0002] The electric energy metering and supervision system is a high-tech intelligent electricity consumption information collection system that integrates smart meters, communication networks, and computer technologies. It is mainly used for accurate metering, standardized classification and statistics of electricity for university teaching and office, enterprise production and operation, and store leasing management, etc. It clarifies energy consumption, assesses energy consumption indicators, monitors abnormal energy consumption, and conducts energy-saving transformation. Managers at all levels of electricity-using units can easily monitor and manage the electricity consumption of various departments of their units no matter where they are and when.

[0003] In the electric energy metering monitoring and management system, the electric energy data collected by the electric energy meter is transmitted to the system main station through the communication channel, so that the system can display the electric energy data in various forms such as curve graphs and bar graphs, and provide users with comprehensive analysis of electricity consumption.

[0004] In the production and operation of an enterprise, electricity data can reflect the company's production plan, equipment operation status and other commercial secrets. Therefore, the electricity data needs to be encrypted to ensure that the electricity data is not accessed and stolen by unauthorized persons.

[0005] Chaotic mapping is suitable for encrypting data sequences with large amounts of data due to its pseudo-randomness, sensitivity to initial conditions, non-periodicity and long-term unpredictability. Encrypting data sequences based on chaotic mapping is achieved by scrambling the position of the data in the data sequence. The scrambling knowledge changes the position of the data in the data sequence, while the value of the data in the data sequence does not change. Therefore, the statistical characteristics of the data in the data sequence before and after encryption remain unchanged. By performing statistical analysis attacks on the encrypted data sequence, attackers can infer the information in the data sequence before encryption, and may even recover part or all of the data sequence, thereby inferring part or all of the company's production plans, equipment operation status and other commercial secrets. Summary of the invention

[0006] In order to solve the technical problem that when encrypting a data sequence based on chaotic mapping, the statistical characteristics of the data in the data sequence before and after encryption remain unchanged, which leads to the attacker being able to recover part or all of the data sequence through statistical analysis attacks and further infer the company's business secrets, the present invention provides a data encryption method for an electric energy meter, comprising: collecting electric energy data through an electric energy meter, and forming an electric energy sequence from the electric energy data collected within a unit time; obtaining the initial frequencies of all basic values ​​according to the electric energy data in the electric energy sequence, and constructing a Huffman tree through the initial frequencies of all basic values; generating a chaotic sequence according to the key agreed upon by the electric energy meter and the system master station and a one-dimensional chaotic mapping; in the process of encoding the electric energy sequence through the Huffman tree, when the first The Huffman tree after the update completes the to After encoding the electric energy data, is the length of the encoding cycle, The Huffman tree after the update is The update includes: calculating the The influence of each subtree in the Huffman tree after the update on the encryption result when it is moved is determined according to the chaotic sequence. The node that was moved during the first update is replaced by the subtree with the most influential node. The Huffman tree after the update is repeated until the encoding of all the electric energy data in the electric energy sequence is completed, and the encoding result of the electric energy sequence is obtained as the encryption result of the electric energy sequence to realize the encryption of the electric energy data collected by the electric energy meter.

[0007] In the process of encoding the electric energy sequence through the Huffman tree, the present invention combines the chaotic sequence and the encoded electric energy data, continuously updates the Huffman tree, destroys the statistical characteristics of the electric energy data in the electric energy sequence before and after encryption, so that the encryption result of the electric energy sequence has the ability to resist statistical analysis attacks, and at the same time makes the encryption result of the electric energy sequence have an avalanche effect, destroying the possibility of attackers trying to find clues from the change relationship before and after encryption, thereby effectively resisting differential analysis attacks; thereby protecting the electric energy data from unauthorized access and theft, and protecting the company's production plan, equipment operation status and other commercial secrets.

[0008] Preferably, the electric energy data collected by the electric energy meter includes electric quantity, voltage, current, power, power factor and neutral current.

[0009] Preferably, the method of obtaining the initial frequencies of all basic numerical values ​​based on the electric energy data in the electric energy sequence includes: taking the electric energy data with the same value in the electric energy sequence as a basic numerical value; and counting the number of times the electric energy data equal to each basic numerical value appears in the electric energy sequence as the initial frequency of each basic numerical value.

[0010] Preferably, the chaotic sequence is generated according to the key agreed upon by the electric energy meter and the system master station and the one-dimensional chaotic map, including: the electric energy meter and the system master station jointly agree on a key according to the initial condition of the one-dimensional chaotic map; using the key as the initial condition of the one-dimensional chaotic map, iterating the calculation formula of the one-dimensional chaotic map times, obtained Chaos value, is a preset value used to distinguish regular chaotic values ​​from irregular chaotic values; The regular chaos values ​​are removed, and the remaining An irregular chaos value, To A sequence composed of chaotic values ​​is regarded as a chaotic sequence; among them, is the number of all electric energy data in the electric energy sequence, is the length of the encoding cycle, is the floor function.

[0011] Preferably, the electric energy meter and the system master station jointly agree on a key based on the initial conditions of the one-dimensional chaotic map, including: the initial conditions of the one-dimensional chaotic map include initial values ​​and parameters, and within the value range of the initial values ​​and parameters, a set of initial value and parameter combinations are randomly generated as the key.

[0012] According to the initial conditions of the one-dimensional chaotic mapping, the present invention agrees on different keys for different electric energy meters and the system master station, thereby increasing the difficulty of brute force cracking by attackers and further improving the security of electric energy data.

[0013] Preferably, in the process of encoding the electric energy sequence by using the Huffman tree, the first to Encode the electric energy data to complete the to After encoding the electric energy data, the initial Huffman tree is The first update, based on the encoded power data, calculates the impact of each subtree in the initial Huffman tree on the encryption result when it is moved, and determines the first The node that was moved during the first update is replaced by the subtree with the most influential node. Huffman tree after update.

[0014] Preferably, the step of determining the first The nodes moved during the update include: For the initial Huffman tree, obtain the set of all leaf nodes in the initial Huffman tree and record it as the set ; For the subtree with the greatest influence, obtain the set of all leaf nodes in the subtree with the greatest influence and record it as the set ; Get the collection Pair Collection The relative complement of ; For relative complement All leaf nodes in , among which leaf node, as the The nodes that were moved during the update, The first Chaos value, To round down.

[0015] Preferably, the step of determining the first The nodes moved during the update include: After the Huffman tree is updated, we get The set of all leaf nodes in the Huffman tree after the update is recorded as the set ; For the subtree with the greatest influence, obtain the set of all leaf nodes in the subtree with the greatest influence and record it as the set ; Get the collection Pair Collection The relative complement of ; For relative complement All leaf nodes in , among which leaf node, as the The nodes that were moved during the update, is the first Chaos value, To round down.

[0016] The present invention utilizes the pseudo-randomness, unpredictability and extreme sensitivity to initial conditions of chaotic mapping to determine the first sequence The nodes that are moved during the first update increase the difficulty of brute force cracking by attackers, thereby improving the security of power data.

[0017] Preferably, the initial Huffman tree / first The degree of influence on the encryption result when each subtree in the Huffman tree after the update is moved includes: ; In the formula, is the impact on the encryption result when the subtree is moved, is the number of all leaf nodes in the subtree, is the number of all leaf nodes in the initial Huffman tree, For the subtree The initial frequency of the basic value corresponding to the leaf node, For the subtree The frequency of the basic value corresponding to the leaf node in the encoded electric energy data is the frequency of the basic value in the encoded electric energy data equal to the first leaf node. The number of basic value electric energy data, is the number of all electric energy data in the electric energy sequence, For the subtree The basic value corresponding to the leaf node, The last one among all the encoded electric energy data Electric energy data, is the minimum value function; Indicates taking the absolute value.

[0018] The present invention combines the basic value with the latest coding The difference between the individual electric energy data and the difference between the initial frequency of the basic value and the frequency in the encoded electric energy data is used to express the probability that the subsequent electric energy data waiting to be encoded is equal to the basic value corresponding to each leaf node on the subtree, so as to ensure that the Huffman tree is updated by moving the subtree, which can affect the electric energy sequence more quickly.

[0019] Preferably, the method further comprises: initial frequencies of all basic values ​​and lengths of coding periods , stored as decrypted information.

[0020] The present invention stores the decryption information, and can ensure the decryptability of the encryption result of the electric energy sequence.

[0021] The beneficial effects of the present invention are: The present invention destroys the statistical characteristics of the electric energy data in the electric energy sequence before and after encryption, so that the encryption result of the electric energy sequence has the ability to resist statistical analysis attacks. At the same time, the encryption result of the electric energy sequence has an avalanche effect, which destroys the possibility of attackers trying to find clues from the change relationship before and after encryption, thereby effectively resisting differential analysis attacks; thereby protecting the electric energy data from unauthorized access and theft, and protecting the company's production plans, equipment operation status and other commercial secrets. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a flow chart schematically illustrating a data encryption method for an electric energy meter in the present invention; Figure 2 is a schematic diagram schematically showing an initial Huffman tree; Figure 3 It is schematically shown Figure 2 A schematic diagram of all subtrees of the initial Huffman tree shown; Figure 4 It is a schematic diagram showing the Schematic diagram of the Huffman tree after the update; Figure 5 It is schematically shown Figure 4 The shown Schematic diagram of all subtrees of the Huffman tree after the update; Figure 6 It is a schematic diagram showing the Schematic diagram of the Huffman tree after the update. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0024] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0025] The embodiment of the present invention discloses a data encryption method for an electric energy meter, referring to Figure 1 , including steps S1 to S4: S1. Collecting electric energy data through an electric energy meter, and organizing the electric energy data collected within a unit time into an electric energy sequence.

[0026] Specifically, electric energy data is collected by an electric energy meter, and the electric energy data collected by the electric energy meter includes electricity quantity, voltage, current, power, power factor and neutral current; among them, the unit of electricity quantity is usually kilowatt-hour (kWh), the unit of voltage is volt (V), the unit of current and neutral current is ampere (A), the unit of power is watt (W) and kilowatt (kW), and the value range of power factor is between [0,1]. The closer the power factor is to 1, the higher the ratio of active power to apparent power in the circuit, and the higher the energy utilization efficiency.

[0027] The measurement accuracy of electric energy data varies depending on the application scenario. The measurement of electrical quantity and power factor is usually accurate to two or three decimal places, and the measurement of voltage, current, power and neutral current is usually accurate to one or two decimal places.

[0028] Further, a sequence consisting of electric energy data collected within a unit time period is taken as an electric energy sequence; in this embodiment, the unit time period is set to one day.

[0029] S2. According to the electric energy data in the electric energy sequence, the initial frequencies of all basic values ​​are obtained for constructing a Huffman tree.

[0030] Specifically, the electric energy data with the same value in the electric energy sequence is taken as a basic value; the number of times the electric energy data equal to each basic value appears in the electric energy sequence is counted as the initial frequency of each basic value.

[0031] For example, the power sequence is {107, 103, 106, 103, 101, 102, 105, 104, 103, 105, 106, 107, 101, 102, 101, 105, 107, 105, 106, 105, 102, 107, 103, 105, 102, 105, 107, 102, 103, 104, 106, 105, 107, 107, 101, 102, 102, 103, 105, 101, 102, 105, 107, 105, 106}, and the number of all power data in the power sequence is Equal to 45; taking the electric energy data with the same value in the electric energy sequence as a basic value, there are 7 basic values, namely 101, 102, 103, 104, 105, 106, and 107, and the initial frequencies of these 7 basic values ​​are 5, 8, 6, 2, 11, 5, and 8 respectively.

[0032] Furthermore, a Huffman tree is constructed according to the initial frequencies of all basic values. The Huffman tree is the initial Huffman tree, and the number of all leaf nodes on the initial Huffman tree is equal to the number of all basic values. The Huffman tree is a binary tree. Therefore, the nodes in the Huffman tree are divided into leaf nodes and branch nodes. Leaf nodes refer to nodes without subtrees, and the nodes corresponding to each basic value are all leaf nodes. Branch nodes refer to nodes with subtrees.

[0033] For example, according to the initial frequencies of 5, 8, 6, 2, 11, 5, and 8 of the seven basic values ​​101, 102, 103, 104, 105, 106, and 107, the schematic diagram of constructing the initial Huffman tree is as follows: Figure 2As shown, the number of all leaf nodes on the initial Huffman tree is equal to 7, and the encoding results of these 7 basic values ​​are 1101, 111, 011, 1100, 10, 010, and 00 respectively.

[0034] S3. Generate a chaotic sequence according to the key agreed upon between the electric energy meter and the system master station and the one-dimensional chaotic map.

[0035] It should be noted that chaotic mapping is used to set keys due to its pseudo-randomness, unpredictability, and extreme sensitivity to initial conditions. The keys obtained based on chaotic mapping are difficult to crack and have high security.

[0036] The initial conditions of the one-dimensional chaotic map include initial values ​​and parameters. The electric energy meter and the system master station jointly agree on a key based on the initial conditions of the one-dimensional chaotic map, which is used to encrypt the electric energy data collected by the electric energy meter, and the system master station decrypts the encrypted result; specifically, within the range of the initial values ​​and parameters, a group of initial value and parameter combinations are randomly generated as the key.

[0037] Among them, one-dimensional chaotic mapping includes but is not limited to Logistic chaotic mapping, Singer chaotic mapping, Cubic chaotic mapping, Sine chaotic mapping, Tent chaotic mapping, Sinusoidal chaotic mapping, and Piecewise chaotic mapping. These chaotic mappings are well-known technologies and will not be described in detail here.

[0038] For example, in the initial conditions of the Logistic chaotic map, the range of the initial value is , the parameter value range is ; In the initial conditions of the Singer chaotic map, the range of the initial value is , the parameter value range is .

[0039] It should be noted that different electricity meters have different keys agreed upon with the system master station, which increases the difficulty of brute force cracking by attackers and thus improves the security of electricity data.

[0040] The common The length of the encoding cycle is Therefore, the entire encoding process includes coding cycles; since the Huffman tree is updated once in each coding cycle, and each update requires one chaotic value, the entire coding process requires a total of This requires that the length of the chaotic sequence is equal to .

[0041] In addition, since the first 30 chaotic values ​​generated according to the key and the one-dimensional chaotic map have regularity, which will help the attacker to crack the key by brute force, this embodiment will generate the first (Required Greater than 30) Regular chaos values ​​are deleted, and the remaining ones are retained An irregular chaotic value is obtained, and then a chaotic sequence composed of irregular chaotic values ​​is obtained, thereby increasing the difficulty of the attacker's brute force cracking of the key.

[0042] In summary, a chaotic sequence is generated according to the key agreed upon by the electric energy meter and the system master station and the one-dimensional chaotic map; specifically, the key is used as the initial condition of the one-dimensional chaotic map, and the calculation formula of the one-dimensional chaotic map is iterated. times, obtained Chaos values, among which, is the number of all electric energy data in the electric energy sequence, is the length of the encoding period, then Indicates the number of updates to the Huffman tree. is the floor function, is a preset value used to distinguish regular chaotic values ​​from irregular chaotic values; The regular chaos values ​​are removed, and the remaining An irregular chaos value, To A sequence composed of chaotic values ​​is used as a chaotic sequence to obtain an irregular chaotic sequence; therefore, the length of the obtained chaotic sequence is equal to .

[0043] Among them, the length of the encoding cycle And preset values The specific value can be set according to the actual application scenario and requirements, and the length of the encoding cycle The value range is [3,10]. Since the first 30 chaotic values ​​in the one-dimensional chaotic map have regularity, in order to obtain an irregular chaotic sequence, it is required to preset the value is an integer greater than 30. The present invention sets the length of the coding period to 5. Set to 40.

[0044] S4. In the process of encoding the electric energy sequence through the Huffman tree, the chaotic sequence and the encoded electric energy data are combined to continuously update the Huffman tree until the encoding of all the electric energy data in the electric energy sequence is completed, the encryption result of the electric energy sequence is obtained, and the electric energy data collected by the electric energy meter is encrypted.

[0045] The Huffman tree is used to encode the electric energy data in the electric energy sequence. The Huffman tree is updated once for each piece of electric energy data. The specific process is as follows: (1) Through the initial Huffman tree, The electric energy data to Encode the electric energy data to obtain the The electric energy data to The encoding result of the electric energy data.

[0046] (2) After the initial Huffman tree is completed, The electric energy data to After encoding the electric energy data, the initial Huffman tree is Updated, got The specific operation of the Huffman tree after the update is: According to the encoded electric energy data, the influence of each subtree in the initial Huffman tree on the encryption result when it is moved is calculated, and the first The node that was moved during the first update is replaced by the subtree with the most influential node. Huffman tree after update.

[0047] The subtrees in the initial Huffman tree refer to the subtrees of the branch nodes in the initial Huffman tree.

[0048] (3) Through After the Huffman tree is updated, The electric energy data to Encode the electric energy data to obtain the The electric energy data to The encoding result of electric energy data; among them, , is the number of all electric energy data in the electric energy sequence, is the length of the encoding cycle, is the floor function, is the length of the encoding cycle.

[0049] (4) When passing The Huffman tree after the update completes the The electric energy data to After encoding the electric energy data, The Huffman tree after the update is Updated, got The specific operation of the Huffman tree after the update is: According to the encoded electric energy data, calculate the The influence of each subtree in the Huffman tree after the update on the encryption result when it is moved is determined according to the chaotic sequence. The node that was moved during the first update is replaced by the subtree with the most influential node. Huffman tree after update.

[0050] Among them, Each subtree in the Huffman tree after the update refers to the The subtrees of each branch node in the Huffman tree after the update.

[0051] (5) Repeat steps (3) and (4) until the encoding of all the electric energy data in the electric energy sequence is completed. At this point, the encoding results of all the electric energy data in the electric energy sequence are obtained.

[0052] Furthermore, a sequence composed of encoding results of all electric energy data in the electric energy sequence is used as an encryption result of the electric energy sequence, thereby realizing encryption of the electric energy data collected by the electric energy meter.

[0053] In addition, the initial frequencies of all basic values ​​and the length of the coding cycle are required , stored as decryption information, can ensure the decryptability of the encryption result of the electric energy sequence.

[0054] It should be noted that, in the process of encoding the electric energy sequence through the Huffman tree, the present invention combines the chaotic sequence and the encoded electric energy data, and continuously updates the Huffman tree, so that even if the electric energy data with equal values ​​in the electric energy sequence are encrypted, due to the continuous updating of the Huffman tree, the encoding results of the electric energy data with equal values ​​are obtained through different Huffman trees, resulting in different encryption results of the electric energy data with equal values, thereby causing significant changes in the statistical characteristics of the electric energy data in the electric energy sequence before and after encryption. Even if the attacker performs a statistical analysis attack on the encrypted electric energy sequence, it is impossible to infer the information in the electric energy sequence before encryption; therefore, the encryption result of the electric energy sequence obtained by the encryption method of the present invention has a strong ability to resist statistical analysis attacks.

[0055] In steps (2) and (4), for the initial Huffman tree / The calculation formula for the influence of any subtree in the Huffman tree after the update is as follows: ; In the formula, is the impact on the encryption result when the subtree is moved, is the number of all leaf nodes in the subtree, then the number of all affected basic values ​​is equal to , is the number of all leaf nodes in the initial Huffman tree, For the subtree The initial frequency of the basic value corresponding to the leaf node, For the subtree The frequency of the basic value corresponding to the leaf node in the encoded electric energy data is the frequency of the basic value in the encoded electric energy data equal to the first leaf node. The number of basic value electric energy data, is the number of all electric energy data in the electric energy sequence, For the subtree The basic value corresponding to the leaf node, The last one among all the encoded electric energy data Electric energy data, , is the length of the encoding cycle, is the minimum value function; Indicates taking the absolute value.

[0056] Among them, the subtree The basic value corresponding to the leaf node The following in the encoded energy data The difference between the power data The smaller the value, the energy data to be encoded is equal to the Basic Values The greater the probability, the greater the basic value Weighted weight The bigger; Indicates the basic value The frequency in the electric energy data to be encoded. The larger the value, the higher the basic value. The greater the impact on the encryption result when the subtree is moved; in addition, under the same impact, the fewer leaf nodes on the moved subtree, the better. Therefore, the number of all leaf nodes on the subtree The smaller the base value The greater the impact on the encryption result, the more the subtree is moved.

[0057] In step (2), the first The specific process of moving the nodes during the first update is as follows: for the initial Huffman tree, obtain the set of all leaf nodes in the initial Huffman tree and record it as the set ; For the subtree with the greatest influence, obtain the set of all leaf nodes in the subtree with the greatest influence and record it as the set ; Get the collection Pair Collection The relative complement of ,gather Pair Collection The relative complement of By belonging to the set Not part of a collection All leaf nodes of , Relative complement The leaf nodes in All leaf nodes in , among which leaf node, as the The nodes that were moved during the update, is the first Chaos value, To round down.

[0058] In step (4), the first The specific process of the nodes being moved during the first update is as follows: After the Huffman tree is updated, we get The set of all leaf nodes in the Huffman tree after the update is recorded as the set ; For the subtree with the greatest influence, obtain the set of all leaf nodes in the subtree with the greatest influence and record it as the set ; Get the collection Pair Collection The relative complement of ,gather Pair Collection The relative complement of By belonging to the set Not part of a collection All leaf nodes of , Relative complement The leaf nodes in All leaf nodes in , among which leaf node, as the The nodes that were moved during the update, is the first Chaos value, To round down.

[0059] For example, by Figure 2The initial Huffman tree shown encodes the electric energy data in the electric energy sequence {107,103,106,103,101,102,105,104,103,105,106,107,101,102,101,105,107,105,106,105,102,107,103,105,102,105,107,102,103,104,106,105,107,107,101,102,102,103,105,101,102,105,107,105,106}. After encoding 5 electric energy data, the Huffman tree is updated once. The specific process is as follows: (1) For Figure 2 The initial Huffman tree shown in the figure has seven basic values ​​encoded as 1101, 111, 011, 1100, 10, 010, and 00. The electric energy data to The electric energy data 107, 103, 106, 103, 101 are encoded to obtain the The electric energy data to The encoding results of the electric energy data are 00, 011, 010, 011, and 1101 respectively.

[0060] (2) For Figure 2 The initial Huffman tree shown has 5 subtrees. The schematic diagram of these 5 subtrees is as follows Figure 3 As shown; for the first subtree, the number of all leaf nodes on the subtree , the number of all leaf nodes on the initial Huffman tree , the basic values ​​corresponding to all leaf nodes on the subtree , , , the initial frequencies of these three basic values ​​are 8, 5, and 6 respectively. At this time, the encoded electric energy data include electric energy data 107, 103, 106, 103, and 101, and the last 5 electric energy data of all the encoded electric energy data are 107, 103, 106, 103, and 101 respectively. Therefore, , , , then the degree of influence on the encryption result when the subtree is moved = + + =0.624; Similarly, for the second to fifth subtrees, the degree of influence on the encryption result when the subtree is moved =0.464, =0.61, =0.469, =0.526.

[0061] (3) For the five subtrees in the initial Huffman tree, the first subtree has the greatest impact. At this time, there are four nodes that can be moved, namely the nodes corresponding to the basic value 105, the basic value 102, the basic value 104, and the basic value 101. The first subtree is determined according to the chaotic sequence. The node moved in the first update is the second node, that is, the node corresponding to the base value 102. The subtree with the greatest influence, that is, the first subtree, is swapped with the node moved, that is, the node corresponding to the base value 102, to obtain the After the Huffman tree is updated, The schematic diagram of the Huffman tree after the update is as follows Figure 4 shown.

[0062] (4) For Figure 4 The shown After the Huffman tree is updated, the encoding results of the seven basic values ​​are 1101, 0, 11111, 1100, 10, 11110, and 1110 respectively. The Huffman tree after the update is The electric energy data to The electric energy data 102, 105, 104, 103, 105 are encoded to obtain the The electric energy data to The encoding results of the electric energy data are 0, 10, 1100, 11111, and 10 respectively.

[0063] (5) For Figure 4 The shown After the update, the Huffman tree has 5 subtrees. The schematic diagram of these 5 subtrees is as follows: Figure 5 As shown; for the first subtree, the number of all leaf nodes on the subtree , the number of all leaf nodes on the initial Huffman tree , the basic values ​​corresponding to all leaf nodes on the subtree , , , , , , the initial frequencies of these six basic values ​​are 11, 2, 5, 8, 5, and 6 respectively. At this time, the encoded electric energy data include electric energy data 107, 103, 106, 103, 101, 102, 105, 104, 103, and 105, and the last five electric energy data of all the encoded electric energy data are 102, 105, 104, 103, and 105 respectively. Therefore, , , , , , , then the degree of influence on the encryption result when the subtree is moved = + + + + + =0.432; Similarly, for the second to fifth subtrees, the degree of influence on the encryption result when the subtree is moved =0.288, =0.436, =0.404, =0.517.

[0064] (6) For The 5 subtrees in the Huffman tree after the update are the most affected. At this time, there are 5 nodes that can be moved, namely the nodes corresponding to the basic value 102, the basic value 105, the basic value 104, the basic value 101 and the basic value 107. The chaotic sequence determines the The node moved in the first update is the third node, that is, the node corresponding to the base value 104. The fifth subtree, which has the greatest impact, is swapped with the node moved, that is, the node corresponding to the base value 104, to obtain the After the Huffman tree is updated, The schematic diagram of the Huffman tree after the update is as follows Figure 6 As shown, for Figure 6 The shown After the Huffman tree is updated, the encoding results of the 7 basic values ​​are 1101, 0, 11001, 1111, 10, 11000, and 1110 respectively.

[0065] (7) And so on, until the encoding of all the electric energy data in the electric energy sequence is completed.

[0066] It should be noted that in the above process, the basic value 103 is in the initial Huffman tree, the The Huffman tree after the update and The encoding results in the Huffman tree after the update are 011, 11111, and 11001, which are all different. The basic value 106 is The Huffman tree after the update and The encoding results in the Huffman tree after the first update are 010, 11110, and 11000, which are all different. This shows that in the process of continuously updating the Huffman tree, even if the electric energy data with equal values ​​in the electric energy sequence are encrypted, the encoding results of the electric energy data with equal values ​​will be different due to the continuous updating of the Huffman tree, thereby causing significant changes in the statistical characteristics of the electric energy data in the electric energy sequence before and after encryption. Even if the attacker conducts a statistical analysis attack on the encrypted electric energy sequence, it is impossible to infer the information in the electric energy sequence before encryption.

[0067] When it is necessary to view the electric energy data, the encrypted result of the electric energy sequence is decrypted according to the key agreed upon by the electric energy meter and the system master station. The specific steps are as follows: (1) Construct a Huffman tree based on the initial frequencies of all basic values.

[0068] (2) Generate a chaotic sequence based on the key agreed upon by the electric energy meter and the system master station and the one-dimensional chaotic map.

[0069] (3) Decode the encrypted result of the electric energy sequence through the Huffman tree. The Huffman tree is updated once. is the length of the encoding cycle, and the specific process is: In the process of decoding the encrypted result of the electric energy sequence through the Huffman tree, when the After the Huffman tree is updated, decoding obtains to After the electric energy data is The Huffman tree after the update is The update includes: calculating the The influence of each subtree in the Huffman tree after the update on the encryption result when it is moved is determined according to the chaotic sequence. The node that was moved during the first update is replaced by the subtree with the most influential node. The Huffman tree after the update is updated; until the electric energy sequence composed of all the decoded electric energy data is obtained, so as to decode the encrypted result of the electric energy data.

[0070] It should be noted that when encrypting the electric energy sequence, the Huffman tree is continuously updated based on the encoded electric energy data, and the remaining electric energy data is encoded through the updated Huffman tree. Therefore, when decrypting the encrypted result of the electric energy sequence, the Huffman tree also needs to be continuously updated based on the encoded electric energy data, so that the encrypted result of the electric energy sequence can be accurately decrypted through the accurate Huffman tree. Therefore, if an attacker wants to brute force the encryption result of the electric energy sequence, even if an electric energy data is decrypted incorrectly, the subsequent decryption results will change significantly, making the encryption result of the electric energy sequence have an avalanche effect, destroying the possibility of the attacker trying to find clues from the change relationship before and after encryption, thereby effectively resisting differential analysis attacks.

[0071] It should be further explained that the encryption result of the electric energy sequence obtained by the encryption method of the present invention can resist statistical analysis attacks and differential analysis attacks, thereby protecting the electric energy data from unauthorized access and theft, and protecting the company's production plans, equipment operating status and other commercial secrets.

Claims

1. A data encryption method for an electric energy meter, characterized in that: include: The electric energy data is collected through the electric energy meter, and the electric energy data collected within a unit time is formed into an electric energy sequence; According to the electric energy data in the electric energy sequence, the initial frequencies of all basic values ​​are obtained, and the Huffman tree is constructed through the initial frequencies of all basic values; Generate a chaotic sequence based on the key agreed upon between the electric energy meter and the system master station and the one-dimensional chaotic map; In the process of encoding the electric energy sequence through the Huffman tree, when the The Huffman tree after the update completes the to After encoding the electric energy data, is the length of the encoding cycle, The Huffman tree after the update is The update includes: calculating the The influence of each subtree in the Huffman tree after the update on the encryption result when it is moved is determined according to the chaotic sequence. The node that was moved during the first update is replaced by the subtree with the most influential node. Huffman tree after update; Until the encoding of all the electric energy data in the electric energy sequence is completed, the encoding result of the obtained electric energy sequence is used as the encryption result of the electric energy sequence to realize the encryption of the electric energy data collected by the electric energy meter.

2. A data encryption method for an electric energy meter according to claim 1, characterized in that: The electric energy data collected by the electric energy meter includes electric quantity, voltage, current, power, power factor and neutral current.

3. A data encryption method for electric energy meter according to claim 1, characterized in that: The step of obtaining the initial frequencies of all basic values ​​according to the electric energy data in the electric energy sequence includes: The electric energy data with the same value in the electric energy sequence is taken as a basic value; the number of times the electric energy data equal to each basic value appears in the electric energy sequence is counted as the initial frequency of each basic value.

4. A data encryption method for electric energy meter according to claim 1, characterized in that: The method generates a chaotic sequence according to a key agreed upon between the electric energy meter and the system master station and a one-dimensional chaotic map, including: The electric energy meter and the system master station jointly agree on a key based on the initial conditions of the one-dimensional chaotic mapping; The key is used as the initial condition of the one-dimensional chaotic map, and the calculation formula of the one-dimensional chaotic map is iterated. times, obtained Chaos value, is a preset value used to distinguish regular chaotic values ​​from irregular chaotic values; The regular chaos values ​​are removed, and the remaining An irregular chaos value, To A sequence composed of chaotic values ​​is called a chaotic sequence; in, is the number of all electric energy data in the electric energy sequence, is the length of the encoding cycle, is the floor function.

5. A data encryption method for electric energy meter according to claim 4, characterized in that: The electric energy meter and the system master station jointly agree on a key according to the initial conditions of the one-dimensional chaotic mapping, including: The initial conditions of the one-dimensional chaotic mapping include initial values ​​and parameters. Within the range of the initial values ​​and parameters, a set of combinations of initial values ​​and parameters are randomly generated as a key.

6. A data encryption method for electric energy meter according to claim 1, characterized in that: In the process of encoding the electric energy sequence through the Huffman tree, the first to Encode the electric energy data to complete the to After encoding the electric energy data, the initial Huffman tree is The first update, based on the encoded power data, calculates the impact of each subtree in the initial Huffman tree on the encryption result when it is moved, and determines the first The node that was moved during the first update is replaced by the subtree with the most influential node. Huffman tree after update.

7. A data encryption method for an electric energy meter according to claim 6, characterized in that: The method of determining the first The nodes moved during the update include: For the initial Huffman tree, obtain the set of all leaf nodes in the initial Huffman tree and record it as the set ; For the subtree with the greatest influence, obtain the set of all leaf nodes in the subtree with the greatest influence and record it as the set ; Get the collection Pair Collection The relative complement of ; For relative complement All leaf nodes in , among which leaf node, as the The nodes that were moved during the update, The first Chaos value, To round down.

8. A data encryption method for electric energy meter according to claim 1, characterized in that: The method of determining the first The nodes moved during the update include: For After the Huffman tree is updated, we get The set of all leaf nodes in the Huffman tree after the update is recorded as the set ; For the subtree with the greatest influence, obtain the set of all leaf nodes in the subtree with the greatest influence and record it as the set ; Get the collection Pair Collection The relative complement of ; For relative complement All leaf nodes in , among which leaf node, as the The nodes that were moved during the update, The first Chaos value, To round down.

9. A data encryption method for an electric energy meter according to claim 1 or 6, characterized in that: The initial Huffman tree / first The degree of influence on the encryption result when each subtree in the Huffman tree after the update is moved includes: ; In the formula, is the impact on the encryption result when the subtree is moved, is the number of all leaf nodes in the subtree, is the number of all leaf nodes in the initial Huffman tree, For the subtree The initial frequency of the basic value corresponding to the leaf node, For the subtree The frequency of the basic value corresponding to the leaf node in the encoded electric energy data is the frequency of the basic value in the encoded electric energy data equal to the leaf node. The number of basic value electric energy data, is the number of all electric energy data in the electric energy sequence, For the subtree The basic value corresponding to the leaf node, The last one among all the encoded electric energy data Electric energy data, is the minimum value function; Indicates taking the absolute value.

10. A data encryption method for electric energy meter according to claim 1, characterized in that: The method further comprises: setting the initial frequencies of all basic values ​​and the lengths of the coding periods , stored as decrypted information.

Citation Information

Patent Citations

  • Encrypted Huffman encoding method and decoding method

    CN101465724A

  • Adaptive Huffman coding system and method

    CN114900193A

  • Intelligent electricity selling data storage method based on data encryption

    CN116484442A

  • Variable length coding method and apparatus

    JP2004048723A

  • Huffman coding and decoding

    US20060290537A1