This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Compute MD5 message digests in pure Elm
version 1.0.7
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.7
Committed At 2018-07-25 12:48:40 UTC
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1

Modules

README

elm-md5

Compute MD5 message digests in Elm.

Quick Start

This library exposes just one function, hex, which takes a String input and returns the 128-bit MD5 digest as a String of 32 hexadecimal characters.

MD5.hex ""          == "d41d8cd98f00b204e9800998ecf8427e"
MD5.hex "foobarbaz" == "6df23dc03f9b54cc38a0fc1483df6e21"

Unlike the JavaScript function from which this implementation has been ported, CRLF pairs in the input are not automatically replaced with LFs prior to computing the digest. If you want that behaviour, adjust the input before evaluating the function. For example:

myHex : String -> String
myHex input =
    let
        myInput =
            Regex.replace Regex.All (Regex.regex "\x0D\n") (\_ -> "\n") input
    in
        MD5.hex myInput

Versioning

There are versions of this library for Elm 0.17.1 and 0.18. As I probably won't be maintaining this module any longer, for future Elm versions please check out a fork of this project, truqu/elm-md5.

Install the package as normal for Elm 0.18 (elm package install sanichi/elm-md5).

However, for Elm 0.17.1, there is an as yet undiagnosed problem with the normal method of installation. Please use the following workaround:

  1. Remove any dependency on sanichi/elm-md5 from your elm-package.json if you haven't already done so.
  2. Grab a copy of the 1.0.0 version of MD5.elm (the only file you need) and add it to your project's Elm files.
  3. Make sure the file has been copied correctly (it's MD5 digest should be 101fd0190906aa0febfae987b86a03e1).
  4. Then use as normal (import MD5 etc).