diff --git a/Cargo.lock b/Cargo.lock index afcc852..5b84ede 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,7 +142,7 @@ dependencies = [ [[package]] name = "digest" -version = "0.1.1" +version = "0.1.2" 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)", diff --git a/Cargo.toml b/Cargo.toml index 03c41f9..36a5503 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "digest" -version = "0.1.1" +version = "0.1.2" authors = ["Hatter Jiang "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 95da813..b7e06da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ use std::{ }; use crypto::{ digest::Digest, + ripemd160::Ripemd160, md5::Md5, sha1::Sha1, sha2::{ @@ -124,12 +125,13 @@ Written by Hatter Jiang Supported algorithms: MD5, SHA1, SHA224, SHA256, SHA512, SHA512-224, SHA512-256, SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE-128, SHAKE-256, -KECCAK-224, KECCAK-256, KECCAK-384, KECCAK-512, SM3 +KECCAK-224, KECCAK-256, KECCAK-384, KECCAK-512, SM3, RIPEMD160 "#, VERSION, &GIT_HASH[0..7]); } fn get_digest_by_algorithm(algo: &str) -> Option> { match algo { + "RIPEMD160" => Some(Box::new(Ripemd160::new())), "MD5" => Some(Box::new(Md5::new())), "SHA1" | "SHA-1" => Some(Box::new(Sha1::new())), "SHA224" | "SHA-224" => Some(Box::new(Sha224::new())),