Expand description

The BLAKE2s hash function.

Examples

use blake2_rfc::blake2s::{Blake2s, blake2s};

// Using the convenience function.
let hash = blake2s(32, &[], b"The quick brown fox jumps over the lazy dog");

// Using the state context.
let mut context = Blake2s::new(32);
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 = blake2s(32, b"key", b"The quick brown fox jumps over the lazy dog");

// Using the state context, with a key.
let mut context = Blake2s::with_key(32, b"key");
context.update(b"The quick brown fox jumps over the lazy dog");
let hash = context.finalize();

The returned hash is a Blake2sResult, 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.

Functions

Convenience function for all-in-one computation.

Runs the self-test for this hash function.