add RIPEMD160
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -142,7 +142,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argparse 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use std::{
|
|||||||
};
|
};
|
||||||
use crypto::{
|
use crypto::{
|
||||||
digest::Digest,
|
digest::Digest,
|
||||||
|
ripemd160::Ripemd160,
|
||||||
md5::Md5,
|
md5::Md5,
|
||||||
sha1::Sha1,
|
sha1::Sha1,
|
||||||
sha2::{
|
sha2::{
|
||||||
@@ -124,12 +125,13 @@ Written by Hatter Jiang
|
|||||||
Supported algorithms:
|
Supported algorithms:
|
||||||
MD5, SHA1, SHA224, SHA256, SHA512, SHA512-224, SHA512-256,
|
MD5, SHA1, SHA224, SHA256, SHA512, SHA512-224, SHA512-256,
|
||||||
SHA3-224, SHA3-256, SHA3-384, SHA3-512, SHAKE-128, SHAKE-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]);
|
"#, VERSION, &GIT_HASH[0..7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_digest_by_algorithm(algo: &str) -> Option<Box<dyn Digest>> {
|
fn get_digest_by_algorithm(algo: &str) -> Option<Box<dyn Digest>> {
|
||||||
match algo {
|
match algo {
|
||||||
|
"RIPEMD160" => Some(Box::new(Ripemd160::new())),
|
||||||
"MD5" => Some(Box::new(Md5::new())),
|
"MD5" => Some(Box::new(Md5::new())),
|
||||||
"SHA1" | "SHA-1" => Some(Box::new(Sha1::new())),
|
"SHA1" | "SHA-1" => Some(Box::new(Sha1::new())),
|
||||||
"SHA224" | "SHA-224" => Some(Box::new(Sha224::new())),
|
"SHA224" | "SHA-224" => Some(Box::new(Sha224::new())),
|
||||||
|
|||||||
Reference in New Issue
Block a user