[][src]Enum libpasta::hashing::Algorithm

pub enum Algorithm {
    Single(Primitive),
    Nested {
        outer: Primitive,
        inner: Box<Algorithm>,
    },
}

libpasta password hashing algorithms can be nested, which is captured by this recursive enum.

Variants

Single(Primitive)

A single instance of a password-hashing primitive.

Nested

The password-hashing algorithm is composed of nested primitives.

Fields of Nested

outer: Primitive

The outermost layer of the algorithm is a single primitive

inner: Box<Algorithm>

The rest of the layers

Implementations

impl Algorithm[src]

pub fn hash(&self, password: &str) -> Output[src]

Type-safe function to compute the hash of a password.

pub fn hash_with_salt(&self, password: &[u8], salt: &[u8]) -> Vec<u8>[src]

Computes the hash output for given password and salt.

pub fn verify(&self, password: &[u8], salt: &[u8], hash: &[u8]) -> bool[src]

Verifies the password, salt and hash are matching by recursively re-computing the hash and verifying the final value.

pub fn needs_migrating(&self, prim: &Primitive) -> bool[src]

Test whether the current 'Algorithm` is sufficiently secure.

pub fn to_wrapped(&self, outer: Primitive) -> Self[src]

Copies self into a new Algorithm wrapped by outer

pub fn into_wrapped(self, outer: Primitive) -> Self[src]

Moves self into a new Algorithm wrapped by outer

Trait Implementations

impl Clone for Algorithm[src]

impl Debug for Algorithm[src]

impl Default for Algorithm[src]

impl PartialEq<Algorithm> for Algorithm[src]

impl<'a> Serialize for Algorithm[src]

impl StructuralPartialEq for Algorithm[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.