on master help sign in
Switch to using `cryptonite` instead of `cryptohash`
3adaa80Timo von Holtz
uuid/Data/UUID/Named.hs+4−2
@@ -33,19 +33,21 @@ import Data.Binary.Get (runGet, getWord32be)
33import Data.Maybe
33import Data.Maybe
34import Data.Word (Word8)
34import Data.Word (Word8)
35
35
36+import qualified Data.ByteArray as BA
36import qualified Data.ByteString as B
37import qualified Data.ByteString as B
37import qualified Data.ByteString.Lazy as BL
38import qualified Data.ByteString.Lazy as BL
38
39
39-- |Generate a 'UUID' within the specified namespace out of the given
40-- |Generate a 'UUID' within the specified namespace out of the given
40-- object.
41-- object.
42+generateNamed :: BA.ByteArrayAccess bs
41−generateNamed :: (B.ByteString -> B.ByteString) -- ^Hash
43+ => (B.ByteString -> bs) -- ^Hash
42 -> Word8 -- ^Version
44 -> Word8 -- ^Version
43 -> UUID -- ^Namespace
45 -> UUID -- ^Namespace
44 -> [Word8] -- ^Object
46 -> [Word8] -- ^Object
45 -> UUID
47 -> UUID
46generateNamed hash version namespace object =
48generateNamed hash version namespace object =
47 let chunk = B.pack $ toList namespace ++ object
49 let chunk = B.pack $ toList namespace ++ object
48− bytes = BL.fromChunks . (:[]) $ hash chunk
50+ bytes = BL.fromStrict . BA.convert $ hash chunk
49 w = getWord32be
51 w = getWord32be
50 unpackBytes = runGet $
52 unpackBytes = runGet $
51 buildFromWords version <$> w <*> w <*> w <*> w
53 buildFromWords version <$> w <*> w <*> w <*> w
uuid/Data/UUID/V3.hs+2−2
@@ -35,7 +35,7 @@ import Data.Word
35
35
36import Data.UUID.Types.Internal
36import Data.UUID.Types.Internal
37import qualified Data.UUID.Named as Shared
37import qualified Data.UUID.Named as Shared
38−import qualified Crypto.Hash.MD5 as MD5
38+import qualified Crypto.Hash as H
39
39
40
40
41-- |Generate a 'UUID' within the specified namespace out of the given
41-- |Generate a 'UUID' within the specified namespace out of the given
@@ -46,4 +46,4 @@ import qualified Crypto.Hash.MD5 as MD5
46generateNamed :: UUID -- ^Namespace
46generateNamed :: UUID -- ^Namespace
47 -> [Word8] -- ^Object
47 -> [Word8] -- ^Object
48 -> UUID
48 -> UUID
49−generateNamed = Shared.generateNamed MD5.hash 3
49+generateNamed = Shared.generateNamed (H.hashWith H.MD5) 3
uuid/Data/UUID/V5.hs+2−2
@@ -30,7 +30,7 @@ import Data.Word
30
30
31import Data.UUID.Types.Internal
31import Data.UUID.Types.Internal
32import qualified Data.UUID.Named as Shared
32import qualified Data.UUID.Named as Shared
33−import qualified Crypto.Hash.SHA1 as SHA1
33+import qualified Crypto.Hash as H
34
34
35
35
36-- |Generate a 'UUID' within the specified namespace out of the given
36-- |Generate a 'UUID' within the specified namespace out of the given
@@ -41,4 +41,4 @@ import qualified Crypto.Hash.SHA1 as SHA1
41generateNamed :: UUID -- ^Namespace
41generateNamed :: UUID -- ^Namespace
42 -> [Word8] -- ^Object
42 -> [Word8] -- ^Object
43 -> UUID
43 -> UUID
44−generateNamed = Shared.generateNamed SHA1.hash 5
44+generateNamed = Shared.generateNamed (H.hashWith H.SHA1) 5
uuid/uuid.cabal+2−1
@@ -29,7 +29,8 @@ Library
29 Build-Depends: base >=3 && < 5,
29 Build-Depends: base >=3 && < 5,
30 binary >= 0.4 && < 0.8,
30 binary >= 0.4 && < 0.8,
31 bytestring >= 0.9 && < 0.11,
31 bytestring >= 0.9 && < 0.11,
32− cryptohash >= 0.7 && < 0.12,
32+ cryptonite,
33+ memory,
33 network-info == 0.2.*,
34 network-info == 0.2.*,
34 random >= 1.0.1 && < 1.2,
35 random >= 1.0.1 && < 1.2,
35 time >= 1.1 && < 1.6,
36 time >= 1.1 && < 1.6,