A simple and fast generic binary [Merkle Tree] for [Rust Crypto] hash functions.
The goal of [MerkleTree
] is simple yet fast implementation
of [Merkle Tree] by supporting the standard Rust traits, e.g.
[FromIterator
].
This also makes [MerkleTree
] work with other data types ergonomically.
Here is how to create [MerkleTree
] from the array of leaves.
Thanks to [FromIterator
], you just call collect()
on the array iterator:
```
use hexliteral::hex;
use sha3::Sha3256;
use merkle_lite::MerkleTree;
// 16 identical leaves for the demonstration purpose.
let leaves = [[0xab_u8; 32]; 16];
let tree: MerkleTree
assert_eq!( tree.root(), hex!("34fac4b8781d0b811746ec45623606f43df1a8b9009f89c5564e68025a6fd604"), ); ```
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.