[][src]Function argon2::verify_raw_old

pub fn verify_raw_old(
    variant: Variant,
    version: Version,
    mem_cost: u32,
    time_cost: u32,
    lanes: u32,
    threads: u32,
    pwd: &[u8],
    salt: &[u8],
    secret: &[u8],
    ad: &[u8],
    hash: &[u8]
) -> Result<bool>
Deprecated since 0.2.0:

please use new verify_raw instead

Verifies the password with the supplied settings (pre 0.2.0 verify_raw).

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 lanes = 1;
let threads = 1;
let secret = &[];
let ad = &[];
let res = argon2::verify_raw_old(Variant::Argon2i,
                                 Version::Version13,
                                 mem_cost,
                                 time_cost,
                                 lanes,
                                 threads,
                                 pwd,
                                 salt,
                                 secret,
                                 ad,
                                 hash).unwrap();
assert!(res);

The above rewritten using the new 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);