Trait Salsa20

Source
pub trait Salsa20 {
    type Lanes: ArrayLength;
    type Block: BlockType;

    // Required methods
    fn read(ptr: GenericArray<&Self::Block, Self::Lanes>) -> Self;
    fn write(&self, ptr: GenericArray<&mut Self::Block, Self::Lanes>);
    fn keystream<const ROUND_PAIRS: usize>(&mut self);

    // Provided methods
    fn shuffle_in(_ptr: &mut Align64<[u32; 16]>) { ... }
    fn shuffle_out(_ptr: &mut Align64<[u32; 16]>) { ... }
}
Expand description

A trait for salsa20 block types

Required Associated Types§

Source

type Lanes: ArrayLength

The number of lanes

Source

type Block: BlockType

The block type

Required Methods§

Source

fn read(ptr: GenericArray<&Self::Block, Self::Lanes>) -> Self

Read block(s)

Source

fn write(&self, ptr: GenericArray<&mut Self::Block, Self::Lanes>)

Write block(s) back

The original/saved value must be present in the pointer.

Source

fn keystream<const ROUND_PAIRS: usize>(&mut self)

Apply the keystream to the block(s)

Provided Methods§

Source

fn shuffle_in(_ptr: &mut Align64<[u32; 16]>)

Shuffle data into optimal representation

Source

fn shuffle_out(_ptr: &mut Align64<[u32; 16]>)

Shuffle data out of optimal representation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Lanes: ArrayLength> Salsa20 for BlockScalar<Lanes>

Source§

type Lanes = Lanes

Source§

type Block = Align64<[u32; 16]>