0

i want to hash my password to SHA1 algo, in asp.net code and then want to compare it with hashed password in sql 2008 db, for login

so how to hash it in asp.net code ?

2
Contributors
7
Replies
8
Views
4 Years
Discussion Span
Last Post by HunainHafeez
1

So, this is not my area of expertise, but this is what I've done in the past....

Sub hashMe(ByVal pswd As String)
    Dim password As String = FormsAuthentication.HashPasswordForStoringInConfigFile(pswd, "SHA1")
    Response.Write(password)
End Sub

I'd suggest some additional research and/or hopefully getting some additional responses.

Edited by JorgeM

0

ok jorgem i converted it into c# and tried, it worked but the problem is that SHA1 i used in sqlserver2008 and the one i used in asp.net(c#), produces different hashes, which couldn't be compared at time of login ,

1

I suspect that the problem there is the way the string is being treated, differently in your asp.net page vs sql. (encoding).

1

Depending on the level of security required, you should consider salted password hashing.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.