Struct secured_cipher::permutation::poly1305::Poly1305
source · pub struct Poly1305 { /* private fields */ }Expand description
Define the Poly1305 struct for the Poly1305 MAC algorithm.
Implementations§
Trait Implementations§
source§impl Permutation for Poly1305
impl Permutation for Poly1305
source§fn init(&mut self, key: &[u8], _iv: &[u8])
fn init(&mut self, key: &[u8], _iv: &[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§fn process(&mut self, data: &[u8]) -> Vec<u8>
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.