Hashery
A flexible and efficient async file hashing library for Rust, supporting multiple hash algorithms.
Features
- Asynchronous file hashing with Tokio
- Multiple hash algorithm support (MD5, SHA1, SHA2, SHA3, BLAKE2, BLAKE3)
- Configurable buffer size for optimal performance
- Feature flags for selective algorithm inclusion
- Builder pattern for easy configuration
Installation
Add this to your Cargo.toml:
[]
= "0.1"
By default, only MD5 is enabled. To use other algorithms, enable the corresponding features:
[]
= { = "0.1", = ["sha2", "blake3"] }
Available Features
md5(default) - Enable MD5 hashingsha1- Enable SHA1 hashingsha2- Enable SHA256 and SHA512sha3- Enable SHA3-256blake2- Enable BLAKE2b and BLAKE2sblake3- Enable BLAKE3
Feature groups:
full- Enable all supported algorithmsmodern- Enable modern algorithms (SHA2 and BLAKE3)
Usage
use ;
async
Hashing Bytes and Strings
You can also hash bytes or strings directly:
let hashery = builder.algorithm.build;
// Hash a byte slice
env let hash = hashery.digest_bytes.unwrap;
println!;
// Hash a string
let hash = hashery.digest_str.unwrap;
println!;
Examples
Using different algorithms: