A hash function is a special type of function used in cryptography. It takes an input, or 'preimage', and returns a fixed-size string of bytes, typically in the form of a 'hash code' or simply a 'hash'. This sensitivity to input changes is known as the 'avalanche effect'.