SSM-Clock Stamp – Algorithm Agility (file and chain digests) (5.14)

Objective. Prove that different digest algorithms can be used per stamp (for both file and chain) without breaking interoperability. Everything remains plain ASCII and deterministic.

Rules (must)

  • Optional tail declares algorithms:
    kv:algo=<file_hash>;chain_algo=<chain_hash>
    where <file_hash>, <chain_hash> ∈ {sha256, sha3_256, blake2b-256}.
  • File digest field still named sha256(file) for backward label compatibility, but the value must be computed with kv:algo when present.
  • Chain step always uses the row’s declared kv:chain_algo (or sha256 if absent):
    chain_k = H_chain( ascii(chain_{k-1} + "|" + stamp_core_k) ) with chain_0 = "0"*64.
  • Digest prints are lowercase 64-hex (256-bit).
  • Anchors remain fixed:
    rollup_D = sha256( ascii(Stamp_1 "|" ... "|" Stamp_n) ) after canonical sort.

Why it works

  • Per-stamp agility affects only how each row’s digests are computed, not the string shape of the stamp or the anchor algorithm.
  • Because anchors hash the entire ASCII line, mixed-algo streams remain anchor-comparable across systems.

Test plan (copy-ready)

  1. Stamp same file 3 times with different file hash algos (and optionally different chain algos):
    • kv:algo=sha256;chain_algo=sha256
    • kv:algo=sha3_256;chain_algo=sha3_256
    • kv:algo=blake2b-256;chain_algo=blake2b-256
      Each emits:
      SSMCLOCK1|iso_utc|rasi_idx|theta_deg|<h64>|<c64>|kv:algo=...;chain_algo=...;theta_prec=5;float=ieee75464;time_mode=derived_utc
  2. Verify each using declared algos:
    • Recompute h' = H_algo(file_bytes) and compare to <h64>.
    • Rewalk chain per row with H_chain chosen from kv:chain_algo.
    • Check clock from UTC and fixed-digit print.
  3. Anchor the day: select, canonical-sort, join with literal |, compute rollup_D using sha256 over the ASCII join.
  4. Expect PASS for all, and identical anchor parity between sources.

Expected outputs (stdout, ASCII)

# For each stamp
HASH_OK=true CLOCK_OK=true CHAIN_OK=true
VERDICT=PASS

# Daily anchor parity
ANCHOR_LEDGER_OK=true
ANCHOR_SIDECARS_OK=true
VERDICT=PASS

Operational notes

  • Keep all digests lowercase 64-hex regardless of algorithm.
  • Do not reformat inner fields; keep theta_deg at exactly theta_prec digits (default 5), round-half-to-even, IEEE-754 binary64.
  • Mixed algorithms in one ledger are allowed; they increase audit effort but remain verifiable.

Mini CLI sketch (illustrative)

  • Stamp with SHA-256:
    stamp --file A --kv "algo=sha256;chain_algo=sha256;theta_prec=5;float=ieee75464"
  • Stamp with SHA3-256:
    stamp --file A --kv "algo=sha3_256;chain_algo=sha3_256;theta_prec=5;float=ieee75464"
  • Stamp with BLAKE2b-256:
    stamp --file A --kv "algo=blake2b-256;chain_algo=blake2b-256;theta_prec=5;float=ieee75464"
  • Anchor the day:
    anchor-make --date YYYY-MM-DD --source ledger

Common pitfalls (avoid)

  • Computing file hash with the wrong algo while declaring another in kv:algo.
  • Uppercase hex or non-ASCII separators.
  • Reprinting stamp lines before anchoring (anchors must use the exact recorded lines).
  • Mixing precision/rounding for theta_deg across stamps.

Navigation
Back: SSM-Clock Stamp – Leap-Minute Policy Enforcement (5.13)
Next: SSM-Clock Stamp – Streaming Hash Equivalence (large file) (5.15)