code wiki / (root) / nx_uuid5.nx

nx_uuid5.nx

buildroot/runtime/nx_uuid5.nx

4293 B126 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

uuid5.nx -- UUIDv5 (SHA-1 namespace + name -> UUID). RFC 4122 ยง4.3. Produces a DETERMINISTIC 128-bit UUID from a namespace UUID + an arbitrary name. Same (ns, name) always yields the same UUID. Used for: - stable IDs derived from URLs (content hashing) - deterministic object IDs in distributed systems - test fixture IDs that don't drift between runs - git-style content addressing without exposing the hash Algorithm: hash = SHA-1(namespace_uuid_bytes || name_bytes) uuid[0..16] = hash[0..16] (take first 16 bytes) uuid[6] = (uuid[6] & 0x0F) | 0x50 (version = 5) uuid[8] = (uuid[8] & 0x3F) | 0x80 (variant = RFC 4122) The RFC defines four standard namespace UUIDs for DNS, URL, OID, and X.500 -- we expose them as byte constants. Callers needing their own namespace mint a v4 UUID (uuid_v4_bytes) once and reuse it forever. Invariants: U5 1 Output is 16 bytes (not the hyphenated string; use uuid_format from uuid.nx to get the string form). U5 2 Deterministic: pure function of (ns, name). U5 3 Byte-for-byte compatible with Python's uuid.uuid5, Node's uuid library, java.util.UUID.nameUUIDFromBytes.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sha1.nx nx_uuid5.nx

imports: nx_syscalls.nxnx_sha1.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap uuid_v5_bytes sys_mmap ↻ sha1 sys_mmap ↻ sha1_process_block if_ge uuid_ns_dns

structs

none

consts

none

functions

41func uuid_ns_dns() -> *u8
called by 1: main
45func uuid_ns_url() -> *u8
49func uuid_ns_oid() -> *u8
53func uuid_ns_x500() -> *u8
60func uuid_v5_bytes(namespace: *u8, name: *u8, name_len: i64,
called by 1: main calls 2: sys_mmapsha1
94func main() -> i64