January 31st, 2004, 04:42 AM
Linux password salt...
When Linux uses the MD5 algorithm to hash passwords, it uses a different salt everytime. ie if I were to hash the word "cgkanchi" multiple times, I'd get a different hash each time. How does the passwd program know which salt to use when verifying the password? In other words, where is this "salt" value stored? It can't be in the shadow file or in the hash itself, because that would nullify the whole point of having the salt. So where???
January 31st, 2004, 11:46 AM
Re: Linux password salt...
It's in the shadow file.
In other words, where is this "salt" value stored?
No, it won't.
It can't be in the shadow file or in the hash itself, because that would nullify the whole point of having the salt.
Normally the salt is the first two characters of the crypted password. It's chosen randomly.
The purpose of the salt is to prevent someone who can read the passwords from using either precalculated hash values, or comparing the passwords of different users usefully.
In principle, if there was no salt, you could crypt all the words in a dictionary, and vastly decrease the time to crack a dictionary-based password (in fact, it could be immediate). If you had plenty of storage, it could crack a fairly complex password almost instantly.
But due to the fact that there are at least 3800 possible salts (i.e. two characters a-zA-Z0-9), this becomes much harder.
Two users with the same password will almost certainly have different salts, hence an attacker cannot know they are the same (unless he cracks them both).
I think that NT password hashes have no salt, hence two users with the same password have the same hash value.
January 31st, 2004, 12:30 PM
Thanks for the reply. Everything is much clearer now .
February 18th, 2004, 06:57 PM
Also, the /etc/shadow file is readable only by root and nobody else. Permissions are usually 0400 (-r--------).
And considering md5 is a 32-digit hash compared to crypt()'s inherent weak encryption, it's definitely a lot better to use!
We the willing, led by the unknowing, have been doing the impossible for the ungrateful. We have done so much with so little for so long that we are now qualified to do just about anything with almost nothing.