pub struct Poly1305Mac;Expand description
Poly1305 one-time message authentication code (16-byte tag).
§Security warning
Poly1305 is a one-time MAC: the 32-byte key MUST NOT be reused for different messages. Re-use of the same key across messages completely destroys the security guarantee. In practice, derive a fresh per-message key from a stream cipher (e.g. ChaCha20) or a KDF.
Trait Implementations§
Source§impl Clone for Poly1305Mac
impl Clone for Poly1305Mac
Source§fn clone(&self) -> Poly1305Mac
fn clone(&self) -> Poly1305Mac
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Poly1305Mac
impl Debug for Poly1305Mac
Source§impl Default for Poly1305Mac
impl Default for Poly1305Mac
Source§fn default() -> Poly1305Mac
fn default() -> Poly1305Mac
Returns the “default value” for a type. Read more
Source§impl Mac for Poly1305Mac
impl Mac for Poly1305Mac
Source§fn key_len(&self) -> usize
fn key_len(&self) -> usize
Required key length (minimum acceptable length; MACs are often variable).
Source§fn output_len(&self) -> usize
fn output_len(&self) -> usize
Output tag length in bytes.
Source§fn mac(&self, key: &[u8], msg: &[u8], out: &mut [u8]) -> Result<(), CryptoError>
fn mac(&self, key: &[u8], msg: &[u8], out: &mut [u8]) -> Result<(), CryptoError>
Compute a MAC tag for
msg under key and write it into out.Source§fn verify(&self, key: &[u8], msg: &[u8], tag: &[u8]) -> Result<(), CryptoError>
fn verify(&self, key: &[u8], msg: &[u8], tag: &[u8]) -> Result<(), CryptoError>
Verify a MAC tag in constant time. Read more
Source§fn mac_to_vec(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>, CryptoError>
fn mac_to_vec(&self, key: &[u8], msg: &[u8]) -> Result<Vec<u8>, CryptoError>
Convenience: compute MAC and return the tag as a
Vec<u8>.impl Copy for Poly1305Mac
Auto Trait Implementations§
impl Freeze for Poly1305Mac
impl RefUnwindSafe for Poly1305Mac
impl Send for Poly1305Mac
impl Sync for Poly1305Mac
impl Unpin for Poly1305Mac
impl UnsafeUnpin for Poly1305Mac
impl UnwindSafe for Poly1305Mac
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more