Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Are Salting and Peppering?

A salt is a unique random value stored with each password hash; a pepper is a secret held outside the database. Together they decide how long a stolen password table survives.

Illustration for the cybersecurity term Salting and Peppering
Home / Blog / Cybersecurity Terms / What Are Salting and Peppering?
17 November 2026

What Are Salting and Peppering?

What Are Salting and Peppering?

Two people on your platform choose the same weak password. Without a salt, their stored hashes are identical, and an attacker who cracks one has cracked both—and can spot every other account using that password at a glance. Salting and peppering are the two values that break this pattern, and the difference between them is where they live.

A salt is a random value generated separately for every password and stored alongside the hash. A pepper is a single secret value mixed into every password, held somewhere the database is not, such as an HSM, a key vault, or application configuration.

What a Salt Actually Prevents

A salt does not make an individual password harder to guess. What it destroys is economy of scale:

Salts are not secret and do not need to be. They must be unique per password, generated by a cryptographically secure random source, and at least 16 bytes. Never reuse a site-wide salt, and never derive one from the username or email address, because attackers can rebuild those.

Where a Pepper Fits

A pepper addresses a different scenario: the database is stolen but the application servers and key store are not. SQL injection, a misconfigured backup bucket, and a leaked read replica all produce exactly that outcome. Without the pepper the hashes cannot be attacked at all, because every guess is missing a secret input.

Two implementations are common. The simpler one applies an HMAC with the pepper as the key before passing the result into the password hash. The stronger one encrypts the finished hash with a key held in an HSM, so the secret never reaches application memory. Either way the pepper needs a rotation plan: version every pepper, store the version with the record, and re-wrap on next login.

Getting the Parameters Right

Salt and pepper only matter on top of a deliberately slow algorithm. The current OWASP guidance is Argon2id as first choice, with scrypt, bcrypt, and PBKDF2 as fallbacks where a vetted Argon2 binding is unavailable.

AlgorithmSuggested settingsSalt handling
Argon2id19 MiB memory, 2 iterations, 1 degree of parallelismGenerated and encoded automatically
bcryptWork factor 10 or above; passwords truncated at 72 bytes128-bit salt in the output string
PBKDF2-HMAC-SHA256600,000 iterationsSupplied by the caller—do not skip it

Raise the cost parameters as hardware improves, and re-hash on successful login when the stored parameters are below your current standard.

Mistakes We Find in Code Reviews

What UK Regulators Expect

Article 32 of the UK GDPR requires security measures appropriate to the risk, and the ICO’s guidance on passwords in online services is specific: hash with a unique salt per password and use a slow, purpose-built algorithm. Where a breach notification shows passwords were stored in plaintext or with a fast unsalted hash, the ICO treats that as a failure of technical measures rather than bad luck. Cyber Essentials and PCI DSS requirement 8.3.1 point in the same direction.

At Privia Security, we check password storage as part of our Web Application Security Services, including the legacy code paths that quietly undo a good implementation.

FAQ – Frequently Asked Questions

Does the Salt Need to Be Kept Secret?

No. A salt is stored in plain sight next to the hash, usually inside the same encoded string, and the scheme is designed to remain safe when the attacker has it. Its job is uniqueness, not secrecy. If you want a secret component, add a pepper and keep that outside the database, because trying to hide salts gives no extra protection and complicates verification.

Can I Add a Pepper to an Existing System?

Yes, and you do not need the original passwords. Apply the pepper to each stored hash, for example by encrypting it with a key in your key vault, and record which records have been converted. New and changed passwords then go through the full chain. Keep a version field so you can rotate the pepper later without another migration.

How Long Should a Salt Be?

At least 16 bytes from a cryptographically secure random generator, which is what Argon2id and bcrypt produce by default. Shorter salts start to collide once you have millions of accounts, which partially restores the attacker’s ability to batch work. There is no practical reason to go below 16 bytes, and nothing is gained by exceeding 32.

What Happens If the Pepper Is Lost?

Every password hash protected by it becomes unverifiable, and all users must reset their passwords. That makes pepper key management a genuine availability risk, so treat the value like any other critical key: store it in an HSM or managed key service, back it up under separate control, document the recovery path, and test that path before you rely on it.

Related Terms

You May Be Interested In These

What Are HTTP Security Headers?

Cybersecurity Terms

17 November 2026

What Are HTTP Security Headers?

Read More
What Is Command Injection?

Cybersecurity Terms

17 November 2026

What Is Command Injection?

Read More
What Is Security Posture?

Cybersecurity Terms

17 November 2026

What Is Security Posture?

Read More