merkleforge_hash/lib.rs
1//! # merkle-hash
2//!
3//! Pluggable cryptographic hash adapters for **`MerkleForge`**.
4//!
5//! Each adapter wraps a well-tested upstream crate and implements the
6//! [`HashFunction`] trait so it can drive any tree variant in `merkle-variants`.
7//!
8//! ## Available adapters
9//!
10//! | Type | Algorithm | Digest | Best for |
11//! |------|-----------|--------|----------|
12//! | [`Sha256`] | SHA-256 | 32 bytes | Hardware-accelerated production deployments |
13//! | [`Keccak256`] | Keccak-256 | 32 bytes | Ethereum-compatible Patricia Tries |
14//! | [`Blake3`] | BLAKE3 | 32 bytes | Maximum throughput on modern CPUs |
15//!
16//! ## Choosing a hash function
17//!
18//! - **SHA-256**: Excellent choice when targeting x86-64 hardware with SHA
19//! extensions. Widely used in Bitcoin and many Ethereum-adjacent systems.
20//! - **Keccak-256**: Required for any tree that must produce state roots
21//! readable by Ethereum tooling (e.g. the `MerklePatriciaTrie` variant).
22//! - **BLAKE3**: Fastest on software paths, good for throughput-sensitive
23//! workloads where Ethereum compatibility is not required.
24//!
25//! Concrete benchmark numbers will be published in the Phase 5 report.
26
27#![deny(missing_docs)]
28#![forbid(unsafe_code)]
29
30mod blake3;
31mod keccak256;
32mod sha256;
33
34pub use crate::blake3::Blake3;
35pub use crate::keccak256::Keccak256;
36pub use crate::sha256::Sha256;
37
38/// Re-export of the [`HashFunction`] trait for convenience.
39pub use merkle_core::traits::HashFunction;