Course contentsShow
← Computer Science
Lesson 2421 of 2,87254. Cryptography FundamentalsFree lesson

Properties of Cryptographic Hash Functions

Learning the three essential properties: preimage resistance, second preimage resistance, and collision resistance.

Properties of Cryptographic Hash Functions

What you'll learn: The three essential security properties that make a hash function cryptographically strong and trustworthy.

Why Properties Matter

You've learned what hash functions are—they take arbitrary data and produce fixed-size digests. But not all hash functions are cryptographically secure. A cryptographic hash function must satisfy three critical properties that prevent different types of attacks.

The Three Essential Properties

1. Preimage Resistance (One-Way Property)

Given a hash output h, it should be computationally infeasible to find any input m such that hash(m) = h.

Analogy: Like a paper shredder that's impossible to reverse—you can see the output strips but can't reconstruct the original document.

2. Second Preimage Resistance (Weak Collision Resistance)

Given an input m1 and its hash hash(m1), it should be computationally infeasible to find a different input m2 where hash(m1) = hash(m2).

Analogy: If you have a specific fingerprint, you shouldn't be able to craft a fake finger that produces the same print.

3. Collision Resistance (Strong Collision Resistance)

It should be computationally infeasible to find any two different inputs m1 and m2 such that hash(m1) = hash(m2).

Analogy: In a huge stadium, it should be impossibly hard to find any two people with identical fingerprints.

Why Each Property Matters

  • Preimage resistance protects password storage—attackers can't reverse hashes
  • Second preimage resistance prevents document forgery—can't substitute a malicious file for a legitimate one with the same hash
  • Collision resistance prevents digital signature attacks—can't create two contracts with the same signature

Key Takeaway: Cryptographic hash functions must be preimage resistant (one-way), second preimage resistant (can't find replacement), and collision resistant (can't find any matching pair) to be secure for real-world applications.