[core] Vault and generators: Argon2id key slot + XChaCha20-Poly1305 file, atomic save, item templates, memorable/nickname/random/PIN/strict generators
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
//! How long one unlock takes with given Argon2id parameters (default: `KdfParams::DEFAULT`):
|
||||
//! `cargo run --release -p custos-vault --example kdf_timing [m_cost_kib t_cost]`
|
||||
use custos_vault::{KdfParams, SecretString, Vault};
|
||||
use std::time::Instant;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<u32> = std::env::args().skip(1).filter_map(|a| a.parse().ok()).collect();
|
||||
let kdf = match args[..] {
|
||||
[m, t] => KdfParams { m_cost_kib: m, t_cost: t, p_cost: 1 },
|
||||
_ => KdfParams::DEFAULT,
|
||||
};
|
||||
let pw = SecretString::from("timing only");
|
||||
let bytes = Vault::create(&pw, kdf).unwrap().to_bytes().unwrap();
|
||||
for _ in 0..3 {
|
||||
let t = Instant::now();
|
||||
Vault::open(&bytes, &pw).unwrap();
|
||||
println!("{kdf:?}: unlock in {:?}", t.elapsed());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user