[][src]Trait pwbox::DeriveKey

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

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:

  • Default (should return a KDF instance with reasonable difficulty params)
  • Clone
  • Serialize / Deserialize from serde

Required methods

fn salt_len(&self) -> usize

Returns byte size of salt supplied to the KDF.

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.

Loading content...

Implementations on Foreign Types

impl DeriveKey for Box<dyn DeriveKey>[src]

Loading content...

Implementors

impl DeriveKey for Scrypt[src]

impl DeriveKey for ScryptCompat[src]

Loading content...