Add engine function to siphash24::Hash

The other hashes that require initial state (keys etc) both have an
`engine` function on the hash type because they cannot use the
`GeneralHash::engine` function.

Add an `engine` function to the `siphash24::Hash` type.
This commit is contained in:
Tobin C. Harding 2025-02-03 13:45:11 +11:00
parent 6ba756b246
commit 1bcfc80fe7
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 3 additions and 0 deletions

View File

@ -168,6 +168,9 @@ impl crate::HashEngine for HashEngine {
} }
impl Hash { impl Hash {
/// Constructs a new SipHash24 engine with keys.
pub fn engine(k0: u64, k1: u64) -> HashEngine { HashEngine::with_keys(k0, k1) }
/// Produces a hash from the current state of a given engine. /// Produces a hash from the current state of a given engine.
pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) } pub fn from_engine(e: HashEngine) -> Hash { from_engine(e) }