[−][src]Struct kuska_sodiumoxide::crypto::generichash::State
State
contains the state for multi-part (streaming) hash computations. This allows the caller
to process a message as a sequence of multiple chunks.
Implementations
impl State
[src]
pub fn new(out_len: usize, key: Option<&[u8]>) -> Result<State, ()>
[src]
new
constructs and initializes a new State
with the given parameters.
out_len
specifies the resulting hash size.
Only values in the interval [DIGEST_MIN
, DIGEST_MAX
] are allowed.
key
is an optional parameter, which when given,
a custom key can be used for the computation of the hash.
The size of the key must be in the interval [KEY_MIN
, KEY_MAX
].
pub fn update(&mut self, data: &[u8]) -> Result<(), ()>
[src]
update
updates the State
with data
. update
can be called multiple times in order
to compute the hash from sequential chunks of the message.
pub fn finalize(self) -> Result<Digest, ()>
[src]
finalize
finalizes the state and returns the digest value. finalize
consumes the
State
so that it cannot be accidentally reused.
Auto Trait Implementations
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,