Function argon2::hash_raw

source ·
pub fn hash_raw(pwd: &[u8], salt: &[u8], config: &Config<'_>) -> Result<Vec<u8>>
Expand description

Hashes the password and returns the hash as a vector.

Examples

Create a hash with the default configuration:

use argon2::{self, Config};

let pwd = b"password";
let salt = b"somesalt";
let config = Config::default();
let vec = argon2::hash_raw(pwd, salt, &config).unwrap();

Create an Argon2d hash with 4 lanes:

use argon2::{self, Config, Variant};

let pwd = b"password";
let salt = b"somesalt";
let mut config = Config::default();
config.variant = Variant::Argon2d;
config.lanes = 4;
let vec = argon2::hash_raw(pwd, salt, &config).unwrap();