The purpose of a hash function is to transform any amount of data into a compact, uniform value. The input can be of arbitrary length but the output is always the same length.
The length is decided by the hash function; it can be as small or large as desired.
Hash functions have many different uses, but all uses rely on the same fundamental properties:
If your hashing function has an output with 3 characters and you feed it 1MM pieces of data, much of it will result in the same output. However, if the output is long enough, a good hash function will have no collisions (two inputs resulting in the same output).
With a strong hashing function, we have the ability to take any data and compress it into a verifiable signature.
If the data is public, then anyone can recreate the signature and verify that the data matches its label. If the data is private, it can form the basis of identity.
Any private information fed into a (good) hash function will instantly become lost but form the basis of a unique, un-replicable signature.
Source Material - Twitter Link
Source Material - PDF