A hash function takes information, scrambles it, and returns a fixed length hash sum. Any given input should always return the same output.
You can see how a hash function works in the image below.
In the image we can see that no matter how long or short the input, a hash function returns an output that is the same length. The particular hash function used in the image (SHA-1) returns a 40-character string.*
There are a few features that good hash functions have:
Even when the input is similar, such as "The red fox runs across the ice" and "The red fox walks across the ice", the hash sum is very different. This is sometimes called an "avalanche effect."
Collision is Rare.
It should be very difficult to find two inputs that hash to the same output. This is called collision.
Hashes should be "one-way" functions, meaning they are easy to do one way (finding a hash sum from an input), but difficult to impossible to do in the opposite direction (moving from hash sum to an input).
* Most hash functions actually return a string of 0s and 1s that can then be encoded into letters and numbers for ease of reading.