I am working on a login form where I would like the user passwords to be encrypted, I don't have a clue how this works can someone please help. I am using c# to do this. I am not looking for something too tight though, I will be working with a 64-bit key for the password.
Thanks in advance
VulpesPosted Jul 25, 2012, 5:35 AM
VulpesPosted Aug 2, 2012, 9:41 AM
Avuya MxoliPosted Aug 2, 2012, 4:33 AM
VulpesPosted Jul 29, 2012, 2:01 PM
Incidentally, if you're happy with using a hash algorithm, I'd use SHA256 rather than MD5 which is much more secure as it uses a 256 bit rather than a 128 bit hash and is still reasonably quick.
Just replace MD5 with SHA256 in the two places it occurs in the above program.
You can also increase the security of hashing algorithms by hashing multiple times rather than just once which makes 'dictionary' attacks much more time-consuming. However, this may be out of place here if you're only looking for moderate security.
Avuya MxoliPosted Jul 29, 2012, 1:37 PM
VulpesPosted Jul 29, 2012, 11:54 AM
For passwords, this is usually all you need. You simply hash the password and store the hash in the database (you don't store the password as well).
If someone then enters their password to log in, you then compute the hash of the password entered and check it against the hash in the database. If they're the same, then the login can proceed.
Cryptographic hash algorithms are always such that the chance of a collision (i.e. two passwords having the same hash) are either zero or extremely slim.
Avuya MxoliPosted Jul 29, 2012, 11:44 AM
Avuya MxoliPosted Jul 25, 2012, 5:03 AM
VulpesPosted Jul 24, 2012, 11:12 AM
However, the weakest (and fastest) of these supported by the .NET Framework is MD5 which has a hash length of 128 bits:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5.aspx
If you're looking for something that has a hash length of only 64 bits, then you may have to write it yourself.
The DES symmetric algorithm has a 64 bit key length but I'd have thought it would be rather tedious to use for passwords:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.des.aspx