pub fn blake3_hash(data: &[u8]) -> Blake3DigestExpand description
Computes BLAKE3 hash of the input data.
BLAKE3 is the fastest cryptographic hash function available and supports parallel computation on multi-core systems. It’s based on Bao (verified streaming) and is significantly faster than BLAKE2.
Requires: extended-hashes feature flag
§Performance
BLAKE3 is typically 5-10x faster than SHA-256 and can utilize multiple CPU cores for very large inputs (>16KB). It’s the fastest option in this library.
§Security
BLAKE3 provides 256-bit security (output is 32 bytes by default, but can be extended to any length). It’s designed to be secure against all known attacks.
§Use Cases
- High-throughput applications (logging, file integrity, checksums)
- Large file hashing (benefits from parallelization)
- Content-addressable storage systems
- Modern replacements for SHA-256 where speed is critical
§Example
ⓘ
use crabgraph::hash::blake3_hash;
let digest = blake3_hash(b"hello world");
assert_eq!(digest.len(), 32);