MD5Crypt is basically a replacement for the old-fashioned unix crypt function. It was introduced in freebsd, and has been adopted by other groups as well.
The basic idea is this:
- a hash is a good way to store a password
- you take the user's entered password and hash it
- compare it to the stored hash
- if the hash is the same, the passwords match
But there's a problem:
- Suppose you pick the password "jeff" and I also pick the password "jeff".
- Now both of our password hashes are the same.
- So if I see the stored hash codes, I will know your password is the same as mine, "jeff".
So, we can add a "salt" string to the password.
- This can be any random thing.
- Suppose for your account it is "zuzu" and for my account it is "rjrj".
- Now we hash the string "jeffzuzu" for your password, and "jeffrjrj" for my password.
- Now we have different hash values for our password.
- We can safely store the salt value with the hashed password, since even knowing the salt value won't help to decode the hash.
You mention .net, there's a pointer over in another forum to this:
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new
System.Security.Cryptography.MD5CryptoServiceProvider();
string hash =BitConverter.ToString((md5.ComputeHash(
System.Text.ASCIIEncoding.Default.GetBytes(stringtohash) ) ));
HTH!