Dynamic security enhancement method for multivariate heterogeneous data of new energy centralized control system

By calculating the basic entropy value and operation characteristics in the new energy centralized control system, generating the initial key, combining the compression enhancement algorithm and the rabbi collaboration algorithm, dynamically adjusting the encryption parameters, the security of multivariate heterogeneous data transmission in the new energy centralized control system is solved. The problem of insufficient achieves efficient and low-consumption data encryption.

CN118944880APending Publication Date: 2024-11-12GUODIAN NANJING AUTOMATION
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202411241849.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-05
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

During the transmission process of multivariate heterogeneous data in new energy centralized control systems, due to the lack of adaptability of the encryption methods used, resulting in insufficient security or waste of resources. The existing dynamic encryption technology fails to fully consider the data operation environment and transmission frequency, and cannot be effective. Ensure data security and reduce resource consumption.

Method used

The dynamic security enhancement method of multivariate heterogeneous data is adopted to generate the initial key by calculating the basic entropy value and running characteristics, combining the compression enhancement algorithm to generate the wheel key and the number of encryption times, and using dynamic hybrid processing and rabbi collaboration algorithm to realize the grouping of data blocks Encryption and state update stream encryption, dynamically adjust encryption parameters to suit different data characteristics and environments.

Benefits of technology

It improves the security and encryption efficiency of data transmission, reduces resource consumption, and realizes flexible and high-security encryption of multivariate heterogeneous data in the new energy centralized control system, avoiding data leakage and resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118944880A_ABST
    Figure CN118944880A_ABST
Patent Text Reader

Abstract

The invention discloses a multivariate heterogeneous data dynamic security enhancement method for a new energy centralized control system, and relates to the field of data security enhancement, and the method comprises the following steps: obtaining plaintext data from the new energy centralized control system, calculating a basic entropy value, generating an initial key based on the basic entropy value, and storing the initial key in a database; combining with a compression enhancement algorithm to generate a round key and encryption times; dividing the plaintext data into data blocks on the basis of the initial key, judging the lengths of the data blocks, and performing byte filling operation on the data blocks on the basis of a judgment result; and performing mixing processing on the data block, performing state update stream encryption operation on the data block according to a mixing result to obtain an encrypted data block, generating a message code in combination with a Labir cooperation algorithm, and generating ciphertext data according to the message code. The invention provides a data consistency verification algorithm based on Labian cooperation, the consistency of data transmission is verified, and the security of data transmission between the substation and the centralized control system is improved to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data security enhancement, and in particular to a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system. Background Art

[0002] When the new energy centralized control system collects and communicates data with each substation, it is often accompanied by many different types of data, such as photovoltaic field output data, box transformer information data, meteorological information data, etc. The structure and size of this type of data are different, and the requirements for security are also quite different. In the actual transmission process, due to the use of dedicated line transmission and reliance on channel security, the communication between the substation and the centralized control center often uses less secure encryption methods or directly transmits in plain text.

[0003] This is understandable for some data with lower security requirements, but for some data with higher security requirements, the use of general encryption methods or plain text transmission will have the risk of data leakage. Encryption methods that rely on manual selection often affect the performance of the server due to poor control of encryption strength. Too low encryption strength will have the risk of data leakage, while too high encryption strength will cause waste of resources. And this open encryption method is likely to produce open source cracking methods over time, so this type of data is still at risk of being deciphered. In response to the above problems, it is urgent to create an encryption method that dynamically adjusts parameters based on data characteristics, adaptively controls the appropriate encryption strength according to different types of data and operating environments, and ensures the difference in the encryption process through dynamic obfuscation technology, thereby improving data security while reducing resource consumption.

[0004] Due to the complex operating environment in new energy centralized control systems and the large differences in data transmission frequencies, the existing dynamic encryption technology only relies on data length to dynamically adjust encryption parameters without fully considering the data operating environment and data transmission frequency. This may not be able to ensure the security of multi-heterogeneous data in new energy centralized control systems and reduce the consumption of centralized control system service resources.

[0005] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0006] In order to solve the above problems, the present invention proposes a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system to achieve high flexibility and security of enhanced encryption algorithms.

[0007] In order to achieve the above object, the present invention adopts the following technical solution:

[0008] The present invention provides a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system, the method comprising the following steps:

[0009] After obtaining plaintext data from the new energy centralized control system, the basic entropy value is calculated, and the initial key is generated based on the operation characteristics of the centralized control system and the basic entropy value, and combined with the compression enhancement algorithm to generate round keys and encryption times; after dividing the plaintext data into data blocks based on the initial key, the length of the data block is determined, and byte padding operations are performed on the data block based on the judgment result; dynamic mixing processing is performed on the data block, and according to the mixing result, the data block is subjected to mixed group encryption and state update stream encryption operations to obtain an encrypted data block; after concatenating and combining all the encrypted data blocks, key parameters are added, and a message code is generated in combination with the Rabi collaboration algorithm, and ciphertext data is generated according to the message code and the encryption function, completing the security enhancement processing of the new energy centralized control system data.

[0010] Preferably, obtaining plaintext data from the new energy centralized control system and calculating the basic entropy value, generating an initial key based on the operation characteristics of the centralized control system and the basic entropy value, and combining the compression enhancement algorithm to generate round keys and encryption times includes the following steps:

[0011] Taking the data base of the new energy centralized control system as the basis, the plaintext data with a byte length greater than the threshold is obtained from the data base, and the basic entropy value of the plaintext data is calculated; the basic entropy value is adjusted according to the operating environment of the new energy centralized control system and the operating environment impact weight to obtain the data entropy; the initial key is dynamically generated according to the length of the plaintext data and the data entropy, and the round key and the round key list are generated based on the initial key and combined with the compression enhancement algorithm; the round key is used as the encryption key to generate an initial vector, and the number of round encryption rounds is determined according to the round key list.

[0012] Preferably, dynamically generating an initial key according to the length of the plaintext data and the data entropy, and generating round keys and round key lists based on the initial key in combination with the compression enhancement algorithm include the following steps:

[0013] Determine the key length according to the length of the plaintext data and the data entropy, and generate the initial key after selecting the random number generator based on the operating system and combining it with the key length to define the key generation method; determine the segment key length and the number of segments based on the key length, the length of the plaintext data and the data entropy, and determine the number of round keys according to the key length; perform numerical conversion on the initial key to generate an unsigned numerical array, and calculate the unsigned numerical array based on the modulus operation formula to generate the modulus coefficient; extract the coefficient block according to the modulus coefficient, and use Python's built-in integer to byte array function to convert the coefficient block into a byte array, and perform hash calculation on the byte array based on the compression enhancement algorithm to obtain the hash value; use the hash value as the first round key, set the number of round keys as the number of times generated, repeatedly perform hash calculation on the byte array to obtain a round key list, and obtain the number of rounds according to the round key list.

[0014] The beneficial effects of the present invention are:

[0015] 1. The present invention provides a dynamic security enhancement method for multi-dimensional heterogeneous data for a new energy centralized control system, which ensures the security of data transmission to a certain extent. At the same time, the multi-dimensional heterogeneous data of the new energy centralized control system is often transmitted in plain text or a single encryption method, and cannot adaptively select a suitable encryption algorithm for each data, which has the risk of resource waste and data leakage. By dynamically adjusting the initial key, number of rounds, initial vector and other parameters based on the current system behavior and operating environment characteristics, and combining the initial key integer modulus transformation and multi-round compression enhanced hash algorithm to complete the generation of round keys, a dynamic group streaming encryption algorithm based on the LWE-Feistel hybrid algorithm is used to complete data encryption, thereby achieving high flexibility and security of the encryption algorithm.

[0016] 2. The present invention proposes a data consistency verification algorithm based on a multi-round compression enhanced hash algorithm combined with Rabi collaboration to verify the consistency of data transmission, which improves the security of data transmission between the substation and the centralized control system to a certain extent, and ensures that the data has not been tampered with by the middleman. At the same time, the present invention can help improve the communication security of multi-dimensional heterogeneous data to a certain extent, and reduce the excessive consumption of system resources during the encryption process. At the same time, based on the dynamically configured multi-round packet streaming encryption algorithm, the encryption parameters can be dynamically adjusted according to the data characteristics and combined with the system behavior and environmental variables, and the complexity of encryption can be controlled to adapt to the multi-dimensional heterogeneous data in the centralized control system and various types of operating environments of the actual site, so as to improve the encryption efficiency and reduce resource utilization while ensuring safety. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0018] Figure 1 is a flow chart of a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system according to an embodiment of the present invention;

[0019] Figure 2 It is a schematic diagram of the framework of an enhancement method in a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system according to an embodiment of the present invention;

[0020] Figure 3 It is a schematic diagram of the framework of a decryption method in a method for dynamic security enhancement of multi-heterogeneous data in a new energy centralized control system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0022] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0023] It should be noted that the terms used herein are only for describing specific embodiments, and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that the terms "include" and "have" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0024] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0025] Real-time status monitoring of new energy centralized control systems distributed in various places, including power generation, equipment operating status, environmental parameters, etc. Ensure the normal operation of equipment and timely detect and handle faults. In large-scale new energy centralized control systems, such as wind farms, photovoltaic power stations or power dispatching centers, the system needs to process various types of data from different substations and equipment. Specific data includes operating parameters, environmental monitoring data, equipment status information, etc. In order to ensure the security and integrity of data, especially in the process of data transmission and storage, it is necessary to adopt dynamic encryption methods.

[0026] See also Figure 1 and Figure 2The present invention provides a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system, and the method for dynamic security enhancement of multi-heterogeneous data comprises the following steps:

[0027] Step S1, after obtaining plaintext data from the new energy centralized control system, calculate the basic entropy value, generate the initial key based on the operation characteristics of the centralized control system and the basic entropy value, and combine it with the compression enhancement algorithm to generate the round key and the number of encryption times.

