Re:Moving Away from UUIDs
by BerislavLopac on Monday November 21, 2022 @07:20PM
(#33700128)
It is also highly recommended that you include a check digit into it, to minimize the chance of a collision. I've used https://arthurdejong.org/python-stdnum for that purpose.
[ Parent
| on HN ]
I don't see how a check digit minimizes the chance of collision. (Here, I'm assuming that a check digit is calculated from the other digits. What am I thinking about incorrectly?)
Re:Moving Away from UUIDs
by georgemcbay on Monday November 21, 2022 @08:31PM
(#33700670)
Looking at the docs for the library linked, it appears to be a Verhoeff algorithm check digit... so yeah, you're correct.
This is effectively a simplistic stand-in for a CRC type system -- useful to detect if the data has been corrupted, but not useful to avoid collisions.
Re:Moving Away from UUIDs
by TedDoesntTalk on Monday November 21, 2022 @09:06PM
(#33700881)
And if someone is worried about UUID collisions, they need to rethink their priorities in life.
Re:Moving Away from UUIDs
by BerislavLopac on Wednesday November 23, 2022 @04:34AM
(#33717022)
You are correct, this should teach me not to write comments when I'm too tired. :/
The check digit wouldn't really help with collisions, since if the strings are the same the digit will be too. They are primarily useful when we need to ensure correctness on human input.