pub struct Hash<'d, T: Instance, D = NoDma> { /* private fields */ }
Expand description
HASH driver.
Implementations§
Source§impl<'d, T: Instance, D> Hash<'d, T, D>
impl<'d, T: Instance, D> Hash<'d, T, D>
Sourcepub fn new(
peripheral: impl Peripheral<P = T> + 'd,
dma: impl Peripheral<P = D> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new( peripheral: impl Peripheral<P = T> + 'd, dma: impl Peripheral<P = D> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Instantiates, resets, and enables the HASH peripheral.
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, D> Freeze for Hash<'d, T, D>
impl<'d, T, D> RefUnwindSafe for Hash<'d, T, D>where
T: RefUnwindSafe,
D: RefUnwindSafe,
impl<'d, T, D> Send for Hash<'d, T, D>where
D: Send,
impl<'d, T, D> Sync for Hash<'d, T, D>
impl<'d, T, D> Unpin for Hash<'d, T, D>
impl<'d, T, D = NoDma> !UnwindSafe for Hash<'d, T, D>
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