21 lines
1006 B
Rust
21 lines
1006 B
Rust
//! Argon2id with explicit parameters matches both providers' fixed-parameter
|
|
//! Argon2id (64 MiB, t=3, 4 lanes), which use two different argon2 crate
|
|
//! versions, and the providers agree 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 wolf = ccc_crypto_wolfssl::WolfSslProvider::new()
|
|
.derive_key(KdfAlgorithm::Argon2id, b"correct horse battery staple", &salt, b"", 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(), wolf.as_slice());
|
|
assert_eq!(ours.as_slice(), rc.as_slice());
|
|
}
|