pub struct ChaCha20Poly1305 { /* private fields */ }Expand description
ChaCha20-Poly1305 (RFC 8439).
Authenticated encryption with a 256-bit key, a 96-bit nonce and a 128-bit tag. The nonce must never repeat for a given key.
Implementations§
Source§impl ChaCha20Poly1305
impl ChaCha20Poly1305
Sourcepub const NONCE_SIZE: usize = 12
pub const NONCE_SIZE: usize = 12
Size of the nonce, in bytes.
Sourcepub fn encrypt(
&self,
nonce: &[u8; 12],
aad: &[u8],
buf: &mut [u8],
) -> Result<[u8; 16], Error>
pub fn encrypt( &self, nonce: &[u8; 12], aad: &[u8], buf: &mut [u8], ) -> Result<[u8; 16], Error>
Encrypt buf in place, authenticating it and aad, and return the tag.
Sourcepub fn encrypt_to(
&self,
nonce: &[u8; 12],
aad: &[u8],
input: &[u8],
output: &mut [u8],
) -> Result<[u8; 16], Error>
pub fn encrypt_to( &self, nonce: &[u8; 12], aad: &[u8], input: &[u8], output: &mut [u8], ) -> Result<[u8; 16], Error>
Encrypt input to output, authenticating it and aad, and return the tag.
Trait Implementations§
Source§impl Clone for ChaCha20Poly1305
impl Clone for ChaCha20Poly1305
Source§fn clone(&self) -> ChaCha20Poly1305
fn clone(&self) -> ChaCha20Poly1305
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for ChaCha20Poly1305
impl !Unpin for ChaCha20Poly1305
impl !UnwindSafe for ChaCha20Poly1305
impl Freeze for ChaCha20Poly1305
impl Send for ChaCha20Poly1305
impl Sync for ChaCha20Poly1305
impl UnsafeUnpin for ChaCha20Poly1305
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