Module blake2_rfc::blake2b
source · Expand description
The BLAKE2b hash function.
Examples
use blake2_rfc::blake2b::{Blake2b, blake2b};
// Using the convenience function.
let hash = blake2b(64, &[], b"The quick brown fox jumps over the lazy dog");
// Using the state context.
let mut context = Blake2b::new(64);
context.update(b"The quick brown fox jumps over the lazy dog");
let hash = context.finalize();
// Using the convenience function, with a key.
let hash = blake2b(64, b"key", b"The quick brown fox jumps over the lazy dog");
// Using the state context, with a key.
let mut context = Blake2b::with_key(64, b"key");
context.update(b"The quick brown fox jumps over the lazy dog");
let hash = context.finalize();
The returned hash is a Blake2bResult
, which can be compared with
a byte string (the comparison will take constant time), or converted
into a byte string.
Structs
State context.
Container for a hash result.