nx_hash_facade.nx
buildroot/runtime/nx_hash_facade.nx
about
nx_hash_facade.nx -- unified hash interface.
Wraps existing crypto primitives (nx_blake2b, nx_sha512, BLAKE3-when-
shipped) behind one substrate-level API. Other primitives that need
a content hash call nx_hash_facade_compute() rather than picking
a specific algorithm — the facade chooses based on caller's
trust ceiling (from nx_attest_silicon).
THE STRUCTURAL VALUE: many primitives I've shipped take a
`content_hash: nx_size` parameter and rely on the caller to compute
it correctly with the "right" algorithm. The facade collapses that
decision into one place, so substrate-wide hash discipline is
uniform.
Composes:
nx_blake2b -- the BLAKE2b 64-byte hash primitive (existing)
nx_sha512 -- the SHA-512 hash primitive (existing)
nx_attest_silicon -- trust-ceiling informs algorithm choice
nx_methyl -- content_hash field uses this facade
nx_vacuole -- content-addressed storage uses this facade
nx_provenance_chain -- output_hash via this facade
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_admin_login_flow.nxnx_crypto_event_compose_test.nxnx_hash_facade_test.nxnx_save_slot.nxnx_wiki_https_daemon.nxnx_wiki_main.nx
structs
| 68 | struct NxHashRequest |
consts
| 28 | const NX_HA_BLAKE2B: nx_int = 0 |
| 29 | const NX_HA_BLAKE3: nx_int = 1 // queued (currently maps to BLAKE2B) |
| 30 | const NX_HA_SHA512: nx_int = 2 |
| 31 | const NX_HA_N_ALGOS: nx_int = 3 |
| 35 | const NX_HF_OK: nx_int = 0 |
| 36 | const NX_HF_ERR_BAD_ALGO: nx_int = 1 |
| 37 | const NX_HF_ERR_BAD_INPUT: nx_int = 2 |
functions
| 39 | func nx_ha_is_valid(a: nx_int) -> nx_int |
| 55 | func nx_hash_facade_pick_algo(trust_q10: nx_int) -> nx_int called by 1: main |
| 75 | func nx_hash_request_new(algo: nx_int, |
| 97 | func _hash_fnv64(ptr: *u8, len: nx_size) -> nx_size |
| 116 | func nx_hash_facade_compute(req: *NxHashRequest, out_hash: *i64) -> nx_int |
| 130 | func nx_hash_facade_compute_bytes(ptr: *u8, len: nx_size) -> nx_size |
| 142 | func nx_hash_facade_compare(a: nx_size, b: nx_size) -> nx_int |