How is a Name-based UUID / GUID made

The name based UUID uses a "name" in the broadest sense imaginable and an UUID indicating the type of name used. Of course againt the variant and version are present in this UUID as well.

The UUID indicating the type of name used

For every namespace an UUID must be defined, for certain namespaces predefined UUIDs have been defined. The Leach, Mealling and Salz draft predefines the following namespace UUIDs:
  • 6ba7b810-9dad-11d1-80b4-00c04fd430c8 for DNS
  • 6ba7b811-9dad-11d1-80b4-00c04fd430c8 for URL
  • 6ba7b812-9dad-11d1-80b4-00c04fd430c8 for ISO OID
  • 6ba7b814-9dad-11d1-80b4-00c04fd430c8 for X.500 DN
To create a name based UUID first convert the UUID into an array of 16 bytes, do this by creating one byte from the hex representation in the string (skipping the dashes, leftmost in the lowest position of the array).
Then convert the name into a sequence of octets (byte array) as defined by the standard or coventions of the name space.
Calculate the MD5 or SHA-1 hash over the combined byte array of name space id and the byte array representing the name.
Take the 16 bytes of the hash as the new UUID after putting in the version and the variant.
To put in the version, take the 7th byte and perform an and operation using 0x0f, followed by an or operation with 0x30 for MD5 and 0x50 for SHA-1 hashes.
To put in the variant, take the 9th byte and perform an and operation using 0x3f, followed by an or operation with 0x80.

Note: the correct way to construct these identifiers is described in RFC 4122 the contents of this document is my interpretation of that document.
Appendix B of the draft seems to contain an incorrectly calculated value for the domain www.widgets.com. Running the program of appendix A and manual calculations with the help of the md5sum tool show the value should be 3d813cbb-47fb-32ba-91df-831e1593ac29, and not e902893a-9d22-3c7e-a7b8-d6e313b71d9f.

Foreseen problems

Some namespaces allow for multple conversion into a sequence of octets, so a question that goes unanswered is: How is a name inside a namespace converted to a canonical sequence of octets? For instance how to treat DNS names conforming to the IDN standards (zääz.de vs xn--zz-viaa.de which are the same in the DNS namespace) and different allowed forms of encoding. The RFC for URL's specifically state "A URI is represented as a sequence of characters, not as a sequence of octets", while the EBDIC encoded sequence of characters will undoubtedly yield another result than the UTF-16 encoded character sequence.

How is an UUID made (with information about version and variant)


If you have improvements, contact information on the homepage of this host.
An agent adding logging to your java programs at runtime
The uptime of home.famkruithof.net