change outputs, version to 0.1.1
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -142,7 +142,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"argparse 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "digest"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
38
src/main.rs
38
src/main.rs
@@ -93,25 +93,25 @@ fn main() -> XResult<()> {
|
||||
let the_algo = options.algorithm.to_uppercase();
|
||||
|
||||
match the_algo.as_str() {
|
||||
"MD5" => println!("{}: {}", the_algo, calc_file_digest(&mut Md5::new(), the_fn)?),
|
||||
"SHA1" | "SHA-1" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha1::new(), the_fn)?),
|
||||
"SHA224" | "SHA-224" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha224::new(), the_fn)?),
|
||||
"SHA256" | "SHA-256" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha256::new(), the_fn)?),
|
||||
"SHA384" | "SHA-384" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha384::new(), the_fn)?),
|
||||
"SHA512" | "SHA-512" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha512::new(), the_fn)?),
|
||||
"SHA512-224" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha512Trunc224::new(), the_fn)?),
|
||||
"SHA512-256" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha512Trunc256::new(), the_fn)?),
|
||||
"SHA3-224" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::sha3_224(), the_fn)?),
|
||||
"SHA3-256" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::sha3_256(), the_fn)?),
|
||||
"SHA3-384" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::sha3_384(), the_fn)?),
|
||||
"SHA3-512" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::sha3_512(), the_fn)?),
|
||||
"SHAKE-128" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::shake_128(), the_fn)?),
|
||||
"SHAKE-256" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::shake_256(), the_fn)?),
|
||||
"KECCAK-224" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::keccak224(), the_fn)?),
|
||||
"KECCAK-256" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::keccak256(), the_fn)?),
|
||||
"KECCAK-384" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::keccak384(), the_fn)?),
|
||||
"KECCAK-512" => println!("{}: {}", the_algo, calc_file_digest(&mut Sha3::keccak512(), the_fn)?),
|
||||
"SM3" => println!("{}: {}", the_algo, hex::encode(Sm3Hash::new(&read_file_full(the_fn)?).get_hash())),
|
||||
"MD5" => println!("{} - {} ({})", calc_file_digest(&mut Md5::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA1" | "SHA-1" => println!("{} - {} ({})", calc_file_digest(&mut Sha1::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA224" | "SHA-224" => println!("{} - {} ({})", calc_file_digest(&mut Sha224::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA256" | "SHA-256" => println!("{} - {} ({})", calc_file_digest(&mut Sha256::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA384" | "SHA-384" => println!("{} - {} ({})", calc_file_digest(&mut Sha384::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA512" | "SHA-512" => println!("{} - {} ({})", calc_file_digest(&mut Sha512::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA512-224" => println!("{} - {} ({})", calc_file_digest(&mut Sha512Trunc224::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA512-256" => println!("{} - {} ({})", calc_file_digest(&mut Sha512Trunc256::new(), the_fn)?, the_fn, the_algo),
|
||||
"SHA3-224" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::sha3_224(), the_fn)?, the_fn, the_algo),
|
||||
"SHA3-256" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::sha3_256(), the_fn)?, the_fn, the_algo),
|
||||
"SHA3-384" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::sha3_384(), the_fn)?, the_fn, the_algo),
|
||||
"SHA3-512" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::sha3_512(), the_fn)?, the_fn, the_algo),
|
||||
"SHAKE-128" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::shake_128(), the_fn)?, the_fn, the_algo),
|
||||
"SHAKE-256" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::shake_256(), the_fn)?, the_fn, the_algo),
|
||||
"KECCAK-224" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::keccak224(), the_fn)?, the_fn, the_algo),
|
||||
"KECCAK-256" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::keccak256(), the_fn)?, the_fn, the_algo),
|
||||
"KECCAK-384" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::keccak384(), the_fn)?, the_fn, the_algo),
|
||||
"KECCAK-512" => println!("{} - {} ({})", calc_file_digest(&mut Sha3::keccak512(), the_fn)?, the_fn, the_algo),
|
||||
"SM3" => println!("{} - {} ({})", hex::encode(Sm3Hash::new(&read_file_full(the_fn)?).get_hash()), the_fn, the_algo),
|
||||
_ => print_message(MessageType::ERROR, &format!("Unknown algorithm: {}", options.algorithm)),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user