Crate password_hash[][src]

This crate defines a set of traits which describe the functionality of password hashing algorithms.

Provides a no_std-friendly implementation of the Password Hashing Competition (PHC) string format specification (a well-defined subset of the Modular Crypt Format a.k.a. MCF) which works in conjunction with the traits this crate defines.

Supported Crates

See RustCrypto/password-hashes for algorithm implementations which use this crate for interoperability:

  • argon2 - Argon2 memory hard key derivation function
  • pbkdf2 - Password-Based Key Derivation Function v2
  • scrypt - scrypt key derivation function

Usage

This crate represents password hashes using the PasswordHash type, which represents a parsed “PHC string” with the following format:

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

For more information, please see the documentation for PasswordHash.

Structs

Ident

Algorithm or parameter identifier.

Output

Output from password hashing functions, i.e. the “hash” or “digest” as raw bytes.

ParamsString

Algorithm parameter string.

PasswordHash

Password hash.

Salt

Salt string.

SaltString

Owned stack-allocated equivalent of Salt.

Value

Algorithm parameter value string.

Enums

B64Error

Generic error, union of InvalidLengthError and InvalidEncodingError.

Encoding

Base64 encoding variants.

Error

Password hashing errors.

Traits

McfHasher

Trait for password hashing algorithms which support the legacy Modular Crypt Format (MCF).

PasswordHasher

Trait for password hashing functions.

PasswordVerifier

Trait for password verification.

Type Definitions

Decimal

Type used to represent decimal (i.e. integer) values.

Result

Result type.