add BLAKE2S, BLAKE2B

This commit is contained in:
2019-11-24 13:04:37 +08:00
parent c16c95056b
commit df87aac2fa
2 changed files with 13 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ pub struct Options {
pub version: bool,
pub algorithm: String,
pub file_name_list: Vec<String>,
pub blake_len: usize,
}
impl Options {
@@ -13,6 +14,7 @@ impl Options {
version: false,
algorithm: "SHA256".to_string(),
file_name_list: Vec::new(),
blake_len: 0_usize,
}
}
@@ -21,6 +23,7 @@ impl Options {
let mut ap = ArgumentParser::new();
ap.set_description("digest - command line digest tool.");
ap.refer(&mut self.algorithm).add_option(&["-a", "--algorithm"], Store, "Algorithm, e.g. SHA256, SM3");
ap.refer(&mut self.blake_len).add_option(&["-l", "--blake-len"], Store, "Blake2s/b length, 1~32/64");
ap.refer(&mut self.version).add_option(&["-v", "--version"], StoreTrue, "Print version");
ap.refer(&mut self.file_name_list).add_argument("File names", List, "File names to be digested");
ap.parse_args_or_exit();