lum_ccc_rust/crates/ccc-cascade/tests/password_cross_check.rs

16 lines
735 B
Rust

//! Argon2id with explicit parameters matches the RustCrypto provider's
//! fixed-parameter Argon2id (64 MiB, t=3, 4 lanes), and it agrees with the pinned conformance vectors.
use ccc_cascade::password::{argon2id, Argon2Params};
use ccc_crypto_core::{KdfAlgorithm, KdfProvider};
#[test]
fn matches_both_providers() {
let p = Argon2Params { memory_kib: 64 * 1024, iterations: 3, parallelism: 4 };
let salt = [0x24u8; 16];
let ours = argon2id(b"correct horse battery staple", &salt, p, 32).unwrap();
let rc = ccc_crypto_rustcrypto::RustCryptoProvider::new()
.derive_key(KdfAlgorithm::Argon2id, b"correct horse battery staple", &salt, b"", 32)
.unwrap();
assert_eq!(ours.as_slice(), rc.as_slice());
}