elm-cardano/blake2b/2.0.0

Blake2b512

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

type Digest

An abstract BLAKE2b-512 digest (64 bytes).

Creating digests

fromString : String -> Digest

Create a digest from a String.

import Blake2b512


Blake2b512.fromString "abc"
    |> Blake2b512.toHex
--> "ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923"
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 64 bytes (512 bits).

toByteValues : Digest -> List Int

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