Debian Codegraph @

merkletree.go

raw symbols SCIP
1 // Package merkletree provides tools for calculating the Merkle root of a
2 // dataset, for creating a proof that a piece of data is in a Merkle tree of a
3 // given root, and for verifying proofs that a piece of data is in a Merkle
4 // tree of a given root. The tree is implemented according to the specification
5 // for Merkle trees provided in RFC 6962.
6 //
7 // Package merkletree also supports building roots and proofs from cached
8 // subroots of the Merkle tree. For example, a large file could be cached by
9 // building the Merkle root for each 4MB sector and remembering the Merkle
10 // roots of each sector. Using a cached tree, the Merkle root of the whole file
11 // can be computed by passing the cached tree each of the roots of the 4MB
12 // sector. Building proofs using these cached roots is also supported. A proof
13 // must be built within the target sector using a normal Tree, requiring the
14 // whole sector to be hashed. The results of that proof can then be passed into
15 // the Prove() function of a cached tree, which will create the full proof
16 // without needing to hash the entire file. Caching also makes it inexpensive
17 // to update the Merkle root of the file after changing or deleting segments of
18 // the larger file.
19 //
20 // Examples can be found in the README for the package.
21 package merkletree