Expand description
Per-broker audit hash-chain primitives.
The chain binds each record to all prior records: new_head = SHA256(prev_head ‖ seq_be ‖ value). The writer stamps (seq, prev_head)
on each record. The verifier recomputes the chain and checks continuity.
The writer and the verifier must use these functions. Never reimplement the
formula.
Structs§
- Chain
Link - The chain position a record is stamped with.
- Chain
State - Running per-broker chain state.
Constants§
- GENESIS_
HEAD - Chain head before the writer writes the first record.
Functions§
- chain_
hash - Canonical chain hash.
new_head = SHA256(prev ‖ seq.to_be_bytes() ‖ value). - from_
hex32 - Parse exactly 32 bytes of lowercase or uppercase hex.
- to_hex
- Encode
bytesas lowercase hex.