From fc6af46a112a825c5784cbf604e866ab19912293 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 19 Nov 2016 10:42:56 +0100 Subject: [PATCH] =?UTF-8?q?w=C3=B6rk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Handler/Login.hs | 12 +++++++++++- eidolon.cabal | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Handler/Login.hs b/Handler/Login.hs index b570c78..4cf5b7b 100755 --- a/Handler/Login.hs +++ b/Handler/Login.hs @@ -18,8 +18,15 @@ module Handler.Login where import Import hiding (returnJson) import qualified Data.Text as T -import Crypto.HMAC + +-- old hmac +import Crypto.HMAC as Old import Crypto.Hash.CryptoAPI (SHA1) + +-- new hmac +import Crypto.MAC.HMAC as New +import Crypto.Hash.Algorithms (SHA3_512) + import Data.Text.Encoding (encodeUtf8) import Data.Serialize (encode) import Data.Maybe @@ -111,3 +118,6 @@ hmacSHA1 keyData msgData = sha1 :: SHA1 sha1 = hmac' key msgData in encode sha1 + +hmacSHA3 :: B.ByteString -> B.ByteString -> B.ByteString +hmacSHA3 key msg = B.pack $ show $ hmacGetDigest (hmac key msg :: HMAC SHA3_512) diff --git a/eidolon.cabal b/eidolon.cabal index 2199e23..a84713f 100755 --- a/eidolon.cabal +++ b/eidolon.cabal @@ -111,6 +111,7 @@ library , cereal >= 0.4 , cryptohash-cryptoapi >= 0.1 , crypto-api >= 0.13 + , cryptonite -- , imagemagick , yesod-markdown >= 0.10 , blaze-markup >= 0.7