Skip to main content

StreamCipher

Trait StreamCipher 

Source
pub trait StreamCipher {
    type Key: AsRef<[u8]>;
    type Nonce: AsRef<[u8]>;

    // Required methods
    fn new(key: &Self::Key, iv: &Self::Nonce) -> Self;
    fn apply_keystream(&mut self, buffer: &mut [u8]) -> Result<(), CipherError>;
}
Expand description

Synchronous stream cipher trait.

Required Associated Types§

Source

type Key: AsRef<[u8]>

The byte array key type which specifies the size of the key used to instantiate the cipher.

Source

type Nonce: AsRef<[u8]>

The byte array nonce type which specifies the size of the nonce used in the cipher operations.

Required Methods§

Source

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

Instantiate a new instance of a stream cipher from a key and iv.

Source

fn apply_keystream(&mut self, buffer: &mut [u8]) -> Result<(), CipherError>

Applies the cipher keystream to buffer in place, returning CipherError on an unsuccessful operation.

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§