Expand description
§RustCrypto: Balloon Hash
Pure Rust implementation of the Balloon password hashing function.
§About
This crate contains an implementation of the Balloon password hashing function as specified in the paper Balloon Hashing: A Memory-Hard Function Providing Provable Protection Against Sequential Attacks.
This algorithm is first practical password hashing function that provides:
- Memory hardness which is proven in the random-oracle model
- Password-independent access
- Performance which meets or exceeds the best heuristically secure password-hashing algorithms
§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 (simple with default params)
The following example demonstrates the high-level password hashing API:
// NOTE: example requires `getrandom` feature is enabled
use balloon_hash::{
password_hash::{PasswordHasher, PasswordVerifier, phc::PasswordHash},
Balloon
};
use sha2::Sha256;
let password = b"hunter42"; // Bad password; don't actually use!
// Balloon with default params
let balloon = Balloon::<Sha256>::default();
// Hash password to PHC string ($balloon$v=1$...)
let password_hash = balloon.hash_password(password)?.to_string();
// Verify password against PHC string
let parsed_hash = PasswordHash::new(&password_hash)?;
assert!(balloon.verify_password(password, &parsed_hash).is_ok());Re-exports§
pub use password_hash;password-hashpub use kdf;kdf
Structs§
- Balloon
- Balloon context.
- Output
password-hash - Output from password hashing functions, i.e. the “hash” or “digest” as raw bytes.
- Params
- Balloon password hash parameters.
- Password
Hash password-hash - Password hash.
- Salt
allocandpassword-hash - In password hashing, a “salt” is an additional value used to personalize/tweak the output of a password hashing function for a given input password.
Enums§
Traits§
- Customized
Password Hasher password-hash - Trait for password hashing functions which support customization.
- Kdf
kdf - Key Derivation Function.
- Password
Hasher password-hash - High-level trait for password hashing functions.
- Password
Verifier password-hash - Trait for password verification.
- Pbkdf
kdf - Password-Based Key Derivation Functions: KDFs where it’s suitable for the input
secretto be a user-specified password, which employ algorithms designed to be resistant to brute-force attacks.