scrypt 0.4.0

Scrypt password-based key derivation function
Documentation

This crate implements the Scrypt key derivation function as specified in [1].

If you are not using convinience functions scrypt_check and scrypt_simple it's recommended to disable scrypt default features in your Cargo.toml:

[dependencies]
scrypt = { version = "0.2", default-features = false }

Usage

extern crate scrypt;

# #[cfg(feature="include_simple")]
# fn main() {
use scrypt::{ScryptParams, scrypt_simple, scrypt_check};

// First setup the ScryptParams arguments with:
// r = 8, p = 1, n = 32768 (log2(n) = 15)
let params = ScryptParams::new(15, 8, 1).unwrap();
// Hash the password for storage
let hashed_password = scrypt_simple("Not so secure password", &params)
.expect("OS RNG should not fail");
// Verifying a stored password
assert!(scrypt_check("Not so secure password", &hashed_password).is_ok());
# }
# #[cfg(not(feature="include_simple"))]
# fn main() {}

References

[1] - C. Percival. Stronger Key Derivation Via Sequential Memory-Hard Functions