use ascon_hash::{AsconHash256, ExtendableOutput}; use belt_hash::BeltHash; use blake2::{Blake2b512, Blake2s256}; use blake3::Hasher as Blake3; use fsb::{Fsb160, Fsb224, Fsb256, Fsb384, Fsb512}; use gost94::Gost94CryptoPro; use groestl::{Groestl224, Groestl256, Groestl384, Groestl512}; use jh::{Jh224, Jh256, Jh384, Jh512}; use k12::KangarooTwelve; use md2::Md2; use md4::Md4; use md5::Md5; use ripemd::{Ripemd128, Ripemd160, Ripemd256, Ripemd320}; use sha1::Sha1; use sha2::{Digest as _, Sha224, Sha256, Sha384, Sha512}; use sha3::{Sha3_224, Sha3_256, Sha3_384, Sha3_512, Shake128, Shake256}; use shabal::{Shabal192, Shabal224, Shabal256, Shabal384, Shabal512}; use skein::{consts::U32, Skein1024, Skein256, Skein512}; use sm3::Sm3; use std::io; use std::{fs::File, io::Read}; use streebog::{Streebog256, Streebog512}; use tiger::Tiger; use whirlpool::Whirlpool; pub fn hash_streebog256(mut file: File) -> String { let mut hasher = Streebog256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_streebog512(mut file: File) -> String { let mut hasher = Streebog512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_tiger(mut file: File) -> String { let mut hasher = Tiger::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_whirlpool(mut file: File) -> String { let mut hasher = Whirlpool::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha224(mut file: File) -> String { let mut hasher = Sha224::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sm3(mut file: File) -> String { let mut hasher = Sm3::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha3_224(mut file: File) -> String { let mut hasher = Sha3_224::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha3_256(mut file: File) -> String { let mut hasher = Sha3_256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha3_384(mut file: File) -> String { let mut hasher = Sha3_384::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha3_512(mut file: File) -> String { let mut hasher = Sha3_512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_shake128(mut file: File) -> String { let mut hasher = Shake128::default(); _ = io::copy(&mut file, &mut hasher); let mut result = String::new(); let mut finalized = hasher.finalize_xof(); _ = finalized.read_to_string(&mut result); return format!("{}", result); } pub fn hash_shake256(mut file: File) -> String { let mut hasher = Shake256::default(); _ = io::copy(&mut file, &mut hasher); let mut result = String::new(); let mut finalized = hasher.finalize_xof(); _ = finalized.read_to_string(&mut result); return format!("{}", result); } pub fn hash_shabal192(mut file: File) -> String { let mut hasher = Shabal192::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_shabal224(mut file: File) -> String { let mut hasher = Shabal224::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_shabal256(mut file: File) -> String { let mut hasher = Shabal256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_shabal384(mut file: File) -> String { let mut hasher = Shabal384::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_shabal512(mut file: File) -> String { let mut hasher = Shabal512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_skein256(mut file: File) -> String { let mut hasher = Skein256::::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_skein512(mut file: File) -> String { let mut hasher = Skein512::::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_skein1024(mut file: File) -> String { let mut hasher = Skein1024::::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_gost94(mut file: File) -> String { let mut hasher = Gost94CryptoPro::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_groestl224(mut file: File) -> String { let mut hasher = Groestl224::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_groestl256(mut file: File) -> String { let mut hasher = Groestl256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_groestl384(mut file: File) -> String { let mut hasher = Groestl384::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_groestl512(mut file: File) -> String { let mut hasher = Groestl512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_jh224(mut file: File) -> String { let mut hasher = Jh224::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_jh256(mut file: File) -> String { let mut hasher = Jh256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_jh384(mut file: File) -> String { let mut hasher = Jh384::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_jh512(mut file: File) -> String { let mut hasher = Jh512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_k12(mut file: File) -> String { let mut hasher = KangarooTwelve::default(); _ = io::copy(&mut file, &mut hasher); let mut result = String::new(); let mut finalized = hasher.finalize_xof(); _ = finalized.read_to_string(&mut result); return format!("{}", result); } pub fn hash_md2(mut file: File) -> String { let mut hasher = Md2::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_md4(mut file: File) -> String { let mut hasher = Md4::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_ripemd128(mut file: File) -> String { let mut hasher = Ripemd128::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_ripemd160(mut file: File) -> String { let mut hasher = Ripemd160::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_ripemd256(mut file: File) -> String { let mut hasher = Ripemd256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_ripemd320(mut file: File) -> String { let mut hasher = Ripemd320::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_ascon(mut file: File) -> String { let mut hasher = AsconHash256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_belt(mut file: File) -> String { let mut hasher = BeltHash::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_blake3(mut file: File) -> String { let mut hasher = Blake3::default(); _ = io::copy(&mut file, &mut hasher); return format!("{}", hasher.finalize().to_hex()); } pub fn hash_blake2b512(mut file: File) -> String { let mut hasher = Blake2b512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_blake2s256(mut file: File) -> String { let mut hasher = Blake2s256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_fsb160(mut file: File) -> String { let mut hasher = Fsb160::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_fsb224(mut file: File) -> String { let mut hasher = Fsb224::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_fsb256(mut file: File) -> String { let mut hasher = Fsb256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_fsb384(mut file: File) -> String { let mut hasher = Fsb384::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_fsb512(mut file: File) -> String { let mut hasher = Fsb512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_md5(mut file: File) -> String { let mut hasher = Md5::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha1(mut file: File) -> String { let mut hasher = Sha1::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha256(mut file: File) -> String { let mut hasher = Sha256::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha384(mut file: File) -> String { let mut hasher = Sha384::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); } pub fn hash_sha512(mut file: File) -> String { let mut hasher = Sha512::new(); _ = io::copy(&mut file, &mut hasher); return format!("{:x}", hasher.finalize()); }