Skip to main content

Hasher

Struct Hasher 

Source
pub struct Hasher { /* private fields */ }
Expand description

An incremental hash under a profile. It is not Clone, and Debug names its algorithm only.

Implementations§

Source§

impl Hasher

Source

pub fn new(a: &Admitted, h: HashAlgorithm) -> Result<Hasher, CryptoError>

A hasher for h. Refuses, in order, a hash a’s profile does not admit or its module line lacks (Admitted::admit_hash) and one this backend does not implement (CryptoError::Unavailable). Panics only if the module fails to initialise the digest context.

Source

pub fn algorithm(&self) -> HashAlgorithm

The algorithm.

Source

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

Feeds data. Panics only if the module’s digest context fails, or if the bytes fed in total pass u64::MAX, where aws-lc-rs stops. A SHA-256 hasher fed 2^61 bytes or more, past FIPS 180-4’s limit, then gives a non-conforming digest from finish: the module’s bit count wraps silently.

Source

pub fn finish(self) -> Vec<u8> ⓘ

The full-length digest of everything fed. Panics only if the module’s digest context fails.

Trait Implementations§

Source§

impl Debug for Hasher

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Hasher

§

impl Freeze for Hasher

§

impl Move for Hasher

§

impl RefUnwindSafe for Hasher

§

impl Send for Hasher

§

impl Sync for Hasher

§

impl Unpin for Hasher

§

impl UnsafeUnpin for Hasher

§

impl UnwindSafe for Hasher

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.