Struct salsa20::SalsaCore

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

The Salsa20 core function.

Implementations§

source§

impl<R: Unsigned> SalsaCore<R>

source

pub fn from_raw_state(state: [u32; 16]) -> Self

Create new Salsa core from raw state.

This method is mainly intended for the scrypt crate. Other users generally should not use this method.

Trait Implementations§

source§

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

source§

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

Size of the block in bytes.
source§

fn block_size() -> usize

Return block size in bytes.
source§

impl<R: Unsigned> Drop for SalsaCore<R>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

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

source§

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

Initialization vector size in bytes.
source§

fn iv_size() -> usize

Return IV size in bytes.
source§

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

source§

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

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

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

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

fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>

Generate random key using the provided CryptoRng.
source§

fn generate_iv(rng: impl CryptoRng + RngCore) -> GenericArray<u8, Self::IvSize>

Generate random IV using the provided CryptoRng.
source§

fn generate_key_iv( rng: impl CryptoRng + RngCore, ) -> (GenericArray<u8, Self::KeySize>, GenericArray<u8, Self::IvSize>)

Generate random key and nonce using the provided CryptoRng.
source§

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

source§

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

Key size in bytes.
source§

fn key_size() -> usize

Return key size in bytes.
source§

impl<R: Unsigned> StreamCipherCore for SalsaCore<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.
source§

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

Write keystream block. Read more
source§

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

Write keystream blocks. Read more
source§

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

Apply keystream block. Read more
source§

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

Apply keystream blocks. Read more
source§

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

Apply keystream blocks. Read more
source§

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

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

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 SalsaCore<R>

source§

type Counter = u64

Counter type used inside stream cipher.
source§

fn get_block_pos(&self) -> u64

Get current block position.
source§

fn set_block_pos(&mut self, pos: u64)

Set block position.
source§

impl<R: Unsigned> ZeroizeOnDrop for SalsaCore<R>

Auto Trait Implementations§

§

impl<R> Freeze for SalsaCore<R>

§

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

§

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

§

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

§

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

§

impl<R> UnwindSafe for SalsaCore<R>
where R: 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

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.