UUID · MD5
UUID v3 and v5
Deterministic identifiers derived from a namespace and a name via MD5 or SHA-1.
Key facts
| v3 hash | MD5 |
|---|---|
| v5 hash | SHA-1 |
| Input | Namespace UUID + name bytes |
| Output | Same UUID for the same input |
| Recommended | v5 over v3 |
| Use case | Stable IDs for external names |
Deterministic by design
Name-based UUIDs let independent systems derive the same identifier for the same entity without coordination. For example, a user's UUID can be the v5 hash of a DNS namespace and their email address. Change the name and the identifier changes, so treat the name as part of the key.
v5 over v3
MD5 is broken for collision resistance; v3 is retained for compatibility. v5 uses SHA-1, which is also deprecated for signatures but still acceptable here because the input is not adversarial in the usual sense. If an attacker can choose names, collisions in MD5 are practical, so prefer v5.
Frequently asked questions
Do v3 and v5 leak the name?
The hash is one-way in principle, but short or guessable names can be brute-forced. Do not treat the UUID as a secret.
Can I regenerate the same UUID later?
Yes, if you keep the namespace and the exact name bytes. A change in case or whitespace produces a different UUID.
Which namespace should I use?
Use a dedicated namespace UUID for your application rather than a shared well-known one, so your names cannot collide with other systems.