merkle-root

Crates.iomerkle-root
lib.rsmerkle-root
version
sourcesrc
created_at2024-10-12 18:25:42.704667
updated_at2024-10-12 18:25:42.704667
descriptionLibrary for calculating the Merkle root of either a file, or walked directory.
homepage
repository
max_upload_size
id1406733
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Michael Bullington (mbullington)

documentation

README

merkle-root

Library for calculating the Merkle root of either a file, or walked directory.

Supports both xxHash (non-cryptographic) and SHA2-256.

  • Files are split into 8kb blocks, then recursively hashed.
  • Walked "directories" are hashes into n arbitrary levels. Individual files can be "tested" for inclusion in O(n * log n) time.
use merkle_root::MerkleTree;

let data_to_hash = [0xffu8; 8192];
let tree = MerkleTree::from_reader(&data_to_hash[..]).unwrap();
assert_eq!(
    tree.root(),
    hex::decode("68d131bc271f9c192d4f6dcd8fe61bef90004856da19d0f2f514a7f4098b0737").unwrap()
);

Meta

This library is forked from Fuchsia.

Changes:

  • Support for non-cryptographic hashes (xxhash-rust).
  • Create a MerkleTree from a walked directory.

License

This work is originally under the BSD License.

Any new contributions are under the MIT License.

Commit count: 0

cargo fmt