Struct chacha20::XChaCha

source ·
pub struct XChaCha<R: Rounds>(_);
Expand description

XChaCha family stream cipher, generic around a number of rounds.

Use the XChaCha8, XChaCha12, or XChaCha20 type aliases to select a specific number of rounds.

Generally XChaCha20 is preferred.

Trait Implementations§

source§

impl<R: Rounds> NewCipher for XChaCha<R>

§

type KeySize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

Key size in bytes

§

type NonceSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>

Nonce size in bytes

source§

fn new(key: &Key, nonce: &XNonce) -> Self

Create new stream cipher instance from key and nonce arrays.
source§

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

Create new stream cipher instance from variable length key and nonce given as byte slices.
source§

impl<R: Rounds> StreamCipher for XChaCha<R>

source§

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

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

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

Apply keystream to the data. Read more
source§

impl<R: Rounds> StreamCipherSeek for XChaCha<R>

source§

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

Try to get current keystream position Read more
source§

fn try_seek<T: SeekNum>(&mut self, pos: T) -> Result<(), LoopError>

Try to seek to the given position Read more
source§

fn current_pos<T>(&self) -> Twhere 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

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for XChaCha<R>where R: RefUnwindSafe,

§

impl<R> Send for XChaCha<R>where R: Send,

§

impl<R> Sync for XChaCha<R>where R: Sync,

§

impl<R> Unpin for XChaCha<R>where R: Unpin,

§

impl<R> UnwindSafe for XChaCha<R>where R: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.