Salt
From Hak5
| This article (or section) may need to be wikified. Please help improve this article, especially its introduction, section layout, and relevant internal links. This article has been tagged since February 2007. |
"Salt" or "salting" a hash is a technique used to increase security for password hashes.
For every user name generated by a system, a random string of a fixed length would also be generated. This random string is called the “saltâ€. You would then store the username, the "salt" and the hash of the string formed by attaching the user's password to the "salt". If user Foo's password is "lamepassword" and the randomly generated "salt" is "Q2W#" then we'll hash "Q2W#lamepassword".
This encryption technique is very useful in delaying the success of a dictionary based attack. For example, if we have a system with multiple user accounts where a few of them use the same password, a dictionary attack on one user account could leave multiple accounts compromised.
This is where "salting" a hash comes in handy. We can use randomly generated "salts" to further secure user accounts. Accounts with the same passwords would have a unique "salt" making each account's hash different. While you could use one specific "salt" for all accounts, using a randomly generated one would be much more secure. A determined attacker could somehow obtain the "salt" you use and defeat the purpose of "salting" hashes in the first place.
By sticking with random strings, a dictionary attack would be unsuccessful. The attacker would not be able to calculate the hashes of every word in a dictionary once and then check every hash for matches anymore. Instead, the attacker would have to re-hash the entire dictionary for every "salt". A persistent attacker who has compromised a server will have to mount an entirely new dictionary attack against every user account's "salted" hash, rather than being able to quickly scan the list for known hashes.
"Salting" basically makes it pointless to attack every account at once when the password file is compromised. The attacker must start a whole new attack for each user account. Given enough time, Bawls, hot-pockets and weak passwords, an attacker can be successful.
If you interpret md5() as a function for creating an md5 hash, you could create the following example:
encrypted_hash = md5(original_password + unique_salt)