[0028] In this embodiment, after obtaining plaintext data from the new energy centralized control system, the basic entropy value is calculated, the initial key is generated based on the operating characteristics of the centralized control system and the basic entropy value, and the round key and the number of encryption times are generated in combination with the compression enhancement algorithm. The data base of the new energy centralized control system can be used as a basis, and plaintext data with a byte length greater than a threshold (4 bytes) is obtained from the data base (the present invention is only for the encryption of message data with a certain length in the centralized control system, and is not suitable for the encryption of instruction data less than 4 bytes. Therefore, plaintext data less than 4 bytes is discarded as spam), and the basic entropy value of the plaintext data is calculated; the basic entropy value is adjusted according to the operating environment of the new energy centralized control system and the operating environment impact weight to obtain data entropy; the initial key is dynamically generated according to the length of the plaintext data and the data entropy, and the round key and the round key list are generated based on the initial key in combination with the compression enhancement algorithm; the round key is used as the encryption key to generate an initial vector, and the number of round encryptions is determined according to the round key list.

[0029] It should be explained that when generating data entropy based on data characteristics, system behavior and environmental variables, the basic entropy value of the data is first calculated based on the plaintext data P, and then the entropy value is adjusted based on the basic entropy value combined with the system behavior and environmental variables. The data entropy value is a measure used in information theory to quantify information uncertainty and complexity. The higher the entropy value, the greater the randomness and uncertainty of the data. The calculation formula of the data entropy value is as follows:

[0030]

[0031] In the formula, H(x) represents the information entropy of the input data x, P(x i ) represents the probability of the i-th character appearing in the input data x, and n represents the number of non-repeated characters in the input data x.

[0032] The entropy value is adjusted considering the operating environment of the centralized control system and the frequency of data encryption to reflect the impact of these additional factors on data complexity. The formula for adjusting the entropy value is:

[0033] H adjusted (x) = H(x) × W u ×W e ;

[0034] In the formula, Hadjusted (x) represents the entropy value adjusted according to system behavior and environmental variables, W u Represents the weight of the impact of system behavior on data entropy, W e Represents the weight of the impact of environmental variables on data entropy value, where W u The calculation formula is:

[0035]

[0036] In the formula, t represents the number of times a substation sends uploaded data within an hour, T max Indicates the maximum number of transmissions that the current system can withstand within one hour. In this example, it is set to 10 9 When there are too many data encryption tasks, it may cause excessive consumption of system resources. When the transmission frequency of a substation is too high, u To reduce the entropy value, thereby reducing the encryption key length and other parameters, and reducing the utilization of system resources. At the same time, in order to ensure the lower limit of the key length, set W u Not less than 0.2.

[0037] W e The calculation formula is:

[0038]

[0039] Among them, U cpu is the CPU usage of the server where the current system is located, U men It is the memory usage of the server where the current system is located. When the CPU usage and memory usage are too large, the environment variable will reduce the entropy value and reduce parameters such as the encryption key length, thereby saving system resources.

[0040] In this embodiment, when the initial key is dynamically generated according to the length and data entropy of the plaintext data, and the round key and round key list are generated based on the initial key and the compression enhancement algorithm, the key length can be determined according to the length and data entropy of the plaintext data, and the initial key can be generated after the random number generator and the key length are selected based on the operating system to define the key generation method; the segment key length and the number of segments are determined based on the key length, the length of the plaintext data and the data entropy, and the number of round keys is determined according to the key length; the initial key is numerically converted to generate an unsigned numerical array, and the unsigned numerical array is calculated based on the modulus operation formula to generate a modulus coefficient; the coefficient block is extracted according to the modulus coefficient, and the coefficient block is converted into a byte array using an integer function, and the byte array is hashed based on the compression enhancement algorithm to obtain a hash value; the hash value is used as the first round key, the number of round keys is set as the number of times generated, the byte array is repeatedly hashed to obtain a round key list, and the number of rounds is obtained according to the round key list. It should be explained that the generation of the initial key is to dynamically generate the initial key based on the length of the plaintext data P and the adjusted data entropy, as follows:

[0041] Step 1: Confirm the key length (key_length), where the key length is determined according to the following formula:

[0042]

[0043] In the formula, len(P) represents the length of the plaintext data P, H adjusted represents the adjusted data entropy, Indicates rounding up to ensure that the key length is an integer multiple of 128 bits. This method can dynamically adjust the key length to ensure encryption flexibility and security.

[0044] Step 2: For different operating systems, define the key generation method according to the key length through different random number generators: For Linux and MacOS systems, read random bytes by calling the system's / dev / urandom device file. / dev / urandom is a pseudo-random number generator device file in the Linux system. It generates random numbers by reading the system's entropy pool. These entropy pools are formed by the operating system by collecting various random events (such as keyboard input, mouse movement, system process scheduling, etc.). Use the entropy collected in the operating system kernel to generate random numbers. At the same time, / dev / urandom has very high randomness and will not block when reading. It can return data even if the system entropy pool is exhausted. Use / dev / urandom to grow an initial key of key_length; For Windows systems, call the encryption random number generator CryptGenRandom provided by the Windows API. CryptGenRandom calls the underlying cryptographic service provider (CSP) of the Windows system and uses the random source of the Windows system to generate high-quality random numbers.

[0045] When confirming the segment key length and the number of segments, the segment key will be used as the initial key for subsequent data segment encryption. The initialization key init_key is used according to the plaintext data P and H adjusted Entropy value, confirm the number of segments required num_segments. Since the key is an integer multiple of 128 bits, the key segmentation can be based on the following formula:

[0046] The calculation formula for the segment key length is:

[0047]

[0048] The calculation formula for the number of segments is:

[0049]

[0050] In the formula, segment_size represents the segment key length, num_segments represents the number of segments, len(P) represents the length of the plaintext data P, and H adjusted represents data entropy, min_size represents the minimum key length, which is 32 in this embodiment, and key_length represents the key length.

[0051] In this embodiment, when extracting a coefficient block according to the modulus coefficient, converting the coefficient block into a byte array using an integer to byte array function, and performing hash calculation on the byte array to obtain a hash value based on the compression enhancement algorithm, the coefficient block can be extracted from the modulus coefficient based on the block extraction formula and the length of the modulus coefficient, and the coefficient block can be converted into a byte array through the integer to byte array function; the output length and fixed constant of the hash value in the compression enhancement algorithm are predefined, and after setting parameters according to the output length and the fixed constant, the internal state of the compression enhancement algorithm is initialized; the message block array status in the compression enhancement algorithm is defined, and the working variables of the compression enhancement algorithm are initialized according to the fixed constant and the internal state; the number of mixing operation rounds of the working variables is defined based on the message block array status, and the mixing operation is performed according to the number of mixing operation rounds; after the mixing is completed, the working variables are combined with the internal state to perform an XOR operation to generate a new internal state, and the new internal state is truncated to obtain a preset length byte as the hash value.

[0052] Specifically, when converting a coefficient block into a byte array through the integer to byte array function, the range of the integer and the expected length of the byte array to be converted can be specified. Different integer ranges and byte lengths may affect the conversion results. For example, a smaller integer may only require fewer bytes to represent it, while a larger integer may require more bytes.

[0053] In Python, the int.to_bytes() method provides a direct way to convert an integer to a byte array. This method requires two main parameters:

[0054] Byte length (length): Specifies the length of the converted byte array. This length must be large enough to accommodate the binary representation of the integer. If the specified length is less than the number of bytes required for the integer, an OverflowError will be raised. Byte order (byteorder): Specifies the order of bytes in the byte array. Python supports two byte orders: 'big' (big endian) and 'little' (little endian). Big endian means that the most significant byte (MSB) is stored at the lowest memory address, while little endian is the opposite.

[0055] Here is a detailed step-by-step description: After determining an integer, determine the byte order: big endian ('big') or little endian ('little'), calculate the minimum byte size required to store the integer. This size depends on the value of the integer, use int.to_bytes() to convert the integer, use Python's int.to_bytes() method, according to the determined byte size and order, convert the integer to a byte array, and output or use this byte array to verify whether the conversion was successful.

[0056] It should be explained that the round key generation based on the initial key integer modulus transformation and the multi-round compression enhanced hash algorithm is to transform the byte array into an integer and perform modulus calculation on the initial key as the basis for round key generation, and generate a round key list round_keys through the multi-round compression enhanced hash algorithm. The round key is used for different encryption rounds in the encryption process to enhance security. The specific generation steps are as follows:

[0057] Step 1: Determine the number of round keys num_rounds according to the length of the initial key. In this embodiment, the length of a single round key is set to 32 bits (4 bytes). The specific number calculation formula is:

[0058] num_rounds=len(init_key) / / 32;

[0059] Step 2: Generate round_keys: Round keys are the core of the security enhancement method, so this implementation will focus on the generation of round keys. The generation method of round_keys uses the initial key for integer modulus transformation and combines it with a multi-round compression enhanced hash algorithm. Since the generation process of the initial key is random and dynamic, the initial key is used as the basis for the generation of the round key. It can ensure that the generated round key is highly random, combined with the determinism and irreversibility of the hash algorithm, and can ensure that each generated round key cannot be reversed. The specific steps are as follows:

[0060] (1) The initial key init_key is converted into a numerical value to complete the conversion from a byte array to an integer array, specifically generating an unsigned numerical array S with a length of init_key bytes. n , n is the byte length of init_key, and traverse each byte of init_key, and convert this byte into the corresponding unsigned integer (0-255) according to the ASCII code table, and write these unsigned integers into S n .

[0061] (2) The generated S n Generate coefficient X according to the modulo operation formula i , the specific calculation formula is:

[0062] X i =(S i X i-1 +X i-2 )modS i ,i=2,...,n-1;

[0063] Where, X i Represents the i-th modulus coefficient, initialize X0=S0, X1=S1.

[0064] (3) Initialize the round key list round_keys and set the list length to num_rounds. For each round, first initialize a 4-byte key round_key and perform subsequent operations:

