logo
pub struct XChaCha20(_);
Expand description

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

The construction is an adaptation of the same techniques used by XSalsa20 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

The xchacha20 Cargo feature must be enabled in order to use this (which it is by default).

Trait Implementations

Key size in bytes

Nonce size in bytes

Create new stream cipher instance from variable length key and nonce.

Create new stream cipher instance from variable length key and nonce.

Apply keystream to the data, but return an error if end of a keystream will be reached. Read more

Apply keystream to the data. Read more

Try to get current keystream position Read more

Try to seek to the given position Read more

Get current keystream position Read more

Seek to the given position Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

Encrypt data in place.

Decrypt data in place.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.