Skip to content
uencoder

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)
    Output
    The pepper is required for verification

    Pepper 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

Related tools

References