Module blake2b

Available on crate feature dep_orion only.
Expand description

BLAKE2b as specified in the RFC 7693.

§Parameters:

  • size: The desired output length for the digest.
  • data: The data to be hashed.
  • expected: The expected digest when verifying.

§Errors:

An error will be returned if:

§Panics:

A panic will occur if:

  • More than 2*(2^64-1) bytes of data are hashed.

§Security:

  • The recommended minimum output size is 32.
  • This interface only allows creating hash digest using BLAKE2b. If using a secret key is desired, please refer to the mac::blake2b module.

§Example:

use orion::hazardous::hash::blake2::blake2b::{Blake2b, Hasher};

// Using the streaming interface.
let mut state = Blake2b::new(64)?;
state.update(b"Some data")?;
let hash = state.finalize()?;

// Using the `Hasher` for convenience functions.
let hash_one_shot = Hasher::Blake2b512.digest(b"Some data")?;

assert_eq!(hash, hash_one_shot);

Structs§

Blake2b
BLAKE2b streaming state.
Digest
A type to represent the Digest that BLAKE2b returns.

Enums§

Hasher
Convenience functions for common BLAKE2b operations.