gblake2

Package VersionHex Docs

BLAKE2 hash functions - Gleam bindings for the Elixir blake2 package.

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

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

gleam add gblake2@1
import gblake2

pub fn main() -> Nil {
  "Nimiq rocks!"
  |> bit_array.from_string()
  // Hash a bitarray into a 32-byte hash
  |> gblake2.hash2b(32)
  |> bit_array.base16_encode()
  // -> "E493EE724B7D9D0AFE079DD7236DA36AB9DC5EF446AC16E52F232CF38A2CCB2F"
}

Development

gleam test  # Run the tests