A hash function is any function that can be used to map data of any size to a fixed sized value.

Typically this fixed sized value will also have an arbitrary max value too.

Hashing a value is a non-reversible operation.


Use cases

Hash functions are commonly used for:

  • Storing passwords securely (non-reversible operation)
  • Hash Maps

Operation

A hash function does three things to the input data to produce the output:

  1. Convert the arbitrary length input data to a fixed length with parity preserving operators
  2. Scramble the bits of the key appropriately so that the values are uniformly distributed over the keyspace
  3. Map the values into ones that fit in the defined output size