[−][src]Struct blake3::Hasher
An incremental hash state that can accept any number of writes.
Methods
impl Hasher
[src]
pub fn new() -> Self
[src]
Construct a new Hasher
for the regular hash function.
pub fn new_keyed(key: &[u8; 32]) -> Self
[src]
Construct a new Hasher
for the keyed hash function. See
keyed_hash
.
pub fn new_derive_key(context: &str) -> Self
[src]
Construct a new Hasher
for the key derivation function. See
derive_key
. The context string should be hardcoded, globally
unique, and application-specific.
pub fn update(&mut self, input: &[u8]) -> &mut Self
[src]
Add input bytes to the hash state. You can call this any number of times.
Note that the degree of SIMD and multi-threading parallelism that
Hasher
can use is limited by the size of this input buffer. The 8 KiB
buffer currently used by std::io::copy
is enough to leverage AVX2,
for example, but not enough to leverage AVX-512. If multi-threading is
enabled (the rayon
feature), the optimal input buffer size will vary
considerably across different CPUs, and it may be several mebibytes.
pub fn finalize(&self) -> Hash
[src]
Finalize the hash state and return the Hash
of
the input.
This method is idempotent. Calling it twice will give the same result. You can also add more input and finalize again.
ⓘImportant traits for OutputReaderpub fn finalize_xof(&self) -> OutputReader
[src]
Finalize the hash state and return an OutputReader
, which can
supply any number of output bytes.
This method is idempotent. Calling it twice will give the same result. You can also add more input and finalize again.
Trait Implementations
impl Clone for Hasher
[src]
ⓘImportant traits for Hasherfn clone(&self) -> Hasher
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Hasher
[src]
impl Write for Hasher
[src]
fn write(&mut self, input: &[u8]) -> Result<usize>
[src]
This is equivalent to update
.
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>
1.36.0[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for Hasher
impl Send for Hasher
impl Sync for Hasher
impl Unpin for Hasher
impl UnwindSafe for Hasher
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,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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.
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>,