Hi,
While saving password in DB doing hashing and saved into DB. While doing unhashing the password getting different hash value. In web.config in "securityCryptographyConfiguration" I have defined algorithmType as "System.Security.Cryptography.SHA1Managed" and saltEnabled = true.
If I define saltEnabled = false I'm getting same encryption value for all the password.
can any one help me how to do that????
Revathi.
Loading
Revathi MurugesanPosted May 17, 2011, 2:20 AM
Revathi MurugesanPosted May 17, 2011, 1:19 AM
Ex: user want to change the existing password. The entered password value while doing hashing I suppose to get existing hash value which is stored against the user password. But I'm getting different value everytime while doing hashing. For that i'm using following code in web.config.
<
securityCryptographyConfiguration>hashProviders>add name="CapMonHashProvider" type="Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.HashAlgorithmProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
algorithmType="System.Security.Cryptography.SHA1Managed, mscorlib, System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
saltEnabled="true" />hashProviders>securityCryptographyConfiguration>can you tel me which algorithm type I should use.
Andrew FensterPosted May 16, 2011, 9:50 AM
Posted May 16, 2011, 8:10 AM
http://www.codeproject.com/KB/web-security/encrypt.aspx
http://madskristensen.net.web7.reliabledomainspace.com/post/Simple-and-efficient-password-encryption-in-NET.aspx
http://www.ratajik.com/CreateNetPassword/
Abhimanyu K VatsaPosted May 16, 2011, 5:40 AM
You can place the chcekbox to select either SHA1 or MD5. If you wish to use one then edit the code line
FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "SHA1 or MD5");
Hope this helps you.
Jaganathan BantheswaranPosted May 16, 2011, 2:16 AM
A good Article here. Surely you will get another idea instead of hashing.