Skip to main content

HashInstance

Struct HashInstance 

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

A hash instance.

Implementations§

Source§

impl HashInstance

Source

pub fn new(alg: TpmiAlgHash) -> Result<Self, Infallible>

Create a new hash instance for the specified algorithm.

§Arguments:
  • alg - The hash algorithm to create an instance for.
Source

pub fn try_clone(&self) -> Result<Self, Infallible>

Source

pub fn update<'a, DI: CryptoIoSlicesIter<'a>>( &mut self, data: DI, ) -> Result<(), CryptoError>

Append to the digested data.

§Arguments:
  • data - The data to digest.
Source

pub fn finalize_into_reset( &mut self, digest: &mut [u8], ) -> Result<(), Infallible>

Produce a digest into a provided buffer and reset the hash instance.

Produce a digest into digest and reset the hash instance to the state it would have had right after Self::new().

§Arguments:
  • digest - Destination to write the produced digest to.
Source

pub fn finalize_into(self, digest: &mut [u8]) -> Result<(), Infallible>

Produce the final digest into a provided buffer..

§Arguments:
  • digest - Destination to write the produced digest to.
Source

pub fn finalize_reset(&mut self) -> Result<TpmtHa<'static>, CryptoError>

Produce a digest and reset the hash instance.

Allocate a buffer suitable for the instance’s digest length, produce a digest into it and reset the hash instance to the state it would have had right after Self::new().

Source

pub fn finalize(self) -> Result<TpmtHa<'static>, CryptoError>

Produce the final digest.

Allocate a buffer suitable for the instance’s digest length and produce the final digest into it.

Source

pub fn digest_len(&self) -> usize

Determine the instance’s associated hash algorithm’s digest length.

Trait Implementations§

Source§

impl From<&HashInstance> for TpmiAlgHash

Source§

fn from(instance: &HashInstance) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.