merkle_hash

Finds the hashes of all files and directories in a directory tree.

Documentation

docs.rs/merkle_hash

Usage

To use this crate, add merkle_hash as a dependency to your project's Cargo.toml:

toml [dependencies] merkle_hash = "2"

Examples

Get the master hash of a directory tree:

```rust,norun use merklehash::merkle_tree::MerkleTree;

let tree = MerkleTree::new("path/to/tree").unwrap(); let masterhash = tree.mainnode.hash; ```

Traverse a directory tree, getting the hash of each file and directory:

```rust,norun use merklehash::merkle_tree::MerkleTree;

let tree = MerkleTree::new("/path/to/tree").unwrap(); let traverseresult = tree.traverse(&|path,hash|{ println!("{}: {}", path.absolutepath, hash); Ok(()) }); ```

Collapse the tree for linear traversal:

```rust,norun use merklehash::merkle_tree::MerkleTree;

let tree = MerkleTree::new("/path/to/tree").unwrap(); let btreeset = tree.collapseintotreeset(); ```