uuidv5 generates a name-based UUID, as described in RFC 4122 section
4.3, also known as a "version
Unlike the pseudo-random UUIDs generated by
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:
|Keyword||Namespace ID||Name format|
|A fully-qualified DNS domain name.|
|Any valid URL as defined in RFC 3986.|
|An ISO/IEC object identifier|
|X.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:
> uuidv5("dns", "nomadproject.io")d2616d48-e1cb-5b87-8a8c-46355decc76a > uuidv5("url", "https://nomadproject.io/")a1572394-3948-5251-b0c7-b4ded43587b4 > uuidv5("oid", "184.108.40.206.4")af9d40a5-7a36-5c07-b23a-851cd99fbfa5 > uuidv5("x500", "CN=Example,C=GB")84e09961-4aa4-57f8-95b7-03edb1073253
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:
> uuidv5("6ba7b810-9dad-11d1-80b4-00c04fd430c8", "nomadproject.io")d2616d48-e1cb-5b87-8a8c-46355decc76a
If you wish to use a namespace defined outside of RFC 4122, using the namespace UUID is required because no corresponding keyword is available:
> uuidv5("743ac3c0-3bf7-4a5b-9e6c-59360447c757", "LIBS:diskfont.library")ede1a974-df7e-5f17-84b9-76208818b2c8
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.
uuidv4, which generates pseudorandom UUIDs.