Overview of Hash Functions
Modern cryptography has evolved with the convenient use of cryptographic hash function (CHF), which is an algorithm that maps data of arbitrary size (the “message”) to a bit array of a fixed size (a “hash”).
The hash function is practically infeasible to invert as it is a one-way function. The only ways to intercept the message would be via brute-force search, which iterates through possible inputs until it produces a match, or making use of a rainbow table of matched hashes.
Properties of Hash Functions
The ideal cryptographic hash function has the following properties:
- Deterministic: the same message always results in the same hash.
- Quick: designed to swiftly compute the hash value for any given message.
- Irreversibility: it is infeasible to generate a message that yields a given hash value, aka to reverse the process that generated the given hash value.
- Unique Inheritance: it is infeasible to find two different messages with the same hash value.
- Sensitivity to Change: a small change to a message should change the hash value so extensively that the new hash value appears uncorrelated with the old hash value ( avalanche effect ).
The SHA-1 hash function exhibits good avalanche effect (shown above).
When a single bit is changed the hash sum becomes completely different.
Cryptographic hash functions have many information-security applications, notably in digital signatures, message authentication codes (MACs), and other forms of authentication.
They may also be used as ordinary hash functions, to index data in hash tables, for fingerprinting, to detect duplicate data or uniquely identify files, and as checksums to detect accidental data corruption.
NOTE: In information-security contexts, cryptographic hash values are occasionally referred to as (digital) fingerprints, checksums, or just hash values, even though all these terms stand for more general functions with rather different properties and purposes.