StudyToCert

All certifications / Security+ / Lessons

CompTIA Security+ SY0-701 · Domain 1: General security concepts

Hashing, salting, key stretching

▶ Watch the overview video

Last reviewed October 6, 2026 · Leer en español

Explain it simpler

Hashing turns any piece of data into a short fixed-length fingerprint. The same input always gives the same fingerprint, but you cannot work backward from the fingerprint to the original. Websites store password hashes instead of real passwords. The weakness is that attackers can precompute fingerprints of common passwords and look for matches. Salting adds a random extra value, called a salt, to each password before hashing, so two people with the same password get different fingerprints and precomputed lists become useless. Key stretching runs the hashing many thousands of times, making each guess slow for an attacker. Imagine a cook who adds a unique secret spice to each person's soup and then simmers it for hours: nobody can easily guess the recipe, and copying it takes a very long time.

Friday afternoon at Maplewood Community College, a message lands in the security inbox: a forum post claims to have a copy of the student portal's user table. You pull up the database schema with Jordan from the development team. There is a column called password_hash, and Jordan says, a little too quickly, "We hashed them with SHA-256, so we're fine." You look at the table. No salt column. Two rows have exactly the same hash. Your stomach tightens. What does that matching pair tell an attacker, and what should the table have looked like?

A hash function takes input of any size and produces a fixed-length output called a hash, digest or fingerprint. The same input always gives the same hash, but even a one-character change produces a completely different result. A good cryptographic hash is one-way, meaning you cannot work backward from the hash to the input, and collision-resistant, meaning it is infeasible to find two different inputs with the same hash. Hashing protects integrity, not confidentiality: it does not hide data, it lets you detect whether data has changed. It is also the foundation of how systems should store passwords.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 7 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study Security+ for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the Security+ study plan