embassy-stm32

Crates

git

Versions

stm32l4a6qg

Flavors

embassy_stm32::hash

Struct Hash

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

Source

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.

Source

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.

Source

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.

Source

pub async fn update<'c>(&mut self, ctx: &mut Context<'c>, input: &[u8])
where D: Dma<T>,

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

Source

pub async fn finish<'c>(&mut self, ctx: Context<'c>, digest: &mut [u8]) -> usize
where D: Dma<T>,

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>
where T: Freeze, D: Freeze,

§

impl<'d, T, D> RefUnwindSafe for Hash<'d, T, D>

§

impl<'d, T, D> Send for Hash<'d, T, D>
where D: Send,

§

impl<'d, T, D> Sync for Hash<'d, T, D>
where T: Sync, D: Sync,

§

impl<'d, T, D> Unpin for Hash<'d, T, D>
where T: Unpin, D: Unpin,

§

impl<'d, T, D = NoDma> !UnwindSafe for Hash<'d, T, D>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.