SSM-Clock Stamp – Content Integrity (2.2)

Purpose. Decide HASH_OK by recomputing the file digest under the declared algorithm and comparing hex strings. Everything is plain ASCII and offline.

Definition (must)

  • File digest: h_file = H_algo(file_bytes)
  • Default algo = sha256 unless overridden by kv:algo. Supported: {sha256, sha3_256, blake2b-256} (all 256-bit → 64 hex).
  • Stamps emit lowercase 64-hex in the sha256(file) field (historical label; algorithm comes from kv:algo).

Producer procedure (deterministic)

  1. Open the target file in binary mode.
  2. Compute H_algo(file_bytes) in one pass or streaming; both MUST yield the same hex digest.
  3. Emit the hex digest as lowercase 64-hex and place it in the sha256(file) field.

Verifier procedure (deterministic)

  1. Select algorithm: algo = kv:algo else sha256.
  2. Read file in binary; compute h' = H_algo(file_bytes).
  3. Shape check: recorded digest matches [0-9a-f]{64}.
  4. Compare as strings: h' == recorded_hex → set HASH_OK = true; else false.

Notes (precision & safety)

  • No normalization. Do not change bytes (no CRLF fixes, no encoding conversions, no metadata tweaks). Hash the exact bytes.
  • Streaming allowed. Chunk size is free; the final digest must equal the monolithic hash.
  • Case policy. Emit lowercase in stamps; verifiers may compare case-insensitively but SHOULD normalize to lowercase.

Common failure reasons

  • File read in text mode (newline conversion).
  • Digest not 64-hex or uppercase.
  • kv:algo declared but verifier uses default sha256.
  • File content changed since stamping.

Outcome

  • Set HASH_OK=true/false. Proceed to Clock Consistency (2.3).

Navigation
Back: SSM-Clock Stamp – Parse & Validate Fields (2.1)
Next: SSM-Clock Stamp – Clock Consistency (2.3)