pub trait ScramProvider {
    type Secret: Secret;

    // Required methods
    fn name() -> &'static str;
    fn hash(data: &[u8]) -> Vec<u8>;
    fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidLength>;
    fn derive(
        data: &Password,
        salt: &[u8],
        iterations: u32
    ) -> Result<Vec<u8>, DeriveError>;
}
Expand description

A trait which defines the needed methods for SCRAM.

Required Associated Types§

source

type Secret: Secret

The kind of secret this ScramProvider requires.

Required Methods§

source

fn name() -> &'static str

The name of the hash function.

source

fn hash(data: &[u8]) -> Vec<u8>

A function which hashes the data using the hash function.

source

fn hmac(data: &[u8], key: &[u8]) -> Result<Vec<u8>, InvalidLength>

A function which performs an HMAC using the hash function.

source

fn derive( data: &Password, salt: &[u8], iterations: u32 ) -> Result<Vec<u8>, DeriveError>

A function which does PBKDF2 key derivation using the hash function.

Implementors§