Concatenate all recorded per-chunk digests in ascending sequence order and hash the concatenation.
The lowercase hex-encoded SHA-256 of the ordered digest stream.
Discard all recorded chunk digests so the accumulator can be reused.
Hash one chunk and record its digest under the given sequence number.
Re-updating the same seq overwrites the previous digest.
Chunk sequence number, used to order digests at finalization.
The chunk payload to hash.
Order-independent, incremental SHA-256 accumulator for chunked transfers.
Because chunks may arrive out of order across parallel channels, each chunk is hashed independently and keyed by its sequence number. finalize concatenates the per-chunk digests in ascending sequence order and hashes the result, yielding a deterministic value both peers can compute and compare.
Remarks
The result is a digest-of-digests, not the SHA-256 of the whole file. Both sender and receiver must use this class to produce matching values.
By design this retains one 32-byte per-chunk digest until finalize, i.e. O(chunks) memory. This is an intentional space/verification tradeoff — it enables order-independent, resumable hashing across parallel channels — and is deliberately not redesigned into a streaming single-pass hash.