Type Alias chacha20::XChaCha20

source ·
pub type XChaCha20 = StreamCipherCoreWrapper<XChaChaCore<U10>>;
Expand description

XChaCha is a ChaCha20 variant with an extended 192-bit (24-byte) nonce.

The construction is an adaptation of the same techniques used by XChaCha as described in the paper “Extending the Salsa20 Nonce”, applied to the 96-bit nonce variant of ChaCha20, and derive a separate subkey/nonce for each extended nonce:

https://cr.yp.to/snuffle/xsalsa-20081128.pdf

No authoritative specification exists for XChaCha20, however the construction has “rough consensus and running code” in the form of several interoperable libraries and protocols (e.g. libsodium, WireGuard) and is documented in an (expired) IETF draft:

https://tools.ietf.org/html/draft-arciszewski-xchacha-03

Aliased Type§

struct XChaCha20 { /* private fields */ }

Implementations

source§

impl<T> StreamCipherCoreWrapper<T>

source

pub fn get_core(&self) -> &T

Return reference to the core type.

source

pub fn from_core(core: T) -> StreamCipherCoreWrapper<T>

Return reference to the core type.

Trait Implementations

source§

impl<T> Clone for StreamCipherCoreWrapper<T>

source§

fn clone(&self) -> StreamCipherCoreWrapper<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Default for StreamCipherCoreWrapper<T>

source§

fn default() -> StreamCipherCoreWrapper<T>

Returns the “default value” for a type. Read more
source§

impl<T> Drop for StreamCipherCoreWrapper<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T> IvSizeUser for StreamCipherCoreWrapper<T>

§

type IvSize = <T as IvSizeUser>::IvSize

Initialization vector size in bytes.
source§

fn iv_size() -> usize

Return IV size in bytes.
source§

impl<T> KeyInit for StreamCipherCoreWrapper<T>

source§

fn new( key: &GenericArray<u8, <StreamCipherCoreWrapper<T> as KeySizeUser>::KeySize> ) -> StreamCipherCoreWrapper<T>

Create new value from fixed size key.
source§

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>

Create new value from variable size key.
source§

impl<T> KeyIvInit for StreamCipherCoreWrapper<T>

source§

fn new( key: &GenericArray<u8, <StreamCipherCoreWrapper<T> as KeySizeUser>::KeySize>, iv: &GenericArray<u8, <StreamCipherCoreWrapper<T> as IvSizeUser>::IvSize> ) -> StreamCipherCoreWrapper<T>

Create new value from fixed length key and nonce.
source§

fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength>

Create new value from variable length key and nonce.
source§

impl<T> KeySizeUser for StreamCipherCoreWrapper<T>

§

type KeySize = <T as KeySizeUser>::KeySize

Key size in bytes.
source§

fn key_size() -> usize

Return key size in bytes.
source§

impl<T> StreamCipher for StreamCipherCoreWrapper<T>

source§

fn try_apply_keystream_inout( &mut self, data: InOutBuf<'_, '_, u8> ) -> Result<(), StreamCipherError>

Apply keystream to inout data. Read more
source§

fn try_apply_keystream( &mut self, buf: &mut [u8] ) -> Result<(), StreamCipherError>

Apply keystream to data behind buf. Read more
source§

fn apply_keystream_inout(&mut self, buf: InOutBuf<'_, '_, u8>)

Apply keystream to inout data. Read more
source§

fn apply_keystream(&mut self, buf: &mut [u8])

Apply keystream to data in-place. Read more
source§

fn apply_keystream_b2b( &mut self, input: &[u8], output: &mut [u8] ) -> Result<(), StreamCipherError>

Apply keystream to data buffer-to-buffer. Read more
source§

impl<T> StreamCipherSeek for StreamCipherCoreWrapper<T>

source§

fn try_current_pos<SN>(&self) -> Result<SN, OverflowError>
where SN: SeekNum,

Try to get current keystream position Read more
source§

fn try_seek<SN>(&mut self, new_pos: SN) -> Result<(), StreamCipherError>
where SN: SeekNum,

Try to seek to the given position Read more
source§

fn current_pos<T>(&self) -> T
where T: SeekNum,

Get current keystream position Read more
source§

fn seek<T>(&mut self, pos: T)
where T: SeekNum,

Seek to the given position Read more
source§

impl<T> ZeroizeOnDrop for StreamCipherCoreWrapper<T>