blake512-hash
Pure Rust implementation of the BLAKE-512 cryptographic hash function.
BLAKE was one of the five finalists in the NIST SHA-3 competition. This is the original BLAKE algorithm -- not BLAKE2 or BLAKE3. BLAKE-512 is used in the Quark hash chain found in Divi, PIVX, and other cryptocurrencies.
Features
- Pure Rust -- no C dependencies, no FFI, no
unsafecode no_stdcompatible -- works in embedded and WASM environments- RustCrypto ecosystem -- implements the
digest::Digesttrait (v0.10) - Verified -- 13 test vectors validated against the sphlib C reference implementation
Usage
Add to your Cargo.toml:
[]
= "0.1"
One-shot hashing
use ;
let hash = digest;
println!;
Incremental hashing
use ;
let mut hasher = new;
hasher.update;
hasher.update;
let hash = hasher.finalize;
In a Quark hash chain
use Blake512;
use Bmw512;
use Groestl512;
use Jh512;
use Keccak512;
use Skein512;
use ;
Algorithm
BLAKE-512 operates on 128-byte message blocks using 16 rounds of the G mixing function over a 16-word working vector. It uses the Merkle-Damgard construction with a HAIFA counter for length padding.
Key parameters:
- Output size: 512 bits (64 bytes)
- Block size: 128 bytes
- Rounds: 16
- Word size: 64 bits
This implementation is a direct port of the blake64 functions from sphlib (MIT license, Thomas Pornin / Projet RNRT SAPHIR).
Test Vectors
All test vectors are validated against the sphlib C reference implementation:
| Input | BLAKE-512 (first 32 hex chars) |
|---|---|
"" (empty) |
a8cfbbd73726062df0c6864dda65defe... |
"\x00" |
97961587f6d970faba6d2478045de6d1... |
"abc" |
14266c7c704a3b58fb421ee69fd005fc... |
| 80 zero bytes | 13cee4afd536f7ed6aa3f7fc90e00050... |
128 x 0x41 |
ab691f6ae2543e81bf3276c7ea463212... |
129 x 0x42 |
f643396476f2436066dec3e9c505eb74... |
Reference
- BLAKE specification (original submission site)
- sphlib C implementation by Thomas Pornin
- NIST SHA-3 competition