pub trait HashProvider: Send + Sync {
// Required methods
fn hash(&self, content: &[u8]) -> String;
fn prefix(&self) -> &'static str;
// Provided method
fn hash_bytes(&self, content: &[u8]) -> [u8; 32] { ... }
}Expand description
Trait for pluggable content-hash algorithms.
Any type implementing this trait can serve as CLM’s content hash function.
The trait is intentionally minimal: hash returns the raw hex digest,
and prefix returns the algorithm tag used in prefixed storage format.
Required Methods§
Provided Methods§
Sourcefn hash_bytes(&self, content: &[u8]) -> [u8; 32]
fn hash_bytes(&self, content: &[u8]) -> [u8; 32]
Compute the raw digest as a fixed-size byte array (for Merkle trees, etc.). Default implementation parses the hex digest; providers may override for efficiency.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".