Table of Contents

Cryptography - Salt (init vector)

About

A salt is a text added to the password to make difficult an attack.

See also: Crypto - initialization vector (IV) or starting variable (SV)

The salt value is public (not secret) and should be generated at random for each new encryption stored with the password hash.

This means that two users with the same password will have different password hashes (assuming different salts are used).

Salts are closely related to the concept of nonce.

Both the salt value and the hashed password value are stored.

Characteristics

Random

A salt must not be:

If the salt is:

Large

A large salt value prevents precomputation attacks, including rainbow tables, by ensuring that each user's password is hashed uniquely.

The SHA2-crypt and bcrypt methods—used in Linux, BSD Unixes, and Solaris—have salts of 128 bits

Example

saltedhash(password) = hash(password || salt)

Or

saltedhash(password) = hash(hash(password) || salt)

Documentation / Reference