BlockStream

Trait BlockStream 

Source
pub trait BlockStream:
    Sized
    + Clone
    + ReprC {
    type BlockType: AsRef<[u8]> + ReprC + Clone;

    const BLOCK_SIZE: u32;

    // Required method
    fn next_block(&mut self) -> Self::BlockType;
}
Expand description

Represents a stream of blocks. These are easily convertible into PRNGs through the BlockPRNG wrapper.

Required Associated Constants§

Source

const BLOCK_SIZE: u32

The size of the block in bytes.

Required Associated Types§

Source

type BlockType: AsRef<[u8]> + ReprC + Clone

The actual type of the block.

Even though these implement [AsRef<[u8]>] trait, the actual size of the returned slice should always be Self::BLOCK_SIZE.

Required Methods§

Source

fn next_block(&mut self) -> Self::BlockType

Generates the next block.

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<const ROUNDS: u32> BlockStream for ChaChaStream<ROUNDS>

Source§

const BLOCK_SIZE: u32 = 64u32

Source§

type BlockType = [u8; 64]