A simple, fast, and composable binary [Merkle tree and proof] for [Rust Crypto] hash functions.
Here is how to create MerkleTree
and MerkleProof
for the ordered array of cryptographic hashes:
```
use randcore::RngCore;
use sha3::Sha3256;
use merkle_lite::MerkleTree;
// Composes MerkleTree from the 100 random leaves.
let tree: MerkleTree
// Verifies the proof of inclusion, 12th and 98th leaves. asserteq!( tree.proof(&[12, 98]) .unwrap() .verify(&[ (98, tree.leaves().nth(98).unwrap()), (12, tree.leaves().nth(12).unwrap()), ]) .unwrap() .asref(), tree.root(), ); ```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.