pub struct Hash<'d, T: Instance, M: Mode> { /* private fields */ }Expand description
HASH driver.
Implementations§
Source§impl<'d, T: Instance> Hash<'d, T, Blocking>
 
impl<'d, T: Instance> Hash<'d, T, Blocking>
Sourcepub fn new_blocking(
    peripheral: Peri<'d, T>,
    _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
 
pub fn new_blocking( peripheral: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Instantiates, resets, and enables the HASH peripheral.
Source§impl<'d, T: Instance, M: Mode> Hash<'d, T, M>
 
impl<'d, T: Instance, M: Mode> Hash<'d, T, M>
Sourcepub fn start<'c>(
    &mut self,
    algorithm: Algorithm,
    format: DataType,
    key: Option<&'c [u8]>,
) -> Context<'c>
 
pub fn start<'c>( &mut self, algorithm: Algorithm, format: DataType, key: Option<&'c [u8]>, ) -> Context<'c>
Starts computation of a new hash and returns the saved peripheral state.
Sourcepub fn update_blocking<'c>(&mut self, ctx: &mut Context<'c>, input: &[u8])
 
pub fn update_blocking<'c>(&mut self, ctx: &mut Context<'c>, input: &[u8])
Restores the peripheral state using the given context, then updates the state with the provided data. Peripheral state is saved upon return.
Sourcepub fn finish_blocking<'c>(
    &mut self,
    ctx: Context<'c>,
    digest: &mut [u8],
) -> usize
 
pub fn finish_blocking<'c>( &mut self, ctx: Context<'c>, digest: &mut [u8], ) -> usize
Computes a digest for the given context. The digest buffer must be large enough to accomodate a digest for the selected algorithm. The largest returned digest size is 128 bytes for SHA-512. Panics if the supplied digest buffer is too short.
Auto Trait Implementations§
impl<'d, T, M> Freeze for Hash<'d, T, M>where
    T: Freeze,
impl<'d, T, M> RefUnwindSafe for Hash<'d, T, M>where
    T: RefUnwindSafe,
    M: RefUnwindSafe,
impl<'d, T, M> Send for Hash<'d, T, M>where
    M: Send,
impl<'d, T, M> Sync for Hash<'d, T, M>
impl<'d, T, M> Unpin for Hash<'d, T, M>
impl<'d, T, M> !UnwindSafe for Hash<'d, T, M>
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