A hash function is a mathematical function that converts an input (or 'message') into a fixed-size string of bytes. The output is typically a 'digest' that is unique to each unique input.
Good hash functions are deterministic (same input always produces same output), fast to compute, and have a low probability of collisions (different inputs producing the same output).