Coder Social home page Coder Social logo

elm-md5's Introduction

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 (or if you just want something that runs faster) 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).

elm-md5's People

Contributors

sanichi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

truqu

elm-md5's Issues

Maintenance

Hi @sanichi!

I just spent some time exploring performance improvements for elm-md5 and noticed in #2 that you're no longer terribly interested in maintaining this package.

So, in the interest of saving you some time and effort, I'd like to propose adopting this package by publishing a fork. Naturally, the license and copyright notice will be left intact ๐Ÿ™‚

If you'd prefer to make different arrangements, let me know and we can figure out a comfortable path forward.

Cheers,

Ilias

Installing raises Error: Your .elm/packages/ directory may be corrupted.

I can't install it here. I'm using Elm 0.17.1 โ€”ย but people from Slack had the same issue with Elm 0.18.

$ cat elm-package.json
{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.5 <= v < 5.0.0",
        "elm-lang/html": "1.1.0 <= v < 2.0.0",
        "evancz/elm-http": "3.0.1 <= v < 4.0.0"
    },
    "elm-version": "0.17.1 <= v < 0.18.0"
}

$ elm-package install sanichi/elm-md5 1.0.0
To install sanichi/elm-md5 I would like to add the following
dependency to elm-package.json:

    "sanichi/elm-md5": "1.0.0 <= v < 2.0.0"

May I add that to elm-package.json for you? [Y/n] y

Error: Your .elm/packages/ directory may be corrupted. I was led to beleive that
sanichi/elm-md5 existed, but I could not find anything when I went to look up
the published versions of this package.

MD5 base64

Hi Sanichi! Thanks for this package.

I want to contribute to this package to have base64 encoding.

Can you point me in the right direction to get it done?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.