API reference › @evolu/sqlite-wasm › computeSahPoolDigest

function computeSahPoolDigest(
  corpus: Uint8Array,
  flags: number,
): Uint32Array<ArrayBuffer>;

Defined in: packages/sqlite-wasm/src/SahPool.ts:1324

Computes the digest of a header's first sahPoolHeaderCorpusSize bytes, as opfs-sahpool does.

Without sahPoolDigestV2Flag in the flags, the digest is the legacy [0, 0]. Otherwise h1 starts at 0xdeadbeef and h2 at 0x41c6ce57; for each byte, h1 = Math.imul(h1 ^ byte, 2654435761) and h2 = Math.imul(h2 ^ byte, 104729); the digest is [h1 >>> 0, h2 >>> 0]. The result's bytes are written to the header as they are.