A hash function is a mathematical function that takes an input value, and produce a smaller value in some particular range. The hash function is considered good if the distribution of values in the smaller range is uniform for the anticipated values in the source space.

The input values will commonly be a representation of a string (a message or a key.)

Hash functions are commonly used in computer programming for efficient searching; by hashing an input value, you get a smaller number, which can be used as an index into a table. The original values are then usually stored as a linked list under each hash entry.

For some more specialized cases of hash functions, see Secure Hash Functions and Perfect Hash Functions.