Define Hash Functions.
The primary objective of a hash function is to verify data integrity, as any alteration to even a single bit in the input message will, with high probability, produce a different hash code.
A cryptographic hash function is an algorithm specifically designed for security applications.
It must be computationally infeasible for an adversary to perform attacks significantly more efficient than brute force to either invert a hash result or find two distinct inputs that map to the same hash value.
Requirements of Cryptographic Hash Functions:
For a hash function to be cryptographically secure and effective in practice, it must satisfy seven fundamental requirements:
1. Variable Input Size: The function H can be applied to a data block or message of any arbitrary size.
2. Fixed Output Size: The function H produces a fixed-length output regardless of how large or small the input message is.
3. Efficiency: H(x) is relatively easy and fast to compute for any given input x, making both software and hardware implementations practical.
4. Preimage Resistance (One-Way Property): For any given hash value h, it is computationally infeasible to find an input y <> such that H(y) = h. This property ensures that the original message or a shared secret cannot be recovered simply by observing the hash value.
5. Second Preimage Resistance (Weak Collision Resistance): For any given message x, it is computationally infeasible to find a different message y<>× such that H(y) = H(x) This property prevents an attacker from forging an alternative message that yields the same hash code as a known message.
6. Collision Resistance (Strong Collision Resistance): It is computationally infeasible to find any pair of distinct inputs (x,y) such that H(x) = H(y). This prevents attacks where an adversary prepares two different messages with identical hash values to trick a signing authority.
7. Pseudorandomness: The output of H meets standard tests for pseudorandomness, producing hash values that appear evenly distributed and random.