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]] [[package]]
name = "keyfork-entropy" name = "keyfork-entropy"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"keyfork-bug", "keyfork-bug",
"smex", "smex",

View File

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

View File

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