[][src]Struct blake2b_simd::blake2bp::State

pub struct State { /* fields omitted */ }

An incremental hasher for BLAKE2bp, just like the State type for BLAKE2b.

Example

use blake2b_simd::blake2bp;

let mut state = blake2bp::State::new();
state.update(b"foo");
state.update(b"bar");
let hash = state.finalize();

let expected = "e654427b6ef02949471712263e59071abbb6aa94855674c1daeed6cfaf127c33\
                dfa3205f7f7f71e4f0673d25fa82a368488911f446bccd323af3ab03f53e56e5";
assert_eq!(expected, &hash.to_hex());

Methods

impl State[src]

pub fn new() -> Self[src]

Equivalent to State::default() or Params::default().to_state().

pub fn update(&mut self, input: &[u8]) -> &mut Self[src]

Add input to the hash. You can call update any number of times.

pub fn finalize(&self) -> Hash[src]

Finalize the state and return a Hash. This method is idempotent, and calling it multiple times will give the same result. It's also possible to update with more input in between.

pub fn count(&self) -> u128[src]

Return the total number of bytes input so far.

Note that count doesn't include the bytes of the key block, if any. It's exactly the total number of input bytes fed to update.

Trait Implementations

impl Clone for State[src]

impl Debug for State[src]

impl Default for State[src]

impl Write for State[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.