A cryptographic hash function is a deterministic algorithm that converts data of any size into a fixed-size string of bytes, commonly called a hash value, digest, or fingerprint. Unlike general-purpose checksums, a cryptographic hash is designed to resist deliberate manipulation: small changes to the input produce a dramatically different output and it should be computationally infeasible to reverse or to find two different inputs that produce the same digest. For general background see hash function and for focused material consult sources on cryptographic hash functions.
Key properties
- Determinism: the same input always yields the same digest.
- Fixed output size: output length does not depend on input length.
- Preimage resistance: given a digest it should be infeasible to find an input that produces it.
- Second-preimage resistance: given a specific input, it should be infeasible to find a different input with the same digest.
- Collision resistance: it should be infeasible to find any two distinct inputs with the same digest.
- Avalanche effect: small input changes cause large, unpredictable changes in the digest.
Design and historical development
Early practical functions include MD4 and MD5; later widely used examples are the SHA family. Structural designs such as the Merkle–Damgård construction and sponge constructions underpin many designs. Cryptanalysis over time has revealed weaknesses in some older algorithms (for example practical collisions for MD5 and weaknesses in SHA-1), prompting replacements and a standards-driven process to select robust algorithms. The NIST competition that selected the Keccak sponge as SHA-3 is a notable modern milestone in the field.
Common uses and examples
Cryptographic hashes appear in digital signatures, certificate integrity checks, secure random generation, message authentication codes (HMAC), and blockchain systems where block headers include hashes to link blocks. For password storage they are used together with salts and specialized key-derivation or memory-hard functions (bcrypt, scrypt, Argon2) because raw hash functions alone are vulnerable to brute-force attacks when inputs have low entropy.
Security considerations and distinctions
Not all hash functions are suitable for cryptographic use; non-cryptographic hashes prioritize speed and distribution but lack resistance to adversarial inputs. Some constructions are vulnerable to length-extension attacks or structural weaknesses; protocols and primitives like HMAC and authenticated encryption are designed to mitigate these problems. Progress in cryptanalysis and advances in computing continue to shape recommended algorithms and output sizes.
Overall, cryptographic hash functions are foundational primitives in modern information security: they provide compact representations of data used for verification, authentication, and as building blocks for higher-level cryptographic schemes.