Struct Poly1305

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.