2022-06-18 09:28:34 +00:00
|
|
|
use crypto_utils::sha::{Algorithm, CryptographicHash};
|
2022-06-18 09:24:03 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let input = "This is a input text to be hashed";
|
|
|
|
|
|
|
|
println!("input = `{input}`");
|
|
|
|
|
|
|
|
let sha1 = CryptographicHash::hash(Algorithm::SHA1, input.as_bytes());
|
|
|
|
|
|
|
|
println!("sha1 = `{}`", hex::encode(sha1));
|
|
|
|
|
|
|
|
let sha256 = CryptographicHash::hash(Algorithm::SHA256, input.as_bytes());
|
|
|
|
|
2022-06-18 09:28:34 +00:00
|
|
|
println!("sha256 = `{}`", hex::encode(sha256));
|
2022-06-18 09:24:03 +00:00
|
|
|
|
|
|
|
let sha512 = CryptographicHash::hash(Algorithm::SHA512, input.as_bytes());
|
|
|
|
|
2022-06-18 09:28:34 +00:00
|
|
|
println!("sha512 = `{}`", hex::encode(sha512));
|
2022-06-18 09:24:03 +00:00
|
|
|
}
|