Changeset 56 for trunk/tango/scrapple/util/uuid/NameUuidGen.d
- Timestamp:
- 04/03/08 06:48:19 (4 years ago)
- Files:
-
- trunk/tango/scrapple/util/uuid/NameUuidGen.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tango/scrapple/util/uuid/NameUuidGen.d
r50 r56 9 9 With the functions in this module, UUIDs can be created from names 10 10 that are unique within a name space. 11 11 12 12 MD-5 or SHA-1 hashing algorithms can be used to generate a name-based UUID. 13 13 If backward compatibility is not an issue, SHA-1 should be preferred. 14 14 15 15 The functions are thread-safe. 16 16 … … 39 39 40 40 Uuid uuid = digest.binaryDigest; 41 uuid.ver = ver;42 uuid.variant = UuidVariant.Standard;41 uuid.versionTimeHigh = (uuid.versionTimeHigh & 0x0FFF) | (ver << 12); 42 uuid.variantClockSeqHigh = (uuid.variantClockSeqHigh & 0x3F) | 0x80; 43 43 44 44 return uuid; … … 96 96 } 97 97 98 version(UuidUnitTest)98 debug (UuidUnitTest) 99 99 { 100 100 import tango.io.Stdout; … … 125 125 126 126 // Namespace uuids 127 assert (NameSpaceUuids.dns == cast(Uuid)"6ba7b810-9dad-11d1-80b4-00c04fd430c8");128 assert (NameSpaceUuids.url == cast(Uuid)"6ba7b811-9dad-11d1-80b4-00c04fd430c8");129 assert (NameSpaceUuids.oid == cast(Uuid)"6ba7b812-9dad-11d1-80b4-00c04fd430c8");130 assert (NameSpaceUuids.x500 == cast(Uuid)"6ba7b814-9dad-11d1-80b4-00c04fd430c8");127 assert (NameSpaceUuids.dns == Uuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8")); 128 assert (NameSpaceUuids.url == Uuid("6ba7b811-9dad-11d1-80b4-00c04fd430c8")); 129 assert (NameSpaceUuids.oid == Uuid("6ba7b812-9dad-11d1-80b4-00c04fd430c8")); 130 assert (NameSpaceUuids.x500 == Uuid("6ba7b814-9dad-11d1-80b4-00c04fd430c8")); 131 131 132 132 }
