nodeid

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package nodeid computes the deterministic content-hashed identifier assigned to every extracted symbol (D-02/D-02a). It is a leaf package — it imports only the standard library — so both the extractor and the resolver can depend on it without an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeID

func NodeID(kind, qualifiedName, filePath string) string

NodeID computes the deterministic, collision-resistant identifier for a symbol identified by (kind, qualifiedName, filePath), per D-02/D-02a.

The preimage is built from varint-length-prefixed segments (mirroring keys.go's appendSegment discipline) so a crafted qualifiedName or filePath cannot bleed across the segment boundary and forge/collide an id with a different identity tuple (T-02-01, Tampering).

The preimage is hashed with SHA-256 — never MD5 or another collision-prone hash (D-02a, T-02-05, ASVS V6) — and the digest is hex-encoded and truncated to 32 characters, matching the project's <kind>:<32-hex> id shape while retaining SHA-256's collision resistance for the truncated portion.

The result is a pure function of its arguments: re-running NodeID on the same tuple always yields the same id, which is how the resolver matches a reference back to the symbol it points to (RES-01).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL