Collision-resistant hash function
The purpose of a cryptographic hash function is to protect the integrity of data and prevent data tampering by mapping arbitrary length data to a fixed-length short digest output. The hash function must satisfy various properties such as pre-image resistance, collision resistance, and second pre-image resistance. Pre-image resistance ensures that it is difficult to guess the input given the hash of a random message. Collision resistance holds if it is practically impossible to find two inputs that hash to the same output. Second pre-image resistance requires that it is practically impossible to find a second input that hashes to the same output of a first input. Any collision-resistant hash function is also second pre-image resistant.
Hash functions are used as a component in many other cryptographic tools such as authenticated encryption, Merkle trees, and zero-knowledge proofs. The Zei cryptography module provides audited implementations of common hash functions such as SHA-2 and SHA-3.