diff --git a/hashes/src/internal_macros.rs b/hashes/src/internal_macros.rs index 320b29d7d..4e5f61bd1 100644 --- a/hashes/src/internal_macros.rs +++ b/hashes/src/internal_macros.rs @@ -130,6 +130,9 @@ macro_rules! hash_type { $crate::internal_macros::hash_type_no_default!($bits, $reverse, $doc); impl Hash { + /// Produces a hash from the current state of a given engine. + pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) } + /// Constructs a new engine. pub fn engine() -> HashEngine { Default::default() } @@ -180,9 +183,6 @@ macro_rules! hash_type_no_default { unsafe { &mut *(bytes as *mut _ as *mut Self) } } - /// Produces a hash from the current state of a given engine. - pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) } - /// Copies a byte slice into a hash object. pub fn from_slice( sl: &[u8], diff --git a/hashes/src/siphash24.rs b/hashes/src/siphash24.rs index 1d17885ff..a40f8185c 100644 --- a/hashes/src/siphash24.rs +++ b/hashes/src/siphash24.rs @@ -168,6 +168,9 @@ impl crate::HashEngine for HashEngine { } impl Hash { + /// Produces a hash from the current state of a given engine. + pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) } + /// Hashes the given data with an engine with the provided keys. pub fn hash_with_keys(k0: u64, k1: u64, data: &[u8]) -> Hash { let mut engine = HashEngine::with_keys(k0, k1);