Password salting explained: Learn how unique salts counter rainbow tables, why salted hashes can still be cracked, and how Argon2id strengthens storage.
👉 Master your Security+ skills with Pluralsight here: Pluralsight
You’ll learn what salting in password hashing is, how unique salts protect against rainbow tables, and why salted passwords can still be cracked. Build your CompTIA Security+ foundation by understanding how salts and algorithms like Argon2id work together for secure password storage.
Chapters: 0:00 Intro 0:12 What is a salt in password hashing? 1:04 Why does salting protect stolen password hashes? 1:52 How does salted password verification work? 2:59 Why isn’t salting enough for secure password storage? 4:11 Outro
Affiliate notice: Some links may earn a commission. Thanks for your support.
Key Takeaways
A salt is a unique, random, non-secret input to password hashing. Different salts make identical passwords produce different stored hashes, hiding matching-password patterns.
Salting defeats reusable cracking work, not password guessing. Unique salts undermine rainbow tables and require attackers to calculate guesses separately for each password record.
Secure storage needs both salts and a costly password-hashing algorithm.OWASP recommends Argon2id; a single salted SHA-256 calculation remains too fast.
Store the salt alongside the hash and verification settings. Reuse that salt during login verification; generate a fresh one when creating or replacing a password record.
Salted passwords can still be cracked offline. Weak passwords remain guessable, and salting does not prevent phishing or make password reuse safe.
Use a maintained password-storage library rather than custom cryptography. Follow its salt-generation guidance, use its verification function, and support upgrades to algorithms and cost settings.
👉 Turn password-security concepts into practical skills with Pluralsight, an optional next step offering guided labs, feedback, assessments, and certification practice.
Password salting adds a unique, random value to each stored password’s hashing process. This prevents attackers from efficiently reusing the same calculations across an entire password database.
The important distinction is that salted does not mean uncrackable. A salt makes password guesses less reusable; a suitable password-hashing algorithm makes each guess more expensive. Secure password storage needs both.
What Is a Salt in Password Hashing?
A salt is a unique, randomly generated, non-secret value supplied to a password-hashing algorithm for each stored password. Users do not choose it or need to remember it.
Here, the cost parameters control how much computational work, and, for algorithms such as Argon2id, memory, the process requires.
Hashing is different from encryption. Encryption protects information that can later be recovered with the appropriate key. Password hashing creates a one-way verification value: there is no decryption key that reveals the original password.
However, attackers can still guess a password, run it through the same hashing process, and compare the result with a stolen hash. Salting changes how efficiently they can do that across multiple accounts.
Why Passwords Need Unique Salts
Hashing is deterministic: identical inputs and settings produce identical outputs.
Without salts, two people using the same password will have the same hash when the same hashing procedure is used. This exposes matching-password patterns and lets attackers reuse work.
Password Salting Explained With an Example
Suppose Alice and Bob both choose River!Train7 as their password.
Account
Password
Salt
Stored result
Alice
River!Train7
Random salt A
Verifier A
Bob
River!Train7
Random salt B
Verifier B
These are symbolic labels, not actual hash values. With different salts, Alice’s and Bob’s stored results will almost certainly differ, even though their passwords match.
If an attacker calculates a guess using Alice’s salt, that result cannot simply be compared with Bob’s record. The attacker must calculate the guess again using Bob’s salt.
The salt does not hide the hashing procedure. It prevents one calculation from doing the same work across many accounts.
How Salts Reduce Reusable Attacker Work
Consider an illustrative database containing 100 password records and an attacker testing 1,000 candidate passwords:
Without salts: The attacker can compute the 1,000 candidate hashes once and look for matches across the database.
With unique salts: A straightforward test of every candidate against every record requires approximately 100,000 password-hashing evaluations.
This compares the number of evaluations, not exact cracking time. Hardware, algorithms, and cost settings also affect performance.
How Salting Protects Against Rainbow Tables
A rainbow table is a specialized precomputed structure used to help recover candidate passwords from hashes. Its value depends on reusing work completed before an attacker obtains a particular password database.
Unique, sufficiently large salts undermine that advantage. A table prepared for unsalted hashes does not directly solve records computed with independent salts.
An attacker would need salt-specific computations rather than one broadly reusable table. This is why salting is commonly described as a defense against rainbow tables.
It does not, however, prevent an attacker from making fresh guesses against an individual stolen record. As the OWASP Password Storage Cheat Sheet explains, salts belong alongside strong password-hashing algorithms, not in place of them.
How Salted Password Storage and Verification Work
A website does not need to recover your original password to check whether you entered it correctly. It needs to repeat the appropriate calculation and verify the result.
When a Password Is Created or Changed
A typical password-storage process:
Receives the password.
Generates a fresh random salt.
Runs a suitable password-hashing algorithm with the salt and selected cost settings.
Stores the information needed for later verification.
The stored record generally contains:
Algorithm identifier
Algorithm version, where applicable
Cost parameters
Salt
Derived password hash
The plaintext password is not part of this verification record.
Some libraries combine these fields into a single encoded string. Others may store the salt separately. Both arrangements can preserve the information needed for verification.
When the User Logs In
During login, the system:
Retrieves the existing password record.
Reads its salt, algorithm, and cost settings.
Processes the submitted password using those same settings.
Checks whether the result matches.
The system does not generate a new salt for this comparison. A different salt would change the computation.
Instead, it reuses the stored salt. A fresh salt is appropriate when creating or replacing a password record, including when an application upgrades the record’s protection.
There is also no “removing the salt” or decrypting the hash. The salt is an input to verification, not a removable layer.
Why Storing the Salt Beside the Hash Is Safe
A salt’s protection depends on uniqueness, not secrecy.
An attacker who steals the salt and hash can attempt password guesses, but each guess must be computed with that record’s salt. Knowing the salt does not restore the ability to reuse one result across all independently salted accounts.
NIST’s password-verifier guidance calls for storing salts and hashes, along with algorithm and cost information needed to support future migration.
Why Salting Alone Is Not Enough
Adding a salt to a fast hash does not make that hash slow.
For example, a single salted SHA-256 calculation is still fast, allowing an attacker to test many guesses. SHA-256 can be used within a password-based construction such as PBKDF2-HMAC-SHA-256, but that is different from applying SHA-256 once.
Password-storage algorithms deliberately make each guess consume resources.
Password-Hashing Algorithms and Work Factors
Algorithm
Role in password storage
Argon2id
Preferred modern choice in OWASP guidance
scrypt
Alternative when Argon2id is unavailable
bcrypt
Primarily an option for legacy systems
PBKDF2-HMAC-SHA-256
Common option where FIPS-related requirements apply
A work factor describes settings that control computational expense. Argon2id includes memory, pass-count, and parallelism parameters.
This creates two complementary protections:
Unique salts prevent efficient reuse of calculations across records.
Appropriate cost settings increase the resources required for each guess.
A longer salt cannot substitute for an adequate work factor. Likewise, an expensive algorithm should not be used with one fixed salt for every account.
Salt vs. Hash vs. Encryption vs. Pepper
These terms describe different parts of password protection.
A pepper is commonly shared across multiple password records and stored outside the password database, such as in a secrets-management system or hardware security module.
Unlike a salt, its protection depends on secrecy. Peppering can supplement proper password hashing, but it does not replace unique salts or suitable algorithms.
Can Salted Passwords Still Be Cracked?
Yes. If attackers obtain password records, they can perform an offline attack: testing guesses against those records without sending requests to the live login service.
For each candidate password, they use the stolen record’s salt, algorithm, and cost settings, then check for a match.
A weak or predictable password may still be guessed. Salting does not make it more unpredictable; it makes the attacker’s calculations less reusable.
Salting also does not make password reuse safe. If Alice’s password is recovered, an attacker can try that same password elsewhere. Different salts at other services do not change the fact that the attacker now knows the password.
What Salting Does Not Protect Against
Threat
Separate protections involved
Salting addresses stored password verification. It is not a complete defense for every stage of authentication.
How to Implement Password Salting Safely
For application developers, the practical approach is to use a maintained password-storage library rather than designing a custom hashing scheme.
A sound implementation should:
Generate fresh, cryptographically random salts for new password records.
Use a suitable password-hashing algorithm, such as Argon2id.
Store the algorithm and cost metadata needed to verify and later upgrade records.
Use the library’s verification function rather than manually recreating comparisons.
Avoid a fixed application-wide salt or a username or timestamp as a substitute for random salt generation.
Salt-generation behavior depends on the API. For example, PHP’s password_hash() generates salts automatically, and password_verify() uses the stored record for verification. Lower-level interfaces may require the application to supply and retain the salt.
For Argon2, RFC 9106 recommends a 16-byte salt that is unique for each password. In practice, follow the selected library’s documented guidance rather than choosing salt lengths or constructing encoded records by hand.
Build Practical Password-Security Skills
Understanding salts helps you evaluate password-storage designs: look for unique salts, a suitable password-hashing algorithm, and appropriate cost settings, not simply a claim that passwords are “hashed.”
If you are studying cybersecurity or preparing for Security+, applying these concepts can help reveal gaps that reading alone may miss. Pluralsight is an optional next step with guided security labs, feedback, assessments, and certification practice resources.
👉 Practice with Pluralsight to apply what you’ve learned, find weak spots, and focus your next study session.
Affiliate notice: Some links may earn a commission. Thanks for your support.
Next
FAQ
Quick answers to the questions people usually ask about this topic.
Should I add my own salt to a password before entering it?
No. Password salts should be generated and managed by the application’s password-storage library, not by users. Any extra text you type becomes part of your password; it does not replace server-side salting. As a user, focus on a long, unique password for each account and enable MFA where available.
What happens if two password records accidentally use the same salt?
If both records also use the same algorithm and cost settings, an attacker can reuse a candidate-password calculation across those records. Identical passwords would also produce identical hashes. A collision does not immediately reveal either password, but it weakens the separation salts provide. Cryptographically random, sufficiently large salts make accidental collisions extremely unlikely; RFC 9106 recommends 16-byte salts for Argon2.
How can an application upgrade old, unsalted password hashes?
A common approach is to upgrade each record after a successful login: verify the password using the old method, then pass the submitted password to a modern password-hashing library with a fresh salt and suitable cost settings. Replace the old record with the new verifier. Accounts that do not log in may need a password-reset process. The original password cannot simply be recovered from an old hash for migration.
Does hashing a password in the browser replace server-side salting?
No. Simply hashing a password in the browser does not remove the need for secure server-side password storage or HTTPS. In a basic design where the server accepts the same browser-generated hash at every login, that hash can become a reusable password equivalent. Specialized authentication protocols are different, but a homemade client-side hashing step is not a substitute for a sound password-storage design.
Can I tell whether a website salts passwords from its login page?
Usually not. A login form, HTTPS padlock, or claim that passwords are “hashed” does not reveal how passwords are stored. Look for technical documentation describing a suitable password-hashing algorithm, unique salts, and cost settings. Developers and auditors can verify the implementation by reviewing the password-storage code, library configuration, and stored-record format.
How can I practice password-security concepts for CompTIA Security+?
Practice evaluating sample storage designs: identify fixed or missing salts, distinguish fast hashes from password-hashing algorithms, and explain why offline guessing differs from online login attacks. If you want guided labs, feedback, assessments, and certification practice resources, explore Pluralsight as an optional next step to apply the concepts and identify gaps in your preparation.
Affiliate link — I may earn a commission at no additional cost to you.
Jay's Recommendation
Turn understanding into hands-on confidence
You've built the foundations. Pluralsight adds opportunities to practice in guided security labs, get feedback, and check your knowledge with assessments and practice exams, so your next step is more than another video.
đź› Put concepts to workBuild practical skills with guided security labs and feedback.
🎯Find your weak spotsUse assessments to focus on what needs more work.
📝Check your understandingUse practice exams to guide your certification preparation.
đź§Give study sessions directionOrganize further learning with curated paths and progress tracking.