|
1 | 1 | use crate::{log, warning}; |
2 | 2 | use crate::{ |
3 | 3 | slowkey::{SlowKey, SlowKeyOptions}, |
4 | | - utils::algorithms::{argon2id::Argon2idOptions, balloon_hash::BalloonHashOptions, scrypt::ScryptOptions}, |
| 4 | + utils::algorithms::{ |
| 5 | + argon2id::{Argon2idImplementation, Argon2idOptions}, |
| 6 | + balloon_hash::BalloonHashOptions, |
| 7 | + scrypt::{ScryptImplementation, ScryptOptions}, |
| 8 | + }, |
5 | 9 | }; |
6 | 10 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; |
7 | 11 | use rayon::iter::{IntoParallelIterator, ParallelIterator}; |
@@ -2019,7 +2023,10 @@ static EXPECTED: [&str; STABILITY_TEST_ITERATIONS] = [ |
2019 | 2023 | "cf47a21d7876e09751c534db476c71689ba52b7c85f0f84945e3fa5c27b736af", |
2020 | 2024 | ]; |
2021 | 2025 |
|
2022 | | -pub fn stability_test(tasks: usize, iterations: usize) { |
| 2026 | +pub fn stability_test( |
| 2027 | + tasks: usize, iterations: usize, scrypt_implementation: ScryptImplementation, |
| 2028 | + argon2_implementation: Argon2idImplementation, |
| 2029 | +) { |
2023 | 2030 | if tasks == 0 { |
2024 | 2031 | panic!("Invalid number of tasks"); |
2025 | 2032 | } |
@@ -2057,8 +2064,17 @@ pub fn stability_test(tasks: usize, iterations: usize) { |
2057 | 2064 | let slowkey = SlowKey::new(&SlowKeyOptions { |
2058 | 2065 | iterations, |
2059 | 2066 | length: SlowKeyOptions::DEFAULT_OUTPUT_SIZE, |
2060 | | - scrypt: ScryptOptions::default(), |
2061 | | - argon2id: Argon2idOptions::default(), |
| 2067 | + scrypt: ScryptOptions::new_with_implementation( |
| 2068 | + ScryptOptions::DEFAULT_LOG_N, |
| 2069 | + ScryptOptions::DEFAULT_R, |
| 2070 | + ScryptOptions::DEFAULT_P, |
| 2071 | + scrypt_implementation, |
| 2072 | + ), |
| 2073 | + argon2id: Argon2idOptions::new_with_implementation( |
| 2074 | + Argon2idOptions::DEFAULT_M_COST, |
| 2075 | + Argon2idOptions::DEFAULT_T_COST, |
| 2076 | + argon2_implementation, |
| 2077 | + ), |
2062 | 2078 | balloon_hash: BalloonHashOptions::default(), |
2063 | 2079 | }); |
2064 | 2080 |
|
|
0 commit comments