wörk
This commit is contained in:
parent
27bfdfbd7c
commit
fc6af46a11
2 changed files with 12 additions and 1 deletions
|
@ -18,8 +18,15 @@ module Handler.Login where
|
||||||
|
|
||||||
import Import hiding (returnJson)
|
import Import hiding (returnJson)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Crypto.HMAC
|
|
||||||
|
-- old hmac
|
||||||
|
import Crypto.HMAC as Old
|
||||||
import Crypto.Hash.CryptoAPI (SHA1)
|
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.Text.Encoding (encodeUtf8)
|
||||||
import Data.Serialize (encode)
|
import Data.Serialize (encode)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
@ -111,3 +118,6 @@ hmacSHA1 keyData msgData =
|
||||||
sha1 :: SHA1
|
sha1 :: SHA1
|
||||||
sha1 = hmac' key msgData
|
sha1 = hmac' key msgData
|
||||||
in encode sha1
|
in encode sha1
|
||||||
|
|
||||||
|
hmacSHA3 :: B.ByteString -> B.ByteString -> B.ByteString
|
||||||
|
hmacSHA3 key msg = B.pack $ show $ hmacGetDigest (hmac key msg :: HMAC SHA3_512)
|
||||||
|
|
|
@ -111,6 +111,7 @@ library
|
||||||
, cereal >= 0.4
|
, cereal >= 0.4
|
||||||
, cryptohash-cryptoapi >= 0.1
|
, cryptohash-cryptoapi >= 0.1
|
||||||
, crypto-api >= 0.13
|
, crypto-api >= 0.13
|
||||||
|
, cryptonite
|
||||||
-- , imagemagick
|
-- , imagemagick
|
||||||
, yesod-markdown >= 0.10
|
, yesod-markdown >= 0.10
|
||||||
, blaze-markup >= 0.7
|
, blaze-markup >= 0.7
|
||||||
|
|
Loading…
Reference in a new issue