Struct password_hash::PasswordHash[][src]

pub struct PasswordHash<'a> {
    pub algorithm: Ident<'a>,
    pub version: Option<Decimal>,
    pub params: ParamsString,
    pub salt: Option<Salt<'a>>,
    pub hash: Option<Output>,
}
Expand description

Password hash.

This type corresponds to the parsed representation of a PHC string as described in the PHC string format specification.

PHC strings have the following format:

$<id>[$v=<version>][$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]

where:

  • <id> is the symbolic name for the function
  • <version> is the algorithm version
  • <param> is a parameter name
  • <value> is a parameter value
  • <salt> is an encoding of the salt
  • <hash> is an encoding of the hash output

The string is then the concatenation, in that order, of:

  • a $ sign;
  • the function symbolic name;
  • optionally, a $ sign followed by the algorithm version with a v=version format;
  • optionally, a $ sign followed by one or several parameters, each with a name=value format; the parameters are separated by commas;
  • optionally, a $ sign followed by the (encoded) salt value;
  • optionally, a $ sign followed by the (encoded) hash output (the hash output may be present only if the salt is present).

Fields

algorithm: Ident<'a>

Password hashing algorithm identifier.

This corresponds to the <id> field in a PHC string, a.k.a. the symbolic name for the function.

version: Option<Decimal>

Optional version field.

This corresponds to the <version> field in a PHC string.

params: ParamsString

Algorithm-specific parameters.

This corresponds to the set of $<param>=<value>(,<param>=<value>)* name/value pairs in a PHC string.

salt: Option<Salt<'a>>

Salt string for personalizing a password hash output.

This corresponds to the <salt> value in a PHC string.

hash: Option<Output>

Password hashing function Output, a.k.a. hash/digest.

This corresponds to the <hash> output in a PHC string.

Implementations

Parse a password hash from a string in the PHC string format.

Parse a password hash from the given Encoding.

Generate a password hash using the supplied algorithm.

Verify this password hash using the specified set of supported PasswordHasher trait objects.

Get the Encoding that this PasswordHash is serialized with.

Serialize this PasswordHash as a PasswordHashString.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.