/** * Cryptographic hash utilities using Node.js crypto (Bun compatible) * * Security considerations: * - Uses native SHAKE256 XOF when available (Node.js 12+) * - Falls back to counter-mode SHA3-256 construction * - Intermediate buffers are zeroized * - Domain separation uses length-prefixed encoding to prevent collisions */ /** * SHAKE256 extendable output function (XOF) * Uses native SHAKE256 when available, falls back to counter-mode SHA3-256 * * @param input - Input data to hash * @param outputLength - Desired length of output in bytes * @returns Hash output of specified length */ export declare function shake256(input: Uint8Array, outputLength: number): Uint8Array; /** * Fallback SHAKE256 implementation using counter-mode SHA3-256 * Only used when native SHAKE256 is unavailable * * SECURITY WARNING: This fallback construction: * - Is not a standard XOF and lacks formal security proofs * - May not provide the full security margin of native SHAKE256 * - Should only be used for compatibility; prefer native SHAKE256 * * For high-security applications, ensure native SHAKE256 is available. * * @param input - Input data to hash * @param outputLength - Desired length of output in bytes * @returns Hash output of specified length */ export declare function shake256Fallback(input: Uint8Array, outputLength: number): Uint8Array; /** * SHA3-256 hash * * @param input - Input data to hash * @returns 32-byte hash output */ export declare function sha3_256(input: Uint8Array): Uint8Array; /** * Hash multiple inputs with length-prefixed encoding * Uses length prefixes to prevent collision attacks from concatenation * e.g., H("AB", "C") != H("A", "BC") * * Format: [len1:4][data1][len2:4][data2]... * * @param inputs - Variable number of Uint8Array inputs * @returns Hash of concatenated inputs */ export declare function hashConcat(...inputs: Uint8Array[]): Uint8Array; /** * Domain-separated hash with length-prefixed encoding * Format: [1-byte domain length][domain bytes][input bytes] * * @param domain - Domain string (max 255 bytes) * @param input - Input data * @returns Hash output */ export declare function hashWithDomain(domain: string, input: Uint8Array): Uint8Array; /** * Query whether native SHAKE256 is available in this runtime. * Useful for application code that wants to enforce native-XOF availability * (recommended for production deployments). Returns true if native SHAKE256 * is available, false otherwise. */ export declare function isNativeShake256Available(): boolean; //# sourceMappingURL=shake.d.ts.map