torchcell.datamodels.interned_constant.constant_id

constant_id(kind: str, payload: str) → str[source]

The node id of an interned constant: sha256 over label, kind and exact payload.

The preimage is the label, a NUL byte, the kind, a NUL byte and the payload (UTF-8). It starts with the label, so it is never the preimage of a sub-object’s own node id (the bare json.dumps of its dump), and it carries the kind, so the same bytes interned under two kinds are two nodes, each with a true kind property.