Skip to main content

Crate password_hash

Crate password_hash 

Source
Expand description

§RustCrypto: Password Hashing Traits

crate Docs Build Status Apache2/MIT licensed Rust Version Project Chat

Traits which describe the functionality of password hashing algorithms.

§About

This crate contains traits for using password hashing algorithms to create and verify password hash strings of the sort used by the crypt(3) API, which typically begin with ${ident}$....

It provides first-class support for the Password Hashing Competition (PHC) string format specification via the phc crate and can also be used with the Modular Crypt Format (MCF)) via the mcf crate.

§Supported Password Hashing Algorithms

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

  • argon2: Argon2 memory hard key derivation function
  • balloon-hash: PBKDF with proven memory-hard password-hashing and modern design
  • pbkdf2: Password-Based Key Derivation Function V2
  • scrypt: scrypt key derivation function
  • sha-crypt: SHA-crypt legacy password hashing algorithm for crypt(3)
  • yescrypt: yescrypt key derivation (improved version of scrypt)

§License

Licensed under either of:

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

§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.

Re-exports§

pub use phc;phc
pub use rand_core;rand_core

Enums§

Error
Password hashing errors.

Traits§

CustomizedPasswordHasher
Trait for password hashing functions which support customization.
PasswordHasher
High-level trait for password hashing functions.
PasswordVerifier
Trait for password verification.

Functions§

generate_saltgetrandom
Generate a random salt value of the recommended length using the system’s secure RNG.
try_generate_saltgetrandom
Try generating a random salt value of the recommended length using the system’s secure RNG, returning errors if they occur.

Type Aliases§

PasswordHashDeprecatedphc
DEPRECATED: import this as password_hash::phc::PasswordHash.
PasswordHashStringDeprecatedalloc and phc
DEPRECATED: use password_hash::phc::PasswordHash or String
Result
Result type.
Version
Numeric version identifier for password hashing algorithms.