Trait cipher::NewCipher

source ·
pub trait NewCipher: Sized {
    type KeySize: ArrayLength<u8>;
    type NonceSize: ArrayLength<u8>;

    // Required method
    fn new(key: &CipherKey<Self>, nonce: &Nonce<Self>) -> Self;

    // Provided method
    fn new_from_slices(key: &[u8], nonce: &[u8]) -> Result<Self, InvalidLength> { ... }
}
Expand description

Cipher creation trait.

It can be used for creation of block modes, synchronous and asynchronous stream ciphers.

Required Associated Types§

source

type KeySize: ArrayLength<u8>

Key size in bytes

source

type NonceSize: ArrayLength<u8>

Nonce size in bytes

Required Methods§

source

fn new(key: &CipherKey<Self>, nonce: &Nonce<Self>) -> Self

Create new stream cipher instance from key and nonce arrays.

Provided Methods§

source

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

Create new stream cipher instance from variable length key and nonce given as byte slices.

Implementors§