A hashing function is a one way (non invertible function) that maps a set of inputs to a set of outputs:
hash(s) -> p
,
where for our purposes s
and p
are both strings. For any string s
we can find the hash by applying our hashing function, which will return a new string. This is a deterministic procedure in that given an s
, the same hash()
will produce the same p
. There is no inverse of the hash operation, so you cannot go from output to input:
hash^-1(p) -> s
.
It is also used to verify the integrity of data.