Skip to content

[th/uuid-generate-from-strings] rework nm_uuid_generate_from_strings() to support version 5 UUIDs

Thomas Haller requested to merge th/uuid-generate-from-strings into main

nm_uuid_generate_from_strings() is a sensible function to generate a fixed UUID based on a list of strings.

Rework it:

  • it now accepts a uuid_type argument. Previously, we would always generate version3 (MD5) UUIDs, which seems not best for new code.
  • add a type_arg namespace UUID. Previously, all callers were advised to choose a unique first string for namespacing. It seems nicer to have an explicit namespace UUID, which is awell-known concept when generating UUIDs (see python's uuid.uuid5() which has a mandatory namespace parameter).

Of course, existing uses keep generating the same version 3 UUIDs as before (after all, the main point of this function is to generate stable UUIDs). But this should encourage new users to switch to version 5 UUIDs and think about the necessity of the namespace argument.

Merge request reports

Loading