embassy-stm32

Crates

git

Versions

stm32h5e5zk

Flavors

Skip to main content

Hash

Struct Hash 

Source
pub struct Hash<'d, T: Instance, M: Mode> { /* private fields */ }
Expand description

HASH driver.

Implementations§

Source§

impl<'d, T: Instance> Hash<'d, T, Blocking>

Source

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>

Source

pub fn start<A, H: HmacMode<A>>( &mut self, format: DataType, key: Option<&[u8]>, ) -> Context<A, M, H>

Starts computation of a new hash and returns the saved peripheral state.

Source

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.

Source

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 accommodate 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

pub fn finalize_xof_blocking<A>( &mut self, ctx: Context<A, Blocking, NonHmac>, ) -> XofReader<A>

Finish the absorbing phase of a SHAKE computation: flush the tail, apply the padding and run the first output permutation, then read the first output block and save the sponge state for further squeezes.

Source

pub fn squeeze_blocking<A>(&mut self, reader: &mut XofReader<A>, out: &mut [u8])

Squeeze the next out.len() bytes of XOF output. Every block beyond the one already read triggers another permutation of the saved sponge state, restored and stored around the DCAL.

Source§

impl<'d, T: Instance> Hash<'d, T, Async>

Source

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.

Source

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.

Source

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 accommodate 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.

Trait Implementations§

Source§

impl<'d, T: Instance, M: Mode> Drop for Hash<'d, T, M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'d, T, M> !UnwindSafe for Hash<'d, T, M>

§

impl<'d, T, M> Forget for Hash<'d, T, M>

§

impl<'d, T, M> Freeze for Hash<'d, T, M>
where Peri<'d, T>: Freeze, PhantomData<M>: Freeze, <M as SealedMode>::IfAsync<ChannelAndRequest<'d>>: Freeze,

§

impl<'d, T, M> Move for Hash<'d, T, M>

§

impl<'d, T, M> RefUnwindSafe for Hash<'d, T, M>
where Peri<'d, T>: RefUnwindSafe, PhantomData<M>: RefUnwindSafe, <M as SealedMode>::IfAsync<ChannelAndRequest<'d>>: RefUnwindSafe,

§

impl<'d, T, M> Send for Hash<'d, T, M>
where Peri<'d, T>: Send, PhantomData<M>: Send, <M as SealedMode>::IfAsync<ChannelAndRequest<'d>>: Send,

§

impl<'d, T, M> Sync for Hash<'d, T, M>
where Peri<'d, T>: Sync, PhantomData<M>: Sync, <M as SealedMode>::IfAsync<ChannelAndRequest<'d>>: Sync,

§

impl<'d, T, M> Unpin for Hash<'d, T, M>
where Peri<'d, T>: Unpin, PhantomData<M>: Unpin, <M as SealedMode>::IfAsync<ChannelAndRequest<'d>>: Unpin,

§

impl<'d, T, M> UnsafeUnpin for Hash<'d, T, M>
where Peri<'d, T>: UnsafeUnpin, PhantomData<M>: UnsafeUnpin, <M as SealedMode>::IfAsync<ChannelAndRequest<'d>>: UnsafeUnpin,

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> SuspendablePeripheral for T
where T: SealedSuspendablePeripheral,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.