Trait digest::DynDigest

source ·
pub trait DynDigest {
    // Required methods
    fn update(&mut self, data: &[u8]);
    fn finalize_into(self, buf: &mut [u8]) -> Result<(), InvalidBufferSize>;
    fn finalize_into_reset(
        &mut self,
        out: &mut [u8],
    ) -> Result<(), InvalidBufferSize>;
    fn reset(&mut self);
    fn output_size(&self) -> usize;
    fn box_clone(&self) -> Box<dyn DynDigest>;

    // Provided methods
    fn finalize_reset(&mut self) -> Box<[u8]> { ... }
    fn finalize(self: Box<Self>) -> Box<[u8]> { ... }
}
Expand description

Modification of the Digest trait suitable for trait objects.

Required Methods§

source

fn update(&mut self, data: &[u8])

Digest input data.

This method can be called repeatedly for use with streaming messages.

source

fn finalize_into(self, buf: &mut [u8]) -> Result<(), InvalidBufferSize>

Write result into provided array and consume the hasher instance.

Returns error if buffer length is not equal to output_size.

source

fn finalize_into_reset( &mut self, out: &mut [u8], ) -> Result<(), InvalidBufferSize>

Write result into provided array and reset the hasher instance.

Returns error if buffer length is not equal to output_size.

source

fn reset(&mut self)

Reset hasher instance to its initial state.

source

fn output_size(&self) -> usize

Get output size of the hasher

source

fn box_clone(&self) -> Box<dyn DynDigest>

Available on crate feature alloc only.

Clone hasher state into a boxed trait object

Provided Methods§

source

fn finalize_reset(&mut self) -> Box<[u8]>

Available on crate feature alloc only.

Retrieve result and reset hasher instance

source

fn finalize(self: Box<Self>) -> Box<[u8]>

Available on crate feature alloc only.

Retrieve result and consume boxed hasher instance

Trait Implementations§

source§

impl Clone for Box<dyn DynDigest>

Available on crate feature alloc only.
source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§

source§

impl<D: Update + FixedOutputReset + Reset + Clone + 'static> DynDigest for D