on master help sign in
Switch to using `cryptonite` instead of `cryptohash`
commit3adaa803690439e7c2cd466f43ad89c57060e29e authorTimo von Holtz <tvh@tvholtz.de> dateWed 16 Mar 2016, 23:27 (11 years ago) parentc32f764
4 files changed+10−7
uuid/Data/UUID/Named.hs+4−2 uuid/Data/UUID/V3.hs+2−2 uuid/Data/UUID/V5.hs+2−2 uuid/uuid.cabal+2−1
uuid/Data/UUID/Named.hs+4−2
@@ -33,19 +33,21 @@ import Data.Binary.Get (runGet, getWord32be)
3333import Data.Maybe
3434import Data.Word (Word8)
3535
36+import qualified Data.ByteArray as BA
3637import qualified Data.ByteString as B
3738import qualified Data.ByteString.Lazy as BL
3839
3940-- |Generate a 'UUID' within the specified namespace out of the given
4041-- object.
41−generateNamed :: (B.ByteString -> B.ByteString) -- ^Hash
42+generateNamed :: BA.ByteArrayAccess bs
43+ => (B.ByteString -> bs) -- ^Hash
4244 -> Word8 -- ^Version
4345 -> UUID -- ^Namespace
4446 -> [Word8] -- ^Object
4547 -> UUID
4648generateNamed hash version namespace object =
4749 let chunk = B.pack $ toList namespace ++ object
48− bytes = BL.fromChunks . (:[]) $ hash chunk
50+ bytes = BL.fromStrict . BA.convert $ hash chunk
4951 w = getWord32be
5052 unpackBytes = runGet $
5153 buildFromWords version <$> w <*> w <*> w <*> w
uuid/Data/UUID/V3.hs+2−2
@@ -35,7 +35,7 @@ import Data.Word
3535
3636import Data.UUID.Types.Internal
3737import qualified Data.UUID.Named as Shared
38−import qualified Crypto.Hash.MD5 as MD5
38+import qualified Crypto.Hash as H
3939
4040
4141-- |Generate a 'UUID' within the specified namespace out of the given
@@ -46,4 +46,4 @@ import qualified Crypto.Hash.MD5 as MD5
4646generateNamed :: UUID -- ^Namespace
4747 -> [Word8] -- ^Object
4848 -> 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
3030
3131import Data.UUID.Types.Internal
3232import qualified Data.UUID.Named as Shared
33−import qualified Crypto.Hash.SHA1 as SHA1
33+import qualified Crypto.Hash as H
3434
3535
3636-- |Generate a 'UUID' within the specified namespace out of the given
@@ -41,4 +41,4 @@ import qualified Crypto.Hash.SHA1 as SHA1
4141generateNamed :: UUID -- ^Namespace
4242 -> [Word8] -- ^Object
4343 -> 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
2929 Build-Depends: base >=3 && < 5,
3030 binary >= 0.4 && < 0.8,
3131 bytestring >= 0.9 && < 0.11,
32− cryptohash >= 0.7 && < 0.12,
32+ cryptonite,
33+ memory,
3334 network-info == 0.2.*,
3435 random >= 1.0.1 && < 1.2,
3536 time >= 1.1 && < 1.6,