HashAlgoKernel

Trait HashAlgoKernel 

Source
pub trait HashAlgoKernel {
    type Option: HashOption;
    type Error: Into<HashError> + Debug;
    type Output: Eq + AsRef<[u8]> + LowerHex + UpperHex;

    // Required methods
    fn name() -> &'static str;
    fn digest_size() -> usize;
    fn new(opt: Self::Option) -> Self;
    fn update<T>(&mut self, data: T) -> Result<(), Self::Error>
       where T: AsRef<[u8]>;
    fn finalize(self) -> Result<Self::Output, Self::Error>;
}
Expand description

Kernel of hash algorithms.

Required Associated Types§

Source

type Option: HashOption

Source

type Error: Into<HashError> + Debug

Source

type Output: Eq + AsRef<[u8]> + LowerHex + UpperHex

The message digest of hash algorithms.

Required Methods§

Source

fn name() -> &'static str

The name of hash algorithm.

Source

fn digest_size() -> usize

The size of the output in bytes.

Source

fn new(opt: Self::Option) -> Self

Create a new hash algorithm.

Source

fn update<T>(&mut self, data: T) -> Result<(), Self::Error>
where T: AsRef<[u8]>,

Append bytes to compute the digest.

Source

fn finalize(self) -> Result<Self::Output, Self::Error>

Finalize and return the digest.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§