It is a function that takes arbitrary-sized data and maps it to a fixed-size integer value.
Some uses cases of hash functions in cryptography are as follows:
Properties of good cryptographic hash functions are as follows:
It is a property of a hash function h for which it is computationally very hard to find two distinct inputs, A and B, for which h(A) = h(B).
It is computationally infeasible to invert a hash function (find an input that hashes to the given output). The following is not possible.
It is computationally infeasible to find a second input that hashes to the same output as the given input. e.g., Given h(Cat) = AB38DA, it is computationally very hard to find another input that maps to the same output.
Outputs of cryptographic hash functions usually are very large integers (represented in binary as bits). The output of the
A given input x to a hash function H will always generate the same output.
A small change in the input will result in a completely different output hash.
A hash function is puzzle friendly if no solution exists, which is better than just making random guesses. Thus, the only way to find a solution is the brute force which takes
The output size of a hash function is fixed and independent of the input size. The output size of the SHA-256 hash function is 256 bits for any arbitrary-sized input.
Free Resources