Your V5 UUID — Click to copy
UUID Anatomy
What is V5?
UUID v5 Generator — Complete Guide
UUID Version 5 is a name-based UUID that uses SHA-1 hashing. Given a namespace UUID and a name string, it always produces exactly the same UUID output — it is fully deterministic. This property makes UUID v5 unique among UUID versions: while v4 generates a different UUID every time, v5 generates the same UUID for the same input, on any machine, at any time, without any coordination. UUID v5 supersedes UUID v3 (which used the weaker MD5 hash).
RFC 9562 Definition: UUID v5 is computed as SHA-1(namespace_bytes + name_bytes). The first 128 bits of the 160-bit SHA-1 hash are used. Bits 49–52 (the version field) are set to 0101 (5), and bits 65–66 (the variant field) are set to 10. The SHA-1 hash provides the determinism — the same inputs always produce the same hash.
When to Use V5
UUID v5 is ideal for content-addressable storage where the same content should always have the same ID, generating stable identifiers from URLs or domain names, deduplication systems where you need to detect identical records, caching keys derived from input parameters, and any situation where you need a reproducible UUID from known data. It is also used to build hierarchical UUID namespaces.
Advantages
- ✅ Fully deterministic — reproducible IDs
- ✅ Same output on any machine
- ✅ Great for deduplication and caching
- ✅ Standard namespaces for common use cases
- ✅ No coordination needed between systems
Considerations
- ⚠️ Cannot be used for security tokens (deterministic)
- ⚠️ SHA-1 is weak for cryptographic use
- ⚠️ Name must be exactly identical for same output
- ⚠️ Not suitable when randomness is required
UUID Structure
| Field | Bits | Description |
|---|---|---|
| Namespace | 128 bits | A predefined UUID (DNS, URL, OID, X500) or custom |
| Name | Variable | Any string — hashed together with namespace |
| SHA-1 Hash | 160 bits | SHA-1(namespace + name), first 128 bits used |
| Version | 4 bits (49–52) | Set to 0101 (5) |
| Variant | 2 bits (65–66) | Set to 10 (RFC 9562) |
Code Examples
JavaScript
import { v5 } from 'uuid'; // DNS namespace — always same output const DNS_NS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; const uuid = v5('example.com', DNS_NS); console.log(uuid); // → cfbff0d1-9375-5685-968c-48ce8b15ae17
Python
import uuid # v5 with DNS namespace my_uuid = uuid.uuid5(uuid.NAMESPACE_DNS, 'example.com') print(my_uuid) # → cfbff0d1-9375-5685-968c-48ce8b15ae17 # v5 with URL namespace url_uuid = uuid.uuid5(uuid.NAMESPACE_URL, 'https://example.com/page')
C# / .NET
// Use GuidUtility or Faithlife.Utility package using System; using System.Security.Cryptography; using System.Text; // Third-party: Faithlife.Utility var uuid = GuidUtility.Create(GuidUtility.DnsNamespace, "example.com");
Go
// Using google/uuid import "github.com/google/uuid" ns := uuid.MustParse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") uuid5 := uuid.NewSHA1(ns, []byte("example.com")) fmt.Println(uuid5)
Frequently Asked Questions
What are the standard UUID v5 namespaces? ▾
RFC 9562 defines four standard namespaces: DNS (6ba7b810-...) for domain names, URL (6ba7b811-...) for URLs, OID (6ba7b812-...) for ISO OIDs, and X500 (6ba7b814-...) for X.500 distinguished names. You can also use any valid UUID as a custom namespace for your own naming hierarchy.
What is the difference between UUID v3 and v5? ▾
UUID v3 uses MD5 hashing while UUID v5 uses SHA-1. Since MD5 is cryptographically broken, you should always use UUID v5 over v3. Neither version should be used for cryptographic security purposes — they are designed for generating deterministic, reproducible identifiers, not secure tokens.
Will UUID v5 always produce the same output? ▾
Yes, absolutely. Given the same namespace UUID and the same name string, UUID v5 will produce the exact same UUID on any machine, using any compliant implementation, at any point in time. This is its defining property.
Can UUID v5 be reversed to find the original name? ▾
No. SHA-1 is a one-way hash function. You cannot reverse a UUID v5 to find the name that was used to generate it. However, if you know the possible inputs, you can verify them by generating the UUID and comparing.
Related Tools