Skip to main content
Deterministic / SHA-1 Hash

UUID v5 Generator

Enter a namespace and a name below to generate a deterministic UUID v5 using SHA-1 hashing — the same namespace and name combination will always produce the exact same UUID every time. Use this UUID version 5 generator to create reproducible, name-based unique identifiers for URL mapping, content addressing, configuration keys, and any scenario where you need a consistent UUID derived from meaningful input data without relying on randomness. The uuid validator checks RFC 4122 and RFC 9562 compliance — useful for debugging malformed identifiers.

Enter namespace and name below

Standard namespaces: DNS, URL, OID (ISO Object ID), X.500 DN (Distinguished Name)

The name to hash within the namespace. Same namespace + name = same UUID.

Output Format Options

Every time your application needs a stable, reproducible identifier tied to a meaningful name — a domain, a URL, a resource path — a UUID v5 generator gives you exactly that: a fixed, predictable UUID derived from a namespace and a name string. Unlike a randomly generated value that changes on every call, a version 5 UUID always returns the same output for the same inputs, so you get a consistent, collision-resistant identifier with no mapping table to maintain.

How the Namespace and Name Inputs Work

The generator above requires two inputs: a namespace UUID and an arbitrary name string. Together they feed a SHA-1 hash, producing a stable 128-bit identifier every time — no randomness, no surprises. RFC 4122 predefines four standard namespaces: For Node.js and Python PyMongo UUID patterns, the mongodb uuid guide has complete driver-specific examples.

You can also supply any UUID of your own as a custom namespace — useful for scoping IDs to your own application or entity type. Once you generate, the result appears in standard format: 32 hex characters in five hyphenated groups (8-4-4-4-12), 36 characters total.

Determinism reminder: the same namespace and name pair always yields the same v5 UUID — across every machine, every language runtime, every point in time. If you need a different output, change either the namespace or the name.

How UUID v5 Generation Works

UUID v5 is a name-based scheme built on SHA-1, a cryptographic hash producing a 160-bit (20-byte) digest from any input. Generation takes the first 128 bits of that digest and stamps in the version and variant markers:

UUID NameToUUID(UUID namespace, String name) {
    // Concatenate namespace bytes and name bytes
    byte[] input = namespace.toBytes() + name.toBytes();

    // Compute SHA-1 -- produces 20 bytes (160 bits)
    byte[] hash = SHA1(input);

    // Copy first 16 bytes into result UUID
    byte[] result = hash[0..15];

    // Stamp version 5 into the high nibble of byte 6
    result[6] = (result[6] & 0x0F) | 0x50;

    // Stamp the RFC 4122 variant into byte 8
    result[8] = (result[8] & 0x3F) | 0x80;

    return result;
}

This is the canonical sequence used by every conforming implementation, whether in a software library or a command-line tool. It's a pure, one-way function — given only the output UUID, you cannot reverse the SHA-1 to recover the original name, which makes v5 a safe choice for internal naming schemes where the source shouldn't be exposed.

UUID v5 vs UUID v3, v4, and v1

Note on SHA-1: SHA-1 is considered cryptographically broken for digital signatures, but that concern doesn't apply here — within UUID v5, SHA-1 is used purely as a reproducible digest function, not for authentication or data integrity verification, so its known weaknesses don't affect its suitability for this purpose.

When to Use UUID v5

Reach for a name-based UUID whenever you need a persistent token for a resource that already has a canonical name: The fastest way to generate uuid v4 is to use the browser-based UUID v4 Generator — no sign-up required.

For a completely anonymous, non-reproducible token — session values, temporary objects, anything where revealing the name structure would be a privacy risk — use UUID v4 instead.

Frequently Asked Questions

What is a UUID Version 5 (v5)?

UUID v5 is a name-based, deterministic identifier: it hashes a namespace UUID together with a name string using SHA-1, then stamps in the version and variant bits. The same namespace and name pair always produces the identical UUID, with no randomness involved.

What is the difference between UUID v3 and UUID v5?

They work identically except for the hash function: v3 uses MD5, v5 uses SHA-1. Since MD5 is cryptographically weaker and largely deprecated, RFC 4122 and every modern implementation recommend v5 for new applications.

What is a namespace in UUID v5?

A namespace is a UUID that scopes your name string, so the same name produces different results in different namespaces. RFC 4122 predefines four: DNS, URL, OID, and X.500. You can also use any UUID of your own as a custom namespace.

Can I decode or reverse a UUID v5 to get the original name?

No. SHA-1 is a one-way function — given only the output UUID, you cannot recover the namespace or name that produced it. This makes v5 suitable for internal naming schemes where you don't want the source name exposed.

Why does the same namespace and name always produce the same UUID v5?

Because the generation process has no random input at all — it's a pure function of the namespace bytes and name bytes through SHA-1. Any conforming implementation, in any language, produces byte-for-byte identical output for the same inputs.

When should I use a custom namespace instead of a predefined one?

Use a predefined namespace (DNS, URL, OID, X.500) when your name genuinely is that kind of value. Use a custom namespace — any UUID you generate once and reuse — when you're building your own naming scheme, such as scoping IDs to a specific application or entity type.

Comments & Feedback

Share your experience or ask questions about this tool

Copied to clipboard!