pub struct XChaCha20Poly1305 { /* private fields */ }Expand description
XChaCha20-Poly1305 AEAD (draft-irtf-cfrg-xchacha-03).
Extends ChaCha20-Poly1305 with a 24-byte (192-bit) nonce. Internally uses HChaCha20 to derive a subkey from the first 16 nonce bytes.
§Parameters
- Key: 256 bits (32 bytes)
- Nonce: 192 bits (24 bytes)
- Tag: 128 bits (16 bytes)
§Panics
encrypt_in_place panics if in_out exceeds
CHACHA20_IETF_MAX_LEN bytes (~256 GiB), the maximum allowed by the inner ChaCha20 IETF
32-bit block counter. decrypt_in_place returns
AeadError::InvalidCiphertext in that case instead.
Implementations§
Source§impl XChaCha20Poly1305
impl XChaCha20Poly1305
pub fn new(key: &[u8; 32]) -> XChaCha20Poly1305
Trait Implementations§
Source§impl Aead for XChaCha20Poly1305
impl Aead for XChaCha20Poly1305
const KEY_SIZE: usize = 32
const TAG_SIZE: usize = 16
const NONCE_SIZE: usize = 24
fn encrypt_in_place(&self, in_out: &mut [u8], nonce: &[u8], aad: &[u8]) -> Hash
fn decrypt_in_place( &self, in_out: &mut [u8], nonce: &[u8], aad: &[u8], tag: &[u8], ) -> Result<(), AeadError>
fn encrypt(&self, plaintext: &[u8], nonce: &[u8], aad: &[u8]) -> Vec<u8> ⓘ
fn decrypt( &self, ciphertext: &[u8], nonce: &[u8], aad: &[u8], ) -> Result<Vec<u8>, AeadError>
Source§impl Drop for XChaCha20Poly1305
impl Drop for XChaCha20Poly1305
Auto Trait Implementations§
impl Freeze for XChaCha20Poly1305
impl RefUnwindSafe for XChaCha20Poly1305
impl Send for XChaCha20Poly1305
impl Sync for XChaCha20Poly1305
impl Unpin for XChaCha20Poly1305
impl UnsafeUnpin for XChaCha20Poly1305
impl UnwindSafe for XChaCha20Poly1305
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