bmw-hash
Pure Rust implementation of the Blue Midnight Wish (BMW-512) cryptographic hash function.
BMW-512 is one of the six hash functions in the Quark hash chain used by Divi and other cryptocurrencies. This crate fills the gap as the only Quark component without a pure Rust implementation on crates.io — the other five (BLAKE, Groestl, JH, Keccak, Skein) are all available from RustCrypto.
Features
- Pure Rust — no C dependencies, no FFI, no unsafe code
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 ;
use Blake512; // from RustCrypto
use Groestl512;
use Jh512;
use Keccak512;
use Skein512;
Algorithm
BMW (Blue Midnight Wish) was a candidate in the NIST SHA-3 competition. The 512-bit variant operates on 64-bit words with a 128-byte block size and uses the Merkle-Damgard construction with a unique double-compression finalization step.
This implementation is a direct port of the compress_big function from sphlib (MIT license, Thomas Pornin / Projet RNRT SAPHIR).
Reference
- BMW specification (NIST submission)
- sphlib C implementation by Thomas Pornin