merkle_root/
lib.rs

1// Copyright 2018 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! `merkle_root` contains types and methods for building and working with merkle trees.
6
7#![warn(clippy::all)]
8
9pub type Hash = Vec<u8>;
10
11#[derive(Debug, PartialEq, Eq, Clone, Copy)]
12pub enum HashAlgorithm {
13    SHA256,
14    #[cfg(feature = "xxhash")]
15    XXHash64,
16}
17
18/// The size of a single block of data (or hashes), in bytes.
19pub const BLOCK_SIZE: usize = 8192;
20
21mod util;
22pub use crate::util::hash_block;
23pub use crate::util::hash_hashes;
24
25mod tree;
26pub use crate::tree::MerkleTree;
27
28mod builder;
29pub use crate::builder::MerkleTreeBuilder;
30
31mod writer;
32pub use crate::writer::MerkleTreeWriter;