pub fn hash<P: AsRef<[u8]>>(password: P, cost: u32) -> BcryptResult<String> {
    let salt = {
        let mut s = [0u8; 16];
        OsRng.fill_bytes(&mut s);
        s
    };
    let hash_parts = _hash_password(password.as_ref(), cost, &salt)?;

    Ok(hash_parts.format())
}
/// Generates a password hash using the cost given.
/// The salt is generated randomly using the OS randomness
Generates a password hash using the cost given.
The salt is generated randomly using the OS randomness
Generates a password hash using the cost given . The salt is generated randomly using the OS randomness
pub fn hash<P: AsRef<[u8]>>(password: P, cost: u32) -> BcryptResult<String> {
    let salt = {
        let mut s = [0u8; 16];
        OsRng.fill_bytes(&mut s);
        s
    };
    let hash_parts = _hash_password(password.as_ref(), cost, &salt)?;
    Ok(hash_parts.format())
}
pub fn hash < P : AsRef < [ u8 ] > > ( password : P , cost : u32 ) -> BcryptResult < String > { let salt = { let mut s = [ 0u8 ; 16 ] ; OsRng . fill_bytes ( & mut s ) ; s } ; let hash_parts = _hash_password ( password . as_ref ( ) , cost , & salt ) ? ; Ok ( hash_parts . format ( ) ) }
Generates a password hash using the cost given.
Generates a password hash using the cost given .
password
P
cost
u32