#keccak #sha-2 #blake

ez-hash

Ergonomic hashing helpers with a simple Hashable API and optional algorithm features

3 stable releases

1.1.0 Dec 20, 2025
1.0.1 Dec 19, 2025
1.0.0 Dec 18, 2025

#883 in Cryptography

Download history 97/week @ 2026-01-15 339/week @ 2026-01-22 124/week @ 2026-01-29 88/week @ 2026-02-05

648 downloads per month

Apache-2.0

11KB
176 lines

ez-hash

Ergonomic hashing helpers for Rust.

  • Single, simple API: each hash algorithm is a single function.
  • Supports hashing either a single value or multiple parts by implementing Hashable.
  • Common hash algorithms behind Cargo features (default: all enabled).

Installation

[dependencies]
ez-hash = "1.0"

To enable only selected algorithms:

ez-hash = { version = "1.0", default-features = false, features = ["sha2", "sha3"] }

Usage

Single-part:

use ez_hash::sha256;

let digest = sha256("hello");

Multi-part (tuple / array / vec):

use ez_hash::{keccak256, sha256};

let a = sha256(("a", "bc"));
let b = sha256(["a", "b", "c"]);
let c = keccak256(("prefix", "data", "suffix"));
assert_eq!(a, b);

Bytes:

use ez_hash::sha256;

let bytes = 1u32.to_le_bytes();
let digest = sha256(bytes);

API

The crate exposes:

  • Hashable trait (implemented for common byte/string types and for tuples/arrays/vectors of hashables)

Hash functions (availability depends on enabled features):

  • SHA1: sha1
  • SHA2: sha224, sha256, sha384, sha512, sha512_224, sha512_256
  • SHA3: sha3_224, sha3_256, sha3_384, sha3_512
  • Keccak: keccak256, keccak512
  • Blake2: blake2b_256, blake2b_384, blake2b_512, blake2s_128, blake2s_256
  • Blake3: blake3
  • MD5: md5

License

Licensed under the Apache License, Version 2.0. See LICENSE.

Dependencies

~3.5MB
~66K SLoC