RTCForge API Reference v1.1.1
    Preparing search index...

    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.

    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.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Concatenate all recorded per-chunk digests in ascending sequence order and hash the concatenation.

      Returns Promise<string>

      The lowercase hex-encoded SHA-256 of the ordered digest stream.

    • Hash one chunk and record its digest under the given sequence number. Re-updating the same seq overwrites the previous digest.

      Parameters

      • seq: number

        Chunk sequence number, used to order digests at finalization.

      • bytes: Uint8Array

        The chunk payload to hash.

      Returns Promise<void>