2.8. Cryptographic Hash Functions#

A cryptographic hash function is a special type of hash function designed for security applications. Cryptographic hash functions are widely used in security protocols because they provide a way to verify the integrity of data without revealing the original content. We’ll see this in the next lesson.

Like hash functions we’ve seen so far, the hash values are fixed length and are deterministic, meaning that for a given input they produce the same output.

Unlike general hash functions however, cryptographic hash functions must meet strict security properties which are explained below.

2.8.1. Preimage Resistance#

Given a hash value \(h(s)\), it should be infeasible to determine the original input data.

This ensures that sensitive data cannot be recovered from their hash.

2.8.2. Collision Resistance#

It should be infeasible to search through all possible inputs to find pairs that generate the same hash value.

This ensures that:

  • an attack cannot create two inputs with the same hash, which is useful to prevent malicious data substitution

  • an attacker cannot modify data while keeping the same hash, which is critical for digital signatures and file integrity checks.