Skip to content

Instantly share code, notes, and snippets.

@lukehoersten
Created March 8, 2016 17:38
Show Gist options
  • Select an option

  • Save lukehoersten/6dea9cfc695bb76b4e7b to your computer and use it in GitHub Desktop.

Select an option

Save lukehoersten/6dea9cfc695bb76b4e7b to your computer and use it in GitHub Desktop.

Revisions

  1. lukehoersten created this gist Mar 8, 2016.
    6 changes: 6 additions & 0 deletions BCryptHash.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    import Crypto.BCrypt (hashPasswordUsingPolicy)
    import Data.ByteString.Char8 (ByteString, pack)

    hash :: String -> IO (Maybe ByteString)
    hash = hashPasswordUsingPolicy hp . pack
    where hp = HashingPolicy 12 $ pack "$2y$"