About Version 5 UUIDs
A version 5 UUID is the SHA-1 hash of a namespace UUID and a name, truncated to 128 bits with the version and variant bits set. Like v3 it is deterministic: the same inputs always produce the same UUID.
Names are hashed as UTF-8 bytes, matching Python's uuid.uuid5, Java's libraries and most RFC 9562 implementations.
Structure
sha1(namespace + name)[0..16] with version = 5 and variant = 10
When to use it
- Deriving stable IDs from URLs, domains or natural keys (idempotent imports, content addressing, deduplication).
When to avoid it
- Anywhere unpredictability is required: anyone who knows the name can compute the UUID.
Frequently asked questions
Is v5 better than v3?
Yes, SHA-1 is stronger than MD5 and RFC 9562 prefers it. Both are fine for identifiers, neither is suitable for security purposes.
How do I generate the same UUID in code?
Python: uuid.uuid5(uuid.NAMESPACE_DNS, "example.com"). PHP: Uuid::uuid5(Uuid::NAMESPACE_DNS, "example.com"). Java: Generate with a library such as java-uuid-generator.