Struct chacha20::ChaChaCore

source ·
pub struct ChaChaCore<R: Unsigned> { /* private fields */ }
Expand description

The ChaCha core function.

Trait Implementations§

source§

impl<R: Unsigned> BlockSizeUser for ChaChaCore<R>

§

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

Size of the block in bytes.
§

fn block_size() -> usize

Return block size in bytes.
source§

impl<R: Unsigned> IvSizeUser for ChaChaCore<R>

§

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

Initialization vector size in bytes.
§

fn iv_size() -> usize

Return IV size in bytes.
source§

impl<R: Unsigned> KeyIvInit for ChaChaCore<R>

source§

fn new(key: &Key, iv: &Nonce) -> Self

Create new value from fixed length key and nonce.
§

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

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

impl<R: Unsigned> KeySizeUser for ChaChaCore<R>

§

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

Key size in bytes.
§

fn key_size() -> usize

Return key size in bytes.
source§

impl<R: Unsigned> StreamCipherCore for ChaChaCore<R>

source§

fn remaining_blocks(&self) -> Option<usize>

Return number of remaining blocks before cipher wraps around. Read more
source§

fn process_with_backend( &mut self, f: impl StreamClosure<BlockSize = Self::BlockSize> )

Process data using backend provided to the rank-2 closure.
§

fn write_keystream_block( &mut self, block: &mut GenericArray<u8, Self::BlockSize> )

Write keystream block. Read more
§

fn write_keystream_blocks( &mut self, blocks: &mut [GenericArray<u8, Self::BlockSize>] )

Write keystream blocks. Read more
§

fn apply_keystream_block_inout( &mut self, block: InOut<'_, '_, GenericArray<u8, Self::BlockSize>> )

Apply keystream block. Read more
§

fn apply_keystream_blocks( &mut self, blocks: &mut [GenericArray<u8, Self::BlockSize>] )

Apply keystream blocks. Read more
§

fn apply_keystream_blocks_inout( &mut self, blocks: InOutBuf<'_, '_, GenericArray<u8, Self::BlockSize>> )

Apply keystream blocks. Read more
§

fn try_apply_keystream_partial( self, buf: InOutBuf<'_, '_, u8> ) -> Result<(), StreamCipherError>

Try to apply keystream to data not divided into blocks. Read more
§

fn apply_keystream_partial(self, buf: InOutBuf<'_, '_, u8>)

Try to apply keystream to data not divided into blocks. Read more
source§

impl<R: Unsigned> StreamCipherSeekCore for ChaChaCore<R>

§

type Counter = u32

Counter type used inside stream cipher.
source§

fn get_block_pos(&self) -> u32

Get current block position.
source§

fn set_block_pos(&mut self, pos: u32)

Set block position.

Auto Trait Implementations§

§

impl<R> Freeze for ChaChaCore<R>
where R: Default + Copy + Clone + Sealed + 'static,

§

impl<R> RefUnwindSafe for ChaChaCore<R>
where R: Default + Copy + Clone + Sealed + 'static + RefUnwindSafe,

§

impl<R> Send for ChaChaCore<R>
where R: Default + Copy + Clone + Sealed + 'static + Send,

§

impl<R> Sync for ChaChaCore<R>
where R: Default + Copy + Clone + Sealed + 'static + Sync,

§

impl<R> Unpin for ChaChaCore<R>
where R: Default + Copy + Clone + Sealed + 'static + Unpin,

§

impl<R> UnwindSafe for ChaChaCore<R>
where R: Default + Copy + Clone + Sealed + 'static + UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.