News for hackers. Stuff that matters.
Re:Moving Away from UUIDs by amelius on Monday November 21, 2022 @07:54PM (#33700411)
And what are the hyphens good for? And what is the reason for their irregular placement?
Re:Moving Away from UUIDs by wsc981 on Monday November 21, 2022 @08:25PM (#33700633)
My guess would be readability. Easier to "parse" by humans then just a long string of numbers and letters without "interpunction".
Re:Moving Away from UUIDs by deathanatos on Tuesday November 22, 2022 @12:50AM (#33702508)
They evolved that way, and the hyphens denote the various parts of UUIDv1, the original version of UUIDs; roughly:

  123e4567-e89b-12d3-a456-426614174000
  ^^^^^^^^ ^^^^ ^^^^ ^^^^ ^^^^^^^^^^^^
  time lo  time time  seq   node id
            mid  hi
+/- a few bits reserved for version & variant. The random ones are version 4, but they still share the same string representation as v1. (But outside of the bits mentioned in the article, the other bits are just random; the diagram above doesn't apply to v4.) The only thing the hypens really do there is make it easier to see where the version bits are, if you want to visually verify that it's a v4 UUID.

See: https://en.wikipedia.org/wiki/Universally_unique_identifier