2-- Module : Data.UUID.Named
3-- Copyright : (c) 2008 Antoine Latter
7-- Maintainer : aslatter@gmail.com
8-- Stability : experimental
9-- Portability : portable
12-- This module implements Version 3/5 UUIDs as specified
15-- These UUIDs identify an object within a namespace,
16-- and are deterministic.
18-- The namespace is identified by a UUID. Several sample
19-- namespaces are enclosed.
29import Data.UUID.Internal
34import qualified Data.ByteString.Lazy as BS
36-- |Generate a 'UUID' within the specified namespace out of the given
38generateNamed :: ([Word8] -> (Word32, Word32, Word32, Word32)) -- ^Hash
43generateNamed hash version namespace object =
44 let chunk = BS.unpack (toByteString namespace) ++ object
45 (w1, w2, w3, w4) = hash chunk
46 in buildFromWords version w1 w2 w3 w4
50unsafeFromString :: String -> UUID
51unsafeFromString = fromJust . fromString
53-- |The namespace for DNS addresses
55namespaceDNS = unsafeFromString "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
57-- |The namespace for URLs
59namespaceURL = unsafeFromString "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
61-- |The namespace for ISO OIDs
63namespaceOID = unsafeFromString "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
65-- |The namespace for X.500 DNs
67namespaceX500 = unsafeFromString "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list