Skip to main content

KeyDerivation

Trait KeyDerivation 

Source
pub trait KeyDerivation: Send + Sync {
    // Required methods
    fn derive_key(
        &self,
        password: &[u8],
        salt: &[u8],
        key_length: usize,
    ) -> CryptoResult<Vec<u8>>;
    fn generate_salt(&self, length: usize) -> Vec<u8> ;
    fn algorithm(&self) -> &'static str;
}
Expand description

Trait for key derivation functions.

Required Methods§

Source

fn derive_key( &self, password: &[u8], salt: &[u8], key_length: usize, ) -> CryptoResult<Vec<u8>>

Derive a key from a password and salt.

Source

fn generate_salt(&self, length: usize) -> Vec<u8>

Generate a random salt of the specified length.

Source

fn algorithm(&self) -> &'static str

Get the algorithm name.

Implementors§