[−][src]Struct exonum_crypto::HashStream
This structure provides a possibility to calculate a hash digest
for a stream of data. Unlike the
Hash
structure,
the given structure lets the code process several data chunks without
the need to copy them into a single buffer.
Examples
The example below indicates the data the code is working with; runs the system hash update as many times as required to process all the data chunks and calculates the resulting hash of the system.
use exonum_crypto::HashStream; let data: Vec<[u8; 5]> = vec![[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]; let mut hash_stream = HashStream::new(); for chunk in data { hash_stream = hash_stream.update(&chunk); } let _ = hash_stream.hash();
Methods
impl HashStream
[src]
pub fn new() -> Self
[src]
Creates a new instance of HashStream
.
pub fn update(self, chunk: &[u8]) -> Self
[src]
Processes a chunk of stream and returns a HashStream
with the updated internal state.
pub fn hash(self) -> Hash
[src]
Returns the resulting hash of the system calculated upon the commit of currently supplied data.
Trait Implementations
Auto Trait Implementations
impl Send for HashStream
impl Sync for HashStream
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,