[0065] a. According to the coefficient X i , extract coefficient block block i , specifically:

[0066] block i =X[imodn:(imodn)+4];

[0067] In the formula, mod represents the modulo operation, and n represents the length of X, which ensures that the length of the coefficient block taken out each time is 4 bytes.

[0068] b. Block the 4-byte coefficient block i Convert to byte array block_bytes through the integer conversion function tobytes().

[0069] c. Based on the multi-round compression enhanced hash algorithm, block_bytes are subjected to multi-round compression enhanced hash calculation to generate an irreversible hash value. The multi-round compression enhanced hash algorithm has higher encryption efficiency and the same encryption security compared to the ordinary hash algorithm. The specific encryption steps are:

[0070] Initialization: Define the length L as a 32-bit (4-byte) hash value, and a fixed constant C that will not change to ensure the accuracy of the hash algorithm. The definition is as follows:

[0071] C0=0x6A09E667F3BCC908, C1=0xBB67AE8584CAA73B;

[0072] C2=0x3C6EF372FE94F82B, C3=0xA54FF53A5F1D36F1;

[0073] C4=0x510E527FADE682D1, C5=0x9B05688C2B3E6C1F;

[0074] C6=0x1F83D9ABFB41BD6B, C7=0x5BE0CD19137E2179.

[0075] Parameter settings:

[0076] P = {L, K, S, Q, other_params};

[0077] Wherein, L represents the length of the hash value output, which is fixed to 4 bytes, K represents the key length (the key is not set here, so it is set to 16 bytes of 0), S represents the salt value, which is set to 16 bytes of 0, Q is personalized data, which is also set to 16 bytes of 0 here, other_params represents other parameters, and this embodiment does not set other parameters, so 12 bytes of 0 are filled here, so the length of Q is 64 bytes.

[0078] Initialization state: Initialize the internal state H using a fixed constant C and parameter P;

[0079]

[0080] In the formula, Represents a bitwise exclusive OR operation.

[0081] Message block: The default message block size in the multi-round compression enhanced hash algorithm is 128 bytes. Therefore, for a message with an input of 4 bytes, it can be processed into one data block, and the remaining bytes less than 128 bytes are filled with all 0s:

[0082] M={0x01,0x02,0x03,0x04,0x00,0x00,...};

[0083] Mixing operation: Before performing the mixing operation, first define the compression function F. The compression function is the core of the multi-round compression enhanced hash algorithm. The specific definition formula is as follows:

[0084] Hash = F(H,M,T,f);

[0085] In the formula, Hash represents the result after the mixing operation, H represents the internal state, which is an array of 8 8 bytes in length, M represents the message block, which is an array of 16 8 bytes in length, T represents the counter, which is 8 bytes in length and represents the number of message bytes processed so far, and f represents the flag bit, which is 1 bit in length and indicates whether it is the last data block. If yes, it is filled with 1, otherwise it is filled with 0.

[0086] The compression function in this embodiment should be:

[0087] Hash = F(H,M,4,1);

[0088] The detailed working steps of the compression function F are:

[0089] Initialization: Initialize the working variable v, which consists of its internal state H and fixed constant C;

[0090] The specific composition rules are as follows: v0 = H0, v1 = H1, v2 = H2, v3 = H3, v4 = H4, v5 = H5, v6 = H6, v7 = H7, v8 = C0, v9 = C1, v 10 =C2,v 11 =C3, v 15 =C7;

[0091] Multiple rounds of mixing operations: The working variables are mixed through multiple rounds of mixing operations, and then the internal state is mixed in the subsequent steps. Since M is an array of 16 8 bytes, there are 16 rounds of mixing operations in this embodiment. Each round completes the mixing operation of the message M by calling the custom G function. The definition of G(a, b, c, d, R1, R2) is as follows:

[0092] a=a+b+M[i]

[0093]

[0094] c=c+d;

[0095]

[0096] In the formula, a, b, c, d represent working variables, and the present embodiment assigns values ​​here: a=v0, b=v1, c=v2, d=v3; M[i] represents an element in the message block M; R1, R2 represent constants, and the present embodiment assigns values ​​here: R1=32, R2=64; >>> represents an unsigned right circular shift operation.

[0097] State update: After completing all mixing rounds, the first 8 8 bytes of the working variable v are XORed with the internal state H to generate a new internal state;

[0098]

[0099] Hash generation: By truncating the updated internal state H according to the length of L, the hash value is output;

[0100] Hash = H[:L];

[0101] This hash value is the round key round_number of this round. The round key of the next round is generated according to num_rounds, and finally the round key array round_numbers is obtained.

[0102] (4) Initialization Vector (iv) is an important parameter used in cryptography to ensure the randomness and security of encryption. It ensures that the same plaintext generates different ciphertexts after encryption in different sessions, thereby preventing duplicate data attacks.

[0103] The initialization vector is generated and defined as follows:

[0104] a. Length of IV: The length of IV is the same as the block size of the encryption algorithm. The encryption algorithm uses the round key as the encryption key, and its block size is 32 bits (4 bytes). Therefore, the length of IV generated in each round of the encryption algorithm is also 32 bits (4 bytes).

[0105] b. Generate IV: Generate an initial vector of 4 bytes using the same random number generation method as the initial key.

[0106] (5) Number of rounds: The number of rounds of encryption is obtained. The number of rounds is a key factor in the round encryption process, which directly affects the strength and performance of encryption. Generally speaking, the number of rounds is determined by the number in the round key list, that is, the number of rounds is num_rounds.

[0107] Step S2, after dividing the plaintext data into data blocks based on the initial key, determine the length of the data block, and perform a byte padding operation on the data block based on the determination result.

[0108] In this embodiment, after the plaintext data is divided into data blocks based on the initial key, the length of the data block is determined, and when the byte padding operation is performed on the data block based on the determination result, the number of segments can be obtained as the number of blocks, and the number of round keys and the length of the plaintext data are combined to determine the block length; the plaintext data is divided into equal data blocks based on the block length and the number of blocks, and it is verified whether the data block is an integer multiple of the block length. If it is an integer multiple, the division operation is completed; if it is not an integer multiple, the length of the last group of data blocks is determined, the byte padding length is calculated according to the determination result, and it is estimated whether the length of the data block after padding is consistent with the size of the remaining data blocks; if the length is consistent, the number of bytes filled after the last group of data blocks is calculated according to the byte padding length. If the length is inconsistent, the byte padding length is recalculated until the lengths of the data blocks are consistent.

[0109] It should be explained that the block processing is to divide the plaintext data into fixed-size data blocks data_block. First, the number of blocks is determined. The number of data blocks is consistent with the number of key blocks. Then the size of the data block is determined, where the data block size is block_length:

[0110] block_length=len(P) / num_segments;

[0111] The input data is divided into equal data blocks according to the block size. If the data block is not an integer multiple of the block size, data padding is required. When padding, the last data block is first padded to make its size consistent with the size of the remaining data blocks. The specific padding steps are as follows: Check the size of the last data block: If the size of the last data block is inconsistent with other data blocks, padding is required; Calculate the padding length: Determine the number of bytes required to be padded so that the size of the last data block is consistent with the size of the remaining data blocks. The calculation formula for the number of padding bytes is:

[0112] block_length-(len(P)%block_length);

[0113] Add padding data: Add the number of bytes required to be filled after the last data block. The padding content is the number of bytes in hexadecimal. For example, if 3 bytes need to be filled, the padding bytes are: 0x03, 0x03 and 0x03.

[0114] Step S3, performing dynamic mixing processing on the data block, and performing mixed group encryption and state update stream encryption operations on the data block according to the mixing result to obtain an encrypted data block.

[0115] In this embodiment, when dynamic mixing processing is performed on a data block, and a mixed group encryption and state update stream encryption operation is performed on the data block according to the mixing result to obtain an encrypted data block, the current round number can be read as a displacement, and a cyclic left shift operation is performed on the bytes in the data block, and a random number seed is obtained using the round key, the current round number and the data block; a permutation table is dynamically generated according to the random number seed to perform data permutation processing on the bytes in the data block to obtain a permuted data block; the permuted data block, the round key corresponding to the current round number and the initial vector are combined to perform an XOR operation, and the data block after the XOR operation is defined as an XOR data block; after determining the encryption parameters according to the encryption requirements, the XOR data block is grouped and encrypted using a hybrid algorithm, and a stream key is generated to perform XOR permutation on the XOR data block after the group encryption is completed; the XOR data block after the XOR permutation is used as the final encrypted data block, and it is determined whether the current round number is greater than the round number. If it is greater, the data block encryption operation is completed; if it is less, the current round number is increased by one and the encrypted data block is repeatedly generated until the current round number is greater than the round number.

[0116] It should be explained that, in the process of performing hybrid group encryption and state update stream encryption operations on data blocks to obtain encrypted data blocks, the balance state between encryption strength and system resource consumption in the data block encryption process can be evaluated. The specific analysis process is: obtaining a data set of the balance state between encryption strength and system resource consumption in the data block encryption process, and the data set of the balance state between encryption strength and system resource consumption in the data block encryption process specifically includes a security strength coefficient, system resource occupancy rate, and encryption efficiency; based on the obtained data set of the balance state between encryption strength and system resource consumption in the data block encryption process, a comprehensive analysis is performed to obtain a comprehensive evaluation value of the balance state, and the specific analysis process of the comprehensive evaluation value of the balance state is as follows:

[0117]

[0118] In the formula, C e Represents the comprehensive evaluation value of the equilibrium state, S f Represents the safety strength factor, R u Indicates the system resource utilization rate, E e represents encryption efficiency, and e represents a natural constant.

[0119] Among them, S f It is used to evaluate the security strength of the encryption algorithm, taking into account the length of the round key, the number of encryption rounds, and the data complexity after the entropy value is adjusted. The calculation formula is:

[0120]

