Trait DeriveKey

Source
pub trait DeriveKey: 'static {
    // Required methods
    fn salt_len(&self) -> usize;
    fn derive_key(
        &self,
        buf: &mut [u8],
        password: &[u8],
        salt: &[u8],
    ) -> Result<(), Error>;
}
Expand description

Key derivation function (KDF).

An instance of DeriveKey implementation corresponds to a particular set of difficulty params of a particular KDF.

§Implementation notes

If you want to use a DeriveKey implementation with an Eraser, it should additionally implement the following traits:

Required Methods§

Source

fn salt_len(&self) -> usize

Returns byte size of salt supplied to the KDF.

Source

fn derive_key( &self, buf: &mut [u8], password: &[u8], salt: &[u8], ) -> Result<(), Error>

Derives a key from the given password and salt.

§Safety

When used within PwBox, salt is guaranteed to have the correct size.

Trait Implementations§

Source§

impl DeriveKey for Box<dyn DeriveKey>

Source§

fn salt_len(&self) -> usize

Returns byte size of salt supplied to the KDF.
Source§

fn derive_key( &self, buf: &mut [u8], password: &[u8], salt: &[u8], ) -> Result<(), Error>

Derives a key from the given password and salt. Read more

Implementations on Foreign Types§

Source§

impl DeriveKey for Box<dyn DeriveKey>

Source§

fn salt_len(&self) -> usize

Source§

fn derive_key( &self, buf: &mut [u8], password: &[u8], salt: &[u8], ) -> Result<(), Error>

Implementors§

Source§

impl DeriveKey for pwbox::pure::Scrypt

Available on crate feature pure only.
Source§

impl DeriveKey for pwbox::rcrypto::Scrypt

Available on crate feature rust-crypto only.
Source§

impl DeriveKey for pwbox::sodium::Scrypt

Available on crate feature exonum_sodiumoxide only.
Source§

impl DeriveKey for ScryptCompat

Available on crate feature exonum_sodiumoxide only.