Solved

vb.net Decode a SHA1 hash

Posted on 2009-04-07
4
3,495 Views
Last Modified: 2012-05-06
I am using the function below to create an SHA1 hash of a username & password

now, given the username and the hash, how can i recover the password?

Private Function CreateHash(ByVal user As String, ByVal pass As String) As String

        Dim hashAlg As SHA1 = SHA1.Create

        Dim hashvalue() As Byte = hashAlg.ComputeHash(System.Text.Encoding.Default.GetBytes(UCase(user) & ":" & UCase(pass)))

        Dim hashstring As String = ""

        For Each b As Byte In hashvalue

            hashstring += b.ToString("x2")

        Next

        hashAlg = Nothing

        hashvalue = Nothing

        Return hashstring

    End Function

Open in new window

0
Comment
Question by:sgaggerj
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
OBonio earned 500 total points
ID: 24088432
A hash is not asymmetric which means it is one way.  Once hashed, you can't, in theory, 'unhash'.  You use hashes by comparing.  ie, input data is hashed and compared to previously computed hashes.
0
 
LVL 1

Author Comment

by:sgaggerj
ID: 24088690
that's what i figured....
0
 
LVL 8

Expert Comment

by:OBonio
ID: 24094892
If you're trying to unhash, you could look up rainbow tables....
0
 
LVL 1

Author Comment

by:sgaggerj
ID: 24097591
Took a look and it seems a lot more time consuming that I want to spend (cpu cycle wise) on doing what i wanted.
I found a workaround.

Essentially i had a login w/ a 'remember me' box that saved the login info - but when the app is updated the settings get overwritten and the user needs to type in the login/pass again.

i added a field to my db table with the user/pass hash and store that locally instead in a separate file that never gets written over. more secure and gets the job done.

thanks!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this era, as you know, cybercrime and other sorts of frauds using the internet has increased day by day. We should protect our information assets and confidential information from getting exploiting by the attacker or intruders. Most of the fraud…
When the confidentiality and security of your data is a must, trust the highly encrypted cloud fax portfolio used by 12 million businesses worldwide, including nearly half of the Fortune 500.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now