Salt
A unique random value stored with each password hash so identical passwords produce different hashes and precomputed tables fail.
A salt is random data, typically 16 bytes, generated per password and fed into the hash. It is not secret; it is stored alongside the hash (inside the PHC string for Argon2id and bcrypt). It defeats rainbow tables and forces an attacker to crack each account separately, and two users with the same password no longer share a hash.
It does nothing to slow down a targeted guess against one account; that is the job of a slow hash such as Argon2id. People also confuse it with a pepper, which is secret and held outside the database. A fixed, application-wide "salt" is neither.
Salts also appear in key derivation (HKDF's extract step) and in keyed pseudonymisation, where an unsalted hash of an email address or phone number is trivially reversible by hashing every candidate.
Learn it properly
Compared
Also used in
- AEAD and nonce disciplineSecEng · Applied cryptography engineeringFree
- Design an MFA and step-up serviceHLD · Design problems: Access & identityFree
- Design a password hasher with upgradeable parametersLLD · Problems: first security componentsFree
- Design a server-side session storeLLD · Problems: first security componentsFree
- Data minimisation and pseudonymisationSecEng · Privacy engineeringPro
- Design a credential storeLLD · Problems: Advanced componentsPro