Reputation: 127
I have that methods (pseudocode):
string predefinedsalt = "03jf0j02j302jf0j3f08h3298fbckm91jr192jr091j2-r01"
string dynsalt(user)
{
return md5(user.id)
}
And to hash password I want to use one of these ways:
md5(user.password)
md5(user.password + predefinedsalt)
md5(user.password + dynsalt(user))
md5(md5(user.password) + dynsalt(user))
Which of these ways is more secure?
Upvotes: 0
Views: 75
Reputation: 24141
None of your suggestions is save for hashing passwords. Use a slow hash function with a cost factor like BCrypt, PBKDF2 or SCrypt and let the function generate a salt from the random source of the OS.
Password cracker tools already implement such combinations with MD5 out of the box, and MD5 is ways too fast. One can calculate about 100 Giga MD5 per second with common hardware.
Upvotes: 3