[0121] In the formula, Key_length represents the length of the round key, Rounds represents the number of encryption rounds, and H adjusted Indicates the complexity of the data after entropy adjustment.

[0122] R u Used to evaluate the consumption of system resources by the current encryption process, including CPU usage, memory usage, and number of encryption rounds. The calculation formula is:

[0123]

[0124] Where U cpu Indicates CPU usage, U men Indicates memory usage, and Rounds indicates the number of encryption rounds.

[0125] E e It is used to evaluate the amount of data processed by the encryption algorithm per unit time. It is related to the number of encryption rounds, key length, and encrypted data block size. The calculation formula is:

[0126]

[0127] In the formula, Data_Block_Size represents the size of the data block, Rounds represents the number of encryption rounds, and Key_length represents the key length.

[0128] In a symmetric encryption algorithm, a round key is a key used for each round of encryption or decryption. The length of a round key is usually related to the length of a master key. The master key is expanded into multiple round keys through a certain algorithm. For example, in AES (Advanced Encryption Standard), the key length is usually 128, 192, or 256 bits, and the length of the round key is also affected accordingly. During the encryption process, data is usually processed in multiple rounds to enhance its security. The number of encryption rounds refers to the number of times data is encrypted in the encryption algorithm. In AES, 10 rounds are usually performed for a 128-bit key, 12 rounds for a 192-bit key, and 14 rounds for a 256-bit key. Entropy is a measure of the amount of information or complexity in information theory. The higher the entropy value, the greater the randomness and unpredictability of the data. During the data encryption process, the complexity of the data can be increased by adjusting the entropy value, making the data more secure. This usually involves knowledge of cryptography and information theory. During encryption or decryption, CPU usage indicates the percentage of computing power used by the processor when performing encryption operations. The complexity of the encryption algorithm and the number of encryption rounds directly affect the CPU load. Memory usage indicates the amount of memory used during the encryption process. Complex encryption algorithms and larger data blocks may lead to higher memory usage. In many symmetric encryption algorithms, encrypted data is processed in blocks, and the size of each block of data is usually fixed. For example, AES uses 128-bit (16-byte) data blocks. The data block size affects the efficiency of the algorithm, memory usage, and encryption speed.

[0129] The length of the round key and the number of encryption rounds can be obtained by viewing the specification or code implementation of the encryption algorithm. The entropy adjustment can be measured through data analysis and calculation tools (such as the entropy library in Python). The CPU and memory usage can be measured using performance monitoring tools provided by the operating system, such as the Windows Task Manager or the Linux top and htop commands. The size of the data block is usually explicitly specified in the definition of the encryption algorithm.

[0130] There is a correlation between the length of the round key and the number of encryption rounds. The longer the key length, the more encryption rounds may be used to improve security. An increase in the number of encryption rounds usually leads to an increase in CPU usage and memory usage, because each additional round requires more calculations and memory operations. The higher the entropy value, the higher the complexity of the data. For encryption algorithms, higher entropy values ​​usually mean stronger security. Larger data blocks usually require more memory to store and process, which may lead to higher memory usage, and the data block size may also affect the encryption speed, thereby indirectly affecting CPU usage.

[0131] The comprehensive evaluation value of the balance state is compared with the comprehensive reference evaluation value of the balance state stored in the database; if the comprehensive evaluation value of the balance state is higher than or equal to the comprehensive reference evaluation value of the balance state, the balance state between encryption strength and system resource consumption in the encryption process of the data block corresponding to the comprehensive evaluation value of the balance state is qualified; if the comprehensive evaluation value of the balance state is lower than the comprehensive reference evaluation value of the balance state, the balance state between encryption strength and system resource consumption in the encryption process of the data block corresponding to the comprehensive evaluation value of the balance state is unqualified, and an early warning is issued for the balance state between encryption strength and system resource consumption in the encryption process of the unqualified data block.

[0132] Evaluating the encryption strength of data blocks and the consumption of system resources can effectively optimize the use of system resources. Under the premise of ensuring security, select encryption algorithms that can reduce CPU and memory usage, thereby improving the overall performance of the system. Continuous monitoring and evaluation of encryption strength can help identify potential security risks. If the encryption strength is found to be insufficient, a stronger encryption algorithm can be reselected or the encryption configuration can be adjusted to improve the strength of data protection. A database of comprehensive evaluation values ​​of equilibrium states is established to provide decision support for system administrators, making more scientific choices based on historical data to ensure that encryption schemes are in the best state under different circumstances. When insufficient encryption strength or excessive resource consumption is detected, the system can automatically issue an early warning to help administrators adjust security policies in a timely manner to avoid potential data leakage risks. As system requirements and external environment change, the encryption strength and resource consumption can be evaluated based on historical and real-time data, so that the encryption scheme can flexibly adapt to new situations and improve the system's responsiveness to new threats. Collecting and analyzing evaluation data can identify performance bottlenecks, thereby providing a basis for subsequent optimization and promoting continuous improvement of system performance and security.

[0133] Specifically, after the encryption parameters are determined according to the encryption requirements, the XOR data blocks are grouped and encrypted using the hybrid algorithm, and when the stream key is generated to perform XOR permutation on the XOR data blocks after the group encryption is completed, the encryption parameters including the current round number, the initial key, the initial vector and the current round key can be determined based on the preset encryption requirements; physical variables including the vector dimension and the modulus are set, and a pseudo-random generator is defined based on the physical variables, and a private key and a noise vector of the hybrid algorithm are generated using the pseudo-random generator; the random matrix and the public key of the current round number are calculated based on the private key and the noise vector, and the initial vector and the current round key are generated based on the physical variables. and a pseudo-random generator to generate a session key, and use the session key to define an iteration key; convert the XOR data block from a byte array to an integer array, define the conversion result as an integer data block, and split the integer data block into a left data block and a right data block; iteratively encrypt the left data block and the right data block according to a preset number of iterations and an iteration key, and concatenate the iteratively encrypted left data block and right data block to obtain a ciphertext; convert the ciphertext from an integer array to a byte array to obtain a transformed data block, and perform XOR permutation processing after generating a stream key based on the transformed data block.

[0134] It should be explained that dynamic group streaming encryption is the entire operation process of a round of round encryption, which can be implemented through the following process in specific applications:

[0135] Step 1: Dynamic displacement: In order to achieve the dynamics of displacement, the current wheel is used as a parameter to achieve dynamic displacement setting.

[0136] The specific steps to achieve dynamic displacement are as follows:

[0137] (1) Read the current round number: round_index;

[0138] (2) Calculate the shift amount. The shift amount (shift_amount) can be directly equal to the current round number: shift_amount = round_index;

[0139] (3) Circularly shift each byte in the data block data_block to the left, and move the excess part to the right to ensure that the data is not lost. The specific implementation code of dynamic shift is as follows:

[0140] shifted_block=bytearray(len(data_block))

[0141] shift_amount=round_number

[0142] for iin range(len(data_block)):

[0143] shifted_block[i]=(data_block[i]<<shift_amount|data_block[i]> >

[0144] (8-shift_amount))&0xFF

[0145] Example: Assume that one of the bytes in a data_block is 0b10101100, shift_amount is 3, and the result of circular left shift is 0b01100101.

[0146] Step 2: Dynamic permutation: reorder the bytes in the data block through a permutation table dynamically generated by a random number seed;

[0147] (1) Generate a random number seed:

[0148] Get the random number seed seed according to the round key round_key, the current round number round_number and the data block index block_index. The seed is generated as follows:

[0149] seed=int.from_bytes(round_key,'big')+round_number+block_index;

[0150] Each data block in each round has a different seed.

[0151] (2) Dynamically generate a permutation table based on a random number seed:

[0152] According to the input random number seed seed and the length of the permutation table length, the length of the permutation table is the length of the data block, and the random number generator random is initialized through the Python built-in function random.seed(length). It should be noted that the random number generator initialized with the same seed can generate the same random number and sequence each time, which is an important basis for completing decryption;

[0153] At the same time, a list list of length length is initialized, and the values ​​of the list are in the order of [0, length-1]. The shuffle method in the random number generator random is used to shuffle the list, and finally a permutation table permutation_table of length length is obtained;

[0154] (3) Perform data replacement:

[0155] Generate an array permutation_block of the same length as data_block, using data_block as the data source; use permutation_table as the index array, and complete the filling of permutation_block byte by byte. After the filling is completed, the permutation data block permutation_block can be obtained.

[0156] Step 3, dynamic XOR: XOR the permutation_block with the round key round_key of the current round and the initial vector iv. By taking the modulus of the round key and the initial vector each time, it is ensured that the array does not exceed the bounds.

[0157] The specific steps are: generate an XOR data block xored_block of the same length as permutation_block, traverse according to the length of permutation_block, extract the i-th byte of permutation_block and record it as p[i], and extract the i-th byte of round_key and iv after completing the modulo operation with their respective lengths and record them as r[i%len(round_key)] and iv[i%len(iv)] respectively; XOR p[i] with r[i%len(round_key)] and record the result as temp[i]; XOR temp[i] with iv[i%len(iv)] and assign the generated result to xored_block[i]. The data block after XOR is defined as: xored_block.

[0158] Step 4: Hybrid group encryption operation: Perform multiple rounds of hybrid group encryption operations on the mixed data blocks. There are two reasons for performing group encryption here. One is to further split the data blocks when they are too long to improve encryption efficiency. The other is because the hybrid group encryption algorithm, as a pre-operation of the stream encryption algorithm, can increase the complexity of the overall encryption algorithm and further enhance the security of the algorithm.

