summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hakyll.cabal3
-rw-r--r--lib/Hakyll/Core/Store.hs18
2 files changed, 18 insertions, 3 deletions
diff --git a/hakyll.cabal b/hakyll.cabal
index 90ba220..288a616 100644
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -170,13 +170,14 @@ Library
blaze-markup >= 0.5.1 && < 0.9,
bytestring >= 0.9 && < 0.11,
containers >= 0.3 && < 0.7,
- cryptohash >= 0.7 && < 0.12,
+ cryptonite >= 0.25 && < 0.26,
data-default >= 0.4 && < 0.8,
deepseq >= 1.3 && < 1.5,
directory >= 1.0 && < 1.4,
file-embed >= 0.0.10.1 && < 0.0.12,
filepath >= 1.0 && < 1.5,
lrucache >= 1.1.1 && < 1.3,
+ memory >= 0.14.18 && < 0.15,
mtl >= 1 && < 2.3,
network-uri >= 2.6 && < 2.7,
optparse-applicative >= 0.12 && < 0.16,
diff --git a/lib/Hakyll/Core/Store.hs b/lib/Hakyll/Core/Store.hs
index f65a00b..bfcd191 100644
--- a/lib/Hakyll/Core/Store.hs
+++ b/lib/Hakyll/Core/Store.hs
@@ -16,7 +16,8 @@ module Hakyll.Core.Store
--------------------------------------------------------------------------------
-import qualified Crypto.Hash.MD5 as MD5
+import qualified Data.ByteArray as BA
+import qualified Crypto.Hash as CH
import Data.Binary (Binary, decode, encodeFile)
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
@@ -193,8 +194,21 @@ deleteFile = (`catchIOError` \_ -> return ()) . removeFile
--------------------------------------------------------------------------------
-- | Mostly meant for internal usage
hash :: [String] -> String
-hash = toHex . B.unpack . MD5.hash . T.encodeUtf8 . T.pack . intercalate "/"
+hash = toHex . B.unpack . hashMD5 . T.encodeUtf8 . T.pack . intercalate "/"
where
toHex [] = ""
toHex (x : xs) | x < 16 = '0' : showHex x (toHex xs)
| otherwise = showHex x (toHex xs)
+
+
+--------------------------------------------------------------------------------
+-- | Hash by MD5
+hashMD5 :: B.ByteString -> B.ByteString
+hashMD5 x =
+ let
+ digest :: CH.Digest CH.MD5
+ digest = CH.hash x
+ bytes :: B.ByteString
+ bytes = BA.convert digest
+ in
+ bytes