C

Cryptography › Module 1 › Lesson 1

BeginnerModule 1Lesson 1/5

What are Hash Functions?

Learn one-way digests, integrity checks, and why hashes are not encryption

15 min+48 XP3 quiz
Module progress1 of 5
a3f9c2…
Document → Hash digest (one-way)

Opening

A fingerprint, not a lockbox

Hashing is one of the most useful ideas in security—and one of the most misunderstood. People say “encrypted password” when they mean “hashed password.” Those are not the same. A hash is a one-way digest. You can verify data with it. You cannot (practically) reverse it to get the original.

1. What a Hash Function Does

A cryptographic hash function takes input of any size—a password, a file, a firmware image—and produces a fixed-length output called a digest. Good properties: • Deterministic — same input always yields the same hash • Avalanche effect — tiny input change → huge digest change • One-way — hard to find an input that produces a given digest • Collision resistant — hard to find two different inputs with the same digest

2. Hashing vs Encryption

  • Hashing

    One-way. No key to “decrypt.” Used for integrity and password storage.

  • Encryption

    Two-way with a key. Ciphertext can be turned back into plaintext if you have the key.

Hash a string with Pythonimport hashlib print(hashlib.sha256(b"cyberlium").hexdigest())

import hashlib
print(hashlib.sha256(b"cyberlium").hexdigest())

Integrity first use case

Download a Linux ISO, compare the published SHA-256 to your local hash. If they differ, do not trust the file.

Knowledge Check

1

A cryptographic hash is best described as:

Multiple choice

Knowledge Check

2

True or False: Hashing and encryption are the same operation.

True or False

Knowledge Check

3

If one byte of a file changes, a good hash should:

Multiple choice

Answer all 3 knowledge checks to continue. (0/3 answered)