• how i can login from db using MD5
    crypt and decrypt  user and pw and login form
    is ther any idea tnks for all
  • 2 Comments sorted by
  • Vote Up0Vote Down WaqasWaqas
    172.00 Karma Accepted Answer
    hi @jsoncarousel welcome to forum you can get complete idea from this example

    Imports System
    Imports System.Security.Cryptography
    Imports System.Text

    Class Program

    Shared Sub Main(ByVal args() As String)
    Dim [source] As String = "Hello World!" 
    Using md5Hash As MD5 = MD5.Create()

    Dim hash As String = GetMd5Hash(md5Hash, source)

    Console.WriteLine("The MD5 hash of " + source + " is: " + hash + ".")

    Console.WriteLine("Verifying the hash...")

    If VerifyMd5Hash(md5Hash, [source], hash) Then
    Console.WriteLine("The hashes are the same.")
    Console.WriteLine("The hashes are not same.")
    End If 
    End Using 
    End Sub 'Main

    Shared Function GetMd5Hash(ByVal md5Hash As MD5, ByVal input As String) As String 

    ' Convert the input string to a byte array and compute the hash. 
    Dim data As Byte() = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input))

    ' Create a new Stringbuilder to collect the bytes 
    ' and create a string. 
    Dim sBuilder As New StringBuilder()

    ' Loop through each byte of the hashed data  
    ' and format each one as a hexadecimal string. 
    Dim i As Integer 
    For i = 0 To data.Length - 1
    Next i

    ' Return the hexadecimal string. 
    Return sBuilder.ToString()

    End Function 'GetMd5Hash

    ' Verify a hash against a string. 
    Shared Function VerifyMd5Hash(ByVal md5Hash As MD5, ByVal input As String, ByVal hash As String) As Boolean 
    ' Hash the input. 
    Dim hashOfInput As String = GetMd5Hash(md5Hash, input)

    ' Create a StringComparer an compare the hashes. 
    Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase

    If 0 = comparer.Compare(hashOfInput, hash) Then 
    Return True 
    Return False 
    End If 

    End Function 'VerifyMd5Hash
    End Class

    source :http://social.msdn.microsoft.com/Forums/en-US/ede9585a-f19d-43b2-b915-5fd0cd59236f/using-md5-in-vbnet

  • tnks bro  waqas i get the idea
    so i will create a login as md5
    and insert into table
    after user try login i must make this to verify and compar  to value  if  hash is same i login else try again
    nice bro tnks

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative