[][src]Struct exonum_crypto::HashStream

pub struct 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

impl Default for HashStream[src]

impl Debug for HashStream[src]

Auto Trait Implementations

impl Send for HashStream

impl Sync for HashStream

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> InitializableFromZeroed for T where
    T: Default