/** * Hash Algorithm Constants * * Constants used for various hash algorithms including FNV-1a, * SHA, and other cryptographic operations. * * @module utils/hash/constants */ /** * FNV (Fowler-Noll-Vo) Hash Algorithm Constants * * FNV-1a is a non-cryptographic hash function created by Glenn Fowler, * Landon Curt Noll, and Kiem-Phong Vo. It's designed to be fast while * maintaining a low collision rate. */ export declare const FNV_CONSTANTS: { /** * FNV-1a 32-bit prime number * Used as the multiplication factor in the hash algorithm * Decimal: 16777619 */ readonly FNV_32_PRIME: 16777619; /** * FNV-1a 32-bit offset basis * Initial hash value for FNV-1a 32-bit * Decimal: 2166136261 */ readonly FNV_32_OFFSET: 2166136261; /** * FNV-1a 64-bit prime number (as BigInt) * Used for 64-bit hash calculations * Decimal: 1099511628211 */ readonly FNV_64_PRIME: bigint; /** * FNV-1a 64-bit offset basis (as BigInt) * Initial hash value for FNV-1a 64-bit * Decimal: 14695981039346656037 */ readonly FNV_64_OFFSET: bigint; /** * Mask for 32-bit operations */ readonly MASK_32: 4294967295; /** * Number of bits for 32-bit hash */ readonly BITS_32: 32; /** * Number of bits for 64-bit hash */ readonly BITS_64: 64; }; /** * Hash Seed Constants * * Constants for deterministic random seed generation */ export declare const HASH_SEED_CONSTANTS: { /** * Maximum safe seed value for 31-bit positive integer * Used for compatibility with libraries expecting positive signed 32-bit integers * Value: 2^31 - 1 = 2147483647 */ readonly MAX_SAFE_SEED: 2147483647; /** * Maximum 32-bit unsigned integer * Value: 2^32 - 1 = 4294967295 */ readonly MAX_UINT32: 4294967295; }; /** * Hash Distribution Constants * * Constants for hash distribution and bucketing */ export declare const HASH_DISTRIBUTION_CONSTANTS: { /** * Default number of buckets for hash distribution */ readonly DEFAULT_BUCKET_COUNT: 10; /** * Default total buckets for percentage-based distribution * Same as MATH_CONSTANTS.PERCENTAGE_MAX for consistency */ readonly DEFAULT_PERCENTAGE_BUCKETS: 100; /** * Bit shift amount for simple hash algorithms * Used in polynomial rolling hash */ readonly HASH_SHIFT: 5; }; /** * SHA (Secure Hash Algorithm) constants */ export declare const SHA_CONSTANTS: { /** * SHA-1 output length in bytes */ readonly SHA1_LENGTH: 20; /** * SHA-256 output length in bytes */ readonly SHA256_LENGTH: 32; /** * SHA-384 output length in bytes */ readonly SHA384_LENGTH: 48; /** * SHA-512 output length in bytes */ readonly SHA512_LENGTH: 64; /** * SHA block size in bytes */ readonly SHA_BLOCK_SIZE: 64; /** * SHA-512 block size in bytes */ readonly SHA512_BLOCK_SIZE: 128; }; /** * MD5 hash algorithm constants */ export declare const MD5_CONSTANTS: { /** * MD5 output length in bytes */ readonly MD5_LENGTH: 16; /** * MD5 block size in bytes */ readonly MD5_BLOCK_SIZE: 64; }; /** * Hash encoding formats */ export declare const HASH_ENCODING: { /** * Hexadecimal encoding */ readonly HEX: "hex"; /** * Base64 encoding */ readonly BASE64: "base64"; /** * Base64 URL-safe encoding */ readonly BASE64URL: "base64url"; /** * Binary encoding */ readonly BINARY: "binary"; /** * UTF-8 encoding */ readonly UTF8: "utf8"; }; /** * Hash algorithm names */ export declare const HASH_ALGORITHMS: { /** * MD5 algorithm (deprecated for security, use only for checksums) */ readonly MD5: "md5"; /** * SHA-1 algorithm (deprecated for security) */ readonly SHA1: "sha1"; /** * SHA-256 algorithm */ readonly SHA256: "sha256"; /** * SHA-384 algorithm */ readonly SHA384: "sha384"; /** * SHA-512 algorithm */ readonly SHA512: "sha512"; /** * SHA3-256 algorithm */ readonly SHA3_256: "sha3-256"; /** * SHA3-384 algorithm */ readonly SHA3_384: "sha3-384"; /** * SHA3-512 algorithm */ readonly SHA3_512: "sha3-512"; /** * BLAKE2b algorithm */ readonly BLAKE2B: "blake2b"; /** * BLAKE2s algorithm */ readonly BLAKE2S: "blake2s"; /** * FNV-1a 32-bit algorithm */ readonly FNV1A_32: "fnv1a-32"; /** * FNV-1a 64-bit algorithm */ readonly FNV1A_64: "fnv1a-64"; }; /** * Murmur hash constants */ export declare const MURMUR_CONSTANTS: { /** * MurmurHash3 32-bit seed */ readonly MURMUR3_32_SEED: 0; /** * MurmurHash3 32-bit c1 constant */ readonly MURMUR3_32_C1: 3432918353; /** * MurmurHash3 32-bit c2 constant */ readonly MURMUR3_32_C2: 461845907; /** * MurmurHash3 32-bit r1 rotation */ readonly MURMUR3_32_R1: 15; /** * MurmurHash3 32-bit r2 rotation */ readonly MURMUR3_32_R2: 13; /** * MurmurHash3 32-bit m constant */ readonly MURMUR3_32_M: 5; /** * MurmurHash3 32-bit n constant */ readonly MURMUR3_32_N: 3864292196; }; /** * CRC (Cyclic Redundancy Check) constants */ export declare const CRC_CONSTANTS: { /** * CRC-32 polynomial */ readonly CRC32_POLYNOMIAL: 3988292384; /** * CRC-32 initial value */ readonly CRC32_INITIAL: 4294967295; /** * CRC-32 XOR output */ readonly CRC32_XOR_OUTPUT: 4294967295; /** * CRC-16 polynomial */ readonly CRC16_POLYNOMIAL: 40961; /** * CRC-16 initial value */ readonly CRC16_INITIAL: 0; }; /** * Type exports */ export type FnvConstant = (typeof FNV_CONSTANTS)[keyof typeof FNV_CONSTANTS]; export type HashSeedConstant = (typeof HASH_SEED_CONSTANTS)[keyof typeof HASH_SEED_CONSTANTS]; export type HashDistributionConstant = (typeof HASH_DISTRIBUTION_CONSTANTS)[keyof typeof HASH_DISTRIBUTION_CONSTANTS]; export type SHAConstant = (typeof SHA_CONSTANTS)[keyof typeof SHA_CONSTANTS]; export type MD5Constant = (typeof MD5_CONSTANTS)[keyof typeof MD5_CONSTANTS]; export type HashEncoding = (typeof HASH_ENCODING)[keyof typeof HASH_ENCODING]; export type HashAlgorithm = (typeof HASH_ALGORITHMS)[keyof typeof HASH_ALGORITHMS]; export type MurmurConstant = (typeof MURMUR_CONSTANTS)[keyof typeof MURMUR_CONSTANTS]; export type CRCConstant = (typeof CRC_CONSTANTS)[keyof typeof CRC_CONSTANTS]; //# sourceMappingURL=constants.d.ts.map