on 4fb273b help sign in
50 lines 1.3 kB history raw
1{- |
2Module : Data.UUID.V3
3Copyright : (c) 2010,2012 Antoine Latter
5License : BSD-style
7Maintainer : aslatter@gmail.com
8Stability : experimental
9Portability : portable
11NOTE: This module uses MD5 hashing. Unless you know
12you need to use this module, you should probably be
13using "Data.UUID.V5", which offers the same sort of
14functionality as this module except implemented with
15SHA-1 hashing.
17This module implements Version 3 UUIDs as specified
18in RFC 4122.
20These UUIDs identify an object within a namespace,
21and are deterministic.
23The namespace is identified by a UUID. Several sample
24namespaces are enclosed.
25-}
26module Data.UUID.V3
27 (generateNamed
28 ,Shared.namespaceDNS
29 ,Shared.namespaceURL
30 ,Shared.namespaceOID
31 ,Shared.namespaceX500
32 ) where
34import Data.Word
36import Data.UUID.Internal
37import qualified Data.UUID.Named as Shared
38import qualified Crypto.Hash.MD5 as MD5
41-- |Generate a 'UUID' within the specified namespace out of the given
42-- object.
43--
44-- Uses an MD5 hash. The UUID is built from first 128 bits of the hash of
45-- the namespace UUID and the name (as a series of Word8).
46generateNamed :: UUID -- ^Namespace
47 -> [Word8] -- ^Object
48 -> UUID
49generateNamed = Shared.generateNamed MD5.hash 3