Skip to content

Instantly share code, notes, and snippets.

@chrismccord
Created June 23, 2015 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismccord/b662bd26f68fa10b6651 to your computer and use it in GitHub Desktop.
Save chrismccord/b662bd26f68fa10b6651 to your computer and use it in GitHub Desktop.
erlpass wrapper
defmodule MyApp.Password do
@moduledoc """
Handles password authentication, encryption, and decryption
"""
@doc """
Encrypte the password String
"""
def encrypt(raw_password) do
:erlpass.hash(raw_password)
end
@doc """
Checks if the provided password matches the user's encrypted password
"""
def matches?(encrypted_password, provided_password) do
:erlpass.match(provided_password, encrypted_password)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment