CyberGlossary

Cryptography

Cryptographic Hash Function

Also known as: Hash function, Message digest

Definition

A deterministic one-way function that maps arbitrary-length input to a fixed-length digest, designed to be collision-, preimage-, and second-preimage-resistant.

A cryptographic hash function compresses input of any length into a short fixed-size output (the digest or hash) while satisfying three security properties: preimage resistance (hard to find x given H(x)), second-preimage resistance (hard to find x' ≠ x with H(x') = H(x)), and collision resistance (hard to find any pair x ≠ x' with H(x) = H(x')). It is also deterministic, fast, and produces digests that look random. Hash functions underpin digital signatures, MACs (HMAC, KMAC), password storage (with KDFs like Argon2 or scrypt), integrity checks, Merkle trees, blockchains, and content addressing. MD5 and SHA-1 are broken (practical collisions) and only acceptable for legacy non-security uses; SHA-256, SHA-3, and BLAKE2/BLAKE3 are the modern recommended families.

Examples

  • Git uses SHA-1 (transitioning to SHA-256) to identify commits and objects.
  • TLS certificate fingerprints are typically SHA-256 hashes.

Related terms