kenqtade's picture
Use ken-q org namespace for project Spaces
0865492
Raw
History Blame Contribute Delete
1.02 kB
/**
* gearhash-jit — Fast GEAR rolling hash for content-defined chunking.
*
* Uses a tiny hand-written WASM module with native i64 arithmetic.
* The hash state is kept as raw bytes in JS (avoiding BigInt in the hot path)
* and written to WASM memory only for the `nextMatch` call.
*/
export { GEAR_TABLE } from "./table.js";
export declare class Hasher {
private readonly maskBytes;
/**
* The current 64-bit rolling hash state as 8 little-endian bytes.
* Updated after every `nextMatch` call. Zeroed by `resetHash()`.
*/
readonly hash: Uint8Array;
constructor(mask: bigint);
/**
* Scan `buf` for the next gear-hash match. The internal hash state
* carries over between calls (for split-buffer scanning).
*
* @returns 1-based byte position of the match, or -1 if none found.
*/
nextMatch(buf: Uint8Array): number;
/** Reset rolling hash to zero (call when starting a new chunk). */
resetHash(): void;
}
//# sourceMappingURL=index.d.ts.map