chacha20

Struct ChaCha20LegacyCore

Source
pub struct ChaCha20LegacyCore(/* private fields */);
Expand description

The ChaCha20 stream cipher (legacy “djb” construction with 64-bit nonce).

Trait Implementations§

Source§

impl BlockSizeUser for ChaCha20LegacyCore

Source§

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 IvSizeUser for ChaCha20LegacyCore

Source§

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

Initialization vector size in bytes.
§

fn iv_size() -> usize

Return IV size in bytes.
Source§

impl KeyIvInit for ChaCha20LegacyCore

Source§

fn new(key: &Key, iv: &LegacyNonce) -> 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 KeySizeUser for ChaCha20LegacyCore

Source§

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 StreamCipherCore for ChaCha20LegacyCore

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 StreamCipherSeekCore for ChaCha20LegacyCore

Source§

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§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.