2 releases
Uses old Rust 2015
0.1.1 | Nov 11, 2017 |
---|---|
0.1.0 | Nov 11, 2017 |
#49 in #cargo-test
5KB
70 lines
merkle_test
If you find this by chance you will not find anything interesting here, its just test task
Usage
- Documentation: docs.rs
- Test:
cargo test
- Bench:
rustup run nightly cargo bench
TODO
- Find Merkle tree test vectors and test with then
- Compare performance with other implementations
- Adding hashes to tree as pointer (zero-copy)
lib.rs
:
Merkle tree test implementation
Usage
Add this to your Cargo.toml
[dependencies]
merkle_test = "0.1"
extern crate merkle_test;
use merkle_test::MerkleTree;
use merkle_test::crypto_reexport::sha2::Sha256;
fn main() {
let hashes: Vec<Vec<u8>> = vec![];
let mut tree = MerkleTree::new(Sha256::new()); // use Sha256
hashes.iter().for_each(|hash| tree.add_hash(hash.to_vec())); // add hashes to tree
let root = tree.root(); // calculate merkle root
println!("Merkle root: {:?}", root);
}
Dependencies
~4MB
~51K SLoC