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 ?

Recommended Answers

All 7 Replies

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")
End Sub

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

@jorGem: thanks bro but need it in c#

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 ,

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.