Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. 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. The
values returned by a hash function are called hash values, hash codes,
hash sums, checksums or simply hashes. Hash functions are mostly used to
speed up table lookup or data comparison tasks-such as finding items in
a database, detecting duplicated or similar records in a large file,
finding similar stretches in DNA sequences, and so on. A hash function
may map two or more keys to the same hash value. In many applications,
it is desirable to minimize the occurrence of such collisions, which
means that the hash function must map the keys to the hash values as
evenly as possible. Depending on the application, other properties may
be required as well. Although the idea was conceived in the 1950s, the
design of good hash functions is still a topic of active research.