Module lair_keystore_api::dependencies::sodoken::hash::argon2id
source · Expand description
Api functions related to the argon2id password hashing algorithm.
Argon2 is a password hashing scheme designed to be both cpu and
memory hard. You can configure this hardness with the ops_limit
for how difficult it is cpu-wise, and mem_limit
for how much
memory it will use during the operation. For tests, please use
MIN
, otherwise your tests will take a long time.
§Example
// generate salt
let salt = sodoken::BufWriteSized::new_no_lock();
sodoken::random::bytes_buf(salt.clone()).await.unwrap();
let salt = salt.to_read_sized();
// generate the pw hash
let hash = <sodoken::BufWriteSized<32>>::new_no_lock();
sodoken::hash::argon2id::hash(
hash.clone(),
b"my-passphrase".to_vec(),
salt.clone(),
sodoken::hash::argon2id::OPSLIMIT_MIN,
sodoken::hash::argon2id::MEMLIMIT_MIN,
).await.unwrap();
let hash = hash.to_read_sized();
Constants§
- minimum hash length for argon2id pwhash
- argon2id pwhash interactive mem limit
- argon2id pwhash min mem limit
- argon2id pwhash moderate mem limit
- argon2id pwhash sensitive mem limit
- argon2id pwhash interactive ops limit
- argon2id pwhash max ops limit
- argon2id pwhash min ops limit
- argon2id pwhash moderate ops limit
- argon2id pwhash sensitive ops limit
- maximum password length for argon2id pwhash
- minimum password length for argon2id pwhash
- salt buffer length for argon2id pwhash
Functions§
- argon2id13 password hashing scheme