[0159] The specific steps are as follows: parameter input; before group encryption, the encryption parameters need to be confirmed, including the current round round_number, the segmented initial key init_key of the current data block, the initial vector iv and the current round key round_key; group encryption; this embodiment will use the LWE-Feistel hybrid algorithm to group encrypt the data. LWE (Learning With Errors, with error learning) is based on the difficulty of the lattice problem, which makes it have the potential to resist quantum computing attacks. Compared with the traditional RSA algorithm, LWE can achieve the same security level at a shorter key length. Feistel is a simple and widely used symmetric encryption architecture with good scalability and easy implementation. Combining LWE with Feistel can take advantage of the advantages of the Feistel network and provide a flexible and changeable encryption algorithm. The LWE-Feistel hybrid encryption algorithm can not only provide a strong ability to resist quantum computing attacks, use a shorter key length to obtain higher security, but also balance security and performance by adjusting parameters (such as dimension, modulus parameters, etc.) to adapt to different application requirements.

[0160] The hybrid encryption process is as follows:

[0161] 1. Initialization;

[0162] a. LWE initialization: set the vector dimension n to 1024 and the modulus q to 40961;

[0163] b. Define the pseudo-random generator random_generator. The code of the generator is as follows:

[0164] def random_generator(seed, length):

[0165] np.random.seed(int(hashlib.sha256(seed).hexdigest(),16)%(2**32))

[0166] return np.random.randint(0,q,length)

[0167] Parameter explanation: seed is the random seed of the random number generator, length indicates the length of the array for generating random numbers, which can be one-dimensional or multi-dimensional. Working method: hashlib.sha256(seed).hexdigest(): In this step, the input seed is hashed using a hash algorithm to obtain a hexadecimal string of length 64.

[0168] int(…,16): Convert the hexadecimal string obtained in the previous step to a large integer.

[0169] %(2*32): modulus the large integer obtained in the previous step to ensure that the seed is within a reasonable range. Here, 2*32 is used, that is, 2 32 , 4294967296, so the seed will be between 0 and 4294967295.

[0170] np.random.seed(...) : Constructs a random number generator using a random number seed.

[0171] np.random.randint(0,q,length): Generates length random integers between 0 and q, where q is the defined modulus.

[0172] c. Generate LWE private key s and noise vector e:

[0173] s=random_generator(init_key,n)%q;

[0174] In the formula, init_key represents the initial key;

[0175] e=random_generator(bytes([round_number]),n)%q;

[0176] Where round_number represents the current round number.

[0177] d. Calculate the random matrix A and public key b:

[0178] A=random_generator(round_key,(n,n));

[0179] Where round_key is the current round number, generating a 1024*1024 matrix;

[0180] b=(A.dot(s)+e)%q;

[0181] In the formula, dot is matrix multiplication, which multiplies an n*n matrix A with an n*1 vector s, and the result will return an n*1 vector b.

[0182] 2. Generate session key session_key;

[0183] session_key=random_generator(iv,n)%q;

[0184] Where iv is the initial vector.

[0185] 3. Use Feistel algorithm to encrypt data;

[0186] a. Iteration rounds: The iteration rounds is set to 16 for simple operation;

[0187] b. Data block format conversion: convert xored_block from a byte array to an integer array. The conversion method is consistent with the generation method of round_keys. The result of the conversion is data_int.

[0188] c. Data block grouping: Split the input data block data_int into two parts, L0 and R0;

[0189] d. Select the iteration key K i :Each round uses a different iteration key K i The iteration key is generated by session_key. The specific generation method is:

[0190] def generate_round_key(session_key,round_number):

[0191] return session_key[round_number%len(session_key)]

[0192] e. Iterative encryption: initialization is as follows;

[0193] L0=data_int[0:len(data_int)] / / 2-1]

[0194] R0=data_int[len(data_int) / / 2:len(data_int)-1]

[0195] For each round of iteration, counter i, i∈[0,rounds-1]:

[0196] L i =R i-1

[0197]

[0198] Where F represents the iterative function, and F(R, K) is implemented as follows:

[0199]

[0200] Where q represents the modulus.

[0201] f. Ciphertext concatenation: After multiple rounds of iterative encryption, L and R are concatenated to obtain the ciphertext encrypted_int;

[0202] g. Convert encrypted_int from an integer array to a byte array. The result after conversion is: transformed_data_block.

[0203] After completing the above steps, proceed to the next round of the same operation.

[0204] Stream encryption algorithm based on dynamic state update: Stream encryption operation that dynamically updates the state of the data block encrypted by the LWE-Feistel hybrid algorithm. As a commonly used encryption algorithm, stream encryption has the following advantages: stream encryption can flexibly use various data block sizes due to its byte-by-byte XOR operation and can be used with data blocks of any length; since stream encryption operates byte by byte, even if part of the data is truncated or tampered with during transmission, it will only affect the changed part of the data without affecting the integrity of the entire data block; through the continuous update of the stream encryption state word state, the stream encryption algorithm has high dynamics and flexibility; block encryption usually targets data blocks with larger granularity, while stream encryption further operates on bytes on the basis of block encryption, utilizing the efficiency of block encryption and the randomness of stream encryption to jointly improve the security of the overall encryption. The specific steps are as follows:

[0205] Step 1: Receive parameters: including transformed_data_block, round_key (round key of the current round), and iv (initialization vector).

[0206] Step 2, key stream generation: initialize a key stream key_stream that is equal to the length of transformed_data_block; use the current round key round_key and state state to generate the key stream byte by byte. Here, state is initialized with the initial vector iv and converted into a byte array. Each time a key stream byte is generated, the state array is updated according to the current byte and the round key. The code for generating the key stream is as follows:

[0207] def generate_key_stream(self,length,iv,round_key):

[0208] key_stream=bytearray(length)

[0209] state = bytearray(iv)

[0210] for i in range(length):

[0211] state[i%len(state)]=(state[i%len(state)]+round_key[i%len(round_key)])&0xFF

[0212] key_stream[i]=state[i%len(state)]

[0213] return key_stream

[0214] Additional explanation of the code:

[0215] Index calculation (state): By taking the modulus of the counter i and the state array, it can be ensured that the index is within the valid range of state and the array will not be out of bounds;

[0216] Index calculation (round key): the same as index calculation (state);

[0217] Addition operation: add each byte in the state byte array to each byte in round_key, fully combining the state array and the round key to update the state array. The bitwise AND operation ensures that the result of the addition remains between 0 and 255 to prevent byte overflow.

[0218] Step 3: XOR encryption: XOR the data block transformed_data_block with the key stream key_stream to obtain the final encrypted data block encrypted_data_block.

[0219] Step 4: Repeat the next encryption operation.

[0220] Step S4, after concatenating and combining all encrypted data blocks, add key parameters, generate message codes in combination with the Rabi collaboration algorithm, generate ciphertext data based on the message codes and encryption functions, and complete the security enhancement processing of the new energy centralized control system data.

[0221] In this embodiment, after all encrypted data blocks are concatenated and combined, key parameters are added, and a message code is generated in combination with the Rabi collaboration algorithm. Ciphertext data is generated according to the message code and the encryption function. When the security enhancement processing of the new energy centralized control system data is completed, all encrypted data blocks can be concatenated and combined to obtain encrypted data, and the predefined key parameters are added to the back end of the encrypted data to generate a ciphertext string; the ciphertext hash value of the encrypted data is obtained based on the compression enhancement algorithm, the ciphertext hash value is combined with the Rabi collaboration algorithm to calculate the encryption signature, and the encryption signature is encoded to generate a ciphertext appended code; the ciphertext appended code is added to the back end of the ciphertext data to obtain a ciphertext string of the meaning message code, and the ciphertext string is processed using the encryption function to obtain the ciphertext data after security enhancement processing.

[0222] After all encrypted data blocks are concatenated and combined, key parameters are added, and a message code is generated in combination with the Rabi collaboration algorithm. In the process of generating ciphertext data according to the message code and the encryption function, the security, integrity and system consumption status of the entire encryption process can be comprehensively evaluated. The specific analysis process is: obtaining an encryption process comprehensive status data set, which specifically includes a ciphertext integrity assessment coefficient, a security redundancy coefficient, a system security assessment coefficient, and a system consumption assessment coefficient. Based on the obtained encryption process comprehensive status data set, a comprehensive analysis is performed to obtain an encryption process comprehensive status assessment value. The specific analysis process of the encryption process comprehensive status assessment value is expressed as follows:

[0223]

[0224] In the formula, E t represents the comprehensive status evaluation value of the encryption process, L c Represents the ciphertext integrity assessment coefficient, S s Represents the system safety assessment coefficient, R s Represents the safety redundancy factor, C s Indicates the system consumption assessment factor.

[0225] Among them, L c It is used to evaluate whether the ciphertext data block after splicing is complete and lossless. It takes into account the size of the i-th data block, the total number of data blocks, and the average size of the data blocks. The calculation formula is:

[0226]

[0227] Where, Block_Size i Indicates the size of the i-th data block, n indicates the total number of data blocks, and Average_Block_Size indicates the average size of the data blocks.

[0228] R sIt is used to evaluate the redundancy introduced by the system when generating ciphertext, including the total number of redundant bytes and the total length of ciphertext. The calculation formula is:

[0229]

[0230] Where Total_Redundancy represents the total number of redundant bytes, and Ciphertext_Length represents the total length of the ciphertext.

[0231] S s It is used to evaluate the security of the entire encryption process. It is calculated by combining the encryption rounds, key length, complexity of hash value, and security redundancy coefficient. The calculation formula is as follows:

[0232]

[0233] In the formula, Rounds represents the encryption rounds, Key_Length represents the key length, Hash_Complexity represents the complexity of the hash value, and R s Represents the safety redundancy factor.

[0234] C s It is used to evaluate the resources consumed by the system in the process of generating ciphertext, including the time of generating ciphertext, CPU usage, memory usage, and system security assessment coefficient. The calculation formula is as follows:

[0235]

[0236] In the formula, Time_Consumed represents the time to generate the ciphertext, CPU_Usage represents the CPU usage, Memory_Usage represents the memory usage, S s Represents the system safety assessment factor.

