Pepper
A pepper is a server-side secret added during password hashing (unlike a salt, it is globally shared and kept secret), raising the difficulty of offline attacks.
Purpose
To add a server secret on top of the salt, so a database leak alone is insufficient to crack passwords offline.
Mechanism
H(password || salt || pepper). The pepper is globally shared but secret (stored in config/HSM, not the database). On a database leak, attackers without the pepper cannot hash offline. The salt remains unique per user. If the pepper leaks, protection degrades to salt-only.
Use cases
- Hardened password hashing
- Extra protection after a database leak
- Storing the pepper in an HSM
- Compliance requirements
Examples
- Input
H(pass + salt + pepper)OutputThe pepper is required for verificationPepper kept secret
Common errors
- Storing the pepper in the database (the same one as the hashes)
- Keep the pepper in config/HSM, separate from the database
Related terms
Salt
A salt is a random value added during password hashing so identical passwords produce different hashes, defeating rainbow tables and same-password detection. GLOSSARY
Hash Salting
Hash salting is adding a random salt to the hash input so identical inputs produce different hashes, defeating rainbow tables and collision detection. GLOSSARY
PBKDF2
PBKDF2 (Password-Based Key Derivation Function 2) is the KDF standardized in PKCS#5 that derives keys from passwords via iterated HMAC, widely used for password hashing and key derivation. GLOSSARY