Struct fog_crypto::hash::HashState
source · [−]pub struct HashState { /* private fields */ }
Expand description
A hasher that can incrementally take in data and produce a hash at any time.
Example
// Create a hash by feeding in bytes repeatedly
let mut hash_state = HashState::new();
hash_state.update(b"I am the first part of a data sequence");
let hash_first = hash_state.hash(); // Produce a hash of just the first part
hash_state.update(b"And I am their sibling, the second part of a data sequence");
let hash_full = hash_state.finalize(); // Consume the HashState
println!("hash_first(Base58): {}", hash_first);
println!("hash_full(Base58): {}", hash_full);
Implementations
Initialize a new hasher with a specific algorithm version. You should avoid this except when working through an upgrade process, where you may briefly need to support more than one version. Fails if the version isn’t supported.
Get the version of hash that this hasher will produce on completion.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for HashState
impl UnwindSafe for HashState
Blanket Implementations
Mutably borrows from an owned value. Read more