Create a stable UUID v5 for a repeatable integration fixture

Generate a deterministic name-based UUID from a namespace and fictional name, then verify why repeated inputs produce the same identifier.

By DevSphere Editorial · · 5 min read

Open UUID Generator

Choose deterministic identity for a fixture

A name-based UUID v5 is useful when test data needs the same identifier each time given the same namespace and name. That differs from generating a fresh random identifier for each run. Open UUID Generator and select version v5. The v5 options appear with a Namespace selector, a Name field, and a quantity selector. Choose a predefined namespace such as DNS or URL for this example and enter a harmless fictional name. Do not include an email address, customer name, or other private identifier.

The tool hashes the namespace UUID bytes followed by UTF-8 bytes for the name using SHA-1, takes part of the digest, and sets UUID version and variant bits. It then formats the resulting UUID. Because a name and namespace form a deterministic pair, the same exact inputs produce the same UUID in repeated runs. This determinism can simplify an integration fixture, but it does not make the identifier secret or guarantee that another system uses identical name normalization.

Version: v5
Namespace: DNS
Name: demo-widget-17
Expected UUID: 7cd024e6-fa08-5843-a56f-bd99ce27d637

Select namespace and generate

Set Quantity to 1 while establishing the first fixture. Keep Format on Standard (lowercase) so the output is a conventional hyphenated UUID. Enter `demo-widget-17` in Name and press Generate UUID. A result appears with copy, Copy All, and Download actions. The tool also stores a generation timestamp alongside each result, but that timestamp is not part of a v5 UUID and does not affect its deterministic identity. Copy the identifier only into a test fixture or mock data store.

To prove determinism, press Generate again without changing Namespace or Name. The raw UUID should match the first result. Change the name to `demo-widget-18`, generate again, and observe a different deterministic result. Restore the original to reproduce the first one. Do not compare only visual formatting; if using another output format, normalize it before checking the underlying UUID bytes.

Choose names that are canonical for your domain

A UUID v5 has no awareness of application semantics. It hashes the name exactly as entered, so capitalization, whitespace, punctuation, and Unicode normalization can produce a different value. If your application treats names case-insensitively or trims spaces, apply that canonicalization consistently before both generation and lookup. This UI does not normalize the name for you. Document the canonicalization alongside the namespace so a future test runner can reproduce the identifier.

A predefined namespace determines the context of the name. DNS, URL, OID, and X.500 namespaces are available, and a Custom option accepts a namespace UUID. A custom namespace must be a valid 32-hex-digit UUID after hyphens are removed; the parser checks length but should not be treated as a comprehensive UUID validator. Use the namespace specified by your fixture design. Accidentally switching DNS to URL changes the derived identifier even with the same name.

Understand the tradeoffs

The same namespace and name yielding the same UUID is the main benefit of v5. That property is useful for deterministic seed records and idempotent test setup. It is not a random identifier generator, and predictable inputs yield predictable outputs. Do not use v5 to conceal a user identity or to create a secret token. The underlying SHA-1 usage is part of the UUID v5 construction and should not be repurposed as a general security signature or collision-resistant integrity design.

Use v4 when you need a new random identifier rather than a deterministic mapping. Use v1 only when its time-related characteristics suit the application and its privacy tradeoffs are understood. UUID uniqueness is probabilistic or construction-dependent; a generated value is not proof that a database has no collision. The tool does not check your application's existing records or reserve the identifier. A database uniqueness constraint and collision handling remain necessary.

Troubleshoot missing output

If the page displays a prompt asking for a name, check that the Name field is nonempty and the version is v5. The handler returns early when no name is entered or a namespace cannot be parsed. For a custom namespace, verify the full UUID spelling and avoid adding labels or braces unless the accepted parser supports them; its byte parser removes hyphens and requires exactly 32 remaining characters. Return to a predefined namespace if you want to isolate a custom-input problem.

If repeated runs differ, confirm the version, namespace, name, and normalization are identical. A different Format changes the displayed representation but not the raw identifier. If an external library still differs, compare its UUID v5 definition, namespace bytes, UTF-8 handling, and exact name bytes. Do not assume case folding or URL canonicalization is shared between implementations.

Verify the fixture end to end

Store the namespace identifier, exact canonical name, and resulting UUID together in a non-sensitive fixture. Regenerate in the page and compare, then recreate the seed record in the test database and confirm that the same key is accepted. Run the setup twice to check that your fixture is idempotent and that duplicate insertion is handled intentionally. Copy All or Download can export a batch, but a one-item deterministic case is easier to review.

Clear the Name and generated result after the demonstration if it is no longer needed. Remember that v5 determinism supports repeatability, not confidentiality or proof of ownership. For production identity, choose an identifier strategy that matches data lifecycle, privacy, and database constraints. This tool generates a UUID from the entered name and namespace; it does not validate the business meaning of the name or check that another system uses the same canonicalization.

Browse all tutorials