aborg85
asked on
Encryption SHA256
Hi Everyone,
I need to encrypt the password entered by the user. Does anyone know the code for SHA256?? please keep it as simple as possible. What i was able to find on the internet is this:
Protected Shared Function SHA256_Encrypt(ByVal Txt As String) As String
Dim sha As New SHA256Managed()
Dim ae As New ASCIIEncoding()
Dim Hash() As Byte = sha.ComputeHash(ae.GetByte s(Txt))
Dim sb As New StringBuilder(Hash.Length * 2)
Dim ndx As Integer
For ndx = 0 To Hash.Length - 1
sb.Append(Right("0" & Hex(Hash(ndx)), 2)) <----- the word right not being accepted
Next
Return sb.ToString
End Function
Now for some reason the word right is not being accepted and when i go over the word it tells me: "Cannot refer to an instance member of a class from within a shared method or shared method initilizer without an explict instance of the class"
this was taken from:
http://www.thescripts.com/forum/thread384017.html
Any ideas???
Thanks!
I need to encrypt the password entered by the user. Does anyone know the code for SHA256?? please keep it as simple as possible. What i was able to find on the internet is this:
Protected Shared Function SHA256_Encrypt(ByVal Txt As String) As String
Dim sha As New SHA256Managed()
Dim ae As New ASCIIEncoding()
Dim Hash() As Byte = sha.ComputeHash(ae.GetByte
Dim sb As New StringBuilder(Hash.Length * 2)
Dim ndx As Integer
For ndx = 0 To Hash.Length - 1
sb.Append(Right("0" & Hex(Hash(ndx)), 2)) <----- the word right not being accepted
Next
Return sb.ToString
End Function
Now for some reason the word right is not being accepted and when i go over the word it tells me: "Cannot refer to an instance member of a class from within a shared method or shared method initilizer without an explict instance of the class"
this was taken from:
http://www.thescripts.com/forum/thread384017.html
Any ideas???
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER