Method and device for verifying integrity of backup data of equipment, equipment and medium
The backup data of the power end edge device is calculated in blocks through the preset hash algorithm, which solves the problem that the error data cannot be accurately positioned in the prior art, and achieves high security and accurate data verification.
Patent Information
- Application Number
- CN202411889657.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, when verifying the integrity of backup data of power end-side equipment, the error data cannot be accurately located, and manual verification is required to find the error data.
The preset hash algorithm is used to calculate the original data and backup data of the power edge device in blocks, obtain the first hash value and the second hash value, and determine the integrity verification result of the backup data through the comparison results.
It improves the verification accuracy of power side equipment upgrade backup data, and can accurately and quickly find the location of the wrong data when there is a data error, and has high security and collision resistance.
Smart Images

Figure CN119885290A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data verification, and in particular to a method, device, equipment and medium for verifying the integrity of device backup data. Background Art
[0002] Power edge devices refer to devices deployed on edge nodes of the power system. These devices perform data processing and calculations through edge computing technology. Compared with the traditional cloud computing model, edge computing places more data processing tasks locally, reducing the need to transmit data to the cloud, thereby improving processing efficiency and response speed, while ensuring data security and privacy.
[0003] During the upgrade of power-side equipment, the data of the equipment needs to be backed up, and during the data backup process, the integrity of the backed-up data needs to be verified. The purpose of data integrity verification is mainly to detect whether there is data damage, packet loss, etc. caused by server hardware errors and other factors during the backup process, which helps managers to grasp the integrity information of the backup data.
[0004] The current method for verifying the integrity of backup data is: before sending at the sending end, first verify the entire block of data to obtain a verification value; after receiving the data at the receiving end, verify the entire block of data again to obtain another verification value, and compare whether the two verification values are consistent: if so, the data is considered complete and there is no error in the data transmission process; otherwise, the data is considered incomplete, that is, there is an error in the data transmission process. Although this verification process is simple and fast, it can only verify the data as a whole. When an error occurs in the data, it is impossible to accurately locate the erroneous data, and personnel are required to check the overall data before finding the erroneous data. Summary of the invention
[0005] The present invention provides a method, device, equipment and medium for checking the integrity of equipment backup data, so as to improve the checking accuracy of upgraded backup data of power edge equipment.
[0006] According to one aspect of the present invention, a method for verifying the integrity of device backup data is provided, comprising:
[0007] Before the power edge device is upgraded, the original data in the power edge device is acquired;
[0008] Calculate the original data based on a preset hash algorithm to obtain a first hash value;
[0009] After the power end-side device is upgraded, the backup data in the upgraded power end-side device is obtained;
[0010] Calculate the backup data based on the preset hash algorithm to obtain a second hash value;
[0011] Determine the integrity check result of the backup data according to the comparison result of the first Hash value and the second Hash value;
[0012] The preset hash algorithm is calculated based on the block results of the original data and the backup data.
[0013] According to another aspect of the present invention, there is provided a device for checking the integrity of device backup data, comprising:
[0014] The original data acquisition module is used to acquire the original data in the power edge device before the power edge device is upgraded;
[0015] A first hash value calculation module, used to calculate the original data based on a preset hash algorithm to obtain a first hash value;
[0016] A backup data acquisition module is used to acquire the backup data in the upgraded power end-side device after the power end-side device is upgraded;
[0017] A second hash value calculation module, used to calculate the backup data based on the preset hash algorithm to obtain a second hash value;
[0018] an integrity verification module, configured to determine an integrity verification result of the backup data according to a comparison result of the first Hash value and the second Hash value;
[0019] The preset hash algorithm is calculated based on the block results of the original data and the backup data.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] at least one processor; and
[0022] a memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the device backup data integrity verification method described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the device backup data integrity verification method described in any embodiment of the present invention when executed.
[0025] The technical solution of the embodiment of the present invention adopts a preset hash algorithm to verify the backup data in the process of upgrading the power edge equipment. Compared with the existing verification method, it has high security: the preset hash algorithm provides a high security protection for the input data; even if there is a slight change in the input data, it will cause a completely different hash value to be generated; strong anti-collision: the preset hash algorithm has a high anti-collision ability, and it is extremely difficult to find two different inputs that obtain the same hash value; this means that even if the input data is very large, the uniqueness of the hash value can be guaranteed; fast calculation: the process calculation of the preset hash algorithm is not complicated, and the calculation speed is relatively fast, which is suitable for the verification of large-scale data; thereby, the backup data in the process of upgrading the power edge equipment can be checked in a segmented manner, and then when an error occurs in the data, the location of the erroneous data can be accurately and quickly found.
[0026] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 is a flow chart of a method for checking the integrity of device backup data provided according to an embodiment of the present invention;
[0029] Figure 2 It is a structural schematic diagram of a device for verifying the integrity of device backup data provided according to an embodiment of the present invention;
[0030] Figure 3 It is a structural schematic diagram of an electronic device for implementing the device backup data integrity verification method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "candidate", "target", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] Figure 1 A flowchart of a method for checking the integrity of device backup data is provided for an embodiment of the present invention. This embodiment is applicable to the case where the integrity of the upgraded backup data of the power terminal device is checked. The method can be executed by a device backup data integrity check device. The device backup data integrity check device can be implemented in the form of hardware and / or software. The device backup data integrity check device can be configured in a server with computing capabilities. Figure 1 As shown, the method includes:
[0034] S110. Before upgrading the power edge device, the original data in the power edge device is acquired.
[0035] The way to obtain the original data of the power edge equipment is to directly connect the power edge equipment to the data acquisition equipment through the physical interface RS232 / 485 to realize real-time reading and transmission of data. This method has the advantages of stable transmission and accurate data, and is especially suitable for production environments with high real-time requirements.
[0036] S120: Calculate the original data based on a preset hash algorithm to obtain a first hash value.
[0037] The preset hash algorithm is calculated based on the block results of the original data and the backup data.
[0038] Specifically, the original data is divided into blocks to obtain multiple original data blocks. Based on the initial hash value, the first original data block is iteratively calculated multiple times to determine the updated hash value of the first original data block; based on the updated hash value, the subsequent original data blocks are iteratively calculated multiple times in sequence to respectively determine the updated hash values of the subsequent original data blocks; the updated hash value corresponding to the last original data block is used as the first hash value. The initial hash value can be determined according to the actual scenario and is not limited here.
[0039] In a feasible embodiment, calculating the original data based on a preset hash algorithm to obtain a first hash value includes:
[0040] The original data is padded according to the data length of the original data to obtain updated original data;
[0041] Divide the updated original data into blocks to obtain multiple original data blocks;
[0042] Based on the initial hash value, performing multiple iterative calculations on the first original data block to determine an updated hash value of the first original data block;
[0043] Based on the updated hash value, multiple iterative calculations are performed on subsequent original data blocks in sequence to respectively determine updated hash values of subsequent original data blocks;
[0044] The updated hash value corresponding to the last original data block is used as the first hash value.
[0045] In order to increase the complexity of determining the corresponding hash value for the original data block, the original data is first padded to increase the complexity of the updated original data, thereby improving the anti-collision ability of the hash value.
[0046] Specifically, the original data is padded so that the final length of the updated original data is a multiple of 512 bits; the original data is divided into blocks in units of 512 bits to obtain M 1 , M 2 , …M N Based on the initial hash value, M 1 Perform multiple iterations to obtain M 1 The corresponding updated hash value; based on M 1 The corresponding updated hash value for M 2 Perform multiple iterations to obtain M 2 The corresponding updated hash value is obtained by continuously calculating the updated hash value of the next original data block according to the updated hash value of the previous original data block. N The corresponding updated hash value is used as the first hash value, and the updated hash value corresponding to each original data block is recorded at the same time.
[0047] In a feasible embodiment, the original data is padded according to the data length of the original data to obtain updated original data, including:
[0048] Determine the length of the padding data according to the data length of the original data;
[0049] The original data is padded according to the length-padded data to obtain updated original data.
[0050] Assuming that the binary encoding length of the original data is l bits, add the binary representation of l after the above character string to obtain the updated original data.
[0051] In a feasible embodiment, the original data is padded according to the length-padded data to obtain updated original data, including:
[0052] The original data is padded according to the length padded data to determine the encoding byte length of the original data after the padded data;
[0053] If the encoded byte length is not an integer multiple of the preset data block byte length, secondary padding is performed before the length-padded data in the padded original data until the encoded byte length of the original data after the secondary padding is an integer multiple of the preset data block byte length, thereby obtaining the updated original data.
[0054] Since the length of the original data after the padding corresponding to the padding length on the original data is not a multiple of 512, the original data needs to be padded twice. The secondary padding method is to first pad 1, and then pad k 0s, where k is the smallest non-negative integer of the following equation: l+1+k≡448mod512.
[0055] Exemplarily, the original data is complemented, and the data length is appended at the end of the last data block to represent the length of the original data (in bits) in the form of a 64-bit big-endian integer. Next, the original data is padded twice, and the first bit is padded to 1 before the length padded data, and then all are padded to 0 until the length of the original data meets the multiple of 512. The original data is divided into several 512-bit (64-byte) data blocks. The last data block may be less than 512 bits. If the length of the last data block is less than 448 bits (56 bytes), a padding bit 1 (i.e., 0x80) is directly added to the end of the data block. If the length of the last data block is greater than or equal to 448 bits (56 bytes), an additional data block needs to be added. Add a padding bit 1 (i.e., 0x80) at the beginning of the additional data block.
[0056] This padding method ensures that the length of the input data meets the subsequent calculation requirements of the preset hash algorithm, and can uniquely identify the length information of the original data, thereby improving the complexity of the updated original data.
[0057] In a feasible embodiment, based on the initial hash value, performing multiple iterative calculations on the first original data block to determine an updated hash value of the first original data block includes:
[0058] Determine, according to the first original data block, a preset iteration number of extended message blocks corresponding to the first original data block;
[0059] An updated hash value of the first original data block is obtained through a preset hash function according to an initial hash value, a preset iteration number of extended message blocks and a preset key.
[0060] Specifically, the extended message block is used to expand the content in each original data block, and is obtained according to the content in the original data block through a preset logical change to increase the complexity of the updated hash value corresponding to each original data block. Exemplarily, the first original data block is further divided, and the logical relationship between the divided message blocks is calculated to obtain a preset number of iterative extended message blocks. The specific logical relationship can be determined according to the actual scenario and is not limited here.
[0061] The preset hash function refers to the representation of the computational logic relationship between the initial hash value, a preset number of iterations of extended message blocks, and a preset key, and can also be determined according to actual scenarios and is not limited here.
[0062] Exemplarily, the first iteration hash value of the first original data block is determined according to the initial hash value, the first extended message block and the preset key, the second iteration hash value of the first original data block is determined according to the first iteration hash value, the second extended message block and the preset key, and according to the iterative process, the preset iteration number minus one iteration hash value, the preset iteration number extended message block and the preset key are used to determine the preset iteration number hash value of the first original data block as the updated hash value. The preset key can be set to a different value in each iterative calculation process, and can be set according to actual conditions, which is not limited here. One specific example of the preset hash function is shown below.
[0063] In a feasible embodiment, determining, according to the first original data block, a preset iteration number of extended message blocks corresponding to the first original data block includes:
[0064] Dividing the first original data block to obtain a first number of extended message blocks;
[0065] According to a preset extension logic, a first number of extended message blocks are processed to obtain a second number of extended message blocks; wherein the sum of the first number and the second number is a preset iteration number.
[0066] Specifically, the first original data block is divided into equal parts to obtain a first number of extended message blocks, and the remaining extended message blocks are obtained by performing logical calculations on extended message blocks at predetermined positions in the first number of extended message blocks to increase the complexity of the extended message blocks.
[0067] Exemplarily, the first 32 bits of the first original data block are represented as: M0(1), the second 32 bits are represented as: M1(1), and so on, and the last 32 bits are represented as: M15(1).
[0068] The first original data block of 512 bits is equally divided into 16 32-bit extended message blocks, denoted as W[0] to W
[15] . An additional 48 extended message blocks are generated from W
[16] to W
[63] and calculated using the following preset extended logic:
[0069] For each value of i from 0 to 15, W[i] = Mi(1);
[0070] For each value of i from 16 to 63, calculate W[i] = σ1(W[i-2]) + W[i-7] + σ0(W[i-15]) + W[i-16];
[0071] Among them, the σ0 function is expressed as σ0(x)=(x right circular shift 7 bits)⊕(x right circular shift 18 bits)⊕(x right shift 3 bits); the σ1 function is expressed as: σ1(x)=(x right circular shift 17 bits)⊕(x right circular shift 19 bits)⊕(x right shift 10 bits); Wt=σ1(Wt-2)+Wt-7+σ1(Wt-15)+Wt-16.
[0072] Through this process, starting from the 16 initial extended message blocks, an additional 48 extended message blocks are generated, totaling 64 extended message blocks, so that each original data block contains 64 words.
[0073] Exemplarily, the specific process of iteratively updating the hash value includes: dividing the original data after padding into blocks of 512 bits: M(1), M(2), ..., M(N), wherein the first 32 bits of the i-th data block are represented as: M0(i), the second 32 bits are: M1(i), and so on, and the last 32-bit data block can be represented as: M15(i). An additional 48 words are generated in the 512-bit data block, for a total of 64 words, and these additional words are used to increase the complexity of the data and are mixed with the initial hash value to increase the security of the hash algorithm.
[0074] Each 512-bit original data block is divided into 16 32-bit extended message blocks, recorded as W[0] to W
[15] , and an additional 48 extended message blocks are generated from W
[16] to W
[63] , calculated using the following formula:
[0075] For each value of i from 16 to 63, calculate W[i] = σ1(W[i-2]) + W[i-7] + σ0(W[i-15]) + W[i-16];
[0076] Among them, the σ0 function is expressed as σ0(x)=(x right circular shift 7 bits)⊕(x right circular shift 18 bits)⊕(x right shift 3 bits); the σ1 function is expressed as: σ1(x)=(x right circular shift 17 bits)⊕(x right circular shift 19 bits)⊕(x right shift 10 bits); Wt=σ1(Wt-2)+Wt-7+σ1(Wt-15)+Wt-16.
[0077] Through this process, starting from the 16 initial extended message blocks, an additional 48 extended message blocks are generated, totaling 64 extended message blocks, so that each original data block contains 64 words.
[0078] It should be noted that the data expansion process is only performed at the beginning of each data block processing. The subsequent iterative calculations no longer use the results of message expansion, but use the previously calculated words and register values for mixing and updating. Data expansion is mainly used to increase the complexity of data and introduce more changes and randomness, providing better diffusion properties during hash calculations.
[0079] Iterative calculation, performs 64 rounds of iterative calculation on each original data block, uses different constants and words, and updates the hash value in the hash value storage register through logical and bit operations.
[0080] Assuming that the original data M can be decomposed into N blocks, the preset hash algorithm needs to complete N iterations, and the result of N iterations is the final hash value. Each iteration also includes the intermediate iteration process for each original data. That is, a 256-bit digital summary, an initial value H0 of a 256-bit summary, is calculated after the first data block to obtain H1, that is, the first iteration is completed, H1 is calculated after the second data block to obtain H2, ..., and processed in sequence, and finally Hn is obtained, which is the final 256-bit data summary.
[0081] Specifically, the iterative calculation process is as follows:
[0082] Initialization: Initialize 8 32-bit registers (a, b, c, d, e, f, g, h) to fixed initial values, i.e., initial hash values;
[0083] Iterative calculation, 64 rounds of loop calculation are performed on each original data block, each round of calculation uses different words and constants, and in each round of iteration, the register value and word arrangement are updated;
[0084] The calculation of the i-th iteration includes the following steps:
[0085] Define a preset key K[i] used in the i-th round, where the preset key is a constant and is determined according to predefined data; define a word W[i] used in the i-th round, which is the i-th extended data block in the 64 extended message blocks generated by data extension of the original data block;
[0086] Perform a series of logical and bit operations to update the register value;
[0087] The calculation steps for each round of iteration using the preset hash function are as follows:
[0088] T1=h+Σ1(e)+Ch(e,f,g)+K[i]+W[i], where + represents 32-bit modulo 2^32 addition;
[0089] Among them, the Σ1 function is expressed as: The selection function is expressed as:
[0090] T2=Σ0(a)+Maj(a,b,c), where the Σ0 function is expressed as: Σ0(x)=(x right circularly shifted by 2 bits)⊕(x right circularly shifted by 13 bits)⊕(x right circularly shifted by 22 bits); the majority function is expressed as: Maj(x,y,z)=(x∧y)⊕(x∧z)⊕(y∧z).
[0091] The value of the hash value register is updated according to the value calculated in this round of iteration: h=g, g=f, f=e, e=d+T1, d=c, c=b, b=a, a=T1+T2, so as to calculate the next iteration process according to the iteratively updated hash value.
[0092] In the final output process, the hash value register values after the last round of iteration are concatenated together to form a 256-bit 32-byte hash value as the first hash value.
[0093] Each original data block determines the corresponding updated hash value according to the generation of the extended message block and the iterative calculation of the hash value, until the last iteration of the last original data block is calculated to obtain the final first hash value.
[0094] S130: After the power end-side device is upgraded, the backup data in the upgraded power end-side device is obtained.
[0095] The way to obtain the backup data of the power edge equipment is to directly connect the upgraded power edge equipment to the data acquisition equipment through the physical interface RS232 / 485 to realize real-time reading and transmission of data. This method has the advantages of stable transmission and accurate data, and is especially suitable for production environments with high real-time requirements.
[0096] S140: Calculate the backup data based on a preset hash algorithm to obtain a second hash value.
[0097] The backup data is calculated using the same preset hash algorithm to obtain a second hash value corresponding to the backup data. The calculation process is the same as the calculation process of the first hash value, and will not be repeated here.
[0098] In a feasible embodiment, the backup data is calculated based on a preset hash algorithm to obtain a second hash value, including:
[0099] The backup data is padded according to the data length of the backup data to obtain updated backup data;
[0100] Divide the updated backup data into blocks to obtain multiple backup data blocks;
[0101] Based on the initial hash value, performing multiple iterative calculations on the first backup data block to determine an updated hash value of the first backup data block;
[0102] Based on the updated hash value, multiple iterative calculations are performed on the subsequent backup data blocks in sequence to respectively determine the updated hash values of the subsequent backup data blocks;
[0103] The updated hash value corresponding to the last backup data block is used as the second hash value.
[0104] The specific calculation process of the preset hash algorithm can refer to the calculation process of the first hash value, which will not be repeated here.
[0105] S150: Determine the integrity check result of the backup data according to the comparison result of the first Hash value and the second Hash value.
[0106] If the first hash value is the same as the second hash value, the integrity check result of the backup data is determined to be complete. Specifically, when determining the first hash value, the updated hash value corresponding to each original data block is recorded, and when determining the second hash value, the updated hash value corresponding to each backup data block is recorded, and the integrity check result of each backup data block is determined based on the comparison result of the updated hash value corresponding to each original data block and the updated hash value corresponding to the corresponding backup data block, and the position of the erroneous data can be accurately located based on the integrity check result of each backup data block.
[0107] The technical solution of the embodiment of the present invention adopts a preset hash algorithm to verify the backup data in the process of upgrading the power edge equipment. Compared with the existing verification method, it has high security: the preset hash algorithm provides a high security protection for the input data; even if there is a slight change in the input data, it will cause a completely different hash value to be generated; strong anti-collision: the preset hash algorithm has a high anti-collision ability, and it is extremely difficult to find two different inputs that obtain the same hash value; this means that even if the input data is very large, the uniqueness of the hash value can be guaranteed; fast calculation: the process calculation of the preset hash algorithm is not complicated, and the calculation speed is relatively fast, which is suitable for the verification of large-scale data; thereby, the backup data in the process of upgrading the power edge equipment can be checked in a segmented manner, and then when an error occurs in the data, the location of the erroneous data can be accurately and quickly found.
[0108] Figure 2 This is a schematic diagram of the structure of a device backup data integrity verification device provided by Embodiment 2 of the present invention. Figure 2 As shown, the device comprises:
[0109] The original data acquisition module 210 is used to acquire the original data in the power edge device before the power edge device is upgraded;
[0110] A first hash value calculation module 220, configured to calculate the original data based on a preset hash algorithm to obtain a first hash value;
[0111] The backup data acquisition module 230 is used to acquire the backup data in the upgraded power edge device after the power edge device is upgraded;
[0112] A second hash value calculation module 240, configured to calculate the backup data based on the preset hash algorithm to obtain a second hash value;
[0113] An integrity check module 250, configured to determine an integrity check result of the backup data according to a comparison result of the first hash value and the second hash value;
[0114] The preset hash algorithm is calculated based on the block results of the original data and the backup data.
[0115] The technical solution of the embodiment of the present invention adopts a preset hash algorithm to verify the backup data in the process of upgrading the power edge equipment. Compared with the existing verification method, it has high security: the preset hash algorithm provides a high security protection for the input data; even if there is a slight change in the input data, it will cause a completely different hash value to be generated; strong anti-collision: the preset hash algorithm has a high anti-collision ability, and it is extremely difficult to find two different inputs that obtain the same hash value; this means that even if the input data is very large, the uniqueness of the hash value can be guaranteed; fast calculation: the process calculation of the preset hash algorithm is not complicated, and the calculation speed is relatively fast, which is suitable for the verification of large-scale data; thereby, the backup data in the process of upgrading the power edge equipment can be checked in a segmented manner, and then when an error occurs in the data, the location of the erroneous data can be accurately and quickly found.
[0116] Optionally, the first hash value calculation module includes:
[0117] An original data padding unit, used for padding the original data according to the data length of the original data to obtain updated original data;
[0118] An original data block division unit, used for dividing the updated original data into blocks to obtain a plurality of original data blocks;
[0119] an initial hash value calculation unit, configured to perform multiple iterative calculations on the first original data block based on the initial hash value to determine an updated hash value of the first original data block;
[0120] A subsequent hash value calculation unit, configured to perform multiple iterative calculations on subsequent original data blocks in sequence based on the updated hash value, and respectively determine updated hash values of subsequent original data blocks;
[0121] The first Hash value determining unit is configured to use the updated Hash value corresponding to the last original data block as the first Hash value.
[0122] Optionally, the original data padding unit includes:
[0123] A length padding data determining subunit, used to determine the length padding data according to the data length of the original data;
[0124] The original data padding subunit is used to pad the original data according to the length padding data to obtain updated original data.
[0125] Optionally, the original data padding subunit is specifically used for:
[0126] The original data is padded according to the length-padded data to determine the encoded byte length of the original data after the padded data;
[0127] If the encoded byte length is not an integer multiple of the preset data block byte length, secondary padding is performed before the length-padded data in the padded original data until the encoded byte length of the original data after the secondary padding is an integer multiple of the preset data block byte length, thereby obtaining the updated original data.
[0128] Optionally, an initial hash value calculation unit includes:
[0129] an extended message block determining subunit, configured to determine, according to the first original data block, a preset iteration number of extended message blocks corresponding to the first original data block;
[0130] The hash value updating subunit is used to obtain an updated hash value of the first original data block according to the initial hash value, a preset iteration number of extended message blocks and a preset key through a preset hash function.
[0131] Optionally, the extended message block determines the subunit, specifically used for:
[0132] Dividing the first original data block to obtain a first number of extended message blocks;
[0133] The first number of extended message blocks are processed according to a preset extension logic to obtain a second number of extended message blocks; wherein the sum of the first number and the second number is a preset iteration number.
[0134] Optionally, the second hash value calculation module is specifically used to:
[0135] Filling the backup data according to the data length of the backup data to obtain updated backup data;
[0136] Dividing the updated backup data into blocks to obtain multiple backup data blocks;
[0137] Based on the initial hash value, performing multiple iterative calculations on the first backup data block to determine an updated hash value of the first backup data block;
[0138] Based on the updated hash value, performing multiple iterative calculations on subsequent backup data blocks in sequence to respectively determine updated hash values of subsequent backup data blocks;
[0139] The updated hash value corresponding to the last backup data block is used as the second hash value.
[0140] The device for verifying the integrity of device backup data provided by the embodiment of the present invention can execute the device backup data integrity verification method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0141] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations and do not violate public order and good morals.
[0142] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0143] Figure 3 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0144] like Figure 3 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0145] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0146] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a method for checking the integrity of device backup data.
[0147] In some embodiments, the method for determining the parameters for extracting liquid from an oil field during a high water cut period can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps in the method for determining the parameters for extracting liquid from an oil field during a high water cut period described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute the method for determining the parameters for extracting liquid from an oil field during a high water cut period by any other appropriate means (e.g., by means of firmware).
[0148] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific reference products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0149] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0150] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0151] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0152] The systems and techniques described herein may be implemented in a computing system that includes a backend component (e.g., as a data server), or a computing system that includes a switch component (e.g., an application server), or a computing system that includes a frontend component (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, switch components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0153] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0154] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0155] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for checking the integrity of device backup data, characterized in that: The method includes: Before the power edge device is upgraded, the original data in the power edge device is acquired; Calculate the original data based on a preset hash algorithm to obtain a first hash value; After the power end-side device is upgraded, the backup data in the upgraded power end-side device is obtained; Calculate the backup data based on the preset hash algorithm to obtain a second hash value; Determine the integrity check result of the backup data according to the comparison result of the first Hash value and the second Hash value; The preset hash algorithm is calculated based on the block results of the original data and the backup data.
2. The method according to claim 1, characterized in that Calculating the original data based on a preset hash algorithm to obtain a first hash value includes: Filling the original data according to the data length of the original data to obtain updated original data; Dividing the updated original data into blocks to obtain multiple original data blocks; Based on the initial hash value, performing multiple iterative calculations on the first original data block to determine an updated hash value of the first original data block; Based on the updated hash value, performing multiple iterative calculations on subsequent original data blocks in sequence to respectively determine updated hash values of subsequent original data blocks; The updated hash value corresponding to the last original data block is used as the first hash value.
3. The method according to claim 2, characterized in that The original data is padded according to the data length of the original data to obtain updated original data, including: Determine the length-filling data according to the data length of the original data; The original data is padded according to the length-padded data to obtain updated original data.
4. The method according to claim 3, characterized in that The original data is padded according to the length-padded data to obtain updated original data, including: The original data is padded according to the length-padded data to determine the encoded byte length of the original data after the padded data; If the encoded byte length is not an integer multiple of the preset data block byte length, secondary padding is performed before the length-padded data in the padded original data until the encoded byte length of the original data after the secondary padding is an integer multiple of the preset data block byte length, thereby obtaining the updated original data.
5. The method according to claim 2, characterized in that: Based on the initial hash value, performing multiple iterative calculations on the first original data block to determine an updated hash value of the first original data block includes: Determine, according to the first original data block, a preset iteration number of extended message blocks corresponding to the first original data block; An updated hash value of the first original data block is obtained through a preset hash function according to the initial hash value, a preset iteration number of extended message blocks and a preset key.
6. The method according to claim 5, characterized in that Determining, according to the first original data block, a preset iteration number of extended message blocks corresponding to the first original data block, comprising: Dividing the first original data block to obtain a first number of extended message blocks; The first number of extended message blocks are processed according to a preset extension logic to obtain a second number of extended message blocks; wherein the sum of the first number and the second number is a preset iteration number.
7. The method according to claim 1, characterized in that Calculating the backup data based on the preset hash algorithm to obtain a second hash value includes: Filling the backup data according to the data length of the backup data to obtain updated backup data; Dividing the updated backup data into blocks to obtain multiple backup data blocks; Based on the initial hash value, performing multiple iterative calculations on the first backup data block to determine an updated hash value of the first backup data block; Based on the updated hash value, performing multiple iterative calculations on subsequent backup data blocks in sequence to respectively determine updated hash values of subsequent backup data blocks; The updated hash value corresponding to the last backup data block is used as the second hash value.
8. A device for checking the integrity of device backup data, characterized in that: The device includes: The original data acquisition module is used to acquire the original data in the power edge device before the power edge device is upgraded; A first hash value calculation module, used to calculate the original data based on a preset hash algorithm to obtain a first hash value; A backup data acquisition module is used to acquire the backup data in the upgraded power end-side device after the power end-side device is upgraded; A second hash value calculation module, used to calculate the backup data based on the preset hash algorithm to obtain a second hash value; an integrity verification module, configured to determine an integrity verification result of the backup data according to a comparison result of the first Hash value and the second Hash value; The preset hash algorithm is calculated based on the block results of the original data and the backup data.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the device backup data integrity verification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the device backup data integrity verification method according to any one of claims 1 to 7 when executed.