pub struct ChaCha8Poly1305 { /* private fields */ }Expand description
ChaCha8-Poly1305: ChaCha20-Poly1305 with the 8-round ChaCha8 in place of ChaCha20.
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 ChaCha8Poly1305
impl ChaCha8Poly1305
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 ChaCha8Poly1305
impl Clone for ChaCha8Poly1305
Source§fn clone(&self) -> ChaCha8Poly1305
fn clone(&self) -> ChaCha8Poly1305
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 ChaCha8Poly1305
impl !Unpin for ChaCha8Poly1305
impl !UnwindSafe for ChaCha8Poly1305
impl Freeze for ChaCha8Poly1305
impl Send for ChaCha8Poly1305
impl Sync for ChaCha8Poly1305
impl UnsafeUnpin for ChaCha8Poly1305
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