on cee7ffa help sign in
45 lines 1.1 kB history raw
1-- |
2-- Module : Data.UUID.V3
3-- Copyright : (c) 2010 Antoine Latter
4--
5-- License : BSD-style
6--
7-- Maintainer : aslatter@gmail.com
8-- Stability : experimental
9-- Portability : portable
10--
11--
12-- This module implements Version 3 UUIDs as specified
13-- in RFC 4122.
14--
15-- These UUIDs identify an object within a namespace,
16-- and are deterministic.
17--
18-- The namespace is identified by a UUID. Several sample
19-- namespaces are enclosed.
21module Data.UUID.V3
22 (generateNamed
23 ,Shared.namespaceDNS
24 ,Shared.namespaceURL
25 ,Shared.namespaceOID
26 ,Shared.namespaceX500
27 ) where
29import Data.Word
31import Data.UUID.Internal
32import qualified Data.UUID.Named as Shared
33import qualified Crypto.Hash.MD5 as MD5
36-- |Generate a 'UUID' within the specified namespace out of the given
37-- object.
38--
39-- Uses an MD5 hash. The UUID is built from first 128 bits of the hash of
40-- the namespace UUID and the name (as a series of Word8).
41generateNamed :: UUID -- ^Namespace
42 -> [Word8] -- ^Object
43 -> UUID
44generateNamed = Shared.generateNamed MD5.hash 3