Collection of cryptographic hash functions written in pure Rust
open sourceMIT OR Apache-2.0free
RustCrypto Hashes is a collection of cryptographic hash functions in pure Rust, each in its own crate and built on the traits of the digest crate, so they're interchangeable: SHA-2 (sha2: SHA-224, SHA-256, SHA-384 and SHA-512), SHA-3 and Keccak (sha3), BLAKE2 (blake2), SHA-1 (sha1), MD5 (published as md-5), RIPEMD, Whirlpool, SM3, Streebog, Ascon-Hash256 and more. Every crate works without the standard library (no_std), so they run on bare metal and in WebAssembly. The README rates each algorithm's security, marks MD5, MD4, MD2 and SHA-1 as broken in practice, and recommends BLAKE3, SHA-2 or SHA-3 for new applications. Every crate is MIT OR Apache-2.0, maintained by the RustCrypto project.
Problems it solves
- compute a SHA-256 hash in Rust without linking OpenSSL
- hash data in an embedded Rust program with no standard library
- swap one hash algorithm for another in Rust without rewriting the code
Features
- SHA-2, SHA-3, BLAKE2, SHA-1, MD5, RIPEMD, Whirlpool, SM3, Streebog and more
- one crate per algorithm on the shared digest traits
- no_std, for bare metal and WebAssembly
- security rating for each algorithm
Alternatives
The same job
These do what RustCrypto Hashes does.
- md5 (Rust crate) The MD5 hash function for Rust
- rustc-hash The fast, non-cryptographic FxHasher that rustc uses, with FxHashMap and FxHashSet
