pub struct Key(/* private fields */);Expand description
A key for Poly1305 one-time authentication
This key is used for computing and verifying Poly1305 authentication tags. It must be exactly 32 bytes long.
§Security Warning
This key should be used only once for a single message. Reusing the same key for multiple messages completely compromises security. This is why Poly1305 is called a “one-time” authenticator.
§Key Generation
Keys should be generated using a cryptographically secure random number generator.
The generate() method provides a convenient way to create a secure random key.
§Usage Pattern
- Generate a new key for each message to be authenticated
- Use the key to compute an authentication tag
- Never reuse the key for another message
- Store or transmit the key securely alongside the message and tag
Implementations§
Trait Implementations§
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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