Programming Fundamentals: Hashing Functions

A hashing function maps some input data to a (smaller) output data set.
A very simple hashing function takes the input data and does a modulous operator on it.
Example of hashing
Consider for example, office numbers and a simple hash function:
Input (office number)Hash functionOutput
245245 mod 105
248248 mod 108
253253 mod 103
When two input values hash to the same output value, we call it a “collision”. Good hashing functions minimize collisions as well as the overall number of buckets.
In databases, hash functions are useful to quickly look up data records given an input key value.
In cryptography, hash functions are used to create message digests, digital signatures, responses to authentication challenges, etc.