What is UUID v5?
Version 5 UUIDs are generated by hashing a namespace identifier and a name using the SHA-1 algorithm. Like version 3, v5 is deterministic, but it uses SHA-1 (which is 160-bit) instead of MD5, providing better collision resistance.
Key Features
- Deterministic: The same input namespace and name always yield the same UUID.
- SHA-1 Hashing: Uses a stronger hash function than v3 (MD5).
- Preferred for Names: The recommended version for name-based UUIDs in new applications.
When to use UUID v5?
Use Version 5 whenever you need to map non-UUID identifiers (like URLs, email addresses, or usernames) to UUIDs in a consistent, repeatable way. It is preferred over v3 for all new implementations due to the weaknesses of MD5.