SSM-Clock Stamp – Streaming Hash Equivalence (large file) (5.15)

Objective. Prove that streaming digests (chunked reads) equal monolithic digests for large files — deterministic, offline, plain ASCII.

Rule (must)

  • File digest is computed over the exact bytes:
    h_file = H_algo(file_bytes)
    where H_algo ∈ {sha256, sha3_256, blake2b-256} (per kv:algo or default sha256).
  • A streaming implementation that feeds fixed-size chunks to H_algo MUST produce the same 64-hex as a single-pass monolithic read.

Test plan (copy-ready)

  1. Generate a large file B (multi-GiB if possible).
  2. Compute monolithic digest:
    h_mono = H_algo(file_bytes)
  3. Compute streaming digest using fixed chunks (e.g., 1 MiB): init H for each chunk in read_binary(B, chunk_size): H.update(chunk) h_stream = H.final()
  4. Compare: h_stream == h_mono (string-equal, lowercase 64-hex).
  5. Stamp using either method (monolithic or streaming):
    SSMCLOCK1|iso_utc|rasi_idx|theta_deg|<h64>|<c64>[|kv:...]

Expected outputs (stdout, ASCII)

# digest parity
STREAM_EQ_MONO=true
# verification
HASH_OK=true CLOCK_OK=true CHAIN_OK=true
VERDICT=PASS

Why this holds

  • H_algo is a Merkle–Damgård (or sponge) style construction that supports incremental updates; digest depends only on byte order and content, not read strategy.
  • Stamps bind the printed hex (<h64>) regardless of how it was computed.

Operational notes (must/should)

  • Binary reads only; avoid text mode.
  • Print digest as lowercase 64-hex.
  • Do not include file path, size, or metadata in the hash — bytes only.
  • Large files: prefer streaming to bound memory while preserving exactness.
  • If kv:algo is present, compute with that algorithm; otherwise default sha256.

Common pitfalls (avoid)

  • Mixing chunk boundaries with transformations (e.g., newline normalization).
  • Uppercase hex or trimming leading zeros.
  • Hashing a decompressed or decoded view instead of raw bytes.
  • Accidentally hashing with a different algorithm than declared in kv:algo.

Navigation
Back: SSM-Clock Stamp – Algorithm Agility (file and chain digests) (5.14)
Next: SSM-Clock Stamp – Observed-Time Evidence Pack (5.16)