Blake2 (Blake2 v1.0.4)

View Source

BLAKE2 hash functions

Implementing "Blake2b" and "Blake2s" as described in RFC7693

Note that, at present, this only supports full message hashing and no OPTIONAL features of BLAKE2.

Summary

Functions

hash2b(m, output_size \\ 64, secret_key \\ "")

@spec hash2b(binary(), pos_integer(), binary()) :: binary() | :error

Blake2b hashing

Note that the output_size is in bytes, not bits

  • 64 => Blake2b-512 (default)
  • 48 => Blake2b-384
  • 32 => Blake2b-256

Per the specification, any output_size between 1 and 64 bytes is supported.

hash2s(m, output_size \\ 32, secret_key \\ "")

@spec hash2s(binary(), pos_integer(), binary()) :: binary() | :error

Blake2s hashing

Note that the output_size is in bytes, not bits

  • 32 => Blake2s-256 (default)
  • 24 => Blake2b-192
  • 16 => Blake2b-128

Per the specification, any output_size between 1 and 32 bytes is supported.