pub struct Poly1305 { /* private fields */ }
Expand description

Define the Poly1305 struct for the Poly1305 MAC algorithm.

Implementations§

source§

impl Poly1305

source

pub fn new() -> Self

Creates a new instance of Poly1305.

This constructor initializes a new Poly1305 instance with default values. It is typically used to start a new message authentication code (MAC) computation.

Returns

A new instance of Poly1305.

Trait Implementations§

source§

impl AlgorithmKeyInit for Poly1305

source§

fn init(&mut self, key: &[u8])

Initializes the Poly1305 state with the given key.

This method sets up the Poly1305 state using a 32-byte key. The key is split into two parts: the r array (for the algorithm’s internal state) and the pad (used in the final computation steps).

Arguments
  • key - A byte slice containing the 32-byte key.
  • _iv - An optional Initialization Vector, not used in Poly1305.
Returns

A mutable reference to the initialized Poly1305 instance.

Notes

The Initialization Vector (_iv) is not used in Poly1305 and can be passed as an empty slice.

source§

impl AlgorithmProcess for Poly1305

source§

fn process(&mut self, data: &[u8]) -> Vec<u8>

Processes the given data and computes the MAC.

This method processes the input data in 16-byte blocks to compute the message authentication code (MAC). If the data does not divide evenly into 16-byte blocks, the final block is padded as necessary.

Arguments
  • data - A byte slice representing the data to be processed.
Returns

A vector of bytes (Vec<u8>) containing the computed MAC.

source§

impl Default for Poly1305

source§

fn default() -> Poly1305

Returns the “default value” for a type. Read more
source§

impl AEADAlgorithm for Poly1305

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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.