hashes: Move engine functions

The `sha256t` module is unique in that it implements its methods
manually (as call throughs) instead of using the macros. To make it more
clear what is implemented re-order the engine constructor and getter to
better mirror the layout in the macros.

Internal change only.
This commit is contained in:
Tobin C. Harding 2024-10-16 12:19:12 +11:00
parent 12f261c009
commit 98691186dc
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 6 additions and 6 deletions

View File

@ -42,12 +42,6 @@ where
unsafe { &mut *(bytes as *mut _ as *mut Self) } unsafe { &mut *(bytes as *mut _ as *mut Self) }
} }
/// Constructs a new engine.
pub fn engine() -> HashEngine { T::engine() }
/// Produces a hash from the current state of a given engine.
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
/// Copies a byte slice into a hash object. /// Copies a byte slice into a hash object.
#[deprecated(since = "TBD", note = "Use `from_byte_array` instead.")] #[deprecated(since = "TBD", note = "Use `from_byte_array` instead.")]
pub fn from_slice(sl: &[u8]) -> Result<Hash<T>, FromSliceError> { pub fn from_slice(sl: &[u8]) -> Result<Hash<T>, FromSliceError> {
@ -60,6 +54,12 @@ where
} }
} }
/// Produces a hash from the current state of a given engine.
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
/// Constructs a new engine.
pub fn engine() -> HashEngine { T::engine() }
/// Hashes some bytes. /// Hashes some bytes.
#[allow(clippy::self_named_constructors)] // Hash is a noun and a verb. #[allow(clippy::self_named_constructors)] // Hash is a noun and a verb.
pub fn hash(data: &[u8]) -> Self { pub fn hash(data: &[u8]) -> Self {