dear all i am encrypting my password like this
but dont know how to decrypt
Function HashPassword(ByVal password As String) As String
Dim hashedPassword As String
Dim hashProvider As SHA256Managed
Try
Dim passwordBytes() As Byte
Dim hashBytes() As Byte
passwordBytes = System.Text.Encoding.Unicode.GetBytes(password)
hashProvider = New SHA256Managed
hashProvider.Initialize()
passwordBytes = hashProvider.ComputeHash(passwordBytes)
hashedPassword = Convert.ToBase64String(passwordBytes)
Finally
If Not hashProvider Is Nothing Then
hashProvider.Clear()
hashProvider = Nothing
End If
End Try
Loading

Posted May 27, 2011, 8:33 AM
SHA256 is one way algorithm and you can't decrypt it.
Now you want to compare the password with hashed values correct .
http://www.vbdotnetheaven.com/UploadFile/f5b919/7459/
Mayur GujrathiPosted May 27, 2011, 9:10 AM
for giving valuable information
Mayur GujrathiPosted May 27, 2011, 8:24 AM
which i am not getting
Mayur GujrathiPosted May 27, 2011, 8:22 AM
i did not get what you told
simply i want to say i am passing password HO and i am gettin
Tut9HyBycNwiwp/WSN5KPmG5cREufSrUsK6fQSvJ+I4=
now i want to decrypt it
Posted May 27, 2011, 2:59 AM
Mayur GujrathiPosted May 27, 2011, 1:42 AM
means if my password is of 2 words then 2 sqare box are coming as decrypted result
Public Function Crypt(ByVal inp As String, ByVal Key As String) As String
' encryption based on the ryndael algorithem
Dim Sbox(0 To 255) As Long
Dim Sbox2(0 To 255) As Long
Dim j As Long, i As Long, t As Double
Dim K As Long, temp As Long, Outp As String
For i = 0 To 255 'Create SBox #1
Sbox(i) = i 'and fill with
Next i 'successive values
j = 1
For i = 0 To 255 'Create SBox #2
If j > Len(Key) Then j = 1 'And fill with key
Sbox2(i) = Asc(Mid(Key, j, 1)) 'data, repeatedly
j = j + 1 'until the SBox is
Next i 'full
j = 0 'Initialize j
For i = 0 To 255 'Scramble SBox #1
j = (j + Sbox(i) + Sbox2(i)) Mod 256 'with data from
temp = Sbox(i) 'SBox #2
Sbox(i) = Sbox(j)
Sbox(j) = temp
Next
i = 0 'Initialize i
j = 0 'Initialize j
For x = 1 To Len(inp) 'Process the data passed on to us
i = (i + 1) Mod 256 'Increment i
j = (j + Sbox(i)) Mod 256 'Increment j
temp = Sbox(i) 'Scramble SBox #1
Sbox(i) = Sbox(j) 'further so that the encryptor
Sbox(j) = temp 'will never repeat itself
t = (Sbox(i) + Sbox(j)) Mod 256 'Get ready to create "random" byte
K = Sbox(t) 'Get "random" byte
Outp = Outp + Chr(Asc(Mid(inp, x, 1)) Xor K) 'Xor the data with the "random" byte
Next x
Crypt = Outp 'Return the Output Data
End Function
VulpesPosted May 26, 2011, 2:08 PM
Check out the example in MSDN (http://msdn.microsoft.com/en-us/library/system.security.cryptography.aescryptoserviceprovider.aspx).
Posted May 26, 2011, 7:11 AM