Function argon2::verify_raw_std
source · pub fn verify_raw_std(
variant: Variant,
version: Version,
mem_cost: u32,
time_cost: u32,
parallelism: u32,
pwd: &[u8],
salt: &[u8],
hash: &[u8]
) -> Result<bool>
👎Deprecated since 0.2.0: please use
verify_raw
insteadExpand description
Verifies the password with the supplied settings (standard).
Examples
use argon2::{self, Variant, Version};
let pwd = b"password";
let salt = b"somesalt";
let hash = &[137, 104, 116, 234, 240, 252, 23, 45, 187, 193, 255, 103, 166,
126, 133, 93, 104, 130, 95, 130, 186, 165, 110, 148, 123, 80,
103, 207, 61, 59, 103, 192];
let mem_cost = 4096;
let time_cost = 3;
let parallelism = 1;
let res = argon2::verify_raw_std(Variant::Argon2i,
Version::Version13,
mem_cost,
time_cost,
parallelism,
pwd,
salt,
hash).unwrap();
assert!(res);
The above rewritten using verify_raw
:
use argon2::{self, Config, ThreadMode, Variant, Version};
let pwd = b"password";
let salt = b"somesalt";
let hash = &[137, 104, 116, 234, 240, 252, 23, 45, 187, 193, 255, 103, 166,
126, 133, 93, 104, 130, 95, 130, 186, 165, 110, 148, 123, 80,
103, 207, 61, 59, 103, 192];
let config = Config {
variant: Variant::Argon2i,
version: Version::Version13,
mem_cost: 4096,
time_cost: 3,
lanes: 1,
thread_mode: ThreadMode::Sequential,
secret: &[],
ad: &[],
hash_length: hash.len() as u32,
};
let res = argon2::verify_raw(pwd, salt, hash, &config).unwrap();
assert!(res);