Dinesh Ambaliya

Dinesh Ambaliya

  • NA
  • 42
  • 80k

Problem in using GetHashCode method

Oct 10 2012 6:59 AM
I have used GetHashCode() to encrypt password field.
When new user is created the password entered by user is stored in hascode value like
string pswd = txtPassword.text.GetHashCode();
then this pswd string is stored in database. After that when user login to his account then again I convert user's entered value in hascode value like
string userPassword = txtEnterPassword.text.GetHashcode();
Then I check the value of the password saved in database and user's text is matching or not. This working fine in my development server.
But when I uploaded this page in live server it's not working. When user create new account and after that he try to login with his correct password he cannot login to the page.
I searched the solution in msdn then I readed this line: 'The default implementation of the GetHashCode method does not guarantee unique return values for different objects.' What I should to do now. Please anyone have any idea?

Answers (6)