A hash function is a mathematical algorithm which takes an input (such as a string, file or other data) and produces a numerical output known as a “hash”. These hash values are unique to the original input, and should produce the same output for identical inputs, across multiple settings.
Hash functions are used in computer systems for various tasks such as securing data, quickly locating items in databases, verifying the integrity of files, and protecting passwords. Hashing algorithms are designed to be one-way functions – meaning that it is impossible to “unhash” or reverse a hash to its original form.
A hash function works by mapping all the characters of the input into a uniform value; the more characters entered into a given input, the larger and more unique is the generated output. This output serves as an identifying fingerprint of the input data; should even one character be changed, the output will be completely different.
For example, a sixteen character password might appear completely different from its original form after being hashed – but still generates the same output for that specific character set. Hash functions are used in various encryption protocols and for identity verification; for example, many websites use hashed versions of user passwords when logging into their accounts.
Additionally, digital signatures can also be created from hashes and used for verifying the legitimacy of documents and other information.