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, 4:33 AM EDT
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/
Posted May 26, 2011, 3:11 AM EDT
VulpesRank #55 · 29.2K reputationPosted May 26, 2011, 10:08 AM EDT
Check out the example in MSDN (http://msdn.microsoft.com/en-us/library/system.security.cryptography.aescryptoserviceprovider.aspx).
Mayur GujrathiRank #666 · 3.6K reputationPosted May 26, 2011, 9:42 PM EDT
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
Posted May 26, 2011, 10:59 PM EDT
Mayur GujrathiRank #666 · 3.6K reputationPosted May 27, 2011, 4:22 AM EDT
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
Mayur GujrathiRank #666 · 3.6K reputationPosted May 27, 2011, 4:24 AM EDT
which i am not getting
Mayur GujrathiRank #666 · 3.6K reputationPosted May 27, 2011, 5:10 AM EDT
for giving valuable information