-
Website
http://www.codespatter.com -
Original page
http://codespatter.com/2008/08/04/a-new-simple-way-to-salt-your-hashes/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
itjobs1
1 comment · 2 points
-
billymcclure
1 comment · 1 points
-
Ben Bangert
1 comment · 2 points
-
jakubmusil
1 comment · 1 points
-
dobrych
1 comment · 3 points
-
-
Popular Threads
While I don't have an example of a specific weakness to MD5 to hand one of the basic rules of exploiting algorithms is knowing some of the source material or knowing about patterns within it.
The point of using a salt is to use a piece of unknown material which is unique in each string. It's common to generate random junk to use rather than anything meaningful.
As sh1mmer said, introducing patterns or predictability into a crypto system compromises the system's security.
There are many easy ways to easily generate a "secure" salt. Eg:
-Use a seeded PRNG in your language.
-Read from /dev/random .
-Use the ID of an object in your program/script.
Cheers,
Nick
However, there is certainly some value to generating a unique nonce for each hashed password, and storing it alongside the password. It doesn't have to be truly *random* though; since it's sitting right there in the record, it's not of the class of value like a private key where both entropy and secrecy matter. You can use the username, or the timestamp for when the password was reset, or any other easily-retrievable datum.
So, a salt should: Have non-printable and characters, characters with ord() > 128 and be unique per user. That way, every password is drawn (potentially) from the full space of available byte values, making lots of attacks harder.