A hash function is any well-defined procedure or mathematical function that converts a large, possibly variable-sized amount of data into a small datum, usually a single integer that may serve as an index to an array (*cf.* associative array). The values returned by a hash function are called hash values, hash codes, hash sums, checksums or simply hashes.

A cryptographically strong hash function exhibits two features: it is *irreversible* and it minimizes *collisions*. Irreversibility means that the original data cannot be reconstructed from its hash. *Cf.* encryption, which *must* be reversible (see write-only memory.) A collision occurs when two different sets of data generate the same hash.

Hash functions are related to (and often confused with) checksums, check digits, fingerprints, randomization functions, and error-correcting codes. Although these concepts overlap to some extent, each has its own uses and requirements and is designed and optimized differently.

**NOTE:** The content of this tag was originally posted at StackOverflow.com