What, exactly, is a hash function?
Before diving into hash functions, we need to recall the precise mathematical definition of a function. For those not algebraically-oriented, remember the form from your high school days: f(x) = y. That is to say: If we feed some input x into a function f, there will be some output y. For our cryptographic purposes, hash functions must fulfill four other specific criteria. They must be pre-image resistant, quick to compute, producers of fixed-length outputs, and collision-free. We’ll take a look at all of these in turn. First criterion: Hash functions are pre-image resistant, meaning that given output y, it is difficult to derive the input x. The pre-image resistance criterion is accomplished in a variety of ways; the key concept is that one or more steps must be irreversible. Most functions we encounter in our early education are reversible. Addition is reversible via subtraction, multiplication by division, and so on. For a hash function to work, there must be a step in the algorithm