Deterministic vs Random UUIDs: Choosing the Right Standard
Not all UUIDs are created equal. Depending on your use case, you might need randomness or repeatability.
Version 4: Pure Randomness
The most common UUID. It relies on entropy. Use this for unique database primary keys where collisions are the only concern.
Version 3 & 5: Determinism
These versions generate a UUID by hashing a "namespace" and a "name" (v3 uses MD5, v5 uses SHA-1). If you provide the same namespace and name, you get the same UUID every time.
Use Cases for v5
Deterministic UUIDs are perfect for mapping external identifiers (like emails or usernames) to a standard UUID format without storing a separate mapping table.