Skip to content

tm_uuidv5 Function

uuidv5 generates a name-based UUID, as described in RFC 4122 section 4.3, also known as a "version 5" UUID.

uuidv5(namespace, name)

Unlike the pseudo-random UUIDs generated by tm_uuid, name-based UUIDs derive from namespace and an name, producing the same UUID value every time if the namespace and name are unchanged.

Name-based UUID namespaces are themselves UUIDs, but for readability this function accepts some keywords as aliases for the namespaces that were assigned by RFC 4122:

KeywordNamespace IDName format
"dns"6ba7b810-9dad-11d1-80b4-00c04fd430c8A fully-qualified DNS domain name.
"url"6ba7b811-9dad-11d1-80b4-00c04fd430c8Any valid URL as defined in RFC 3986.
"oid"6ba7b812-9dad-11d1-80b4-00c04fd430c8An ISO/IEC object identifier
"x500"6ba7b814-9dad-11d1-80b4-00c04fd430c8X.500 Distinguished Name

To use any other namespace not included in the above table, pass its assigned namespace ID directly in the first argument in the usual UUID string format.


Use the namespace keywords where possible, to make the intent more obvious to a future reader:

tm_uuidv5("dns", "")

tm_uuidv5("url", "")

tm_uuidv5("oid", "")

tm_uuidv5("x500", "CN=Example,C=GB")

The namespace keywords treated as equivalent to their corresponding namespace UUIDs, and in some special cases it may be more appropriate to use the UUID form:

tm_uuidv5("6ba7b810-9dad-11d1-80b4-00c04fd430c8", "")

If you wish to use a namespace defined outside of RFC 4122, using the namespace UUID is required because no corresponding keyword is available:

tm_uuidv5("743ac3c0-3bf7-4a5b-9e6c-59360447c757", "LIBS:diskfont.library")

When using raw UUID namespaces, consider including a comment alongside the expression that indicates which namespace this represents in a human-significant manner, such as by reference to the standard that defined it.

  • tm_uuid, which generates pseudorandom UUIDs.