Data processing method and device
The hash sequence and preset mapping algorithm are generated, and combined with blockchain system verification, the problem of insufficient computing power of IoT devices is solved, and data integrity is guaranteed under low computing resource consumption is achieved.
Patent Information
- Application Number
- CN202210760109.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-06-30
AI Technical Summary
The prior art requires a large amount of computing resources to generate data signatures in IoT devices, especially for battery-powered sensor devices, which lack computing power and cannot effectively ensure the integrity of business data.
Generate digital signatures through hash sequence calculation and preset mapping algorithms, and use the blockchain system to perform data verification, avoid performing complex cryptographic algorithms, and perform only simple hash calculations to generate and verify data signatures.
Without increasing computing resource consumption, ensure the integrity of business data and be able to effectively verify the integrity of data signatures in the blockchain system.
Smart Images

Figure CN115150095B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of computers, and more particularly, to a data processing method and apparatus. Background Art
[0002] Currently, Public Key Infrastructure (PKI) is commonly used to generate and verify digital signatures for business data. This requires devices to have strong computing power to execute complex cryptographic algorithms, or to be equipped with specific cryptographic accelerators to run related cryptographic algorithm components.
[0003] We hope to have a new technical solution to reduce the consumption of computing resources while ensuring data completeness. Summary of the Invention
[0004] One or more embodiments of this specification provide a data processing method and apparatus.
[0005] In a first aspect, a data processing method is provided. The method is executed by a first device and is used to process K-th business data obtained by the first device. The method includes: obtaining a Kth hash sequence corresponding to a Kth random number and a K+1th hash sequence corresponding to a K+1th random number, wherein a single hash sequence includes C hash values, the first hash value is calculated based on the random number corresponding to it, and any other i-th hash value is calculated based on its previous hash value; calculating a first hash value of the Kth business data, and calculating a second hash value based on the first hash value and the Cth hash value in the K+1th hash sequence; mapping the second hash value to a plurality of first numerical values arranged in sequence using a preset mapping algorithm, obtaining a plurality of target hash values corresponding to the plurality of first numerical values from the Kth hash sequence, and generating a digital signature of the Kth business data, which includes the plurality of target hash values arranged in sequence; and sending a Kth first transaction and a K+1th second transaction to a blockchain system, wherein the Kth first transaction includes the Kth business data and the digital signature, and the K+1th second transaction includes the Cth hash value in the K+1th hash sequence.
[0006] In one possible implementation, the second hash value is mapped into several first numerical values arranged in sequence using a preset mapping algorithm, including: determining several sub-bit sequences of length t and arranged in sequence based on the bit sequence used to represent the second hash value, and converting the several sub-bit sequences into several first numerical values represented by decimal numbers.
[0007] In a possible implementation, the target hash value corresponding to the first numerical value d is the d+1th hash value in the Kth hash sequence.
[0008] In a possible implementation, the target hash value corresponding to the first numerical value of d is the Mth hash value in the Kth hash sequence, where M is a result of taking the modulus of d+1+m using C, and m is a preset integer.
[0009] In a possible implementation, the first device is an IoT device, and the K-th service data is service-related data collected by the IoT device through a sensor.
[0010] In a second aspect, a data processing method is provided, which is executed by a second device, the second device being connected to a blockchain system, wherein the blockchain system stores a Kth first transaction, a Kth second transaction, and a K+1th second transaction from a first device, wherein the Kth first transaction includes Kth business data and its digital signature, wherein the digital signature includes a plurality of target hash values arranged in sequence. The method comprises: calculating a third hash value of the Kth business data, and calculating a fourth hash value based on the third hash value and the hash value included in the K+1th second transaction; mapping the second hash value to a plurality of second values arranged in sequence using a preset mapping algorithm; for any fth target hash value, verifying the integrity of the fth target hash value based on the fth second value and the hash value included in the Kth second transaction; and determining that the digital signature has passed verification when all of the plurality of target hash values pass integrity verification.
[0011] In one possible implementation, the fourth hash value is mapped into several second numerical values arranged in sequence using a preset mapping algorithm, including: determining several sub-bit sequences of length t and arranged in sequence based on the bit sequence used to represent the fourth hash value, and converting the several sub-bit sequences into several second numerical values represented by decimal numbers.
[0012] In a possible implementation, verifying the integrity of the f-th target hash value based on the f-th second value and the hash value included in the K-th second transaction includes: calculating Cd-1 hash values arranged in sequence, wherein the first hash value of the Cd-1 hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, and d is the f-th second value; when the Cd-1-th hash value of the Cd-1 hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
[0013] In one possible implementation, verifying the integrity of the f-th target hash value based on the f-th second value and the hash value included in the K-th second exchange includes: calculating CM hash values arranged in sequence, wherein the first hash value of the CM hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, M is the result of taking the modulus of d+1+m using C, d is the f-th second value, and m is a preset integer; when the CM-th hash value of the CM hash values is the same as the hash value included in the K-th second exchange, it is determined that the integrity verification of the f-th target hash value has passed.
[0014] According to a third aspect, a data processing device is provided, which is deployed in a first device and is used to process the K-th business data obtained by the first device. The device includes: a sequence processing unit, configured to obtain the K-th hash sequence corresponding to the K-th random number and the K+1-th hash sequence corresponding to the K+1-th random number, wherein a single hash sequence includes C hash values, the first hash value is calculated based on the random number corresponding to it, and any other i-th hash value is calculated based on its previous hash value; a hash calculation unit, configured to calculate the first hash value of the K-th business data, and calculate the second hash value based on the first hash value and the C-th hash value in the K+1-th hash sequence; a signature processing unit, configured to use The preset mapping algorithm maps the second hash value into several first numerical values arranged in sequence, obtains several target hash values corresponding to the several first numerical values from the Kth hash sequence, and generates a digital signature of the Kth business data, which includes the several target hash values arranged in sequence; the transaction sending unit is configured to send the Kth first transaction and the K+1th second transaction to the blockchain system, the Kth first transaction includes the Kth business data and the digital signature, and the K+1th second transaction includes the Cth hash value in the K+1th hash sequence.
[0015] In a possible implementation, the signature processing unit is configured to determine a plurality of sub-bit sequences of length t arranged in sequence based on the bit sequence used to represent the second hash value, and convert the plurality of sub-bit sequences into a plurality of first numerical values represented by decimal numbers.
[0016] In a possible implementation, the target hash value corresponding to the first numerical value d is the d+1th hash value in the Kth hash sequence.
[0017] In a possible implementation, the target hash value corresponding to the first numerical value of d is the Mth hash value in the Kth hash sequence, where M is a result of taking the modulus of d+1+m using C, and m is a preset integer.
[0018] In a possible implementation, the first device is an IoT device, and the K-th service data is service-related data collected by the IoT device through a sensor.
[0019] In a fourth aspect, a data processing apparatus is provided, which is deployed in a second device, the second device being connected to a blockchain system, wherein the blockchain system stores a Kth first transaction, a Kth second transaction, and a K+1th second transaction from a first device, wherein the Kth first transaction includes Kth business data and its digital signature, wherein the digital signature includes a plurality of target hash values arranged in sequence. The apparatus comprises: a hash calculation unit configured to calculate a third hash value of the Kth business data and calculate a fourth hash value based on the third hash value and the hash value included in the K+1th second transaction; a mapping processing unit configured to map the second hash value to a plurality of second values arranged in sequence using a preset mapping algorithm; a hash verification unit configured to verify the integrity of any fth target hash value based on the fth second value and the hash value included in the Kth second transaction; and a signature verification unit configured to determine that the digital signature has passed verification when all of the plurality of target hash values pass integrity verification.
[0020] In a possible implementation, the mapping processing unit is configured to determine a plurality of sub-bit sequences of length t arranged in sequence based on the bit sequence used to represent the fourth hash value, and convert the plurality of sub-bit sequences into a plurality of second numerical values represented by decimal numbers.
[0021] In a possible implementation, the hash verification unit is configured to calculate Cd-1 hash values arranged in sequence, wherein the first hash value among the Cd-1 hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, and d is the f-th second value; when the Cd-1-th hash value among the Cd-1 hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
[0022] In a possible implementation, the hash verification unit is configured to calculate CM hash values arranged in sequence, wherein the first hash value among the CM hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, M is the result of using C to modulo d+1+m, d is the f-th second value, and m is a preset integer; when the CM-th hash value among the CM hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
[0023] In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computing device, the computing device implements the method described in any one of the first aspect and the second aspect.
[0024] In a sixth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any one of the first and second aspects is implemented.
[0025] Through the methods and devices provided in one or more embodiments of this specification, in the process of the first device obtaining the digital signature of the K-th business data, the algorithm process performed is mainly a relatively simple hash calculation, and a more complex cryptographic algorithm is not executed. The computing resources required are relatively low, and the first device is not required to have good computing capabilities. Moreover, the digital signature of the K-th business data can be used to accurately verify the integrity of the K-th business data. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of this specification, 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 any creative work.
[0027] Figure 1 A system framework diagram of the technical solution provided in the embodiments of this specification;
[0028] Figure 2 This is one of the flow charts of a data processing method provided in the embodiments of this specification;
[0029] Figure 3 This is a schematic diagram of a process for generating a digital signature provided exemplarily in the embodiments of this specification;
[0030] Figure 4 This is a second flow chart of a data processing method provided in an embodiment of this specification;
[0031] Figure 5 This is one of the schematic diagrams of a data processing device provided in the embodiments of this specification;
[0032] Figure 6 This is the second schematic diagram of a data processing device provided in the embodiments of this specification. DETAILED DESCRIPTION
[0033] The following describes in detail various non-limiting embodiments provided in this specification in conjunction with the accompanying drawings.
[0034] When using PKI to generate and verify digital signatures for business data, it requires computational processes such as modular inverse operations, which consume a large amount of computing resources. This typically requires the device to have strong computing power to execute more complex cryptographic algorithms, or to be equipped with a specific cryptographic accelerator to run the relevant cryptographic algorithm components. However, for some Internet of Things (IoT) devices, especially battery-powered sensor IoT devices, their microcontrollers often lack sufficient computing power and are not equipped with additional cryptographic accelerators. However, the business data collected by these IoT devices is often relatively important. For example, business data may be carbon emission-related data, photovoltaic power generation-related data, cold chain temperature and humidity data, and other business-related data collected by IoT devices through sensors. Therefore, designing a digital signature scheme for these IoT devices that does not consume excessive computing resources while ensuring the integrity of business data has become an urgent problem to be solved.
[0035] Figure 1 This is a system framework diagram of the technical solution provided in the embodiments of this specification. Figure 1 As shown, a blockchain system is a distributed network built with multiple nodes. Any two nodes can communicate at the application layer through a peer-to-peer (P2P) network. Other terminals, such as Device 1, Device 2, and Device 3, can connect to the blockchain system through nodes in the blockchain. The blockchain system is a new application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. It packages transactions from terminal devices into blocks and combines the blocks into a chain-like data structure in a chronological order. It is a distributed ledger that is cryptographically guaranteed to be tamper-proof and unforgeable. The aforementioned terminal devices, such as Device 1, Device 2, and Device 3, can be, for example, IoT devices used in various data collection scenarios, or other computing devices used to analyze and use business data collected by IoT devices.
[0036] The following combination Figure 1The system framework shown describes in detail the technical solutions provided in the embodiments of this specification.
[0037] Figure 2 This is a flow chart of a data processing method provided in an embodiment of this specification. The method can be executed by a terminal device (first device) connected to the blockchain system and used to collect business data, such as the aforementioned IOT device. The first device can obtain multiple business data in chronological order and use the following methods in chronological order: Figure 2 The data processing method shown stores multiple business data in the blockchain system in sequence, so that other devices (second devices) connected to the blockchain system can verify the integrity of the business data or use the business data according to their own business needs. Figure 2 Only the process of the first device processing the Kth business data obtained by it is shown in FIG. Before the first device processes the first business data obtained by it, the first device can generate a first random number X1, and generate a first hash sequence P1 based on the random number X1. The hash sequence P1 can include C hash values, of which the first hash value H 1 (X1) is calculated based on the random number X1, and any i-th hash value H except the first hash value H(X1) i (X1) Based on the i-1th hash value H i-1 (X1) is calculated, and the value of C can be 2 t , the value of t can be an integer greater than 0 and can be flexibly configured according to actual business needs. Figure 2 As shown, the first device can process any K-th service data it obtains through the following steps 21 to 27.
[0038] First, in step 21 , the Kth hash sequence corresponding to the Kth random number and the K+1th hash sequence corresponding to the K+1th random number are obtained.
[0039] Similar to the aforementioned hash sequence P1, the Kth hash sequence P k And the K+1th hash sequence P k+1 Each contains C hash values. Hash sequence P k The first hash value H in 1 (X k ) Based on the Kth random number X k Calculated, divided by H 1 (X k Any i-th hash value H other than i (X k )Based on P k The i-1th hash value H in i-1 (X k) is calculated; More specifically, the i-th hash value H i (X k ) is the i-1th hash value H i-1 (X k ) Continue to perform hash operation to obtain, in other words, H i (X k )=H(H i-1 (X k )). P k+1 The first hash value H in 1 (X k+1 ) Based on the K+1th random number X k+1 Calculated, divided by H 1 (X k+1 Any i-th hash value H other than i (X k+1 )Based on P k+1 The i-1th hash value H in i-1 (X k+1 It should be noted that the K+1th random number can be generated by the first device in the process of processing the Kth service data, that is, the random number X K and its corresponding hash sequence P K It can be generated by the first device during the process of processing the K-1th service data. The first device needs to generate a random number X in step 21. K+1 And its corresponding hash sequence P K+1 In addition, it should be noted that the length of each hash value in the hash sequence can also be limited to a predetermined length.
[0040] Next, in step 23, the first hash value of the Kth business data is calculated, and the second hash value is calculated based on the first hash value and the Cth hash value in the K+1th hash sequence. For example, the first hash value H of the Kth business data is calculated 1k (Data) after that, you can splice H 1k (Data) and the Cth hash value H in the K+1th hash sequence C (X K+1 ), and then calculate the second hash value H of the splicing result 1k (T), where H 1k (Data) and H 1k (T) can be used to ensure the Kth business data and H C (X K+1 ) integrity. It should be noted that the hash algorithm executed in step 23 can be used to define the hash value obtained in the computing device to represent H 1k The length of the bit sequence of (T) is N*t, where N is an integer; of course, it is used to represent H1k The length of the bit sequence (T) may not be an integer multiple of t.
[0041] Then, in step 25, the second hash value is mapped into several first numerical values arranged in sequence using a preset mapping algorithm, several target hash values corresponding to the several first numerical values are obtained from the Kth hash sequence, and a digital signature of the Kth business data is generated, which includes several target hash values arranged in sequence.
[0042] In a possible implementation, a plurality of sub-bit sequences having a length of t and arranged in sequence may be determined based on the bit sequence used to represent the second hash value, and the plurality of sub-bit sequences may be converted into a plurality of first numerical values represented by decimal numbers.
[0043] If the length of the bit sequence used to represent the second hash value is N*t, then the bit sequence used to represent the second hash value can be divided into N sub-bit sequences arranged in sequence. Figure 3 As shown, it is assumed that the second hash value H 1k The length of the bit sequence of (T) is N*t, then the bit sequence can be divided into N1~N N In addition, a plurality of sub-bit sequences may be sequentially extracted from the bit sequence starting from the highest bit of the bit sequence used to represent the second hash value according to a set step size.
[0044] For a single sub-bit sequence, after the sub-bit sequence is converted into a first value d represented by a decimal number, for example, the hash sequence P can be converted into a first value d. K The d+1th hash value H in d+1 (X k ) is determined as the target hash value corresponding to the first value d; for example, please continue to refer to Figure 3 , assuming that the first value corresponding to the sub-bit sequence N1 is 1, then P K The second hash value H in 2 (X k ) will be determined as the corresponding target hash value, assuming that the sub-bit sequence N N The corresponding first value is 5, then P K The sixth hash value H in 6 (X k ) will be determined as the corresponding target hash value. Alternatively, the hash sequence P can be determined according to the first value d. K The Mth hash value H in M (X k ) is determined as the corresponding target hash value, where M is the result of taking the modulus of d+1+m using C, and m is a pre-set integer.
[0045] After determining the target hash values corresponding to the first values arranged in sequence, the digital signature of the K-th business data can be constructed using the target hash values arranged in sequence. Figure 3 For example, N1 to N N The target hash values corresponding to the N sub-bit sequences are sequentially concatenated to obtain the digital signature Sign(H k (T)); In other words, the digital signature Sign(H k (T)) includes N sub-bit sequences N1 to N N The corresponding N target hash values are arranged in sequence.
[0046] Finally, in step 27, the Kth first transaction and the K+1th second transaction are sent to the blockchain system. The Kth first transaction includes the Kth business data and its digital signature, and the K+1th second transaction includes the Cth hash value in the K+1th hash sequence; in other words, the Kth first transaction includes the Kth business data and its digital signature Sign (H k (T)); The K+1th second transaction includes the hash value H C (X K+1 ).
[0047] It can be seen from the above steps that the first device obtains the digital signature Sign(H k During the process of (T)), the algorithm process performed is mainly a relatively simple hash calculation, and no relatively complex cryptographic algorithm is executed. The computing resources required are relatively low, and the first device is not required to have good computing capabilities.
[0048] After completing the processing of the Kth business transaction obtained by the first device through steps 21 to 27, the blockchain system will store the Kth first transaction and the K+1th second transaction. Due to the immutability and block timing of the blockchain system, it can be guaranteed that the Kth random number obtained by the first device will only be used to support the first device to generate a digital signature once for the Kth business data it obtained. Other devices (second devices) connected to the blockchain system can verify the digital signature of the Kth business data in the Kth first transaction to determine whether the Kth business data was damaged by an intruder during its transmission to the blockchain system.
[0049] Figure 4 This is a flowchart of another data processing method provided in an embodiment of this specification. Figure 4The method shown can be performed by other devices (second devices) connected to the blockchain system. The second device can verify the integrity of the K-th business data through the signature of any K-th business data according to its own business needs. Figure 4 The process of the second device verifying the digital signature of the K-th business data is shown, in which it is particularly noted that see the aforementioned Figure 2 As can be seen from the process shown, when the blockchain system stores the Kth first transaction from the first device, the blockchain system should also store the Kth second transaction and the K+1th second transaction from the first device. The Kth first transaction should include the Kth business data and its digital signature, and the digital signature of the Kth business data includes several target hash values arranged in sequence. The second device can obtain the Kth business data and its corresponding digital signature in the Kth first transaction, as well as the hash values included in the Kth second transaction and the K+1th second transaction by sending a corresponding query request to the blockchain system, and then execute Figure 4 The following steps 41 to 47 are shown.
[0050] First, in step 41, the third hash value of the Kth business data is calculated, and the fourth hash value is calculated based on the third hash value and the hash value included in the K+1th second transaction. For example, the third hash value H of the Kth business data is calculated. 2k (Data) after that, you can splice H 2k (Data) and the hash value included in the K+1th second transaction, and then calculate the fourth hash value H of the splicing result 2k (T). It should be noted that the integrity of the Kth business data in the first transaction may be damaged by an intruder, resulting in the calculated third hash value H 2k (Data) is different from the first hash value H 1k (Data), which leads to the calculation of the fourth hash value H 2k (T) is different from the second hash value H 1k (T); In addition, the integrity of the hash value included in the second transaction may also be destroyed by the intruder and may be different from the aforementioned hash sequence P K+1 The Cth hash value H in C (X K+1 ), which leads to the calculation of the fourth hash value H 2k (T) is different from the second hash value H 1k (T).
[0051] Next, in step 43, the second Hash value is mapped into a plurality of second numerical values arranged in sequence using a preset mapping algorithm.
[0052] The preset mapping algorithm described in step 43 is the same as the preset mapping algorithm described in step 23. Accordingly, in step 43, for example, a plurality of sub-bit sequences of length t arranged in sequence may be determined based on the bit sequence used to represent the fourth hash value, and the plurality of sub-bit sequences may be converted into a plurality of second numerical values represented by decimal numbers.
[0053] Next, in step 45 , for any f-th target hash value, the integrity of the f-th target hash value is verified based on the f-th second value and the hash value included in the K-th second transaction.
[0054] If the hash sequence P is set according to the first value d in the above step 25 K The d+1th hash value H in d+1 (X k ) is determined as the target hash value corresponding to the first value d. Then, in step 45, Cd-1 hash values arranged in sequence can be calculated based on the f-th second value d and the f-th target hash value, wherein the first hash value in the Cd-1 hash values is calculated based on the f-th target hash value, and any j-th hash value other than the first hash value is calculated based on the j-1-th hash value; when the Cd-1-th hash value in the Cd-1 hash values is the same as the hash value included in the K-th second transaction, it means that the f-th target hash value is a hash value in the K-th hash sequence. In other words, the f-th target hash value is based on the K-th random number X. K The generated,fth target hash value is verified.
[0055] If the hash sequence P is set according to the first value d in the above step 25 K The Mth hash value H in M (X k ) is determined as the corresponding target hash value, where M is the result of taking the modulus of d+1+m using C, and m is a preset integer. Then, in step 45, CM hash values arranged in sequence can be calculated based on the numerical value d represented by the f-th sub-bit sequence and the f-th target hash value, where the first hash value among the CM hash values is calculated based on the f-th target hash value, and any j-th hash value other than the first hash value is calculated based on the j-1-th hash value; when the CM-th hash value among the CM hash values is the same as the hash value included in the K-th second transaction, it means that the f-th target hash value is a hash value in the K-th hash sequence. In other words, the f-th target hash value is based on the K-th random number X. K The generated,fth target hash value is verified.
[0056] When the hash value H included in the K+1th second transaction C (X K+1), the K-th business data in the K-th first transaction and its digital signature Sign(H k If the integrity of any item in (T)) is damaged by an intruder, it will cause the digital signature Sign(H k One or more of the several target hash values included in (T)) cannot pass integrity verification.
[0057] Accordingly, in step 47, when the multiple target hash values all pass integrity verification, the digital signature is determined to have passed verification. If the digital signature in the Kth first transaction passes verification, it indicates that the integrity of the Kth business data and digital signature in the Kth first transaction and the hash value in the K+1th second transaction have not been compromised by the intruder.
[0058] In the aforementioned steps 41 to 47, the hash value in the Kth second transaction is used to verify the digital signature in the Kth first transaction. However, referring to the description of steps 41 to 47, it can be seen that the integrity of the hash value in the Kth second transaction can be verified by the K-1th business data and its digital signature in the K-1th first transaction. The verification process is essentially similar to the aforementioned steps 41 to 47.
[0059] Through the aforementioned embodiments, the algorithm process performed by the first device in obtaining the digital signature of the Kth business data is mainly a relatively simple hash calculation, and no more complex cryptographic algorithm is executed. The computing resources consumed are relatively low, and the first device does not need to have high computing power. In addition, the digital signature of the Kth business data can be used to verify the integrity of the Kth business data. In summary, the technical solutions provided in the embodiments of this specification can achieve the goal of ensuring the integrity of business data without requiring the first device to consume excessive computing resources.
[0060] Based on the same concept as the aforementioned method embodiment, this specification embodiment further provides a data processing device, which is deployed in a first device and is used to process the Kth service data obtained by the first device. Figure 5As shown, the apparatus includes: a sequence processing unit 51, configured to obtain a K-th hash sequence corresponding to the K-th random number and a K+1-th hash sequence corresponding to the K+1-th random number, wherein a single hash sequence includes C hash values, the first hash value is calculated based on its corresponding random number, and any other i-th hash value is calculated based on its previous hash value; a hash calculation unit 53, configured to calculate a first hash value of the K-th business data, and calculate a second hash value based on the first hash value and the C-th hash value in the K+1-th hash sequence; a signature processing unit 55, configured In order to map the second hash value into several first numerical values arranged in sequence using a preset mapping algorithm, several target hash values corresponding to the several first numerical values are obtained from the Kth hash sequence, and a digital signature of the Kth business data is generated, which includes the several target hash values arranged in sequence; the transaction sending unit 57 is configured to send the Kth first transaction and the K+1th second transaction to the blockchain system, the Kth first transaction includes the Kth business data and the digital signature, and the K+1th second transaction includes the Cth hash value in the K+1th hash sequence.
[0061] In a possible implementation, the signature processing unit 55 is configured to determine a plurality of sub-bit sequences of length t arranged in sequence based on the bit sequence used to represent the second hash value, and convert the plurality of sub-bit sequences into a plurality of first numerical values represented by decimal numbers.
[0062] In a possible implementation, the target hash value corresponding to the first numerical value d is the d+1th hash value in the Kth hash sequence.
[0063] In a possible implementation, the target hash value corresponding to the first numerical value of d is the Mth hash value in the Kth hash sequence, where M is a result of taking the modulus of d+1+m using C, and m is a preset integer.
[0064] In a possible implementation, the first device is an IoT device, and the K-th service data is service-related data collected by the IoT device through a sensor.
[0065] Based on the same concept as the aforementioned method embodiment, the embodiment of this specification also provides a data processing device, which is deployed in a second device, and the second device is connected to a blockchain system, wherein the blockchain system stores the Kth first transaction, the Kth second transaction, and the K+1th second transaction from the first device, wherein the Kth first transaction includes the Kth business data and its digital signature, and the digital signature includes several target hash values arranged in sequence. Figure 6As shown, the device includes: a hash calculation unit 61, configured to calculate a third hash value of the K-th business data, and calculate a fourth hash value based on the third hash value and the hash value included in the K+1-th second transaction; a mapping processing unit 63, configured to use a preset mapping algorithm to map the second hash value to a plurality of second numerical values arranged in sequence; a hash verification unit 65, configured to verify the integrity of the f-th target hash value for any f-th target hash value based on the f-th second numerical value and the hash value included in the K-th second transaction; a signature verification unit 67, configured to determine that the digital signature has passed the verification when all of the plurality of target hash values have passed the integrity verification.
[0066] In a possible implementation, the mapping processing unit 63 is configured to determine a plurality of sub-bit sequences of length t arranged in sequence based on the bit sequence used to represent the fourth hash value, and convert the plurality of sub-bit sequences into a plurality of second numerical values represented by decimal numbers.
[0067] In a possible implementation, the hash verification unit 65 is configured to calculate Cd-1 hash values arranged in sequence, where the first hash value among the Cd-1 hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, and d is the f-th second value; when the Cd-1-th hash value among the Cd-1 hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
[0068] In a possible implementation, the hash verification unit 65 is configured to calculate CM hash values arranged in sequence, where the first hash value among the CM hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, M is a result of using C to modulo d+1+m, d is the f-th second value, and m is a preset integer; when the CM-th hash value among the CM hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
[0069] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in this specification can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, the computer program corresponding to these functions can be stored in a computer-readable medium or transmitted as one or more instructions / codes on a computer-readable medium, so that when the computer program corresponding to these functions is executed by a computer, the method described in any embodiment of this specification is implemented by the computer.
[0070] A computer-readable storage medium is also provided in an embodiment of this specification, on which a computer program / instructions are stored. When the computer program is executed in a computing device, the computing device executes the various method steps performed by the first device or the second device provided in any embodiment of this specification.
[0071] A computing device is also provided in an embodiment of this specification, including a memory and a processor, wherein the memory stores a computer program / instruction, and when the processor executes the computer program / instruction, it implements the various method steps performed by the first device or the second device provided in any embodiment of this specification.
[0072] The various embodiments in this specification are described in a progressive manner. References to the same or similar parts of each embodiment can be made to the other embodiments. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so their description is relatively simple. For relevant details, references to the method embodiments can be made to the descriptions of the method embodiments.
[0073] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0074] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A data processing method, executed by a first device, for processing Kth service data acquired by the first device, the method comprising: Obtain the Kth hash sequence corresponding to the Kth random number and the K+1th hash sequence corresponding to the K+1th random number, where each hash sequence includes C hash values, the first hash value is calculated based on its corresponding random number, and any other i-th hash value is calculated based on its previous hash value; Calculate a first hash value of the K-th business data, and calculate a second hash value based on the first hash value and the C-th hash value in the K+1-th hash sequence; Mapping the second hash value into a plurality of sequentially arranged first numerical values using a preset mapping algorithm, obtaining a plurality of target hash values corresponding to the plurality of first numerical values from the Kth hash sequence, and generating a digital signature for the Kth business data, which includes the plurality of sequentially arranged target hash values; wherein mapping the second hash value into the plurality of sequentially arranged first numerical values using the preset mapping algorithm includes extracting a plurality of sub-bit sequences from a bit sequence used to represent the second hash value, and converting the plurality of sub-bit sequences into a plurality of first numerical values represented by decimal numbers; Sending the Kth first transaction and the K+1th second transaction to the blockchain system, where the Kth first transaction includes the Kth business data and the digital signature, and the K+1th second transaction includes the Cth hash value in the K+1th hash sequence.
2. The method according to claim 1, mapping the second hash value into a plurality of first numerical values arranged in sequence using a preset mapping algorithm, comprising: A plurality of sub-bit sequences having a length of t and arranged in sequence are determined according to the bit sequence used to represent the second hash value, and the plurality of sub-bit sequences are converted into a plurality of first numerical values represented by decimal numbers.
3. The method according to claim 1, wherein the target hash value corresponding to the first numerical value d is the d+1th hash value in the Kth hash sequence.
4. The method according to claim 1, wherein the target hash value corresponding to the first numerical value of d is the Mth hash value in the Kth hash sequence, where M is the result of taking the modulus of d+1+m using C, and m is a preset integer.
5. The method according to any one of claims 1 to 4, wherein the first device is an IoT device, and the K-th business data is business-related data collected by the IoT device through a sensor.
6. A data processing method, performed by a second device connected to a blockchain system, wherein the blockchain system stores a Kth first transaction, a Kth second transaction, and a K+1th second transaction from a first device, wherein the Kth first transaction includes the Kth business data and its digital signature, wherein the digital signature includes a plurality of target hash values arranged in sequence, the method comprising: Calculate a third hash value of the K-th business data, and calculate a fourth hash value based on the third hash value and the hash value included in the K+1-th second transaction; Mapping the fourth hash value into a plurality of sequentially arranged second numerical values using a preset mapping algorithm; wherein mapping the fourth hash value into the plurality of sequentially arranged second numerical values using the preset mapping algorithm includes extracting a plurality of sub-bit sequences from a bit sequence used to represent the fourth hash value, and converting the plurality of sub-bit sequences into a plurality of second numerical values represented by decimal numbers; For any f-th target hash value, verify the integrity of the f-th target hash value based on the f-th second value and the hash value included in the K-th second transaction; When the plurality of target hash values all pass the integrity verification, it is determined that the digital signature passes the verification.
7. The method according to claim 6, wherein the fourth hash value is mapped to a plurality of second numerical values arranged in sequence using a preset mapping algorithm, comprising: A plurality of sub-bit sequences having a length of t and arranged in sequence are determined according to the bit sequence used to represent the fourth Hash value, and the plurality of sub-bit sequences are converted into a plurality of second numerical values represented by decimal numbers.
8. The method according to claim 6, verifying the integrity of the f-th target hash value based on the f-th second value and the hash value included in the K-th second transaction, comprising: Calculate Cd-1 hash values arranged in sequence, where the first hash value of the Cd-1 hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, and d is the f-th second value; When the Cd-1th hash value among the Cd-1 hash values is the same as the hash value included in the Kth second transaction, it is determined that the integrity verification of the fth target hash value passes.
9. The method according to claim 6, verifying the integrity of the f-th target hash value based on the f-th second value and the hash value included in the K-th second transaction, comprising: Calculate CM hash values arranged in sequence, where the first hash value of the CM hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, M is a result of C modulo d+1+m, d is the f-th second value, and m is a preset integer; When the CM-th hash value among the CM hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value passes.
10. A data processing apparatus, deployed in a first device, for processing Kth service data acquired by the first device, the apparatus comprising: a sequence processing unit configured to obtain a Kth hash sequence corresponding to the Kth random number and a K+1th hash sequence corresponding to the K+1th random number, wherein each hash sequence includes C hash values, the first hash value is calculated based on the random number corresponding to it, and any other i-th hash value is calculated based on its previous hash value; a hash calculation unit configured to calculate a first hash value of the K-th business data, and calculate a second hash value based on the first hash value and the C-th hash value in the K+1-th hash sequence; The signature processing unit is configured to map the second hash value into a plurality of sequentially arranged first numerical values using a preset mapping algorithm, obtain a plurality of target hash values corresponding to the plurality of first numerical values from the Kth hash sequence, and generate a digital signature for the Kth business data, including the plurality of sequentially arranged target hash values; wherein mapping the second hash value into the plurality of sequentially arranged first numerical values using the preset mapping algorithm includes extracting a plurality of sub-bit sequences from a bit sequence used to represent the second hash value, and converting the plurality of sub-bit sequences into a plurality of first numerical values represented by decimal numbers; A transaction sending unit is configured to send a K-th first transaction and a K+1-th second transaction to the blockchain system, wherein the K-th first transaction includes the K-th business data and the digital signature, and the K+1-th second transaction includes the C-th hash value in the K+1-th hash sequence.
11. The apparatus according to claim 10, wherein the signature processing unit is configured to determine a plurality of sub-bit sequences of length t and arranged in sequence based on the bit sequence used to represent the second hash value, and convert the plurality of sub-bit sequences into a plurality of first numerical values represented by decimal numbers.
12. The apparatus according to claim 10, wherein the target hash value corresponding to the first numerical value d is the d+1th hash value in the Kth hash sequence.
13. The device according to claim 10, wherein the target hash value corresponding to the first numerical value of d is the Mth hash value in the Kth hash sequence, M is a result of taking the modulus of d+1+m using C, and m is a preset integer.
14. The apparatus according to any one of claims 10 to 13, wherein the first device is an IoT device, and the K-th service data is service-related data collected by the IoT device through a sensor.
15. A data processing apparatus, deployed in a second device, the second device being connected to a blockchain system, wherein the blockchain system stores a Kth first transaction, a Kth second transaction, and a K+1th second transaction from a first device, the Kth first transaction including the Kth business data and its digital signature, the digital signature including a plurality of target hash values arranged in sequence, the apparatus comprising: a hash calculation unit configured to calculate a third hash value of the K-th business data, and calculate a fourth hash value based on the third hash value and a hash value included in the K+1-th second transaction; a mapping processing unit configured to map the fourth hash value into a plurality of sequentially arranged second numerical values using a preset mapping algorithm; wherein mapping the fourth hash value into the plurality of sequentially arranged second numerical values using the preset mapping algorithm includes extracting a plurality of sub-bit sequences from a bit sequence used to represent the fourth hash value, and converting the plurality of sub-bit sequences into a plurality of second numerical values represented by decimal numbers; a hash verification unit configured to verify, for any f-th target hash value, the integrity of the f-th target hash value based on the f-th second value and the hash value included in the K-th second transaction; The signature verification unit is configured to determine that the digital signature passes the verification when the multiple target hash values all pass the integrity verification.
16. The apparatus according to claim 15, wherein the mapping processing unit is configured to determine a plurality of sub-bit sequences of length t and arranged in sequence based on the bit sequence used to represent the fourth hash value, and convert the plurality of sub-bit sequences into a plurality of second numerical values represented by decimal numbers.
17. The apparatus according to claim 15, wherein the hash verification unit is configured to calculate Cd-1 hash values arranged in sequence, wherein the first hash value among the Cd-1 hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, and d is the f-th second value; when the Cd-1-th hash value among the Cd-1 hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
18. The apparatus according to claim 15, wherein the hash verification unit is configured to calculate CM hash values arranged in sequence, wherein the first hash value among the CM hash values is calculated based on the f-th target hash value, and any other j-th hash value is calculated based on its previous hash value, M is a result of using C to modulo d+1+m, d is the f-th second value, and m is a preset integer; when the CM-th hash value among the CM hash values is the same as the hash value included in the K-th second transaction, it is determined that the integrity verification of the f-th target hash value has passed.
19. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computing device, the computing device executes the method according to any one of claims 1 to 9.
20. A computing device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Remote equipment control method and system
CN113132395A
Dynamic integrity validation of a high level operating system
US20160065375A1