@@ -27,8 +27,6 @@ module Data.UUID.V3
2727 ) where
2828
2929import Data.Word
30−import Data.Bits
31−import qualified Data.ByteString as B
3230
3331import Data.UUID.Internal
3432import qualified Data.UUID.Named as Shared
@@ -43,26 +41,5 @@ import qualified Crypto.Hash.MD5 as MD5
4341generateNamed :: UUID -- ^Namespace
4442 -> [Word8] -- ^Object
4543 -> UUID
46−generateNamed = Shared.generateNamed hash 3
44+generateNamed = Shared.generateNamed MD5.hash 3
4745
48−hash :: [Word8] -> (Word32, Word32, Word32, Word32)
49−hash bytes
50− = case map f $ chunk 4 $ B.unpack $ MD5.hash $ B.pack bytes of
51− w1:w2:w3:w4:_ -> (w1, w2, w3, w4)
52− _ -> error "Data.UUID.V3.hash: fatal error"
53−
54− where f [b1, b2, b3, b4]
55− = sum
56− [ fromIntegral b4
57− , fromIntegral b3 `shiftL` 8
58− , fromIntegral b2 `shiftL` 16
59− , fromIntegral b1 `shiftL` 24
60− ]
61− f _ = error "Data.UUID.V3.hash: fatal error"
62−
63−chunk :: Int -> [a] -> [[a]]
64−chunk n = go n []
65− where go _ [] [] = []
66− go _ ys [] = reverse ys:[]
67− go 0 ys xs = reverse ys:go n [] xs
68− go m ys (x:xs) = go (m-1) (x:ys) xs