import type { Sha3Exports } from './types.js'; import type { Sha2Exports } from '../sha2/types.js'; /** FIPS 204 §5.4.1, approved pre-hash functions. Names follow the spec * spelling (no hyphens between SHAKE and the digit). The SHAKE entries * are XOFs with fixed output lengths set by FIPS 204 §5.4.1: * SHAKE128 → 256-bit (32-byte) output, SHAKE256 → 512-bit (64-byte). */ export type PreHashAlgorithm = 'SHA2-224' | 'SHA2-256' | 'SHA2-384' | 'SHA2-512' | 'SHA2-512/224' | 'SHA2-512/256' | 'SHA3-224' | 'SHA3-256' | 'SHA3-384' | 'SHA3-512' | 'SHAKE128' | 'SHAKE256'; /** Look up the FIPS 204 §5.4.1 OID DER bytes for `algo`. Returns a fresh * Uint8Array each call so callers can wipe / mutate without aliasing the * module-private constant. */ export declare function getOid(algo: PreHashAlgorithm): Uint8Array; /** FIPS 204 §5.4.1 PH_M byte length for `algo`. SHAKE128 / SHAKE256 are * XOFs but the spec fixes their HashML-DSA output to 32 / 64 bytes * respectively; the SHA-3 and SHA-2 entries return their natural digest * size. Used by `validateDigest` to bound the caller-supplied prehash. */ export declare function digestSize(algo: PreHashAlgorithm): number; /** True iff `algo` is one of the SHA-2 family pre-hashes (and therefore * requires `init({ sha2: ... })`). The SHA-3 family and SHAKE variants * use the same `sha3` module mldsa already requires. */ export declare function algoNeedsSha2(algo: PreHashAlgorithm): boolean; /** * Pre-hash dispatcher, applies the FIPS 204 §5.4.1 hash function `algo` * to message `M` and returns PH_M (the bytes that go into M' alongside * the OID). * * `sha2x` may be `undefined` if `algo` does not need the sha2 module * (i.e. SHA3-* / SHAKE*). When `algo` is a SHA-2 variant, the dispatcher * throws if `sha2x` is missing rather than NPE'ing on a member access. * The arrangement keeps sha2 strictly optional for pure-ML-DSA users and * SHA3-prehash HashML-DSA users. */ export declare function preHashMessage(sx: Sha3Exports, sha2x: Sha2Exports | undefined, algo: PreHashAlgorithm, M: Uint8Array): Uint8Array;