[][src]Function argon2::hash_encoded_old

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

please use new hash_encoded instead

Hashes the password and returns the encoded hash (pre 0.2.0 hash_encoded).

Examples

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

let pwd = b"password";
let salt = b"somesalt";
let mem_cost = 4096;
let time_cost = 10;
let lanes = 1;
let threads = 1;
let secret = b"secret value";
let ad = b"associated data";
let hash_len = 32;
let encoded = argon2::hash_encoded_old(Variant::Argon2i,
                                       Version::Version13,
                                       mem_cost,
                                       time_cost,
                                       lanes,
                                       threads,
                                       pwd,
                                       salt,
                                       secret,
                                       ad,
                                       hash_len).unwrap();

The above rewritten using the new hash_encoded:

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

let pwd = b"password";
let salt = b"somesalt";
let config = Config {
    variant: Variant::Argon2i,
    version: Version::Version13,
    mem_cost: 4096,
    time_cost: 10,
    lanes: 1,
    thread_mode: ThreadMode::Sequential,
    secret: b"secret value",
    ad: b"associated data",
    hash_length: 32,
};
let encoded = argon2::hash_encoded(pwd, salt, &config).unwrap();