passwors 0.1.1

Passwors is a simple password handling library that utilises Rust's type system to enfore better password handling. Use it as a basic building block for more complex authentication systems.

/// Any password hasher should implement this trait.
///
/// Note that password hashers are the only ones that
/// are able to read a clear text password, so try not
/// to leak any kind of information about it.
///
/// If your hasher can be configured to have different
/// time or memory costs, then make sure to store those
/// parameters next to your users' password hashes and
/// salts in your data base, so that you are able to
/// upgrade your parameters at any time.
pub trait PasswordHasher {
    /// Hashes a clear text password.
    ///
    /// Make sure to use all of the given parameters as described
    /// below. Additionally, you should choose a strong hashing
    /// algorithm. As of mid 2016, Argon2i, bcrypt, and scrypt
    /// seem to be very good choices.
    ///
    /// - `clear_text_password` are the given password's raw bytes.
    ///   Do not store or write this data, just hash it.
    /// - `hash_salt` is a random salt that should be used.
    /// - `hashed_password` receives your hash function's result.
    ///   Use every single byte of `hashed_password`, i.e. produce
    ///   `hashed_password.len()` bytes of hash data.
    unsafe fn hash(&self, hashed_password: &mut [u8], clear_text_password: &[u8], hash_salt: &[u8]);
}