Struct chacha20::ChaCha

source ·
pub struct ChaCha<R: Rounds, MC: MaxCounter> { /* private fields */ }
Expand description

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

Use the ChaCha8, ChaCha12, or ChaCha20 type aliases to select a specific number of rounds.

Generally ChaCha20 is preferred.

Trait Implementations§

source§

impl<R: Rounds, MC: MaxCounter> Debug for ChaCha<R, MC>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<R: Rounds, MC: MaxCounter> NewCipher for ChaCha<R, MC>

§

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<UTerm, B1>, B1>, B0>, B0>

Nonce size in bytes

source§

fn new(key: &Key, nonce: &Nonce) -> 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, MC: MaxCounter> StreamCipher for ChaCha<R, MC>

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, MC: MaxCounter> StreamCipherSeek for ChaCha<R, MC>

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, MC> RefUnwindSafe for ChaCha<R, MC>where MC: RefUnwindSafe, R: RefUnwindSafe,

§

impl<R, MC> Send for ChaCha<R, MC>where MC: Send, R: Send,

§

impl<R, MC> Sync for ChaCha<R, MC>where MC: Sync, R: Sync,

§

impl<R, MC> Unpin for ChaCha<R, MC>where MC: Unpin, R: Unpin,

§

impl<R, MC> UnwindSafe for ChaCha<R, MC>where MC: UnwindSafe, 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.