romariolopezc/elm-hmac-sha1/1.0.2

NOTE: the latest version is 3.0.1

Renamed to rlopzc/elm-hmac-sha1. It is published under that name, and new versions come out there.

Versions published as romariolopezc/elm-hmac-sha1 still install under that name. 6 versions of 7 come from the new location (see their notes). 1 version could not be recovered and cannot be installed.

Rerouted (fork, verified). The original repository is gone. This copy comes from a fork that still has the tag. The Lamdera package server serves a copy recovered from https://github.com/Malax/elm-hmac-sha1 (a fork).

What we checked: Rebuilt with git archive from commit 8b99b13b9d94 of https://github.com/Malax/elm-hmac-sha1 (a fork) (zip prefix romariolopezc-elm-hmac-sha1-237cbb3/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 55d7e3145c4666ccf2dec575acc2b498efbdd3de.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/romariolopezc/elm-hmac-sha1/zipball/1.0.2/

elm-hmac-sha1

Compute HMAC message digests using SHA-1 hash function. You provide a key and a message and you get a digest. You can convert the digest into different representations like Bytes, Base16 or Base64.

This provide the native Bytes (elm/bytes). This is important as you can represent the data as you want.

More information of HMAC here.

Examples

Some API's use the HMAC SHA-1 as Authentication, like Amazon or Twitter.

import HmacSha1

canonicalString : String
canonicalString =
  ["application/json", "", "/account", "Wed, 02 Nov 2016 17:26:52 GMT"]
    |> String.join ","

HmacSha1.digest "verify-secret" canonicalString
  |> HmacSha1.toBase64
--> Ok "nLet/JEZG9CRXHScwaQ/na4vsKQ="

Notes

This package doesn't implement the SHA-1 hash function. It internally uses this implementation.

HMAC strength depends on the hashing algorithm and SHA-1 is not considered cryptographically strong. Use this package to interoperate with systems that already uses HMAC SHA-1 and not for implementing new systems.

There are stronger cryptographic algorithms like HMAC SHA-2, and this Elm package implements it.