keyfork-mnemonic-generate: clean up
This commit is contained in:
parent
754fdc10e5
commit
067a373993
|
@ -7,7 +7,7 @@ use std::{
|
||||||
|
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
|
|
||||||
/// Usage: keyfork-mnemonic-generate
|
/// Usage: keyfork-mnemonic-generate [bitsize: 128 or 256]
|
||||||
/// CHECKS:
|
/// CHECKS:
|
||||||
/// * If the system is online
|
/// * If the system is online
|
||||||
/// * If a kernel is running post-BLAKE2
|
/// * If a kernel is running post-BLAKE2
|
||||||
|
@ -99,7 +99,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let entropy = &mut [0u8; 256 / 8];
|
let entropy = &mut [0u8; 256 / 8];
|
||||||
random_handle.read_exact(&mut entropy[..])?;
|
random_handle.read_exact(&mut entropy[..])?;
|
||||||
|
|
||||||
let mut hasher = sha2::Sha256::new();
|
let mut hasher = Sha256::new();
|
||||||
hasher.update(&entropy);
|
hasher.update(&entropy);
|
||||||
let hash = hasher.finalize();
|
let hash = hasher.finalize();
|
||||||
let checksum = &hash[..bit_size / 32 / 8];
|
let checksum = &hash[..bit_size / 32 / 8];
|
||||||
|
|
Loading…
Reference in New Issue