Skip to main content

HUUID

Hierarchical UUID — a UUIDv8-compatible (RFC 9562) identifier that embeds an HMAC-SHA256-derived prefix in the UUID's node field, enabling cryptographic local validation of parent-child relationships while preserving full UUID compatibility.

Install

pip install hierarchical-uuid

Requires Python ≥ 3.8. No external dependencies. The module is imported as huuid; the distribution is named hierarchical-uuid on PyPI to keep the naming consistent with the companion package hierarchical-id64, and to avoid collision with an unrelated existing package of the same short name.

Quick start

from huuid import generate_huuid, validate_huuid

secret    = b"replace-with-tenant-scoped-secret"
parent_id = "account:42"

huuid = generate_huuid(parent_id, secret)   # returns a standard uuid.UUID
assert validate_huuid(parent_id, huuid, secret)
print(str(huuid))   # e.g. "861f6b20-e1cc-8942-b135-e412be9faa3e"

For an end-to-end example combining HUUID with a JWT-based session (stateless tenant validation at the edge, no database lookup), see the jwt_validation.py example.

Specification and security model

The full v1.0 specification — including threat model, key rotation guidance, secret-custody as the security perimeter, complementary (not substitutive) authoritative integrity checks, and the graceful-degradation property under secret compromise — is at:

Related

For the companion compact 64-bit variant, see HID64.

For the umbrella repository (specifications, threat-model note, IETF-style draft, both reference implementations), see github.com/hektorv/hid.

License

MIT — see LICENSE.

Metadata

Release files for hierarchical-uuid 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hierarchical-uuid 1.0.0
File Size Uploaded
hierarchical_uuid-1.0.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hierarchical-uuid 1.0.0
File Interpreter ABI Platform
hierarchical_uuid-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / hierarchical_uuid-1.0.0.tar.gz

Download URL hierarchical_uuid-1.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a76cd0a1dcbead3b5819d89be1b6a846d0b7e9d12279fefef84858e12fb1da45
BLAKE2b-256 checksum
How to use checksums
33b4427e6e4121232512363dc3ff5762add5cc7efcb0069979308920522f1130
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / hierarchical_uuid-1.0.0-py3-none-any.whl

Download URL hierarchical_uuid-1.0.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f5153639f2cceed60e8c37e1971d5ca64eaf2712903545c8763fb3099c63c5a
BLAKE2b-256 checksum
How to use checksums
517d88bd929080737221748ea926a4dc993f4e395859d2b94db9fc654504e8c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page