[0237] The size of a data block refers to the byte length of each data block during the encryption process. When the encryption algorithm is executed, it is calculated according to the block division rules set in the code. When dividing the blocks, the size of each data block can be obtained through len(data_block). The total number of data blocks refers to the number of blocks into which the entire plaintext data is divided during the encryption process. The total number can be calculated during the block division process through code logic, for example, it can be obtained through len(data) / / block_size or len(data_blocks). The average size of a data block is the average size of all data blocks, which is the sum of the sizes of all data blocks and divided by the total number of data blocks. The total number of redundant bytes refers to the number of extra bytes added during the encryption process to enhance data security, including padding bytes, additional The hash value, key parameters, etc., can be obtained by recording the increase in the number of extra bytes through the process of adding redundant data in the code, such as calculating the number of padding bytes, additional key length, etc. The total length of the ciphertext refers to the total number of bytes of the ciphertext finally generated, and the byte length of the entire ciphertext string is obtained through len(ciphertext). The encryption round refers to the number of iterations for encrypting each data block during the encryption process. It is usually set as a fixed value in the encryption algorithm or dynamically adjusted according to security requirements. It can be obtained directly from the encryption parameters. The key length refers to the byte length of the key used in the encryption process, the length set when the key is generated. For example, the key length can be obtained through len(key). The complexity of the hash value is a measure of the security and difficulty of generating the hash value by the hash algorithm. It is usually related to the length of the hash value and the complexity of the algorithm. It is measured by the choice of hash algorithm and the length of the generated hash value. The time to generate ciphertext refers to the time from the start to the completion of the encryption process. It is calculated through the timestamp in the code. For example, the time is recorded at the beginning and end of the encryption, and the difference is the generation time. The CPU utilization rate refers to the percentage of processor resources consumed in the encryption process to the total processing power. It is obtained through system monitoring tools or system calls in the code, such as psutil.cpu_percent(). The memory utilization rate refers to the percentage of memory consumed in the encryption process to the total available memory. It is obtained through system monitoring tools or system calls in the code, such as psutil.virtual_memory()percent.

[0238] The total number of data blocks and the size of data blocks are complementary. When the total amount of data is fixed, the larger the data block, the smaller the total number. The average size of a data block is the result of dividing the total size of the data block by the total number of data blocks. The size of the data block, the number of encryption rounds, and the key length all affect the security and complexity of encryption. Larger data blocks and longer keys require more encryption rounds to ensure security, which in turn increases the computational load. The total number of redundant bytes directly affects the total length of the ciphertext. Increased redundancy will lead to an increase in the ciphertext length. Although it improves security, it may also reduce system efficiency. The number of encryption rounds and the key length directly affect the complexity of the hash value. More rounds and longer keys usually lead to more complex hash values, thereby improving security. The time to generate ciphertext is directly related to the CPU and memory usage. Increased encryption rounds, data block size, and key length will lead to increased CPU and memory consumption, thereby extending the encryption time. More complex hash algorithms consume more CPU and memory resources, which may extend the ciphertext generation time but can improve security.

[0239] The comprehensive status evaluation value of the encryption process is compared with the comprehensive status reference evaluation value of the encryption process stored in the database. If the comprehensive status evaluation value of the encryption process is higher than or equal to the comprehensive status reference evaluation value of the encryption process, the security, integrity and system consumption status of the entire encryption process corresponding to the comprehensive status evaluation value of the encryption process are qualified; if the comprehensive status evaluation value of the encryption process is lower than the comprehensive status reference evaluation value of the encryption process, the security, integrity and system consumption status of the entire encryption process corresponding to the comprehensive status evaluation value of the encryption process are unqualified, and an early warning is issued for the unqualified security, integrity and system consumption status of the entire encryption process.

[0240] Comprehensive evaluation of factors such as ciphertext integrity, security redundancy, and system security ensures the security of the encryption process, thereby preventing data leakage, tampering, and other security threats. The ciphertext integrity evaluation coefficient can promptly detect whether the data is damaged or tampered with during transmission or storage, thereby improving the reliability and accuracy of the data. The system consumption evaluation coefficient helps identify the efficiency of resource use during encryption and decryption, and can optimize the use of system resources while ensuring security, avoiding performance degradation due to excessive resource consumption. Real-time evaluation of the comprehensive status can monitor the status of the encryption process at any time. Once the evaluation value is found to be lower than the reference value, the system can quickly issue an early warning to help managers take timely measures to reduce data security risks. Based on the evaluation results of the encryption process, managers can make more scientific data protection strategies, including selecting appropriate encryption algorithms and parameter settings, thereby improving overall security and ensuring that data remains secure and complete during the encryption process, which can enhance user trust in the system. Through the accumulation and analysis of historical data, potential security and performance issues can be identified, thereby promoting the continuous optimization and improvement of encryption technology and system architecture and enhancing risk resistance.

[0241] Specifically, when obtaining the ciphertext hash value of the encrypted data based on the compression enhancement algorithm, combining the ciphertext hash value with the Rabi collaboration algorithm to calculate the encrypted signature, and encoding the encrypted signature to generate the ciphertext appended code, a public key for consistency verification can be pre-defined, and the ciphertext hash value of the encrypted data is obtained based on the compression enhancement algorithm, and a random number with the same length as the ciphertext hash value is generated; the random number and the ciphertext hash value are converted into an integer structure corresponding to the byte array function, and the signature is calculated based on the Rabi collaboration algorithm and the integer structure, and then the integer to byte array function is called to convert the signature into a byte array; the length encoding of the signature is set to a preset byte, and the length encoding is attached to the front end of the signature, and then the signature and random number splicing processing is performed, and a message code is generated based on the splicing result; the length encoding of the message code is set to a preset byte, and the length encoding is attached to the back end of the message code to obtain the ciphertext appended code.

[0242] It should be explained that the data blocks after completing all rounds of the dynamic group streaming encryption process of the LWE-Feistel hybrid algorithm are spliced ​​and combined, and finally the splicing is completed to obtain the encrypted data encrypted_data. The initial key init_key, the initial key length key_length (fixed length is 4 bytes), the data block length block_length (fixed length is 4 bytes), and the initial vector iv are added to the back of encrypted_data to generate the final ciphertext string encrypted_string. Rabin Encryption is a public key encryption algorithm based on number theory. Its security is based on the difficulty of the integer factorization problem. Similar to the RSA algorithm, the Rabin Encryption algorithm has high security and the algorithm structure is simple and easy to implement. This embodiment uses the Rabin Encryption algorithm to verify the consistency of data for the middleman tampering that may be encountered during data transmission. The specific process is as follows:

[0243] Step 1: Select parameters: The encryption party and the decryption party agree on a large integer n, which is the public key for consistency verification;

[0244] Step 2: Calculate the message hash value: For the encrypted_data ciphertext in the above process, use the multi-round compression enhanced hash algorithm that is the same as the round_keys generation method to generate the ciphertext hash value H(m);

[0245] Step 3, generate a random number k: Generate a random number k with the same length as H(m) (the random number generation method is the same as the initial key generation method);

[0246] Step 4: Calculate the encrypted signature S:

[0247] a. Convert the hash values ​​H(m) and k to large integers h_int and k_int. Since H(m) and the random number k are both byte arrays, you can directly call the Python internal byte array to integer function int.from_bytes:

[0248] h_int=int.from_bytes(H(m),byteorder='big')

[0249] k_int=int.from_bytes(k,byteorder='big')

[0250] The byteorder in the above code is a parameter that specifies the storage order of bytes in integers. Here, big means the high bit comes first, that is, big endian.

[0251] b. Use Rabin collaborative addition to calculate the signature S_int. The calculation method is:

[0252] S_int=(h_int+k_int)modn;

[0253] In the formula, n represents a large integer as agreed upon.

[0254] c. Convert the signature S_int to a byte array. Since S_int is a large integer, you can directly call the Python internal integer to byte array function int.to_bytes() to convert the integer to a byte array. The operation code for obtaining the signature S is:

[0255] S=S_int.to_bytes((S_int.bit_length()+7) / / 8, byteorder='big');

[0256] In the formula, the bit_length function represents the bit length of the integer, that is, the number of binary bits required to represent S_int, (S_int.bit_length()+7) / / 8 represents the calculation of the number of bytes required to convert the integer into a byte array, and the bit length plus 7 divided by 8, which also ensures that all bits of the integer can be accommodated.

[0257] Step 5. Generate message code MAC: Encode the length of signature S into 2 bytes, append it to the front of signature S, concatenate signature S and random number k, and generate MAC = (S, k).

[0258] Step 6. Append MAC to ciphertext: Encode the length of MAC into 2 bytes, append it to MAC, and append the generated MAC to the end of encrypted_data to obtain the ciphertext string encrypted_mac_data with MAC message.

[0259] Finally, use Python's built-in Base64 encryption function:

[0260] base64.b64encode(encrypted_mac_data);

[0261] Get the encrypted data encrypted_mac_base64.

[0262] See also Figure 3 According to the multi-heterogeneous data dynamic security enhancement method proposed in this example, the data decryption method of the centralized control end is described, and the steps are as follows:

[0263] Step 1: Base64 decryption: Use Python's built-in Base64 decryption function base64.b64encode(encrypted_mac_base64) to process the encrypted_mac_base64 received from the substation to obtain encrypted_mac_data.

[0264] Step 2: Extract the message authentication code MAC: Get the length len(MAC) of the MAC based on the length of the last 2 bytes at the end of encrypted_mac_data, and extract the MAC based on len(MAC);

[0265] Step 3: Verify data consistency based on the Rabi collaboration algorithm. The specific steps are as follows:

[0266] (1) Extract signature S and random number k:

[0267] Extract the first 2 bytes from MAC and decode them to get the length of signature S;

[0268] According to the length of signature S, the signature S and the random number k are extracted from MAC.

[0269] (2) Recalculate the hash value H(m): The ciphertext data after extracting the MAC information is recorded as encrypted_data. The hash value is recalculated based on encrypted_data and the multi-round compression enhanced hash algorithm to obtain the hash value H(m).

