Simple/beginner level explanation of salt

I'm a beginner to cryptography and looking to understand in very simple terms what salt is, when I might need to use it and why I should/should not use it. Can anyone offer me a very simple and clear explanation please?

If you know of any references I might read on the topic, these would also be useful in addition to your explanation.

-
I've edited your question to encourage explanations that should help, and the inclusion of references to help you out. I would however be inclined to take Jalaj's advice - definitely have a read around. If you can include in your questions what you're not understanding, you'll get a lot more out of the site. It is completely OK to quote the relevant parts of a reference you're not understanding and ask for clarification - in fact, that's better. The more precise you are about what you don't understand, the more we can help you :) Do feel free to edit in anything you specifically want covered. – Antony Vennard Jan 30 '12 at 14:51

The reason that salts are used is that people tend to choose the same passwords, and not at all randomly. Many used passwords out there are short real words, to make it easy to remember, but this also enables for an attack.

As you may know, passwords are generally not stored in cleartext, but rather hashed. If you are unsure of the purpose of a hash-function, please read up on that first.

Now, what the attackers can do is to simply generate a list of common passwords and their corresponding hashes. Comparing the hashes that a site has stored with the table will, if common passwords are being used, reveal the passwords to the attacker.

A salt is simply added to make a common password uncommon. A salt value is generated at random and can be fairly small, the only purpose is to lower the probability that the hash-value will be found in any precalculated table. A common way to combine the salt and the password is to simply concatenate them, i.e. the stored hash value is Hash(salt||password). The common password "password1" now magically becomes, e.g., "6\$dK,3password1" and is very unlikely to be found in a table.

The salt can be stored completely in the clear in the database, next to the hashed value. Once the attacker has the database and wants to find the passwords, he needs to generate the precalculated table for each salt individually, a costly operation.

Yet another way to defend against this kind of attack is to slow down the attacker. This can be achived by iterating the hash-function many times, i.e. storing Hash(Hash(Hash(Hash.....(Hash(salt||password)))...). Also, a pepper can be used, which is another random value concatenated to the password, such that the stored value is Hash(pepper||salt||password). The pepper is then not stored at all and therefore all possible values of the pepper need to be tested when trying to log in. Using 8 bits for the pepper give 256 possible values, which is very fast when the true user tries to log in. However the attack will work 256 times slower since all pepper values need to be tested for each password!

-

It is a random number that is needed to access the encrypted data, along with the password.

If an attacker does not know the password, and is trying to guess it with a brute-force attack, then every password he tries has to be tried with each salt value.

So, for a one-bit salt (0 or 1), this makes the encryption twice as hard to break in this way. A two bit salt makes it four times as hard, a three bit salt eight times as hard, etc. You can imagine how difficult it is to crack passwords with encryption that uses a 32-bit salt!

-
No. Salt is usually assumed to be known to the attacker. In this case, past some low threshold, salt does not improve security. – fgrieu Mar 7 '12 at 20:24
"Salt is usually assumed to be known to the attacker" -> Who is assuming this? – Mike Mar 8 '12 at 14:45

Refer to the wikipedia page on cryptographic salt. I will always suggest you to exploit internet more before posting a question here. Google search usually give you a very good reference on any matter!

-