pub async fn hash_raw(password: impl AsRef<[u8]>) -> crate::Result<Vec<u8>> {
    let hasher = get_hasher().await?;
    let password = password.as_ref().to_owned();

    let res = tokio::task::spawn_blocking(move || {
        let salt_str = SaltString::generate(rand::thread_rng());
        let salt = salt_str.as_salt();
        let mut output = Vec::new();
        hasher
            .hash_password_into(&*password, salt.as_bytes(), &mut output)
            .map(|_| output)
    });

    Ok(res.await??)
}
/// Hash this password with the given config. Return the hashed password as a raw bytes vector.
///
/// # Errors
/// This function errors if any of the following happen:
/// * the given config is invalid
/// * hashing the password fails
/// * communication between threads fails
Hash this password with the given config. Return the hashed password as a raw bytes vector.
Hash this password with the given config . Return the hashed password as a raw bytes vector .
pub async fn hash_raw(password: impl AsRef<[u8]>) -> crate::Result<Vec<u8>> {
    let hasher = get_hasher().await?;
    let password = password.as_ref().to_owned();
    let res = tokio::task::spawn_blocking(move || {
        let salt_str = SaltString::generate(rand::thread_rng());
        let salt = salt_str.as_salt();
        let mut output = Vec::new();
        hasher
            .hash_password_into(&*password, salt.as_bytes(), &mut output)
            .map(|_| output)
    });
    Ok(res.await??)
}
pub async fn hash_raw ( password : impl AsRef < [ u8 ] > ) -> crate :: Result < Vec < u8 > > { let hasher = get_hasher ( ) . await ? ; let password = password . as_ref ( ) . to_owned ( ) ; let res = tokio :: task :: spawn_blocking ( move | | { let salt_str = SaltString :: generate ( rand :: thread_rng ( ) ) ; let salt = salt_str . as_salt ( ) ; let mut output = Vec :: new ( ) ; hasher . hash_password_into ( & * password , salt . as_bytes ( ) , & mut output ) . map ( | _ | output ) } ) ; Ok ( res . await ? ? ) }
Hash this password with the given config.
Hash this password with the given config .
password
impl AsRef<[u8]>
password
impl AsRef<[u8]>
errors
This function errors if any of the following happen:
the given config is invalid
hashing the password fails
communication between threads fails
This function errors if any of the following happen : the given config is invalid hashing the password fails communication between threads fails