[0270] (3) Verify the signature: Use the extracted random number k and the recalculated hash value H(m) to calculate the signature S';

[0271] Compare the signatures S and S' extracted from MAC. If the two are the same, it means that the data has not been modified and the verification is successful. If the two are different, it means that the data has been modified by the middleman. The decryption of the data is abandoned, a message notification is sent, and a security inspection is requested.

[0272] Step 4, Extraction of encryption parameter information: Split the end of encrypted_data. Since the initial vector is fixed to 4 bytes, extract the last 4 bytes as iv. Use the same method to extract the data block length block_length and the initial key length key_length. Extract the initial key based on key_length. The remaining data after extraction is the encrypted data encrypted_data. The detailed code for extracting parameter information is as follows:

[0273] def extract_encryption_details(encrypted_data):

[0274] #Extract iv

[0275] iv=encrypted_data[-4:]

[0276] encrypted_data=encrypted_data[:-4]

[0277] #Extract segment key length

[0278] block_length=int.from_bytes(encrypted_data[-4:],'big')

[0279] encrypted_data=encrypted_data[:-4]

[0280] # Extract the initial key length

[0281] key_length=int.from_bytes(encrypted_data[-4:],'big')

[0282] key_length=key_length / / 8

[0283] encrypted_data=encrypted_data[:-4]

[0284] # Extract the initial key

[0285] init_key=encrypted_data[-key_length:]

[0286] encrypted_data=encrypted_data[:-key_length]

[0287] return encrypted_data,init_key,key_length,block_length,iv

[0288] Step 5: Round key generation: The round number num_rounds is calculated and the round key generation round_keys is completed in the same way as the round key generation method in the security enhancement process. It should be noted that the round decryption performed in the decryption process is in reverse order relative to the encryption process. For example, if the number of rounds in the encryption process is 10, the round key is incremented from round_numbers[0], then the decryption process is decremented from round_numbers[9], and the current round number used is also decremented from the last round.

[0289] Step 6, data block generation: Split the data according to the encrypted data encrypted_data and the data block length block_length, and finally obtain the encrypted data block array encrypted_blocks.

[0290] Step 7: Dynamic packet streaming decryption based on LWE-Feistel hybrid algorithm:

[0291] Decrypt the data block in step 6. The number of rounds has been obtained in num_rounds in step 5. The specific steps are as follows:

[0292] (1) Traverse the data blocks: traverse according to encrypted_blocks, take out each data block encrypted_block for operation;

[0293] (2) Dynamic hybrid packet streaming decryption:

[0294] a. Generate a key stream based on the data block length block_length, the initial vector iv, and the current round key round_key. The method for generating the key stream key_stream has been described in the security enhancement process.

[0295] b. XOR the current data block encrypted_block with key_stream. Since XOR is reflexive, that is,

[0296] Therefore, the result after XOR can be used as the inverse operation of stream encryption, that is, stream decryption operation, and the decrypted result is recorded as transformed_data_block.

[0297] (3) Hybrid group decryption algorithm based on LWE-Feistel:

[0298] a. LWE initialization: During the decryption process, the same initialization operation as the encryption process is performed to generate the correct key and parameters. Parameter initialization includes: vector dimension n, modulus q, both parameters are pre-negotiated and defined by the sender and the receiver, and will not be transmitted in the ciphertext. Define a pseudo-random generator, the definition of the pseudo-random generator random_generator is the same as the encryption process; generate the LWE private key s and noise vector e, and the generation method is consistent with the encryption process; generate the random matrix A and the public key b, and the generation method is consistent with the encryption process.

[0299] b. Generate the session key session_key. The generation method should be consistent with the encryption process.

[0300] c. Feistel decryption:

[0301] Data block format conversion: convert the byte array transformed_data_block to the integer array transformed_data_int; data block splitting: split into L according to the length of transformed_data_int divided by 2 n-1 and R n-1 , n is the number of rounds, set to 16;

[0302] Traverse n for iterative decryption:

[0303] L n-1 =transformed_data_int[:len(transformed_data_int) / / 2-1];

[0304] R n-1 =transformed_data_int[len(transformed_data_int) / / 2,len(transformed_data

[0305] _int) / / 2-1];

[0306] Iteration key K i :Generation method and encryption process K i The generation method is the same as that of iterative decryption: for each round of iteration, counter i, i∈[rounds-1,0];

[0307] R i =L i-1

[0308]

[0309] Wherein F is an iterative function, and the implementation of F(L, K) in this embodiment is as follows:

[0310]

[0311] After multiple iterations, the final iteration results L0 and R0 will be obtained.

[0312] Ciphertext concatenation: After multiple rounds of iterative encryption, L0 and R0 are concatenated to obtain the ciphertext encrypted_int; data conversion: encrypted_int is converted into a character array, which is defined as encrypted_block.

[0313] Step 8. Decode dynamic XOR: define a data block xored_block with the same length as the packet data block;

[0314] Dynamic XOR decryption: The round key round_key of the current round and the initial vector iv are XORed with the data block, and the XOR restoration sequence is generated based on the reflexive characteristics of XOR. The code for decryption is:

[0315] xored_block=bytearray(len(encrypted_block))

[0316] for iin range(len(encrypted_block)):

[0317] xored_block[i]=encrypted_block[i]^round_key[i%len(round_key)]^iv[i%le n(iv)]

[0318] After dynamic XOR decryption, a dynamic XOR decrypted data block is obtained: xored_block.

[0319] Step 9: Solve dynamic displacement:

[0320] a. Get the random number seed seed according to the current round key round_key, the current round round_number and the data block index block_index;

[0321] b. Obtain the permutation table permutation_table using the same method as the encryption method;

[0322] c. Construct the inverse permutation table inverse_permutation_table:

[0323] At the same time, the permutation table permutation_table is used in the encryption process, which specifies the mapping relationship between the original position and the permuted position.

[0324] For example, if the kth element in permutation_table is m, then during encryption, the kth byte of the original data block is moved to the mth position.

[0325] During the decryption process, the mth byte in the encrypted data block is restored to the kth position by constructing the inverse_permutation_table.

[0326] The inverse_permutation_table is generated as follows:

[0327] First, a sequential list from 0 to len(permutation_table)-1 is generated. Then, the indexes are sorted according to the value of permutation_table through the sorting function. The sorted index list is inverse_permutation_table. The specific code is:

[0328] def reverse_permutation(dataBlock, permutation_table):

[0329] #Build inverse permutation table;

[0330] return sorted(range(len(permutation_table)),key=lambda k:permutation_table[k])

[0331] d. Reconstruct the byte array of the data block xored_block according to the order of inverse_permutation_table, and finally obtain the decryption result permutation_block of dynamic permutation.

[0332] e. Dynamic shift solution: During the encryption process, the number of shifted bits (shift_amount) is dynamically determined according to the current number of rounds. During decryption, the right shift is performed again according to shift_amount, and the part that exceeds the right shift is cycled to the left to ensure that the data is not lost. The specific code implementation is as follows:

[0333] def dynamic_unshift(dataBlock, roundNumber):

[0334] decrypt_block=bytearray(len(dataBlock))

[0335] shift_amount=roundNumber+1

[0336] for iin range(len(dataBlock)):

[0337] decrypt_block[i]=(dataBlock[i]>>shift_amount|dataBlock[i]<<(8-shift_amount))&0xFF

[0338] return decrypt_block

[0339] After solving the dynamic displacement, the decrypted data block decrypt_block of this round of decryption is finally obtained.

[0340] Step 10: combine the decrypted data blocks that have undergone multiple rounds of decryption in step 9 to obtain decrypted data decrypt_data.

[0341] Step 11, de-padding: a. Take out the last byte of decrypt_data and record it as the padding length padding_length; b. Determine whether padding_length is greater than the data block length block_length. If so, return an exception; c. Take out the last data with a length of padding_length from decrypt_data and generate the same number of padding bytes to determine whether the padding is normal. d. Remove the padding part and return the original data result_data.

[0342] By introducing dynamic encryption and security enhancement algorithms, the security risks caused by data interception, tampering or attack are effectively reduced. The hardware system can better prevent malware and hacker attacks, protect key equipment and data from unauthorized access, and is suitable for key hardware devices such as servers, routers, and firewalls, especially in environments with high data security requirements. By adjusting parameters such as encryption rounds, key lengths, and dynamic entropy values, the use of hardware resources such as CPU and memory can be optimized while ensuring security, so that the system can run efficiently under limited resources, avoid excessive consumption of hardware resources, and increase the service life of hardware equipment. It is suitable for hardware environments with strict resource management requirements such as embedded systems, low-power devices, and Internet of Things devices. Technologies such as dynamic packet streaming encryption and state update streaming encryption ensure the integrity and consistency of data during transmission. When hardware devices process and transmit data, they can effectively avoid system failures or data misjudgments caused by data loss or tampering, thereby improving the overall reliability of the system. It is suitable for hardware devices such as network switches, communication base stations, and wireless transmission equipment that work in high data throughput environments. Through dynamic encryption technology, the system can intelligently allocate hardware resources when processing multiple tasks in parallel to avoid system bottlenecks caused by resource contention. This mechanism ensures that the hardware equipment can maintain efficient and stable operation when processing multiple data streams. It is suitable for hardware equipment that needs to process tasks in parallel, such as multi-core processors, high-performance computers (HPC), and distributed computing clusters. By optimizing encryption algorithms and reducing unnecessary computing overhead, the load on hardware equipment is reduced, thereby reducing the risk of hardware failure caused by overheating and overload. Especially in scenarios of continuous high-load operation, it can significantly improve the stability and reliability of hardware equipment. It is suitable for servers, data center hardware, and industrial control equipment that need to run stably for a long time. For complex computing tasks such as the LWE-Feistel hybrid encryption algorithm, the system can combine hardware acceleration technology (such as GPU acceleration, ASIC chips) to greatly improve the encryption processing speed. Through hardware acceleration, the system can achieve efficient data processing while maintaining high security. It is suitable for encryption servers, GPU acceleration devices, dedicated encryption chips (ASICs), and other hardware equipment that require high-intensity computing.

