MD5 Name-Based UUID Generator (v3)
Generate repeatable, name-based version 3 UUIDs using MD5 hashing and namespaces.
Deterministic by Design
Unlike random identifiers (v4) or time-based generators (v1), version 3 UUIDs are strictly deterministic. This means that if you supply the exact same Namespace and the exact same Name, the underlying MD5 hashing algorithm guarantees you will output the exact same UUID every single time.
This property is critical for distributed systems where multiple separate databases need to agree on a unique ID for a piece of data (like a URL or an email address) without communicating with each other over the network.
RFC 4122 Namespaces
The hashing algorithm requires a baseline "Namespace UUID" to prevent naming collisions across different data types. RFC 4122 defines four standard constants:
- DNS: For generating UUIDs based on domain names (e.g.,
www.example.com). - URL: For generating identifiers based on full web addresses.
- OID / X.500: For legacy directory structures and object identifiers.
Frequently Asked Questions
What is the difference between UUID v3 and v4?
UUID v4 is entirely random and unpredictable, whereas UUID v3 is deterministic. This means that if you supply the exact same namespace and name to a v3 generator, you will always get the exact same resulting UUID.
How does UUID v3 hashing work?
Version 3 UUIDs combine the raw bytes of a 16-byte Namespace UUID and your text string, calculate the MD5 hash of that combined data, and format the resulting 16 bytes into standard UUID structure (while setting the version and variant bits).
When should I use UUID v3 vs v5?
You should use UUID v5 in modern applications, as it uses the more secure SHA-1 algorithm instead of MD5. UUID v3 should only be used when required for backward compatibility with legacy systems that specifically implemented MD5 name-based generation.