Hash
Auth
Content digests and HMAC for webhooks, ETags, and signed payloads.
Prefer Password for storing user secrets and Jwt for tokens. Use this module for checksums and keyed message authentication.
Values
sha256
sha256 : Bytes -> BytesSHA-256 digest of data.
Examples
Hash.sha256 bodyByteshmacSha256
hmacSha256 : Bytes -> Bytes -> BytesHMAC-SHA256 of message under key.
Examples
Hash.hmacSha256 secretKey payloadequal
equal : Bytes -> Bytes -> BoolConstant-time equality for equal-length digests. Different lengths are always False (not constant-time across length).
Examples
Hash.equal expectedDigest actualDigesttoHex
toHex : Bytes -> StringLowercase hex encoding of bytes.
Examples
Hash.toHex (Hash.sha256 bodyBytes)fromHex
fromHex : String -> Maybe BytesDecode a hex string (case-insensitive). Returns Nothing on invalid input.
Examples
Hash.fromHex "deadbeef"