A hash function takes an input (or 'message') and returns a fixed-size string of bytes. The output is typically a 'digest' that uniquely represents the input data. However, because hash functions compress data into a smaller size, the possibility of different inputs producing the same hash value exists.