Function argon2::hash_raw[][src]

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 and parallel execution:

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

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