keyfork-entropy: downgrade entropy size limit to warning

This commit is contained in:
Ryan Heywood 2024-04-12 16:13:01 -04:00
parent 71b6e4ed0c
commit 5438f4e111
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
3 changed files with 8 additions and 6 deletions

2
Cargo.lock generated
View File

@ -1776,7 +1776,7 @@ dependencies = [
[[package]]
name = "keyfork-entropy"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"keyfork-bug",
"smex",

View File

@ -1,6 +1,6 @@
[package]
name = "keyfork-entropy"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
license = "MIT"

View File

@ -10,10 +10,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
bit_size % 8 == 0,
"Bit size must be divisible by 8, got: {bit_size}"
);
assert!(
bit_size <= 256,
"Maximum supported bit size is 256, got: {bit_size}"
);
match bit_size {
128 | 256 | 512 => {}
_ => {
eprintln!("reading entropy of uncommon size: {bit_size}");
}
}
let entropy = keyfork_entropy::generate_entropy_of_size(bit_size / 8)?;
println!("{}", smex::encode(entropy));