This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Compute HMAC with SHA-2 hash functions or use SHA-2 directly.
version 1.1.1
license MIT
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.1.1
Committed At 2017-11-29 16:43:24 UTC
ktonon/elm-word 2.1.1 <= v < 3.0.0 2.1.2
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1



live-demo elm-package CircleCI

Cryptography with HMAC and SHA.

Use SHA-2 hashing functions directly:

import Crypto.Hash

Crypto.Hash.sha512 ""
--> "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"

Crypto.Hash.sha224 "The quick brown fox jumps over the lazy dog"
--> "730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525"

Or with HMAC:

import Crypto.HMAC exposing (sha256, sha512)

Crypto.HMAC.digest sha256 "key" "The quick brown fox jumps over the lazy dog"
--> "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8"

Crypto.HMAC.digest sha512 "key" "I ❤ cheese"
--> "a885c96140f95cb0b326306edfba49afbb5d38d3a7ed6ccfd67153429cbd3c56d0c514fcaa53b710bb7ba6cc0dfedfdb4d53795acbeb48eb23aa93e5ce9760dd"


Not officially validated through CAVP, but unit tested against published test vectors:

  • SHA-2 functions are unit tested against the FIPS 180-4 test vectors (short and long messages).
  • HMAC with SHA-2 is unit tested against RFC4231.