2023-09-21 22:30:48 +00:00
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
let bit_size: usize = std::env::args()
|
|
|
|
.nth(1)
|
|
|
|
.unwrap_or(String::from("256"))
|
|
|
|
.parse()
|
|
|
|
.expect("Expected integer bit size");
|
|
|
|
assert!(
|
|
|
|
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}"
|
|
|
|
);
|
|
|
|
|
2023-10-03 03:15:21 +00:00
|
|
|
keyfork_plumbing::ensure_safe();
|
|
|
|
let entropy = keyfork_plumbing::generate_entropy_of_size(bit_size / 8)?;
|
2023-09-21 22:30:48 +00:00
|
|
|
println!("{}", smex::encode(&entropy));
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|