WO2021233182A1 - 默克尔树更新方法、装置、设备及可读存储介质 - Google Patents
默克尔树更新方法、装置、设备及可读存储介质 Download PDFInfo
- Publication number
- WO2021233182A1 WO2021233182A1 PCT/CN2021/093397 CN2021093397W WO2021233182A1 WO 2021233182 A1 WO2021233182 A1 WO 2021233182A1 CN 2021093397 W CN2021093397 W CN 2021093397W WO 2021233182 A1 WO2021233182 A1 WO 2021233182A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target
- preset
- coding model
- hash
- hash coding
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
Definitions
- This application relates to the field of artificial intelligence of financial technology (Fintech), and in particular to a method, device, device, and readable storage medium for updating a Merkel tree.
- Merkle tree is a data structure used to quickly verify the integrity of data.
- the principle is to use grouped hashing to enable hash value matching to be quickly traced from the leaf node to the root node, thereby achieving the purpose of reducing the computational complexity of data query.
- all nodes of the tree branch where the random leaf node is located need to be updated, which leads to excessive calculations when updating the Merkel tree, and the calculation complexity is too high, which in turn leads to the Merck tree
- the calculation efficiency during the update is too low. Therefore, the current technology has a technical problem of low calculation efficiency during the update of the Merkel tree.
- the main purpose of this application is to provide a Merkel tree update method, device, device and readable storage medium, aiming to solve the technical problem of low computational efficiency during Merkel tree update in the prior art.
- the present application provides a Merkel tree updating method, and the Merkel tree updating method includes:
- the present application also provides a Merkel tree updating device, the Merkel tree updating device is a virtual device, and the Merkel tree updating device is applied to a Merkel tree updating device, the Merkel tree updating The device includes:
- the determining module is used to obtain the updated data and the Merkel tree to be updated, and determine the original data set and the preset hash coding model corresponding to the Merk tree to be updated;
- a training module configured to train and update the preset hash coding model based on the updated data and the original data set to obtain a target hash coding model
- the update module is used to update the random leaf node layer of the Merkel tree to be updated based on the target hash coding model and the update data to obtain the target Merkel tree.
- the present application also provides a Merkel tree update device, the Merkel tree update device is a physical device, and the Merkel tree update device includes: a memory, a processor, and stored in the memory and available in all
- the program of the Merkel tree updating method running on the processor when the program of the Merkel tree updating method is executed by the processor, can realize the steps of the above-mentioned Merkel tree updating method.
- the present application also provides a readable storage medium, the readable storage medium stores a program for implementing the Merkel tree update method, and when the program of the Merkel tree update method is executed by a processor, the above-mentioned default The steps of the Kerr tree update method.
- This application obtains the updated data and the Merkel tree to be updated, and determines the original data set and the preset hash coding model corresponding to the Merk tree to be updated, and then based on the updated data and the original data set,
- the preset hash coding model is trained and updated to obtain a target hash coding model, and then based on the target hash coding model and the update data, the random leaf node layer of the to-be-updated Merkel tree is updated to obtain Target Merkel tree. That is, this application provides a Merkel tree to be updated constructed based on a preset hash coding model, and then when the Merkel tree to be updated needs to be updated, the update data and the Merkel tree to be updated are acquired.
- the original data set corresponding to the tree is further trained and updated on the preset hash coding model based on the updated data and the original data set to obtain a target hash coding model. Further, based on the target hash The coding model and the update data are updated, and the random leaf node layer of the Merkel tree to be updated is updated to obtain the target Merkel tree. That is, when the present application updates the Merkel tree to be updated, no matter how much data on the random leaf nodes are updated by the Merk tree, only one training update needs to be performed on the preset hash coding model, and then the information obtained based on the training update In the hash coding model, the random leaf node layer of the Merkel tree to be updated can be updated to complete the update of the Merkel tree to be updated.
- FIG. 1 is a schematic flowchart of a first embodiment of a Merkel tree update method according to this application;
- Figure 2 is a schematic diagram of the binary Merkel tree in the Merkel tree update method of the application
- FIG. 3 is a schematic flowchart of a second embodiment of a Merkel tree updating method according to this application.
- FIG. 4 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the application.
- the embodiment of the present application provides a Merkel tree updating method.
- the Merkel tree updating method includes:
- Step S10 Obtain the updated data and the Merkel tree to be updated, and determine the original data set and the preset hash coding model corresponding to the Merk tree to be updated;
- the original data set includes one or more original data blocks, each of the original data blocks corresponds to one or more data categories, and one data category corresponds to a target hash code.
- the target hash coding value is obtained by hash coding the original data block corresponding to the corresponding data category based on a preset hash coding method, wherein the preset hash coding method includes a random target Hash coding and adaptive target Hash coding, etc.
- the Hamming distance between any two original data blocks in each data category is less than or equal to the preset first Hamming distance Threshold, for example, assuming that the preset first Hamming distance threshold is 1, the original data block A is 0101010111, and the original data block B is 0101010101, then the Hamming distance between the original data block A and the original data block B is 1. , And then determine that the original data block A and the original data block B belong to the same data category.
- the update data is newly added data added to the Merkel tree to be updated, wherein the newly added data includes one or more newly added data blocks, and the to be updated
- the Merkel tree is a data structure for storing the original data set, wherein the Merkel tree to be updated includes a random leaf node layer, each intermediate node layer, and a root node, wherein the random leaf node layer includes one or A plurality of random leaf nodes, the intermediate node layer includes one or more intermediate nodes, as shown in Fig.
- FIG. 2 is a schematic diagram of a binary Merkel tree, wherein the single node at the uppermost layer is the root node, and the lowermost layer 1, 2 , 3, 4, 5, 6, 7, 8 are all random leaf nodes, and the nodes between the uppermost layer and the lowermost layer are the intermediate nodes.
- the random leaf nodes are storage nodes.
- the intermediate node and the root node are nodes that store the target model output value of the preset hash coding model, where ,
- the target model output value is a hash code value obtained based on the preset hash code model and the model input value, wherein, in the to-be-updated Merkel tree, each layer node stores The model input value corresponding to the model output value is the hash code value stored in the previous layer, and the model input value corresponding to the model output value stored in the root node is the hash code value corresponding to the last intermediate node layer, where,
- the preset hash coding model original data blocks belonging to the same data category are input into the preset hash coding model, and the same output hash coding value will be output, and the output hash coding value Is the target hash code value corresponding to the data category.
- node layer M includes 4 nodes (A, B, C, D), and the previous node layer N corresponding to node layer M includes 2 nodes (E, F), where node A and node B point to Node E, node C and node D point to node F.
- Step S20 training and updating the preset hash coding model based on the updated data and the original data set to obtain a target hash coding model
- the preset hash coding model is trained and updated to obtain the target hash coding model. Specifically, each of the newly added data blocks is added to The original data set, and in each of the target hash codes, match the corresponding target hash code value for each of the newly added data blocks to obtain the target data set, and select training data from the target data set A target hash code value set corresponding to the training data, wherein the training data includes one or more training data blocks in the target data set, and the target hash code value set includes each of the training data blocks The corresponding target hash code value, and then based on the target hash code value set and the training data, the preset hash code model is iteratively trained and updated until the preset iteration end condition is satisfied, and the target is obtained Hash coding model.
- the step of training and updating the preset hash coding model based on the updated data and the original data set to obtain the target hash coding model includes:
- Step S21 Determine a target data set based on the updated data and the original data set, and determine a data category set corresponding to the target data set;
- the target data set includes one or more training data blocks
- the data category set includes data categories corresponding to each of the training data blocks.
- Step S22 Obtain the target hash code value set corresponding to the data category set, and determine the training data corresponding to the target data set and the target hash code value corresponding to the target hash code value set;
- the target hash code value set includes target hash code values corresponding to each of the data categories.
- the target hash code value set corresponding to the data category set and determine the training data corresponding to the target data set and the target hash code value corresponding to the target hash code value set, specifically, obtain each of the The target hash code value corresponding to the data category is extracted, and the training data is extracted from the target data set, and the target hash code value corresponding to the training data is extracted from the target hash code set.
- a preset number of data blocks are extracted from each of the data categories as the training data blocks, and each of the training data blocks is used as the training data, and each is determined in the target hash code value set.
- the target hash code value corresponding to the data category of the training data block.
- Step S23 Based on the training data and the target hash coding value, perform iterative training on the preset hash coding model to optimize the polarization loss function corresponding to the preset hash coding model until the The preset hash coding model reaches the preset iteration end condition, and the target hash coding model is obtained.
- the preset iteration end condition includes reaching a preset iteration number threshold, polarization loss function convergence, etc.
- the iterative training includes one or more rounds of training.
- the preset hash coding model is iteratively trained to optimize the polarization loss function corresponding to the preset hash coding model until the preset hash coding value It is hoped that the coding model reaches a preset iteration end condition, and the target hash coding model is obtained.
- a training data block is extracted from the training data and input into the preset hash coding model, based on the corresponding training data block
- the target hash coding value is used to train and update the preset hash coding model, and determine whether the preset hash coding model after the training update satisfies the preset iteration end condition, if the preset hash coding model after the training update If the hash coding model satisfies the preset iteration end condition, the preset hash coding model after the training update is used as the target hash coding model, if the preset hash coding model after the training update does not meet the preset Assuming the end condition of the iteration, the initial hash coding value of this round of training is obtained, and based on the initial hash coding value and the target hash coding result, the polarization loss function is optimized, and the optimized all
- the preset hash coding model is trained and updated until the preset hash coding model after the training update satisfie
- the iterative training is performed on the preset hash coding model based on the training data and the target hash coding value to optimize the polarization loss function corresponding to the preset hash coding model until all
- the preset hash coding model reaches a preset iteration end condition
- the step of obtaining the target hash coding model includes:
- Step S221 input the training data into the preset hash coding model to hash the training data based on the polarization loss function to obtain an initial hash coding value;
- the training data is input to the preset hash coding model to hash the training data based on the polarization loss function to obtain an initial hash coding value, specifically, Extract a training data block from the training data, and input the to-be-processed training matrix corresponding to the training data block into the preset hash coding model, wherein the to-be-processed training matrix is a matrix representation of the training data block , Used to store the data in the to-be-processed training matrix to hash the to-be-processed training matrix to obtain a hash vector, and then, based on the polarization loss function, calculate each bit of the hash vector Bit to perform forced polarization, obtain the polarization vector corresponding to the hash vector, and then generate the initial hash code value based on the polarization identifier corresponding to each bit in the polarization vector, wherein the polarization vector
- the loss function is as follows,
- L is the polarization loss function
- m is a preset forced polarization parameter
- v is the value of each hash vector bit in the hash vector
- the absolute value of v is greater than m
- t ⁇ c Is the target hash value corresponding to the bits of the hash vector
- the target hash value is the bit value on the target hash code value corresponding to the training data block
- t ⁇ c ⁇ -1, + 1 ⁇
- the polarization identifier on each bit in the polarization vector corresponding to each training data block belonging to the same data category is consistent, and then based on each For the polarization identification, the obtained model output values are consistent, that is, for model input data belonging to the same data category, the trained preset hash coding model can output the same model output value.
- each bit in the hash vector corresponds to a polarization output channel of the preset hash encoding
- the preset forced polarization parameters corresponding to each polarization output channel are all It is obtained by training the preset hash coding model, and the preset forced polarization parameters corresponding to each of the polarization output channels may be the same or different.
- the polarization output channel is used for The preset forced polarization parameter is forced to polarize the value of each bit in the hash vector through the corresponding polarization loss function, and output the corresponding bit in the initial hash code value The coded value.
- the step of inputting the training data into the preset hash coding model to hash the training data based on the polarization loss function to obtain an initial hash coding value includes:
- Step A10 input the training data into the preset hash coding model, hash the training data, and obtain a training hash result;
- the preset hash coding model includes a hidden layer and a hash layer.
- the hidden layer is a layer or multilayer neural network for data processing, and the data processing includes volume product. Pooling, etc.
- the hash layer is a layer or multilayer neural network for hashing.
- the training data is input to the preset hash coding model, the training data is hashed to obtain the training hash result, specifically, the training data block in the training data is extracted, and the training data is The to-be-processed training matrix corresponding to the block is input to the hidden layer, and the to-be-processed training matrix is subjected to a preset number of convolution and pooling processes to obtain a feature representation matrix, and then the feature representation matrix is input to the hash layer , Performing a full connection on the feature representation matrix to obtain a hash vector, and use the hash vector as the training hash result.
- Step A20 based on the polarization loss function, polarize the training hash result to obtain a polarization result
- the training hash result is polarized to obtain the polarization result.
- each of the hash vectors is Polarize one bit to obtain a polarization vector, and use the polarization vector as the polarization result. For example, assuming that the hash vector is (-1, -8), then after polarization, obtain The polarization vector is (1, -8).
- Step A30 Determine the initial hash code value based on the polarization result.
- the initial hash code value is determined based on the polarization result, specifically, the polarization identifier corresponding to each bit in the polarization result is extracted, wherein the polarization identifier Is the positive and negative sign of the bit, and then determines the initial hash code value based on each polarization identifier. For example, assuming that the polarization result is (1, -8, -7, 0.9), then The initial hash code value is 1001.
- Step S222 Calculate the training Hamming distance between the initial hash code value and the target hash code value, and compare the training Hamming distance with a preset Hamming distance threshold;
- the training Hamming distance between the initial hash coding value and the target hash coding result is calculated, and the training Hamming distance is compared with a preset Hamming distance threshold, Specifically, the value on each bit of the initial hash code value is compared with the value on each bit of the target hash code result to determine the initial hash code value and the The number of bits with different bits of the target hash encoding result, and the number of bits is used as the training Hamming distance, and the training Hamming distance is compared with a preset Hamming distance threshold, for example , Assuming that the initial hash coding value is a vector (1,1,1,1) and the target hash coding result is a vector (-1,1,1,-1), then the number of bits is 2 , The training Hamming distance is 2.
- Step S223 If the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the preset hash coding model does not meet the preset iteration end condition, and based on the initial hash coding value Optimizing the polarization loss function;
- the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the preset hash coding model does not meet the preset iteration end condition, and based on the initial Hamming distance It is hoped that the coding value optimizes the polarization loss function. Specifically, if the training Hamming distance is greater than the preset Hamming distance threshold, it is determined that the polarization loss function is not in the training matrix to be hashed.
- the preset hash coding model Convergence on all bits of, that is, the polarization loss function does not converge, and then it is determined that the preset hash coding model does not meet the preset iteration end condition, and the initial hash coding value and the total One or more different bits between the target hash encoding results, and determine the non-convergent polarization output channels corresponding to each of the different bits, and adjust the polarization loss corresponding to each of the non-convergent polarization output channels
- Step S224 based on the optimized polarization loss function, retrain the preset hash coding model until the training Hamming distance is less than or equal to the preset Hamming distance threshold;
- the training of the preset hash coding model is re-trained until the training Hamming distance is less than or equal to the preset Hamming distance threshold, Specifically, re-acquire the training matrix to be hashed corresponding to the training data, and re-train iteratively on the preset hash coding model corresponding to the optimized polarization loss function based on the re-acquired training matrix to be hashed , To continue to optimize the polarization loss function until the training Hamming distance is less than or equal to the preset Hamming distance threshold.
- Step S225 If the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the preset hash coding model reaches the preset iteration end condition, and the preset hash The coding model is used as the target hash coding model.
- the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the preset hash coding model reaches the preset iteration end condition, and the preset Suppose a hash coding model is used as the target hash coding model. Specifically, if the training Hamming distance is less than or equal to the preset Hamming distance threshold, it is determined that the preset hash coding model reaches the A preset iteration end condition, that is, the polarization loss function corresponding to each polarization output channel in the preset hash coding model converges, and the preset hash coding model is used as the target hash coding Model.
- Step S30 based on the target hash coding model and the update data, update the random leaf node layer of the Merkel tree to be updated to obtain the target Merkel tree.
- the random leaf node layer of the to-be-updated Merkel tree is updated to obtain the target Merkel tree, and specifically, each of the new Increase the new random leaf node corresponding to the data block, and input each of the newly added data blocks into the target hash coding model, output the hash code value, and then determine each of the new data blocks based on the output value of each new model
- the target parent node of the newly added data block is further connected to each of the newly added random leaf nodes to the corresponding target parent node to obtain the target Merkel tree.
- model parameters of the target hash coding model are sent to each Merkel tree user, and each Merkel tree user can construct their own target Merkel tree based on the model parameters.
- the update data includes newly added data blocks
- the step of updating the random leaf node layer of the Merkel tree to be updated based on the target hash coding model and the update data, and obtaining the target Merkel tree includes:
- Step S31 generating a target random leaf node corresponding to the newly added data block, and inputting the newly added data block into the target hash coding model to obtain an output hash code value corresponding to the newly added data block;
- the target random leaf node is a Merkel tree node that stores the newly added data block, and the update data includes at least one newly added data block.
- the output hash code value corresponding to the newly added data block, wherein the newly added data block belonging to the same data category corresponds to the same output hash code value.
- Step S32 matching the target parent node corresponding to the target random leaf node based on the output hash code value
- one target parent node corresponds to one target hash code value.
- the target parent node corresponding to the target random leaf node is matched. Specifically, each output hash code value is compared with each target hash code value. In the target hash code values, selected target hash code values that are the same as each of the output hash code values are respectively determined, and the Merkel tree node corresponding to each of the selected target hash code values is determined As the target parent node corresponding to each target random leaf node.
- Step S33 based on the target random leaf node and the target parent node, update the random leaf node layer to obtain the target Merkel tree.
- the random leaf node layer is updated to obtain the target Merkel tree, specifically, the target random leaf nodes are respectively connected To the corresponding target parent node to update the random leaf node layer to obtain the target Merkel tree, and since the hash code value of each target has not changed, in the waiting list of the Merkel tree to be updated
- the random leaf node layer is updated to complete the update of the Merkel tree to be updated, and then It reduces the amount of calculation when the Merkel tree is updated, and reduces the computational complexity.
- the updated data and the Merkel tree to be updated are acquired, and the original data set and the preset hash coding model corresponding to the Merk tree to be updated are determined, and then based on the updated data and the original data set, Determine a target data set, and then train and update the preset hash coding model based on the target data set to obtain a target hash coding model, and then update all based on the target hash coding model and the update data.
- the random leaf node layer of the Merkel tree to be updated is described to obtain the target Merkel tree.
- this embodiment provides a to-be-updated Merkel tree constructed based on a preset hash coding model, and then when the to-be-updated Merkel tree needs to be updated, the update data and the to-be-updated default are acquired.
- the original data set corresponding to the gram tree is further trained and updated on the preset hash coding model based on the updated data and the original data set to obtain a target hash coding model, and further, based on the target hash coding model.
- the Greek coding model and the update data update the random leaf node layer of the to-be-updated Merkel tree to obtain the target Merkel tree.
- the random leaf node layer of the Merkel tree to be updated can be updated to complete the update of the Merkel tree to be updated.
- the random leaf node layer of the Merkel tree to be updated can be updated to complete the update of the Merkel tree to be updated.
- the original data set includes one or more original data blocks and corresponding original data blocks.
- a target hash code value, the Merkel tree to be updated includes one or more random leaf nodes, one or more intermediate nodes, and a root node,
- the Merkel tree update method includes:
- Step B10 generating random leaf nodes corresponding to each of the original data blocks, wherein one of the original data blocks corresponds to one of the random leaf nodes;
- the random leaf node is a Merkel tree node that stores the original data block.
- Step B20 Generate each of the intermediate nodes and the root node based on each of the target hash coding values and the preset hash coding model.
- each of the intermediate nodes includes one or more first-level intermediate nodes and one or more second-level intermediate nodes.
- the first-level intermediate node is a Merkel tree node that stores the target hash code value
- one of the target hash code values corresponds to the first-level intermediate node
- each of the The target hash code value is input into the preset hash code model
- each of the target hash code values is hash coded to obtain the second layer hash code value corresponding to each of the target hash code values, where ,
- One of the second-level hash coded values belongs to one or more target hash coded values of the same data category, and then a second-level intermediate node corresponding to each of the second-level hash coded values is generated, and then the The second-layer hash coding value is used as the input of the preset hash coding model, and the intermediate nodes of other layers are continuously generated until the prese
- each of the intermediate nodes includes one or more first-level intermediate nodes and one or more upper-level intermediate nodes;
- the step of generating each of the intermediate node and the root node based on each of the target hash value and the preset hash coding model includes:
- Step B21 generating a first-level intermediate node corresponding to each of the target hash code values, wherein one of the target hash code values corresponds to one of the first-level intermediate nodes;
- the first-level intermediate node is a Merkel tree node that stores the target hash code value.
- Step B22 based on the preset hash coding model, cyclically generate upper-level intermediate nodes corresponding to each of the first-level intermediate nodes until the root node is obtained.
- the upper-level intermediate nodes corresponding to each of the first-level intermediate nodes are generated cyclically until the root node is obtained, specifically, the first-level intermediate nodes are The target hash coding value corresponding to the node is input to the preset hash coding model, and the second-layer hash coding value corresponding to each target hash coding value is output, and the corresponding second-layer hash coding value is generated Further, based on the preset hash coding model, continue to generate intermediate nodes of other layers until the preset hash coding model outputs a single hash code value, and generates the single The root node corresponding to the hash code value is used to complete the construction of the Merkel tree to be updated.
- This embodiment first generates random leaf nodes corresponding to each of the original data blocks, where one of the original data blocks corresponds to one of the random leaf nodes, and then based on each of the target hash code values and the preset hash
- the coding model generates each of the intermediate nodes and the root nodes. That is, this embodiment provides a method for constructing a Merkel tree based on a preset hash coding model, that is, first generating random leaf nodes corresponding to each of the original data blocks, and then generating each of the target hashes.
- the intermediate node corresponding to the encoding value further, based on the preset hash encoding model and each target hash encoding value, the remaining intermediate nodes and root nodes can be generated to complete the to-be-updated Merkel
- This embodiment can directly generate the hash code value corresponding to the input data block based on the preset hash coding model, there is no need to perform a complicated hash transformation on each input data block, thereby improving the default.
- the construction efficiency of the Kerr tree when updating the to-be-updated Merkel tree, only one training update is required to the preset hash coding model of the to-be-updated Merk tree to complete the
- the update of the Merkel tree to be updated avoids the need to update all the nodes of the tree branch where the random leaf node is located when updating the Merkel tree to be updated, thereby reducing the calculation when the Merkel tree is updated Furthermore, it reduces the computational complexity when updating the Merkel tree, so it lays a foundation for solving the technical problem of low computational efficiency when updating the Merkel tree.
- FIG. 4 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
- the Merkel tree updating device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002.
- the communication bus 1002 is used to implement connection and communication between the processor 1001 and the memory 1005.
- the memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a magnetic disk memory.
- the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
- the Merkel tree update device may also include a rectangular user interface, a network interface, a camera, and RF (Radio Frequency (radio frequency) circuits, sensors, audio circuits, WiFi modules, etc.
- the rectangular user interface may include a display screen (Display) and an input sub-module such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface.
- the optional network interface can include standard wired interface and wireless interface (such as WI-FI interface).
- the structure of the Merkel tree update device shown in FIG. 4 does not constitute a limitation on the Merkel tree update device, and may include more or less components than those shown in the figure, or a combination of some components. Components, or different component arrangements.
- the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a Merkel tree update program.
- the operating system is a program that manages and controls the hardware and software resources of the Merkel tree update device, and supports the operation of the Merkel tree update program and other software and/or programs.
- the network communication module is used to realize the communication between the components in the memory 1005 and the communication with other hardware and software in the Merkel tree update system.
- the processor 1001 is configured to execute the Merkel tree update program stored in the memory 1005 to implement the steps of the Merkel tree update method described in any one of the above.
- the embodiment of the present application also provides a Merkel tree updating device, the Merkel tree updating device is applied to a Merkel tree updating device, and the Merkel tree updating device includes:
- the determining module is used to obtain the updated data and the Merkel tree to be updated, and determine the original data set and the preset hash coding model corresponding to the Merk tree to be updated;
- a training module configured to train and update the preset hash coding model based on the updated data and the original data set to obtain a target hash coding model
- the update module is used to update the random leaf node layer of the Merkel tree to be updated based on the target hash coding model and the update data to obtain the target Merkel tree.
- the update module includes:
- the hash coding sub-module is used to generate the target random leaf node corresponding to the newly added data block, and input the newly added data block into the target hash coding model to obtain the output corresponding to the newly added data block.
- Greek code value
- a matching sub-module configured to match the target parent node corresponding to the target random leaf node based on the output hash code value
- An update submodule is used to update the random leaf node layer based on the target random leaf node and the target parent node to obtain the target Merkel tree.
- the training module includes:
- An extraction sub-module configured to determine a target data set based on the updated data and the original data set, and determine the data category set corresponding to the target data set;
- Iterative training sub-module configured to iteratively train the preset hash coding model based on the training data and the target hash coding value to optimize the polarization loss function corresponding to the preset hash coding model , Until the preset hash coding model reaches the preset iteration end condition, the target hash coding model is obtained.
- the iterative training sub-module includes:
- a hash coding unit configured to input the training data into the preset hash coding model to perform hash coding on the training data based on the polarization loss function to obtain an initial hash coding value
- a comparing unit configured to calculate the training Hamming distance between the initial hash code value and the target hash code value, and compare the training Hamming distance with a preset Hamming distance threshold;
- the first determining unit is configured to determine that if the training Hamming distance is greater than the preset Hamming distance threshold, determine that the preset hash coding model does not meet the preset iteration end condition, and based on the initial Hash coding value optimizes the polarization loss function;
- a retraining unit configured to retrain the preset hash coding model based on the optimized polarization loss function until the training Hamming distance is less than or equal to the preset Hamming distance threshold;
- the second determining unit is configured to determine that if the training Hamming distance is less than or equal to the preset Hamming distance threshold, determine that the preset hash coding model meets the preset iteration end condition, and set the A preset hash coding model is used as the target hash coding model.
- the hash coding unit includes:
- a hash subunit used to input the training data into the preset hash coding model, hash the training data, and obtain a training hash result
- a polarization subunit configured to polarize the training hash result based on the polarization loss function to obtain a polarization result
- the determining subunit is configured to determine the initial hash code value based on the polarization result.
- the Merkel tree updating device further includes:
- the first generating module is configured to generate random leaf nodes corresponding to each of the original data blocks, wherein one of the original data blocks corresponds to one of the random leaf nodes;
- the second generating module is configured to generate each of the intermediate node and the root node based on each of the target hash coding value and the preset hash coding model.
- the second generating module includes:
- the cyclic generation sub-module is configured to cyclically generate upper-level intermediate nodes corresponding to each of the first-level intermediate nodes based on the preset hash coding model, until the root node is obtained.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Power Engineering (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
一种默克尔树更新方法、装置、设备及可读存储介质,所述默克尔树更新方法包括:获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型(S10),进而基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型(S20),进而基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树(S30)。
Description
本申请要求于2020年5月22日申请的、申请号为202010453608.5的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及金融科技(Fintech)的人工智能领域,尤其涉及一种默克尔树更新方法、装置、设备及可读存储介质。
随着金融科技,尤其是互联网科技金融的不断发展,越来越多的技术(如分布式、区块链Blockchain、人工智能等)应用在金融领域,但金融业也对技术提出了更高的要求,如对金融业对应待办事项的分发也有更高的要求。
随着计算机软件和人工智能的不断发展,人工智能的应用领域也越来越广泛,目前,默克尔(Merkle)树是一种用于快速验证数据完整性的数据结构。其原理是通过分组哈希,使得哈希值匹配能够从叶节点快速上溯到根节点,进而达到降低数据查询时计算复杂度的目的,但是,当默克尔树的随机叶子节点需要更新时,除了需要更新随机叶子节点之外,还需要对随机叶子节点所在树分枝的所有节点进行更新,进而导致默克尔树更新时的计算量过大,计算复杂度过高,进而导致默克树更新时的计算效率过低,所以,现在技术中存在默克尔树更新时计算效率低的技术问题。
本申请的主要目的在于提供一种默克尔树更新方法、装置、设备及可读存储介质,旨在解决现有技术中默克尔树更新时计算效率低的技术问题。
为实现上述目的,本申请提供一种默克尔树更新方法,所述默克尔树更新方法包括:
获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;
基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;
基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
本申请还提供一种默克尔树更新装置,所述默克尔树更新装置为虚拟装置,且所述默克尔树更新装置应用于默克尔树更新设备,所述默克尔树更新装置包括:
确定模块,用于获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;
训练模块,用于基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;
更新模块,用于基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
本申请还提供一种默克尔树更新设备,所述默克尔树更新设备为实体设备,所述默克尔树更新设备包括:存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的所述默克尔树更新方法的程序,所述默克尔树更新方法的程序被处理器执行时可实现如上述的默克尔树更新方法的步骤。
本申请还提供一种可读存储介质,所述可读存储介质上存储有实现默克尔树更新方法的程序,所述默克尔树更新方法的程序被处理器执行时实现如上述的默克尔树更新方法的步骤。
本申请通过获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型,进而基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型,进而基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。也即,本申请提供了一种基于预设哈希编码模型构建的待更新默克尔树,进而当所述待更新默克尔树需要进行更新时,获取更新数据和所述待更新默克树对应的原数据集,进而基于所述更新数据和所述原数据集,进行对所述预设哈希编码模型的训练更新,获得目标哈希编码模型,进一步地,基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。也即,本申请在更新待更新默克尔树时,无论默克树更新多少随机叶子节点上的数据,只需对所述预设哈希编码模型进行一次训练更新,进而基于训练更新获得的哈希编码模型,对待更新默克尔树的随机叶子节点层进行更新,即可完成对所述待更新默克尔树的更新,进而相比于当前的默克尔树的更新方法,当默克尔树的随机叶子节点需要更新时,只需更新默克尔树的随机叶子节点层即可完成对所述待更新默克尔树的更新,无需对随机叶子节点所在树分枝的所有节点进行更新,进而降低了默克尔树更新时的计算量,进而降低了默克尔树更新时计算复杂度,所以,解决了默克尔树更新时计算效率低的技术问题。
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请默克尔树更新方法第一实施例的流程示意图;
图2为本申请默克尔树更新方法中二叉默克尔树的示意图;
图3为本申请默克尔树更新方法第二实施例的流程示意图;
图4为本申请实施例方案涉及的硬件运行环境的设备结构示意图。
本申请目的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
本申请实施例提供一种默克尔树更新方法,在本申请默克尔树更新方法的第一实施例中,参照图1,所述默克尔树更新方法包括:
步骤S10,获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;
在本实施例中,需要说明的是,所述原数据集包括一个或者多个原数据块,各所述原数据块对应一个或者多个数据类别,一所述数据类别对应一目标哈希编码值,其中,所述目标哈希编码值为基于预设哈希编码方式对相对应的数据类别对应的原数据块进行哈希编码获得的,其中,所述预设哈希编码方式包括随机目标哈希编码和自适应目标哈希编码等,且需要说明的是,每一所述数据类别中的任意两个所述原数据块之间的汉明距离小于或者等于预设第一汉明距离阀值,例如,假设预设第一汉明距离阀值为1,原数据块A为0101010111,原数据块B为0101010101,则原数据块A与原数据块B之间的汉明距离为1,进而判定原数据块A和原数据块B属于同一所述数据类别。
另外地,需要说明的是,所述更新数据为向所述待更新默克尔树中加入的新增数据,其中,所述新增数据包括一个或者多个新增数据块,所述待更新默克尔树为存储所述原数据集的数据结构,其中,所述待更新默克尔树包括随机叶子节点层、各中间节点层和根节点,其中,所述随机叶子节点层包括一个或者多个随机叶子节点,所述中间节点层包括一个或者多个中间节点,如图2所示为二叉默克尔树示意图,其中,最上层的单个节点为根节点,最下层的1,2,3,4,5,6,7,8均为随机叶子节点,处于最上层和最下层之间的节点为各所述中间节点,另外地,需要说明的是,所述随机叶子节点为存储所述原数据块的节点,一所述随机叶子节点对应一所述原数据块,所述中间节点和所述根节点为存储所述预设哈希编码模型的目标模型输出值的节点,其中,所述目标模型输出值为基于所述预设哈希编码模型和所述模型输入值而获得的哈希编码值,其中,在所述待更新默克尔树中,每一层节点存储的模型输出值对应的模型输入值均为上一层存储的哈希编码值,所述根节点存储的模型输出值对应的模型输入值为最后一层中间节点层对应的哈希编码值,其中,需要说明的是,对于所述预设哈希编码模型,属于同一数据类别的原数据块输入所述预设哈希编码模型,将输出相同的输出哈希编码值,所述输出哈希编码值为所述数据类别对应的目标哈希编码值,同样地,属于同一类别的模型输入值,所述预设哈希编码值均可输出相同的模型输出值,例如,假设在所述待更新默克尔树中,节点层M包括4个节点(A,B,C,D),节点层M对应的上一节点层N包括2个节点(E,F),其中,节点A和节点B指向节点E,节点C和节点D指向节点F,若所述预设哈希编码模型为H,则满足H(A)=E,H(B)=E,H(C)=F,H(D)=F。
获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型,具体地,从预设存储数据库中提取各新增数据块和待更新默克尔树,并确定所述待更新默克尔树中各随机叶子节点对应的原数据块和每一所述原数据块对应的目标哈希编码值,并获取构建所述待更新默克树所采用的预设哈希编码模型,其中,所述待更新默克尔树为基于预设哈希编码模型、各所述原数据块和各所述目标哈希编码值构建的,也即,首先生成各所述原数据块对应的随机叶子节点层,并生成各所述目标哈希编码值对应的第一中间节点层,其中,所述第一中间节点层为所述随机叶子节点层的相邻的上一节点层,进一步地,以各所述目标哈希编码层为所述预设哈希编码模型的输入,获得对应的各模型输出值,进而生成各所述模型输出值对应的第二中间节点层,其中,所述第二中间节点层为所述第一中间节点层的相邻的上一节点层,进而以各所述模型输出值为所述预设哈希编码模型的输入,循环进行各中间节点层的生成,直至获得所述根节点,则完成所述待更新默克尔树的构建。
步骤S20,基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;
在本实施例中,基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型,具体地,将各所述新增数据块加入所述原数据集,并在各所述目标哈希编码中为各所述新增数据块匹配对应的目标哈希编码值,获得所述目标数据集,并从所述目标数据集中选取训练数据和所述训练数据对应的目标哈希编码值集,其中,所述训练数据包括一个或者多个所述目标数据集中的训练数据块,所述目标哈希编码值集包括各所述训练数据块对应的目标哈希编码值,进而基于所述目标哈希编码值集和所述训练数据,对所述预设哈希编码模型进行迭代训练更新,直至满足预设迭代结束条件,获得所述目标哈希编码模型。
其中,所述基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型的步骤包括:
步骤S21,基于所述更新数据和所述原数据集,确定目标数据集,并确定所述目标数据集对应的数据类别集合;
在本实施例中,需要说明的是,所述目标数据集合包括一个或者多个训练数据块,所述数据类别集合包括各所述训练数据块对应的数据类别。
步骤S22,获取所述数据类别集合对应的目标哈希编码值集合,并确定所述目标数据集对应的训练数据和所述目标哈希编码值集合对应的目标哈希编码值;
在本实施例中,需要说明的是,所述目标哈希编码值集合包括各所述数据类别对应的目标哈希编码值。
获取所述数据类别集合对应的目标哈希编码值集合,并确定所述目标数据集对应的训练数据和所述目标哈希编码值集合对应的目标哈希编码值,具体地,获取各所述数据类别对应的目标哈希编码值,并从所述目标数据集中提取所述训练数据,从所述目标哈希编码集合中提取所述训练数据对应的目标哈希编码值。
优选地,分别从各所述数据类别中提取预设数量的数据块作为训练数据块,并将各所述训练数据块作为所述训练数据,并在所述目标哈希编码值集合中确定各所述训练数据块所述数据类别对应的目标哈希编码值。
步骤S23,基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型。
在本实施例中,需要说明的是,所述预设迭代结束条件包括达到预设迭代次数阀值、极化损失函数收敛等,所述迭代训练包括一轮或者多轮训练。
基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型,具体地,从所述训练数据中提取训练数据块输入所述预设哈希编码模型,基于所述训练数据块对应的目标哈希编码值,对所述预设哈希编码模型进行训练更新,并判断训练更新后的所述预设哈希编码模型是否满足预设迭代结束条件,若训练更新后的所述预设哈希编码模型满足预设迭代结束条件,则将训练更新后的所述预设哈希编码模型作为所述目标哈希编码模型,若训练更新后的所述预设哈希编码模型不满足预设迭代结束条件,则获取本轮训练的初始哈希编码值,并基于所述初始哈希编码值和所述目标哈希编码结果,优化所述极化损失函数,并重新对优化后的所述预设哈希编码模型进行训练更新,直至训练更新后的所述预设哈希编码模型满足预设迭代结束条件。
其中,所述基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型的步骤包括:
步骤S221,将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值;
在本实施例中,将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值,具体地,在所述训练数据中提取训练数据块,并将所述训练数据块对应的待处理训练矩阵输入所述预设哈希编码模型,其中,所述待处理训练矩阵为训练数据块的矩阵表示形式,用于存储所述待处理训练矩阵中的数据,以对所述待处理训练矩阵进行哈希,获得哈希向量,进而基于所述极化损失函数,对所述哈希向量的每一比特位进行强制极化,获得所述哈希向量对应的极化向量,进而基于所述极化向量中每一比特位对应的极化标识,生成所述初始哈希编码值,其中,所述极化损失函数如下所示,
L(v,t^c) = max( m - v * t^c,0)
其中,L为所述极化损失函数,m为预设强制极化参数,v为所述哈希向量中每一哈希向量比特位上的数值,且v的绝对值大于m,t^c为所述哈希向量比特位对应的目标哈希值,所述目标哈希值为所述训练数据块对应的目标哈希编码值上的比特位数值,且t^c = {-1, +1},且所述极化损失函数收敛于0,例如,假设m为1,t^c为1,v为-1,此时,L=2,若要使得极化损失函数收敛于0,则需要对v进行强制极化,使得v为1,此时L=0,进而当t^c等于1时,所述哈希向量比特位上的数值将朝正方向逐渐远离0,当t^c等于-1时,所述哈希向量比特位上的数值将朝负方向逐渐远离0,进而在极化成功后,获得的极化向量中每一比特位的极化标识应与对应的目标哈希值一致,进一步地,由于同一数据类别的目标哈希编码值相同,所以属于同一数据类别的各训练数据块对应的极化向量中每一比特位上的极化标识一致,进而基于各所述极化标识,获得的模型输出值一致,也即,对于属于同一数据类别的模型输入数据,训练好的所述预设哈希编码模型可输出相同的模型输出值。
另外地,需要说明的是,所述哈希向量中每一比特位对应所述预设哈希编码的一极化输出通道,每一所述极化输出通道对应的预设强制极化参数均由对所述预设哈希编码模型进行训练而得到,进而每一所述极化输出通道对应的预设强制极化参数可能相同,也可能不同,其中,所述极化输出通道用于基于所述预设强制极化参数,通过对应的所述极化损失函数,强制极化所述哈希向量中每一比特位上的数值,并输出所述初始哈希编码值中对应的比特位的编码数值。
其中,所述将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值的步骤包括:
步骤A10,将所述训练数据输入所述预设哈希编码模型,对所述训练数据进行哈希,获得训练哈希结果;
在本实施例中,需要说明的是,所述预设哈希编码模型包括隐藏层和哈希层,所述隐藏层为进行数据处理的一层或者多层神经网络,所述数据处理包括卷积。池化等,所述哈希层为进行哈希的一层或者多层神经网络。
将所述训练数据输入所述预设哈希编码模型,对所述训练数据进行哈希,获得训练哈希结果,具体地,提取所述训练数据中的训练数据块,并将所述训练数据块对应的待处理训练矩阵输入所述隐藏层,对所述待处理训练矩阵进行预设次数的卷积和池化处理,获得特征表示矩阵,进而将所述特征表示矩阵输入所述哈希层,对所述特征表示矩阵进行全连接,获得哈希向量,并将所述哈希向量作为所述训练哈希结果。
步骤A20,基于所述极化损失函数,对所述训练哈希结果进行极化,获得极化结果;
在本实施例中,基于所述极化损失函数,对所述训练哈希结果进行极化,获得极化结果,具体地,基于所述极化损失函数,对所述哈希向量中的每一比特位进行极化,获得极化向量,并将所述极化向量作为所述极化结果,例如,假设所述哈希向量为(-1,-8),则进行极化后,获得所述极化向量为(1,-8).
步骤A30,基于所述极化结果,确定所述初始哈希编码值。
在本实施例中,基于所述极化结果,确定所述初始哈希编码值,具体地,提取所述极化结果中的每一比特位对应的极化标识,其中,所述极化标识为所述比特位的正负符号,进而基于各所述极化标识,确定所述初始哈希编码值,例如,假设所述极化结果为(1,-8,-7,0.9),则所述初始哈希编码值为1001。
步骤S222,计算所述初始哈希编码值和所述目标哈希编码值之间的训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对;
在本实施例中,计算所述初始哈希编码值和所述目标哈希编码结果之间的训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对,具体地,将所述初始哈希编码值的每一比特位上的数值与所述目标哈希编码结果的每一比特位上的数值进行比对,确定所述初始哈希编码值和所述目标哈希编码结果比特位不相同的比特位数量,并将所述比特位数量作为所述训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对,例如,假设所述初始哈希编码值为向量(1,1,1,1),所述目标哈希编码结果为向量(-1,1,1,-1),则所述比特位数量为2,则所述训练汉明距离为2。
步骤S223,若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述预设哈希编码模型未达到所述预设迭代结束条件,并基于所述初始哈希编码值优化所述极化损失函数;
在本实施例中,若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述预设哈希编码模型未达到所述预设迭代结束条件,并基于所述初始哈希编码值优化所述极化损失函数,具体地,若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述极化损失函数并未在所述待哈希训练矩阵的所有比特位上收敛,也即,所述极化损失函数未收敛,进而判定所述预设哈希编码模型未达到所述预设迭代结束条件,进而确定所述初始哈希编码值和所述目标哈希编码结果之间的一个或者多个不同比特位,并确定各所述不同比特位对应的未收敛极化输出通道,并调整各所述未收敛极化输出通道对应的极化损失函数中的预设强制极化参数,其中,所述未收敛极化输出通道为未收敛的极化损失函数对应的极化输出通道,其中,所述预设哈希编码模型包括一个或者多个极化输出通道,且所述极化输出通道的数量与所述待哈希训练矩阵的比特位的数量相关,也即,一所述比特位对应一所述极化输出通道。
步骤S224,基于优化后的所述极化损失函数,重新训练所述预设哈希编码模型,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值;
在本实施例中,基于优化后的所述极化损失函数,重新进行所述预设哈希编码模型的训练,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值,具体地,重新获取所述训练数据对应的待哈希训练矩阵,并基于重新获取的待哈希训练矩阵,对优化后的所述极化损失函数对应的预设哈希编码模型重新进行迭代训练,以继续优化所述极化损失函数,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值。
步骤S225,若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,并将所述预设哈希编码模型作为所述目标哈希编码模型。
在本实施例中,若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,并将所述预设哈希编码模型作为所述目标哈希编码模型,具体地,若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,也即,所述预设哈希编码模型中各所述极化输出通道对应的极化损失函数收敛,进而将所述预设哈希编码模型作为所述目标哈希编码模型。
步骤S30,基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
在本实施例中,基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树,具体地,生成各所述新增数据块对应的新增随机叶子节点,并将各所述新增数据块输入所述目标哈希编码模型,输出哈希编码值,进而基于各所述新增模型输出值,确定各所述新增数据块的目标父节点,进而将各所述新增随机叶子节点连接至对应的所述目标父节点,获得所述目标默克尔树。
进一步地,将所述目标哈希编码模型的模型参数发送至各默克树使用方,各默克尔树使用方即可基于所述模型参数构建各自的目标默克尔树。
其中,所述更新数据包括新增数据块,
所述基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树的步骤包括:
步骤S31,生成所述新增数据块对应的目标随机叶子节点,并将所述新增数据块输入所述目标哈希编码模型,获得所述新增数据块对应的输出哈希编码值;
在本实施例中,需要说明的是,所述目标随机叶子节点为存储所述新增数据块的默克尔树节点,所述更新数据至少包括一个新增数据块。
生成所述新增数据块对应的目标随机叶子节点,并将所述新增数据块输入所述目标哈希编码模型,获得所述新增数据块对应的输出哈希编码值,具体地,生成各所述新增数据块对应的目标随机叶子节点,并将各所述新增数据块输入所述目标哈希编码模型,分别对各所述新增数据块进行哈希编码,获得各所述新增数据块对应的输出哈希编码值,其中,属于同一数据类别的新增数据块对应同一所述输出哈希编码值。
步骤S32,基于所述输出哈希编码值,匹配所述目标随机叶子节点对应的目标父节点;
在本实施例中,需要说明的是,一所述目标父节点对应一所述目标哈希编码值。
基于所述输出哈希编码值,匹配所述目标随机叶子节点对应的目标父节点,具体地,将每一所述输出哈希编码值分别与各所述目标哈希编码值进行对比,在各所述目标哈希编码值中分别确定与每一所述输出哈希编码值相同的选定目标哈希编码值,并将每一所述选定目标哈希编码值对应的默克尔树节点作为各所述目标随机叶子节点对应的所述目标父节点。
步骤S33,基于所述目标随机叶子节点和所述目标父节点,更新所述随机叶子节点层,获得所述目标默克尔树。
在本实施例中,基于所述目标随机叶子节点和所述目标父节点,更新所述随机叶子节点层,获得所述目标默克尔树,具体地,将各所述目标随机叶子节点分别连接至对应的目标父节点,以更新所述随机叶子节点层,获得所述目标默克尔树,进而由于各所述目标哈希编码值没有发生改变,在所述待更新默克尔树的待更新随机叶子节点需要大量更新时,无需对所述待更新随机叶子节点所在树分支的所有进行更新,只需更新随机叶子节点层,即可完成对所述待更新默克尔树的更新,进而减少了默克尔树更新时的计算量,且降低了计算复杂度。
本实施例通过获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型,进而基于所述更新数据和所述原数据集,确定目标数据集,进而基于所述目标数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型,进而基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。也即,本实施例提供了一种基于预设哈希编码模型构建的待更新默克尔树,进而当所述待更新默克尔树需要进行更新时,获取更新数据和所述待更新默克树对应的原数据集,进而基于所述更新数据和所述原数据集,进行对所述预设哈希编码模型的训练更新,获得目标哈希编码模型,进一步地,基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。也即,本实施例在更新待更新默克尔树时,无论默克树更新多少随机叶子节点上的数据,只需对所述预设哈希编码模型进行一次训练更新,进而基于训练更新获得的哈希编码模型,对待更新默克尔树的随机叶子节点层进行更新,即可完成对所述待更新默克尔树的更新,进而相比于当前的默克尔树的更新方法,当默克尔树的随机叶子节点需要更新时,只需更新默克尔树的随机叶子节点层即可完成对所述待更新默克尔树的更新,无需对随机叶子节点所在树分枝的所有节点进行更新,进而降低了默克尔树更新时的计算量,进而降低了默克尔树更新时计算复杂度,所以,解决了默克尔树更新时计算效率低的技术问题。
进一步地,参照图3,基于本申请中第一实施例,在本申请的另一实施例中,所述原数据集包括一个或者多个原数据块、以及与各所述原数据块对应的目标哈希编码值,所述待更新默克尔树包括一个或者多个随机叶子节点、一个或者多个中间节点、以及根节点,
在所述获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型步骤之前,所述默克尔树更新方法包括:
步骤B10,生成各所述原数据块对应的随机叶子节点,其中,一所述原数据块对应一所述随机叶子节点;
在本实施例中,需要说明的是,所述随机叶子节点为存储所述原数据块的默克尔树节点。
步骤B20,基于各所述目标哈希编码值和所述预设哈希编码模型,生成各所述中间节点和所述根节点。
在本实施例中,各所述中间节点包括一个或者多个第一层中间节点和一个或者多个第二层中间节点。
基于各所述目标哈希编码值和所述预设哈希编码模型,生成各所述中间节点和所述根节点,具体地,生成各所述目标哈希编码值对应的第一层中间节点,其中,所述第一层中间节点为存储所述目标哈希编码值的默克尔树节点,且一所述目标哈希编码值对应一所述第一层中间节点,进而将各所述目标哈希编码值输入所述预设哈希编码模型,分别对各所述目标哈希编码值进行哈希编码,获得各所述目标哈希编码值对应的第二层哈希编码值,其中,一所述第二层哈希编码值属于同一数据类别的一个或者多个目标哈希编码值,进而生成各所述第二层哈希编码值对应的第二层中间节点,进而将所述第二层哈希编码值作为所述预设哈希编码模型的输入,继续生成其他各层的中间节点,直至所述预设哈希编码模型输出单个哈希编码值,并生成所述单个哈希编码值对应的根节点,以完成所述待更新默克尔树的构建。
其中,各所述中间节点包括一个或者多个第一层中间节点、以及一个或者多个上层中间节点;
所述基于各所述目标哈希值和所述预设哈希编码模型,生成各所述中间节点和所述根节点的步骤包括:
步骤B21,生成各所述目标哈希编码值对应的第一层中间节点,其中,一所述目标哈希编码值对应一所述第一层中间节点;
在本实施例中,需要说明的是,所述第一层中间节点为存储所述目标哈希编码值的默克尔树节点。
步骤B22,基于所述预设哈希编码模型,循环生成各所述第一层中间节点对应的上层中间节点,直至获得所述根节点。
在本实施例中,基于所述预设哈希编码模型,循环生成各所述第一层中间节点对应的上层中间节点,直至获得所述根节点,具体地,将各所述第一层中间节点对应的目标哈希编码值输入所述预设哈希编码模型,输出各所述目标哈希编码值对应的第二层哈希编码值,进而生成各所述第二层哈希编码值对应的第二层中间节点,进一步地,基于所述预设哈希编码模型,继续生成其他各层的中间节点,直至所述预设哈希编码模型输出单个哈希编码值,并生成所述单个哈希编码值对应的根节点,以完成所述待更新默克尔树的构建。
本实施例首先生成各所述原数据块对应的随机叶子节点,其中,一所述原数据块对应一所述随机叶子节点,进而基于各所述目标哈希编码值和所述预设哈希编码模型,生成各所述中间节点和所述根节点。也即,本实施例提供了一种基于预设哈希编码模型构建默克尔树的方法,也即,首先生成各所述原数据块对应的随机叶子节点,进而生成各所述目标哈希编码值对应的中间节点,进一步地,基于所述预设哈希编码模型和各所述目标哈希编码值,即可生成其余的各中间节点和根节点,进而完成所述待更新默克尔树的构建,所以,由于本实施例可直接基于预设哈希编码模型,直接生成输入数据块对应的哈希编码值,无需对每一输入数据块进行复杂的哈希变换,进而提高了默克尔树的构建效率,进一步地,在更新所述待更新默克尔树时,只需对所述待更新默克树的预设哈希编码模型进行一次训练更新,即可完成对所述待更新默克尔树的更新,避免了在更新待更新默克尔树时,需对随机叶子节点所在树分枝的所有节点进行更新的情况发生,进而降低了默克尔树更新时的计算量,进一步地,降低了默克尔树更新时计算复杂度,所以,为解决默克尔树更新时计算效率低的技术问题奠定了基础。
参照图4,图4是本申请实施例方案涉及的硬件运行环境的设备结构示意图。
如图4所示,该默克尔树更新设备可以包括:处理器1001,例如CPU,存储器1005,通信总线1002。其中,通信总线1002用于实现处理器1001和存储器1005之间的连接通信。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储设备。
在一实施例中,该默克尔树更新设备还可以包括矩形用户接口、网络接口、摄像头、RF(Radio
Frequency,射频)电路,传感器、音频电路、WiFi模块等等。矩形用户接口可以包括显示屏(Display)、输入子模块比如键盘(Keyboard),可选矩形用户接口还可以包括标准的有线接口、无线接口。网络接口可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。
本领域技术人员可以理解,图4中示出的默克尔树更新设备结构并不构成对默克尔树更新设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图4所示,作为一种计算机存储介质的存储器1005中可以包括操作***、网络通信模块以及默克尔树更新程序。操作***是管理和控制默克尔树更新设备硬件和软件资源的程序,支持默克尔树更新程序以及其它软件和/或程序的运行。网络通信模块用于实现存储器1005内部各组件之间的通信,以及与默克尔树更新***中其它硬件和软件之间通信。
在图4所示的默克尔树更新设备中,处理器1001用于执行存储器1005中存储的默克尔树更新程序,实现上述任一项所述的默克尔树更新方法的步骤。
本申请默克尔树更新设备具体实施方式与上述默克尔树更新方法各实施例基本相同,在此不再赘述。
本申请实施例还提供一种默克尔树更新装置,所述默克尔树更新装置应用于默克尔树更新设备,所述默克尔树更新装置包括:
确定模块,用于获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;
训练模块,用于基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;
更新模块,用于基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
在一实施例中,所述更新模块包括:
哈希编码子模块,用于生成所述新增数据块对应的目标随机叶子节点,并将所述新增数据块输入所述目标哈希编码模型,获得所述新增数据块对应的输出哈希编码值;
匹配子模块,用于基于所述输出哈希编码值,匹配所述目标随机叶子节点对应的目标父节点;
更新子模块,用于基于所述目标随机叶子节点和所述目标父节点,更新所述随机叶子节点层,获得所述目标默克尔树。
在一实施例中,所述训练模块包括:
提取子模块,用于基于所述更新数据和所述原数据集,确定目标数据集,并确定所述目标数据集对应的数据类别集合;
迭代训练子模块,用于基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型。
在一实施例中,迭代训练子模块包括:
哈希编码单元,用于将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值;
比对单元,用于计算所述初始哈希编码值和所述目标哈希编码值之间的训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对;
第一判定单元,用于若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述预设哈希编码模型未达到所述预设迭代结束条件,并基于所述初始哈希编码值优化所述极化损失函数;
重新训练单元,用于基于优化后的所述极化损失函数,重新训练所述预设哈希编码模型,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值;
第二判定单元,用于若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,并将所述预设哈希编码模型作为所述目标哈希编码模型。
在一实施例中,所述哈希编码单元包括:
哈希子单元,用于将所述训练数据输入所述预设哈希编码模型,对所述训练数据进行哈希,获得训练哈希结果;
极化子单元,用于基于所述极化损失函数,对所述训练哈希结果进行极化,获得极化结果;
确定子单元,用于基于所述极化结果,确定所述初始哈希编码值。
在一实施例中,所述默克尔树更新装置还包括:
第一生成模块,用于生成各所述原数据块对应的随机叶子节点,其中,一所述原数据块对应一所述随机叶子节点;
第二生成模块,用于基于各所述目标哈希编码值和所述预设哈希编码模型,生成各所述中间节点和所述根节点。
在一实施例中,所述第二生成模块包括:
生成子模块,用于生成各所述目标哈希编码值对应的第一层中间节点,其中,一所述目标哈希编码值对应一所述第一层中间节点;
循环生成子模块,用于基于所述预设哈希编码模型,循环生成各所述第一层中间节点对应的上层中间节点,直至获得所述根节点。
本申请默克尔树更新装置的具体实施方式与上述默克尔树更新方法各实施例基本相同,在此不再赘述。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利处理范围内。
Claims (20)
- 一种默克尔树更新方法,其中,所述默克尔树更新方法包括:获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
- 如权利要求1所述的默克尔树更新方法,其中,所述更新数据包括新增数据块,所述基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树的步骤包括:生成所述新增数据块对应的目标随机叶子节点,并将所述新增数据块输入所述目标哈希编码模型,获得所述新增数据块对应的输出哈希编码值;基于所述输出哈希编码值,匹配所述目标随机叶子节点对应的目标父节点;基于所述目标随机叶子节点和所述目标父节点,更新所述随机叶子节点层,获得所述目标默克尔树。
- 如权利要求1所述的默克尔树更新方法,其中,所述基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型的步骤包括:基于所述更新数据和所述原数据集,确定目标数据集,并确定所述目标数据集对应的数据类别集合;获取所述数据类别集合对应的目标哈希编码值集合,并确定所述目标数据集对应的训练数据和所述目标哈希编码值集合对应的目标哈希编码值;基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型。
- 如权利要求3所述的默克尔树更新方法,其中,所述基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型的步骤包括:将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值;计算所述初始哈希编码值和所述目标哈希编码值之间的训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对;若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述预设哈希编码模型未达到所述预设迭代结束条件,并基于所述初始哈希编码值优化所述极化损失函数;基于优化后的所述极化损失函数,重新训练所述预设哈希编码模型,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值;若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,并将所述预设哈希编码模型作为所述目标哈希编码模型。
- 如权利要求4所述的默克尔树更新方法,其中,所述将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值的步骤包括:将所述训练数据输入所述预设哈希编码模型,对所述训练数据进行哈希,获得训练哈希结果;基于所述极化损失函数,对所述训练哈希结果进行极化,获得极化结果;基于所述极化结果,确定所述初始哈希编码值。
- 如权利要求1所述的默克尔树更新方法,其中,所述原数据集包括一个或者多个原数据块、以及与各所述原数据块对应的目标哈希编码值,所述待更新默克尔树包括一个或者多个随机叶子节点、一个或者多个中间节点、以及根节点,在所述获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型步骤之前,所述默克尔树更新方法还包括:生成各所述原数据块对应的随机叶子节点,其中,一所述原数据块对应一所述随机叶子节点;基于各所述目标哈希编码值和所述预设哈希编码模型,生成各所述中间节点和所述根节点。
- 如权利要求6所述的默克尔树更新方法,其中,各所述中间节点包括一个或者多个第一层中间节点、以及一个或者多个上层中间节点;所述基于各所述目标哈希值和所述预设哈希编码模型,生成各所述中间节点和所述根节点的步骤包括:生成各所述目标哈希编码值对应的第一层中间节点,其中,一所述目标哈希编码值对应一所述第一层中间节点;基于所述预设哈希编码模型,循环生成各所述第一层中间节点对应的上层中间节点,直至获得所述根节点。
- 一种默克尔树更新装置,其中,所述默克尔树更新装置包括:确定模块,用于获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;训练模块,用于基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;更新模块,用于基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
- 一种默克尔树更新设备,其中,所述默克尔树更新设备包括:存储器、处理器以及存储在存储器上的用于实现所述默克尔树更新方法的程序,所述存储器用于存储实现默克尔树更新方法的程序;所述处理器用于执行实现所述默克尔树更新方法的程序,以实现如下步骤:获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
- 如权利要求9所述的默克尔树更新设备,其中,所述更新数据包括新增数据块,所述基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树的步骤包括:生成所述新增数据块对应的目标随机叶子节点,并将所述新增数据块输入所述目标哈希编码模型,获得所述新增数据块对应的输出哈希编码值;基于所述输出哈希编码值,匹配所述目标随机叶子节点对应的目标父节点;基于所述目标随机叶子节点和所述目标父节点,更新所述随机叶子节点层,获得所述目标默克尔树。
- 如权利要求9所述的默克尔树更新设备,其中,所述基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型的步骤包括:基于所述更新数据和所述原数据集,确定目标数据集,并确定所述目标数据集对应的数据类别集合;获取所述数据类别集合对应的目标哈希编码值集合,并确定所述目标数据集对应的训练数据和所述目标哈希编码值集合对应的目标哈希编码值;基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型。
- 如权利要求11所述的默克尔树更新设备,其中,所述基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型的步骤包括:将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值;计算所述初始哈希编码值和所述目标哈希编码值之间的训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对;若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述预设哈希编码模型未达到所述预设迭代结束条件,并基于所述初始哈希编码值优化所述极化损失函数;基于优化后的所述极化损失函数,重新训练所述预设哈希编码模型,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值;若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,并将所述预设哈希编码模型作为所述目标哈希编码模型。
- 如权利要求12所述的默克尔树更新设备,其中,所述将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值的步骤包括:将所述训练数据输入所述预设哈希编码模型,对所述训练数据进行哈希,获得训练哈希结果;基于所述极化损失函数,对所述训练哈希结果进行极化,获得极化结果;基于所述极化结果,确定所述初始哈希编码值。
- 如权利要求9所述默克尔树更新设备,其中,所述原数据集包括一个或者多个原数据块、以及与各所述原数据块对应的目标哈希编码值,所述待更新默克尔树包括一个或者多个随机叶子节点、一个或者多个中间节点、以及根节点,在所述获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型步骤之前,所述默克尔树更新方法还包括:生成各所述原数据块对应的随机叶子节点,其中,一所述原数据块对应一所述随机叶子节点;基于各所述目标哈希编码值和所述预设哈希编码模型,生成各所述中间节点和所述根节点。
- 如权利要求14所述的默克尔树更新设备,其中,各所述中间节点包括一个或者多个第一层中间节点、以及一个或者多个上层中间节点;所述基于各所述目标哈希值和所述预设哈希编码模型,生成各所述中间节点和所述根节点的步骤包括:生成各所述目标哈希编码值对应的第一层中间节点,其中,一所述目标哈希编码值对应一所述第一层中间节点;基于所述预设哈希编码模型,循环生成各所述第一层中间节点对应的上层中间节点,直至获得所述根节点。
- 一种可读存储介质,其中,所述可读存储介质上存储有实现默克尔树更新方法的程序,所述实现默克尔树更新方法的程序被处理器执行以实现如下步骤:获取更新数据和待更新默克尔树,并确定所述待更新默克树对应的原数据集和预设哈希编码模型;基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型;基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树。
- 如权利要求16所述的可读存储介质,其中,所述更新数据包括新增数据块,所述基于所述目标哈希编码模型和所述更新数据,更新所述待更新默克尔树的随机叶子节点层,获得目标默克尔树的步骤包括:生成所述新增数据块对应的目标随机叶子节点,并将所述新增数据块输入所述目标哈希编码模型,获得所述新增数据块对应的输出哈希编码值;基于所述输出哈希编码值,匹配所述目标随机叶子节点对应的目标父节点;基于所述目标随机叶子节点和所述目标父节点,更新所述随机叶子节点层,获得所述目标默克尔树。
- 如权利要求16所述的可读存储介质,其中,所述基于所述更新数据和所述原数据集,对所述预设哈希编码模型进行训练更新,获得目标哈希编码模型的步骤包括:基于所述更新数据和所述原数据集,确定目标数据集,并确定所述目标数据集对应的数据类别集合;获取所述数据类别集合对应的目标哈希编码值集合,并确定所述目标数据集对应的训练数据和所述目标哈希编码值集合对应的目标哈希编码值;基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型。
- 如权利要求18所述的可读存储介质,其中,所述基于所述训练数据和所述目标哈希编码值,对所述预设哈希编码模型进行迭代训练,以优化所述预设哈希编码模型对应的极化损失函数,直至所述预设哈希编码模型达到预设迭代结束条件,获得所述目标哈希编码模型的步骤包括:将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值;计算所述初始哈希编码值和所述目标哈希编码值之间的训练汉明距离,并将所述训练汉明距离与预设汉明距离阀值进行比对;若所述训练汉明距离大于所述预设汉明距离阀值,则判定所述预设哈希编码模型未达到所述预设迭代结束条件,并基于所述初始哈希编码值优化所述极化损失函数;基于优化后的所述极化损失函数,重新训练所述预设哈希编码模型,直至所述训练汉明距离小于或者等于所述预设汉明距离阀值;若所述训练汉明距离小于或者等于所述预设汉明距离阀值,则判定所述预设哈希编码模型达到所述预设迭代结束条件,并将所述预设哈希编码模型作为所述目标哈希编码模型。
- 如权利要求19所述的可读存储介质,其中,所述将所述训练数据输入所述预设哈希编码模型,以基于所述极化损失函数,对所述训练数据进行哈希编码,获得初始哈希编码值的步骤包括:将所述训练数据输入所述预设哈希编码模型,对所述训练数据进行哈希,获得训练哈希结果;基于所述极化损失函数,对所述训练哈希结果进行极化,获得极化结果;基于所述极化结果,确定所述初始哈希编码值。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010453608.5 | 2020-05-22 | ||
CN202010453608.5A CN111625258B (zh) | 2020-05-22 | 2020-05-22 | 默克尔树更新方法、装置、设备及可读存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021233182A1 true WO2021233182A1 (zh) | 2021-11-25 |
Family
ID=72260731
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/093397 WO2021233182A1 (zh) | 2020-05-22 | 2021-05-12 | 默克尔树更新方法、装置、设备及可读存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111625258B (zh) |
WO (1) | WO2021233182A1 (zh) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111625258B (zh) * | 2020-05-22 | 2021-08-27 | 深圳前海微众银行股份有限公司 | 默克尔树更新方法、装置、设备及可读存储介质 |
CN114281793A (zh) * | 2020-09-28 | 2022-04-05 | 华为技术有限公司 | 数据校验方法、装置和*** |
CN112380209B (zh) * | 2020-10-29 | 2021-08-20 | 华东师范大学 | 一种面向区块链多通道状态数据的聚集结构树方法 |
CN112559518A (zh) * | 2020-12-10 | 2021-03-26 | 杭州趣链科技有限公司 | 默克尔树更新方法、终端设备及存储介质 |
CN113377979B (zh) * | 2021-06-09 | 2023-09-19 | 中国国家铁路集团有限公司 | 一种基于默克尔树的列车开行方案对比生成优化方法 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180276528A1 (en) * | 2015-12-03 | 2018-09-27 | Sun Yat-Sen University | Image Retrieval Method Based on Variable-Length Deep Hash Learning |
CN109829549A (zh) * | 2019-01-30 | 2019-05-31 | 宁波大学 | 基于演化树的哈希学习方法及其无监督的在线哈希学习方法 |
CN110134803A (zh) * | 2019-05-17 | 2019-08-16 | 哈尔滨工程大学 | 基于哈希学习的图像数据快速检索方法 |
CN110688501A (zh) * | 2019-08-28 | 2020-01-14 | 宁波大学 | 一种基于深度学习的全卷积网络的哈希检索方法 |
CN111625258A (zh) * | 2020-05-22 | 2020-09-04 | 深圳前海微众银行股份有限公司 | 默克尔树更新方法、装置、设备及可读存储介质 |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103218574A (zh) * | 2013-04-09 | 2013-07-24 | 电子科技大学 | 一种基于哈希树的数据动态操作可验证性方法 |
CN105868369B (zh) * | 2016-03-30 | 2019-10-01 | 电子科技大学 | 一种基于Merkle树结构的数据模型验证***与方法 |
US11265147B2 (en) * | 2016-12-16 | 2022-03-01 | Nokia Technologies Oy | Secure document management |
CN106897368B (zh) * | 2017-01-16 | 2020-03-24 | 西安电子科技大学 | Merkle哈希求和树及其可验证数据库更新操作方法 |
CN106845280A (zh) * | 2017-03-14 | 2017-06-13 | 广东工业大学 | 一种Merkle哈希树云数据完整性审计方法及*** |
CN111784350A (zh) * | 2019-01-31 | 2020-10-16 | 阿里巴巴集团控股有限公司 | 构建区块对应的梅克尔树、简单支付验证方法及装置 |
CN110704664B (zh) * | 2019-08-28 | 2022-04-05 | 宁波大学 | 一种哈希检索方法 |
-
2020
- 2020-05-22 CN CN202010453608.5A patent/CN111625258B/zh active Active
-
2021
- 2021-05-12 WO PCT/CN2021/093397 patent/WO2021233182A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180276528A1 (en) * | 2015-12-03 | 2018-09-27 | Sun Yat-Sen University | Image Retrieval Method Based on Variable-Length Deep Hash Learning |
CN109829549A (zh) * | 2019-01-30 | 2019-05-31 | 宁波大学 | 基于演化树的哈希学习方法及其无监督的在线哈希学习方法 |
CN110134803A (zh) * | 2019-05-17 | 2019-08-16 | 哈尔滨工程大学 | 基于哈希学习的图像数据快速检索方法 |
CN110688501A (zh) * | 2019-08-28 | 2020-01-14 | 宁波大学 | 一种基于深度学习的全卷积网络的哈希检索方法 |
CN111625258A (zh) * | 2020-05-22 | 2020-09-04 | 深圳前海微众银行股份有限公司 | 默克尔树更新方法、装置、设备及可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN111625258A (zh) | 2020-09-04 |
CN111625258B (zh) | 2021-08-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021233182A1 (zh) | 默克尔树更新方法、装置、设备及可读存储介质 | |
WO2021232752A1 (zh) | 哈希编码方法、装置、设备及可读存储介质 | |
CN111988614B (zh) | 哈希编码优化方法、设备及可读存储介质 | |
US20210224692A1 (en) | Hyperparameter tuning method, device, and program | |
CN115169568B (zh) | 量子计算处理方法、装置及电子设备 | |
CN111967609A (zh) | 模型参数验证方法、设备及可读存储介质 | |
CN111158912A (zh) | 云雾协同计算环境下一种基于深度学习的任务卸载决策方法 | |
WO2021232747A1 (zh) | 数据确权方法、设备及可读存储介质 | |
Ghosh et al. | Communication-efficient and byzantine-robust distributed learning with error feedback | |
CN113011529A (zh) | 文本分类模型的训练方法、装置、设备及可读存储介质 | |
CN116644804B (zh) | 分布式训练***、神经网络模型训练方法、设备和介质 | |
US20240071070A1 (en) | Algorithm and method for dynamically changing quantization precision of deep-learning network | |
WO2023024749A1 (zh) | 视频检索的方法、装置、设备及存储介质 | |
WO2021233183A1 (zh) | 神经网络校验方法、装置、设备及可读存储介质 | |
CN114186609A (zh) | 模型训练方法和装置 | |
Yuan et al. | A novel hard decision decoding scheme based on genetic algorithm and neural network | |
JP2023123636A (ja) | ハイパーパラメータチューニング方法、装置及びプログラム | |
CN114707655B (zh) | 一种量子线路转换方法、***、存储介质和电子设备 | |
Yue et al. | Coded decentralized learning with gradient descent for big data analytics | |
CN116384471A (zh) | 模型剪枝方法、装置、计算机设备、存储介质和程序产品 | |
CN113743012B (zh) | 一种多用户场景下的云-边缘协同模式任务卸载优化方法 | |
Yue et al. | Really should we pruning after model be totally trained? Pruning based on a small amount of training | |
CN111010196B (zh) | 一种极化码BP List译码方法 | |
CN108055045A (zh) | 一种新型ldpc码译码器的结构 | |
Bian et al. | A parameterized douglas–rachford splitting algorithm for nonconvex optimization |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21809410 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21809410 Country of ref document: EP Kind code of ref document: A1 |