Cyberstudy
1.4 In progress

Hashing

17 flashcards

Summary

A hash function turns input of any size into a fixed-size digest. The same input always gives the same digest, a tiny change gives a completely different one, and it is infeasible to work backward or to find two inputs with the same digest. Hashes verify integrity and store password verifiers.

In plain words

A hash function turns any data into a short fixed-length fingerprint. You can't turn the fingerprint back into the data, and even a tiny change gives a completely different result, which makes hashes perfect for integrity checks.

Detailed explanation

  • Hash function: A one-way algorithm that maps data of any length to a fixed-length value called a digest or hash.

Properties

  • Deterministic: The same input always produces the same digest.
  • Preimage resistance: Given a digest, it is computationally infeasible to find an input that produces it.
  • Collision resistance: It is infeasible to find two different inputs with the same digest.
  • Avalanche effect: Changing one bit of input changes about half of the output bits.

Uses

  • File integrity: Comparing a downloaded file's hash with the publisher's value shows whether it changed.
  • Password storage: Systems store a salted, slow hash of each password rather than the password itself.
  • Digital signatures: The signer signs the hash of a message rather than the whole message.

Algorithms

  • SHA-2: The Secure Hash Algorithm 2 family (SHA-256, SHA-384, SHA-512); the current standard choice.
  • SHA-3: A newer family with a different internal design, standardized as an alternative to SHA-2.
  • SHA-1: Deprecated because practical collisions exist; NIST plans to retire it fully by 2030.
  • MD5: Message Digest 5; broken because collisions are easy to produce. Use it only for non-security checksums.

Important terms

taken from the text above
Hash function
A one-way algorithm that maps data of any length to a fixed-length value called a digest or hash.
Deterministic
The same input always produces the same digest.
Preimage resistance
Given a digest, it is computationally infeasible to find an input that produces it.
Collision resistance
It is infeasible to find two different inputs with the same digest.
Avalanche effect
Changing one bit of input changes about half of the output bits.
File integrity
Comparing a downloaded file's hash with the publisher's value shows whether it changed.
Password storage
Systems store a salted, slow hash of each password rather than the password itself.
Digital signatures
The signer signs the hash of a message rather than the whole message.
SHA-2
The Secure Hash Algorithm 2 family (SHA-256, SHA-384, SHA-512); the current standard choice.
SHA-3
A newer family with a different internal design, standardized as an alternative to SHA-2.
SHA-1
Deprecated because practical collisions exist; NIST plans to retire it fully by 2030.
MD5
Message Digest 5; broken because collisions are easy to produce. Use it only for non-security checksums.

Examples & real-world scenarios

  • Comparing a download's SHA-256 with the value the publisher lists.
  • Storing password hashes instead of passwords.
  • MD5 gives 128-bit hashes; SHA-256 gives 256-bit hashes.

Scenario

A company distributes a firmware update and publishes its hash on a separate HTTPS page. Technicians hash the file before installing it, so a tampered copy is caught before it reaches any device.

Common mistakes

  • Calling hashing 'encryption'. It can't be decrypted.
  • Using MD5 for anything security-sensitive when a SHA-2 option exists.

Practical skills

  • Verify a file's integrity with a hash.

What I should remember

  • Hash: A fixed-size, one-way digest used to check integrity.
  • Collision: Two inputs giving the same hash; a secure hash makes this infeasible.
  • SHA-256: A widely used, secure SHA-2 hash.
  • MD5: Broken; not suitable for security.
  • Exam tip: Hashing is not encryption; there is no key and no way to decrypt.