Cryptographic Hash Function
A cryptographic hash function maps arbitrary-length input to a fixed-length digest in a way that is deterministic, fast to compute, and infeasible to reverse or collide. Its security rests on three properties: preimage resistance, second-preimage resistance, and collision resistance.
A cryptographic hash function is a deterministic function that maps an input of arbitrary length to a fixed-length output called a digest or hash. Unlike ordinary hash functions used in hash tables, a cryptographic hash is designed to make several kinds of attack infeasible, which is what allows it to act as a compact fingerprint of data in signatures, message authentication, password storage, and Content-Addressable Storage systems. Three security properties define the standard threat model. Preimage resistance means that given a digest h, it is computationally infeasible to find any input m such that hash(m) = h — the function is hard to invert. Second-preimage resistance means that given a specific input m1, it is infeasible to find a different input m2 with hash(m1) = hash(m2). Collision resistance is the stronger property that it is infeasible to find any pair m1 ≠ m2 with the same digest at all. Collision resistance implies second-preimage resistance but not preimage resistance. Well-known families include the MD5 and SHA-1 constructions, both now considered broken for collision resistance, and the SHA-2 family (including SHA-256) and SHA-3, which remain the current standards for general-purpose cryptographic hashing. Because the output is a fixed-size representation of the entire input, even a one-bit change produces an essentially unrelated digest — the property that lets hashes serve as integrity checks, content addresses, and the building blocks of Merkle tree structures.