uuid 1.3.11 → 1.3.12
raw patch · 8 files changed
+37/−30 lines, 8 filesdep +cryptonitedep +memorydep −cryptohashdep ~HUnitdep ~QuickCheckdep ~binary
Dependencies added: cryptonite, memory
Dependencies removed: cryptohash
Dependency ranges changed: HUnit, QuickCheck, binary, bytestring, tasty, time
Files
- CHANGES +10/−0
- CONTRIBUTORS +0/−13
- Data/UUID/Named.hs +4/−2
- Data/UUID/V3.hs +2/−2
- Data/UUID/V4.hs +9/−3
- Data/UUID/V5.hs +2/−2
- tests/BenchUUID.hs +3/−1
- uuid.cabal +7/−7
CHANGES view
@@ -1,3 +1,13 @@+1.3.12++- Update package dependencies+- Use `cryptonite` for crypto+- The function `V4.nextRandom` is now implemented with functions from+ `Crypto.Random` in package `cryptonite`. This does slow-down random+ UUID generation but provides for far greater randomness. The+ `Random` instance for `UUID` can be used to re-gain the old+ behavior.+ 1.3.11 - Add toText/fromText
− CONTRIBUTORS
@@ -1,13 +0,0 @@-In order of appearance:--Antoine Latter-Jason Dusek-Tim Newsham-Mark Lentczner-Neil Mitchell-Bas van Dijk-Sergei Trofimovich-davean-Francesco Mazzoli-Michael Snoyman-Bardur Arantsson
Data/UUID/Named.hs view
@@ -33,19 +33,21 @@ import Data.Maybe import Data.Word (Word8) +import qualified Data.ByteArray as BA import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL -- |Generate a 'UUID' within the specified namespace out of the given -- object.-generateNamed :: (B.ByteString -> B.ByteString) -- ^Hash+generateNamed :: BA.ByteArrayAccess bs+ => (B.ByteString -> bs) -- ^Hash -> Word8 -- ^Version -> UUID -- ^Namespace -> [Word8] -- ^Object -> UUID generateNamed hash version namespace object = let chunk = B.pack $ toList namespace ++ object- bytes = BL.fromChunks . (:[]) $ hash chunk+ bytes = BL.fromStrict . BA.convert $ hash chunk w = getWord32be unpackBytes = runGet $ buildFromWords version <$> w <*> w <*> w <*> w
Data/UUID/V3.hs view
@@ -35,7 +35,7 @@ import Data.UUID.Types.Internal import qualified Data.UUID.Named as Shared-import qualified Crypto.Hash.MD5 as MD5+import qualified Crypto.Hash as H -- |Generate a 'UUID' within the specified namespace out of the given@@ -46,4 +46,4 @@ generateNamed :: UUID -- ^Namespace -> [Word8] -- ^Object -> UUID-generateNamed = Shared.generateNamed MD5.hash 3+generateNamed = Shared.generateNamed (H.hashWith H.MD5) 3
Data/UUID/V4.hs view
@@ -1,6 +1,6 @@ {- | Module : Data.UUID.V4- Copyright : (c) 2012 Antoine Latter+ Copyright : (c) 2012-2016 Antoine Latter License : BSD-style @@ -21,8 +21,14 @@ module Data.UUID.V4 (nextRandom) where import Data.UUID-import qualified System.Random as R+import Data.UUID.Types.Internal ( buildFromBytes ) +import Crypto.Random.Entropy ( getEntropy )+import Data.ByteString ( unpack )+ -- | Generate a random UUID. Introduced in version 1.2.6. nextRandom :: IO UUID-nextRandom = R.randomIO+nextRandom = do+ [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf]+ <- unpack `fmap` getEntropy 16+ return $ buildFromBytes 4 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf
Data/UUID/V5.hs view
@@ -30,7 +30,7 @@ import Data.UUID.Types.Internal import qualified Data.UUID.Named as Shared-import qualified Crypto.Hash.SHA1 as SHA1+import qualified Crypto.Hash as H -- |Generate a 'UUID' within the specified namespace out of the given@@ -41,4 +41,4 @@ generateNamed :: UUID -- ^Namespace -> [Word8] -- ^Object -> UUID-generateNamed = Shared.generateNamed SHA1.hash 5+generateNamed = Shared.generateNamed (H.hashWith H.SHA1) 5
tests/BenchUUID.hs view
@@ -6,6 +6,7 @@ import Data.Word import qualified Data.UUID as U import qualified Data.UUID.V1 as U+import qualified Data.UUID.V4 as U import qualified Data.UUID.V3 as U3 import qualified Data.UUID.V5 as U5 import System.Random@@ -27,7 +28,8 @@ defaultMain [ bgroup "generation" [ bench "V1" $ nfIO U.nextUUID,- bench "V4" $ nfIO (randomUUID :: IO U.UUID),+ bench "V4-stock" $ nfIO (U.nextRandom :: IO U.UUID),+ bench "V4-mersenne" $ nfIO (randomUUID :: IO U.UUID), bench "V3" $ nf (U3.generateNamed U3.namespaceURL) n1, bench "V5" $ nf (U5.generateNamed U5.namespaceURL) n1 ]
uuid.cabal view
@@ -1,5 +1,5 @@ Name: uuid-Version: 1.3.11+Version: 1.3.12 Copyright: (c) 2008-2014 Antoine Latter Author: Antoine Latter Maintainer: aslatter@gmail.com@@ -22,17 +22,17 @@ Extra-Source-Files: CHANGES- CONTRIBUTORS Library Build-Depends: base >=3 && < 5,- binary >= 0.4 && < 0.8,+ binary >= 0.4 && < 0.9, bytestring >= 0.9 && < 0.11,- cryptohash >= 0.7 && < 0.12,+ cryptonite,+ memory, network-info == 0.2.*, random >= 1.0.1 && < 1.2,- time >= 1.1 && < 1.6,+ time >= 1.1 && < 1.7, text >= 1 && < 1.3, uuid-types >= 1.0.2 && < 2 @@ -64,10 +64,10 @@ Build-Depends: base >= 3 && < 5, uuid, bytestring >= 0.9 && < 0.11,- HUnit >=1.2 && < 1.3,+ HUnit >=1.2 && < 1.4, QuickCheck >=2.4 && < 2.9, random >= 1.0.1 && < 1.2,- tasty == 0.10.*,+ tasty >= 0.10 && < 0.12, tasty-hunit == 0.9.*, tasty-quickcheck == 0.8.*