rs-hash-blake2 0.1.0
BLAKE2b and BLAKE2s (RFC 7693) with keyed mode, variable output length and a streaming API, std only
Install
cargo add rs-hash-blake2 --registry rupm
In Ruststudio: Packages, search for rs-hash-blake2, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.
Versions
- 0.1.0 2026-11-23
README
# rs-hash-blake2 BLAKE2b and BLAKE2s (RFC 7693) with keyed mode, variable output length and a streaming API, std only Add it with `rupm add rs-hash-blake2` (or `cargo add rs-hash-blake2 --registry rupm`). The hashes are checked against the RFC 7693 and reference implementation test vectors. This is a plain, unaudited implementation that is not constant-time: do not use it for security-critical work, use an audited crate there. ## Install ``` rupm add rs-hash-blake2 ``` ## Usage ```rust let hex = rs_hash_blake2::blake2s_hex(b"abc"); assert_eq!(hex, "508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982"); // Keyed mode (a MAC) with a 32 byte output, streaming. let mut h = rs_hash_blake2::Blake2b::new(32, b"secret key").unwrap(); h.update(b"message "); h.update(b"part two"); assert_eq!(h.finalize().len(), 32); ``` ## API overview - `blake2b(data)` (64 bytes), `blake2s(data)` (32 bytes) and the `_hex` variants: one-shot digests. - `blake2b_keyed(key, data, out_len)`, `blake2s_keyed(key, data, out_len)`: keyed one-shot, returns `Result`. - `Blake2b`, `Blake2s`: streaming hashers with `new(out_len, key)`, `update`, `finalize`. - `Error`: returned for an out-of-range output length (BLAKE2b 1..=64, BLAKE2s 1..=32) or key (up to 64 / 32 bytes).