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)
whereH_algo ∈ {sha256, sha3_256, blake2b-256}(perkv:algoor defaultsha256). - A streaming implementation that feeds fixed-size chunks to
H_algoMUST produce the same64-hex as a single-pass monolithic read.
Test plan (copy-ready)
- Generate a large file
B(multi-GiB if possible). - Compute monolithic digest:
h_mono = H_algo(file_bytes) - 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() - Compare:
h_stream == h_mono(string-equal, lowercase64-hex). - 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_algois 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:algois present, compute with that algorithm; otherwise defaultsha256.
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)