/** * Hashing helpers. * * Two jobs: content addressing for exact duplicate detection, and privacy preserving identifiers so * that the corpus database can group by sender or subject without storing either. Salted hashes use * a per database salt, so a leaked database cannot be dictionary attacked against a known address * list without also leaking the salt. */ export declare function sha256(buf: Buffer | string): string; /** Short content hash, enough to group duplicates within a single corpus. */ export declare function shortHash(buf: Buffer | string): string; /** Keyed hash for values that must be groupable but never recoverable. */ export declare function saltedHash(salt: string, value: string): string; /** Generate a random salt for a new corpus database. */ export declare function newSalt(): string; /** * Deterministic 32 bit selector in [0, 1) derived from a key and a seed. * * Used for reproducible sampling: the same file always lands in the same position for a given seed, * without needing to hold the corpus in memory or shuffle it. */ export declare function deterministicUnit(seed: string, key: string): number; /** FNV-1a, 32 bit. Fast and good enough for shingling and simhash token weights. */ export declare function fnv1a32(value: string): number; /** Second, independent 32 bit hash so that two of them can form a 64 bit value. */ export declare function fnv1a32b(value: string): number; /** * 64 bit SimHash over whitespace separated tokens, returned as a 16 character hex string. * * Near duplicate detection matters for split hygiene: a template that appears thousands of times * must not be spread across train, validation and test. Hamming distance on this value is a cheap * first pass filter before any expensive comparison. */ export declare function simhash64(text: string): string; /** * Default Hamming distance below which two bodies are treated as near duplicates. * * Measured against a 300 character templated invoice mail: changing one identifier gives distance * 4, changing two fields gives 7, adding a sentence gives 6, and an unrelated message gives 30. * Eight therefore separates template variants from distinct content with a comfortable margin. * * Short bodies are noisier, because each token carries more of the signal. A one token change in a * 14 token message already gives distance 8. Callers comparing very short texts should either * tighten this or fall back to exact comparison. */ export declare const NEAR_DUPLICATE_THRESHOLD = 8; /** Hamming distance between two hex SimHash values. Returns 64 when either is malformed. */ export declare function simhashDistance(a: string, b: string): number; //# sourceMappingURL=hash.d.ts.map