Skip to main content

HID64

Compact 64-bit hierarchical identifier with cryptographic local validation.

HID64 binds a child identifier to an externally-authenticated root_id and to its immediate parent_id via HMAC-SHA256, fitting the result into a 64-bit unsigned integer suitable for BIGINT storage and compact wire formats. Validation is local: a holder of the per-tenant secret can verify hierarchical relationships without database lookups or central coordination.

Install

pip install hierarchical-id64

Requires Python ≥ 3.8 and cryptography>=41. The module is imported as hid64; the distribution is named hierarchical-id64 on PyPI to keep the naming consistent with the companion package hierarchical-uuid.

Quick start

from hid64 import derive_key, generate_hid64, validate_hid64

master_key = b"replace-with-securely-stored-master-key"
tenant_key = derive_key(master_key, "tenant:acme")

root_id   = "tenant:acme"   # must be authenticated externally (JWT/OAuth/etc.)
parent_id = "app:42"

hid = generate_hid64(root_id, parent_id, tenant_key)
assert validate_hid64(root_id, parent_id, hid, tenant_key)

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 128-bit UUIDv8-compatible variant, see HUUID.

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-id64 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-id64 1.0.0
File Size Uploaded
hierarchical_id64-1.0.0.tar.gz 4.0 kB Details

Built distribution (wheel)

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

Total release size: 8.6 kB

Release files / hierarchical_id64-1.0.0.tar.gz

Download URL hierarchical_id64-1.0.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0c9f50860da5c43a0f168a049e1968394f974359a852305ea8c9209343082536
BLAKE2b-256 checksum
How to use checksums
b87132768f53c1d905d12e3bc7dcde4feb4e13cbe09f384b6ff75f793dea6994
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

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

Download URL hierarchical_id64-1.0.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
484d4608650be7f53816823dd464343a774c0214f8df3135c56de0fceb7d881d
BLAKE2b-256 checksum
How to use checksums
48344fadc8d9aebec9e3593ee4eb2fcb7f551ac5a20ff9042853b1e2806331ca
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