This commit is contained in:
nek0 2016-11-19 10:42:56 +01:00
parent 27bfdfbd7c
commit fc6af46a11
2 changed files with 12 additions and 1 deletions

View File

@ -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)

View File

@ -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