elm-cardano/blake2b/2.0.0

Blake2b256

BLAKE2b-256 is a cryptographic hash function (RFC 7693) that gives 128 bits of security with a 32-byte digest.

type Digest

An abstract BLAKE2b-256 digest (32 bytes).

Creating digests

fromString : String -> Digest

Create a digest from a String.

import Blake2b256


Blake2b256.fromString "abc"
    |> Blake2b256.toHex
--> "bddd813c634239723171ef3fee98579b94964e3bb1cb3e427262c8c068d52319"
fromBytes : Bytes -> Digest

Create a digest from Bytes.

fromByteValues : List Int -> Digest

Create a digest from a list of byte values (0-255).

Formatting digests

toHex : Digest -> String

Turn a digest into a hex string.

toBase64 : Digest -> String

Turn a digest into a base64 encoded string.

To binary data

toBytes : Digest -> Bytes

Turn a digest into Bytes. The width is 32 bytes (256 bits).

toByteValues : Digest -> List Int

Turn a digest into a list of byte values (0-255).