merkle_hash

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

Usage

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

toml [dependencies] merkle_hash = "3"

Features

Examples

Get the master hash of a directory tree:

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

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

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

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

let tree = MerkleTree::new("/path/to/directory", true).unwrap(); for item in tree { println!("{}: {}", item.path.relative, item.hash); } ```

Collapse the tree into any linear collection:

```rust,norun use std::collections::BTreeSet; use merklehash::MerkleTree; use merkle_hash::MerkleItem;

let tree = MerkleTree::new("/path/to/directory", true).unwrap(); let btreeset: BTreeSet = tree.intoiter().collect(); ```

Used technologies

License

Licensed under MIT license.