Hash functions work by taking an input (or 'message') and returning a fixed-size string of bytes. The output is typically a 'digest' that uniquely represents the input data. Even a small change in the input will produce a significantly different hash value, making it easy to detect alterations.