Password peppers: when to add a separate secret key
What a pepper protects, how it differs from salt, and the key storage, rotation, and recovery decisions it adds.
Password peppers: when to add a separate secret key
A password pepper is an optional service secret used in an additional keyed-hash or encryption step for stored password hashes. Unlike a per-password salt, it must remain secret and separate from the password database. It may help when an attacker obtains only the database, but does not replace salts, a suitable costly password-hashing scheme, or login rate limits.
Salt and pepper differ
| Salt | Pepper | |
|---|---|---|
| Scope | Random value per password | Secret key shared by a service or defined scope |
| Storage | Alongside the hash | Separate from the password database |
| Change | New hash gets a new salt | Requires planned migration or reset |
“Pepper” is common operational terminology. NIST SP 800-63B-4 recommends an additional keyed-hash or encryption operation using a verifier-only secret key; it does not make pepper mandatory or a salt replacement.
Protection and limits
If only the database is stolen and the pepper remains inaccessible, verifying password guesses may be harder. Compromise of the pepper or application environment may remove this layer. Pepper does not make attacks impossible. Its value depends on the threat model and reliable key operations.
Decide before deployment
Define what remains protected after database-only exposure and after application compromise.
Keep the key in a separate protected secret store or HSM. Exclude it from database backups, source code, container images, and configuration files.
Record a non-secret key version with each verifier record.
Test rotation first. Plaintext passwords are not stored, so old hashes generally cannot simply be recomputed with a new pepper. Rehash after successful login; after key compromise, consider password resets and session revocation.
Plan availability, restricted recovery access, key loss, and retirement. Login verification may fail if the application cannot reach the pepper.
Follow library and secret-management documentation rather than inventing a construction. A security review should decide whether database-only protection justifies the added operational responsibilities.
Sources
[NIST SP 800-63B-4: Authenticator and Verifier Requirements](https://pages.nist.gov/800-63-4/sp800-63b/authenticators/)
[NIST SP 800-63B-4: Strength of Passwords](https://pages.nist.gov/800-63-4/sp800-63b/passwords/)