← New search

Other meanings of Cryptographic hash function

Cryptography

Cryptographic hash function

A cryptographic hash function is a mathematical algorithm that converts data of arbitrary length into a fixed-size digest, supporting integrity checks, authentication protocols, and digital signatures. A secure design makes it computationally impractical to recover an input from its digest or to find two suitable inputs with the same digest.

256 bits
Common digest length
SHA-256 produces a 256-bit output
2⁻²⁵⁶
Ideal random-match probability
Probability that a chosen input matches a particular 256-bit digest
3 core properties
Security objectives
Preimage, second-preimage, and collision resistance
1

Definition and core properties

A cryptographic hash function maps an input of any length to a fixed-length string called a hash value, digest, or fingerprint. Standardized examples include SHA-2 and SHA-3, whose outputs have fixed sizes regardless of whether the input is a short message or a large file.12 The function is deterministic: identical inputs produce identical digests, while a small input change should produce an apparently unpredictable change in the result.

Security is described through three related goals. Preimage resistance makes it difficult to find an input for a given digest; second-preimage resistance makes it difficult to find a different input with the same digest as a specified input; and collision resistance makes it difficult to find any two different inputs with equal digests. These are computational properties, not mathematical guarantees that collisions do not exist.

2

Uses in authentication and signatures

Hash functions usually protect the integrity of data by making an altered message produce a different digest. A stored digest can reveal accidental or unauthorized modification, although a bare digest does not authenticate its source because anyone can recompute it. Authentication therefore combines hashes with secret-key mechanisms such as HMAC, which is specified for use with approved hash functions.3

Digital-signature systems commonly sign a message digest rather than the entire message, reducing the amount of data processed by the public-key operation while binding the signature to the message content. Signature standards specify how the digest is encoded and which hash algorithms are acceptable; the hash alone is not a signature and does not provide non-repudiation.4 Hashes also support certificate fingerprints, software checksums, content-addressed storage, and Merkle trees, where parent digests summarize pairs or groups of lower-level data.

3

Algorithms, strengths, and failure modes

SHA-2 remains a widely deployed family, including SHA-256 and SHA-512, while SHA-3 uses the Keccak sponge construction and provides a structurally different standardized design.12 Digest length affects generic collision security: an ideal n-bit hash has roughly 2n/2 collision work because of the birthday effect, whereas generic preimage search requires roughly 2n trials. These estimates assume an idealized attack model and do not replace analysis of a particular algorithm or protocol.

MD5 and SHA-1 are unsuitable for collision-sensitive security applications because practical collision attacks have been demonstrated. A broken hash should not automatically be treated as useless for every historical or non-adversarial purpose, but new designs should follow current standards and transition guidance. Secure systems also domain-separate related uses, validate algorithm identifiers, and avoid silently accepting weaker legacy digests.

4

Lesser-known aspects

Hash security depends as much on protocol construction as on the primitive itself. A hash can be collision-resistant yet unsuitable for password storage, because password databases require deliberately slow, memory-hard password-hashing schemes such as Argon2 rather than a fast general-purpose digest. Likewise, simple constructions that concatenate a secret with a message can be vulnerable to length-extension attacks for some hash designs; HMAC avoids this class of problem through its keyed composition.

Merkle trees are a particularly influential application: they let a verifier check that one item belongs to a large dataset using a short authentication path instead of downloading every item. The concept originated in Ralph Merkle's work on digital signatures and later became important in distributed systems, version control, blockchains, and authenticated databases. Hashes are also used in deduplication and reproducible-build workflows, where equal digests provide evidence of equal content but not an absolute proof against deliberate collision attacks.

Glossary

Digest
The fixed-size output produced by a hash function.
Collision
A pair of distinct inputs that produce the same digest.
Preimage resistance
The difficulty of finding an input that produces a specified digest.
HMAC
A keyed message-authentication construction built from a hash function.
Merkle tree
A tree of hashes that compactly authenticates the contents and structure of a dataset.

Digest security depends on the algorithm, output length, implementation, and protocol context; a hash value by itself is not encryption or authentication.