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<A, H: HmacMode<A>>(
&mut self,
format: DataType,
key: Option<&[u8]>,
) -> Context<A, M, H>where
A: ContextBufferType<M> + AlgorithmSpec,
pub fn start<A, H: HmacMode<A>>(
&mut self,
format: DataType,
key: Option<&[u8]>,
) -> Context<A, M, H>where
A: ContextBufferType<M> + AlgorithmSpec,
Starts computation of a new hash and returns the saved peripheral state.
Sourcepub fn update_blocking<A, H: HmacMode<A>>(
&mut self,
ctx: &mut Context<A, Blocking, H>,
input: &[u8],
)
pub fn update_blocking<A, H: HmacMode<A>>( &mut self, ctx: &mut Context<A, Blocking, H>, 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<A, H: HmacMode<A>>(
&mut self,
ctx: Context<A, Blocking, H>,
digest: &mut [u8],
) -> usize
pub fn finish_blocking<A, H: HmacMode<A>>( &mut self, ctx: Context<A, Blocking, H>, 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.
Source§impl<'d, T: Instance> Hash<'d, T, Async>
impl<'d, T: Instance> Hash<'d, T, Async>
Sourcepub fn new<D: Dma<T>>(
peripheral: Peri<'d, T>,
dma: Peri<'d, D>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + Binding<D::Interrupt, InterruptHandler<D>> + 'd,
) -> Self
pub fn new<D: Dma<T>>( peripheral: Peri<'d, T>, dma: Peri<'d, D>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + Binding<D::Interrupt, InterruptHandler<D>> + 'd, ) -> Self
Instantiates, resets, and enables the HASH peripheral.
Sourcepub async fn update<A, H: HmacMode<A>>(
&mut self,
ctx: &mut Context<A, Async, H>,
input: &[u8],
)
pub async fn update<A, H: HmacMode<A>>( &mut self, ctx: &mut Context<A, Async, H>, 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 async fn finish<A, H: HmacMode<A>>(
&mut self,
ctx: Context<A, Async, H>,
digest: &mut [u8],
) -> usize
pub async fn finish<A, H: HmacMode<A>>( &mut self, ctx: Context<A, Async, H>, 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.