Overview

Hashing converts data into a fixed-length, one-way value — used to verify integrity and to store passwords without keeping plaintext.

Key concepts

  • Hash value / message digest, collisions
  • Salting and peppering passwords
  • SHA-256 (current) vs SHA-1/MD5 (deprecated)

How it works

Hashing converts data into a fixed-length value called a hash. A hash is designed to be one-way — the original data should not be recoverable from it. It's commonly used to verify integrity and to store passwords without keeping the plaintext.

Core terms

TermMeaning
Hash value / message digestThe fixed-length output created by a hashing algorithm (both terms mean the same thing).
Hash functionThe algorithm that creates a hash value from data.
CollisionWhen two different inputs produce the same hash value — a weakness in an algorithm.

Strengthening password hashes

TermMeaning
SaltRandom data added to a password before hashing, making password-cracking attacks harder.
PepperA secret value added to passwords before hashing, stored separately from the password database.

Common algorithms

AlgorithmStatus
SHA-256Commonly used, currently secure — produces a 256-bit hash value.
SHA-1Older, no longer recommended due to known weaknesses.
MD5Older, no longer considered secure for security purposes.