[0343] Those skilled in the art will appreciate that the units, i.e., algorithm steps, of the various examples described in conjunction with this embodiment can be implemented in electronic hardware or in a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0344] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A method for dynamic security enhancement of multi-heterogeneous data in a new energy centralized control system, characterized in that: The method for dynamic security enhancement of multi-heterogeneous data comprises the following steps: After obtaining plaintext data from the new energy centralized control system, the basic entropy value is calculated, and the initial key is generated based on the operation characteristics of the centralized control system and the basic entropy value, and combined with the compression enhancement algorithm to generate the round key and encryption times; After dividing the plaintext data into data blocks based on the initial key, determine the length of the data block, and perform a byte padding operation on the data block based on the determination result; Performing dynamic mixing processing on the data block, and performing mixed block encryption and state update stream encryption operations on the data block according to the mixing result to obtain an encrypted data block; After all encrypted data blocks are concatenated and combined, key parameters are added, and a message code is generated in combination with the Rabi collaboration algorithm. Ciphertext data is generated based on the message code and encryption function to complete the security enhancement processing of the new energy centralized control system data.

2. According to claim 1, a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system is characterized in that: The method of obtaining plaintext data from the new energy centralized control system and calculating the basic entropy value, generating an initial key based on the operation characteristics of the centralized control system and the basic entropy value, and combining the compression enhancement algorithm to generate round keys and encryption times includes the following steps: Taking the data base of the new energy centralized control system as the basis, obtaining the plaintext data with a byte length greater than the threshold from the data base, and calculating the basic entropy value of the plaintext data; The basic entropy value is adjusted according to the operating environment of the new energy centralized control system and the weight of the operating environment impact to obtain the data entropy; Dynamically generate the initial key according to the length of the plaintext data and the data entropy, and generate the round key and round key list based on the initial key and the compression enhancement algorithm; The round key is used as the encryption key to generate the initial vector, and the number of round encryptions is determined according to the round key list.

3. According to claim 2, a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system is characterized in that: The method of dynamically generating an initial key according to the length of the plaintext data and the data entropy, and generating a round key and a round key list based on the initial key in combination with the compression enhancement algorithm, comprises the following steps: The key length is determined based on the length of the plaintext data and the data entropy, and the initial key is generated after the random number generator and the key length are selected based on the operating system and the key generation method is defined; Determine the segment key length and the number of segments based on the key length, the length of the plaintext data and the data entropy, and determine the number of round keys based on the key length; Performing numerical conversion processing on the initial key to generate an unsigned numerical array, and calculating the unsigned numerical array based on a modulus operation formula to generate a modulus coefficient; Extract the coefficient block according to the modulus coefficient, convert the coefficient block into a byte array using an integer function, and perform hash calculation on the byte array based on a compression enhancement algorithm to obtain a hash value; Use the hash value as the first round key, set the number of round keys as the number of times generated, repeatedly perform hash calculations on the byte array to obtain a round key list, and obtain the number of rounds based on the round key list.

4. According to claim 3, a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system is characterized in that: The calculation formula of the segment key length is: The calculation formula for the number of segments is: In the formula, segment_size represents the segment key length, num_segments represents the number of segments, len(P) represents the length of the plaintext data P, and H adjusted Indicates data entropy, min_size indicates the minimum key length, and key_length indicates the key length.

5. According to claim 4, a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system is characterized in that: The method of extracting a coefficient block according to the modulus coefficient, converting the coefficient block into a byte array using an integer function, and performing hash calculation on the byte array based on a compression enhancement algorithm to obtain a hash value comprises the following steps: Extract coefficient blocks from the modulo coefficients based on the block extraction formula and the length of the modulo coefficients, and convert the coefficient blocks into byte arrays using the integer to byte array function; Predefine the output length and fixed constant of the hash value in the compression enhancement algorithm, and after setting parameters according to the output length and the fixed constant, initialize the internal state of the compression enhancement algorithm; Define the message block array status in the compression enhancement algorithm, and initialize the working variables of the compression enhancement algorithm based on fixed constants and internal states; Defining the number of mixed operation rounds of the working variables based on the message block array status, and performing the mixed operation according to the number of mixed operation rounds; After the mixing is completed, the working variable is combined with the internal state to perform an XOR operation to generate a new internal state, and the new internal state is truncated to obtain a preset length byte as the hash value.

6. According to claim 4, a method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system is characterized in that: After dividing the plaintext data into data blocks based on the initial key, determining the length of the data block, and performing a byte padding operation on the data block based on the determination result, the method includes the following steps: The number of segments is obtained as the number of blocks, and the number of round keys is combined with the length of the plaintext data to determine the length of the block; The plaintext data is divided into equal data blocks based on the block length and the number of blocks, and it is verified whether the data block is an integer multiple of the block length. If it is an integer multiple, the division operation is completed; If it is not an integer multiple, determine the length of the last group of data blocks, calculate the byte padding length based on the determination result, and estimate whether the length of the padded data block is consistent with the size of the remaining data blocks; If the lengths are consistent, the number of bytes filled after the last group of data blocks is calculated according to the byte padding length. If the lengths are inconsistent, the byte padding length is recalculated until the lengths of the data blocks are consistent.

7. The method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system according to claim 6 is characterized in that: The method of performing dynamic mixing processing on the data block and performing mixed group encryption and state update stream encryption operations on the data block according to the mixing result to obtain an encrypted data block includes the following steps: Read the current round number as the displacement, and perform a circular left shift operation on the bytes in the data block, and use the round key, the current round number and the data block to obtain the random number seed; Dynamically generate a substitution table based on a random number seed to perform data substitution processing on bytes in the data block to obtain a substitution data block; Perform an XOR operation on the replacement data block, the round key corresponding to the current round number, and the initial vector, and define the XORed data block as an XORed data block; After the encryption parameters are determined according to the encryption requirements, the XOR data blocks are encrypted in groups using a hybrid algorithm, and a stream key is generated to perform XOR permutation on the XOR data blocks after the group encryption is completed; The XOR data block after XOR permutation is used as the final encrypted data block, and it is determined whether the current round number is greater than the round number. If it is greater, the data block encryption operation is completed. If it is less, the current round number is increased by one and the encrypted data block is repeatedly generated until the current round number is greater than the round number.

8. The method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system according to claim 7 is characterized in that: After the encryption parameters are determined according to the encryption requirements, the XOR data blocks are grouped and encrypted using a hybrid algorithm, and a stream key is generated to perform XOR substitution on the XOR data blocks after the group encryption is completed, including the following steps: Determine encryption parameters including current round number, initial key, initial vector and current round key based on preset encryption requirements; Set physical variables including vector dimension and modulus, define a pseudo-random generator based on the physical variables, and use the pseudo-random generator to generate a private key and a noise vector of the hybrid algorithm; Calculate the random matrix and public key of the current round according to the private key and the noise vector, generate the session key based on the physical variable and the pseudo-random generator, and use the session key to define the iteration key; Convert the XOR data block from a byte array to an integer array, define the conversion result as an integer data block, and split the integer data block into a left data block and a right data block; Iteratively encrypt the left data block and the right data block according to the preset number of iterations and the iteration key, and concatenate the iteratively encrypted left data block and the right data block to obtain the ciphertext; The ciphertext is converted from an integer array to a byte array to obtain a transformed data block, and a stream key is generated based on the transformed data block and then an XOR permutation process is performed.

9. The method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system according to claim 1 is characterized in that: The method includes adding key parameters after splicing and combining all encrypted data blocks, generating message codes in combination with the Rabi collaboration algorithm, generating ciphertext data according to the message codes and the encryption function, and completing the security enhancement processing of the new energy centralized control system data, including the following steps: All encrypted data blocks are concatenated to obtain encrypted data, and predefined key parameters are added to the backend of the encrypted data to generate a ciphertext string; Based on the compression enhancement algorithm, the ciphertext hash value of the encrypted data is obtained, the ciphertext hash value is combined with the Rabi collaboration algorithm to calculate the encrypted signature, and the encrypted signature is encoded to generate the ciphertext append code; The ciphertext append code is added to the back end of the ciphertext data to obtain a ciphertext string of the meaning message code, and the ciphertext string is processed using an encryption function to obtain the ciphertext data after security enhancement processing.

10. The method for dynamic security enhancement of multi-heterogeneous data of a new energy centralized control system according to claim 9 is characterized in that: The method of obtaining a ciphertext hash value of the encrypted data based on the compression enhancement algorithm, combining the ciphertext hash value with the Rabi collaboration algorithm to calculate an encrypted signature, and encoding the encrypted signature to generate a ciphertext appended code includes the following steps: Predefine the public key for consistency verification, obtain the ciphertext hash value of the encrypted data based on the compression enhancement algorithm, and generate a random number with the same length as the ciphertext hash value; Use the byte array to integer function to convert the random number and the ciphertext hash value into an integer structure, and then call the integer to byte array function to convert the signature into a byte array after calculating the signature based on the Rabi collaboration algorithm and the integer structure; Set the length code of the signature to a preset byte, append the length code to the front end of the signature, perform signature and random number concatenation, and generate a message code based on the concatenation result; The length code of the message code is set to a preset byte, and the length code is appended to the back end of the message code to obtain the ciphertext append code.

Citation Information

Cited By

  • Power grid upgrading mirror image data transmission method and system

    CN119788350A

  • A power grid upgrading mirror data transmission method and system

    CN119788350B

  • Data encryption method applied to SoC and SoC

    CN121456922A

  • Data encryption methods applied to SoC and SoC

    CN121456922B

  • Multi-core server control method and system based on data security

    CN121681124A