pub struct HashInstance { /* private fields */ }Expand description
A hash instance.
Implementations§
Source§impl HashInstance
impl HashInstance
Sourcepub fn new(alg: TpmiAlgHash) -> Result<Self, Infallible>
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.
pub fn try_clone(&self) -> Result<Self, Infallible>
Sourcepub fn update<'a, DI: CryptoIoSlicesIter<'a>>(
&mut self,
data: DI,
) -> Result<(), CryptoError>
pub fn update<'a, DI: CryptoIoSlicesIter<'a>>( &mut self, data: DI, ) -> Result<(), CryptoError>
Sourcepub fn finalize_into_reset(
&mut self,
digest: &mut [u8],
) -> Result<(), Infallible>
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.
Sourcepub fn finalize_into(self, digest: &mut [u8]) -> Result<(), Infallible>
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.
Sourcepub fn finalize_reset(&mut self) -> Result<TpmtHa<'static>, CryptoError>
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().
Sourcepub fn finalize(self) -> Result<TpmtHa<'static>, CryptoError>
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.
Sourcepub fn digest_len(&self) -> usize
pub fn digest_len(&self) -> usize
Determine the instance’s associated hash algorithm’s digest length.
Trait Implementations§
Source§impl From<&HashInstance> for TpmiAlgHash
impl From<&HashInstance> for TpmiAlgHash
Source§fn from(instance: &HashInstance) -> Self
fn from(instance: &HashInstance) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HashInstance
impl RefUnwindSafe for HashInstance
impl Send for HashInstance
impl Sync for HashInstance
impl Unpin for HashInstance
impl UnsafeUnpin for HashInstance
impl UnwindSafe for HashInstance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more