mirror of
https://github.com/mii443/RustySecrets.git
synced 2025-08-22 16:25:32 +00:00
38 lines
1.3 KiB
Rust
38 lines
1.3 KiB
Rust
extern crate rusty_secrets;
|
|
|
|
use rusty_secrets::wrapped_secrets;
|
|
|
|
#[ignore]
|
|
#[test]
|
|
fn test_reasonable_splits() {
|
|
let max_shares = 25;
|
|
let secret = "I grew up with the understanding that the world I lived in was one where people \
|
|
enjoyed a sort of freedom to communicate with each other in privacy, without it \
|
|
being monitored, without it being measured or analyzed or sort of judged by \
|
|
these shadowy figures or systems, any time they mention anything that travels \
|
|
across public lines."
|
|
.to_string()
|
|
.into_bytes();
|
|
|
|
let mime_type = "image/jpeg".to_string();
|
|
|
|
for is_signing in &[true, false] {
|
|
for k in 1..max_shares {
|
|
for n in k..max_shares {
|
|
let shares = wrapped_secrets::split_secret(
|
|
k,
|
|
n,
|
|
&secret,
|
|
Some(mime_type.clone()),
|
|
*is_signing,
|
|
).unwrap();
|
|
println!("Testing {} out-of- {}", k, n);
|
|
|
|
let s = wrapped_secrets::recover_secret(&shares, *is_signing).unwrap();
|
|
assert_eq!(s.get_secret().to_owned(), secret);
|
|
assert_eq!(mime_type, s.get_mime_type());
|
|
}
|
|
}
|
|
}
|
|
}
|