Iam getting 3 :frown::frown::frown:errors while trying the below code for storing the password of registered user as md5 hash and performing hash check at time of login...
please help me out.... thanks in advance !!!
ERRORS WHICH I AM GETTING:
1. Value of type '1-dimensional array of Byte' cannot be converted to 'Byte'.
2. Overload resolution failed because no accessible 'ComputeHash' can be called with these arguments:
'Public Function ComputeHash(buffer() As Byte) As Byte()': Value of type 'Byte' cannot be converted to '1-dimensional array of Byte'.
'Public Function ComputeHash(inputStream As System.IO.Stream) As Byte()': Value of type 'Byte' cannot be converted to 'System.IO.Stream'.
3.Expression is of type 'Byte', which is not a collection type.

please help me out.... thanks in advance !!!
VB.NET:
Option Strict On
Imports System.IO
Public Class LoginForm1
#Region "Functions"
Private Function stringtomd4(ByRef content As String) As String
Dim MS As System.Security.Cryptography.MD5CryptoServiceProvider
Dim bytestring As Byte = System.Text.Encoding.ASCII.GetBytes(content) ' ERROR 1 IS ON THIS LINE
bytestring = MS.ComputeHash(bytestring) ' ERROR 2 IS ON THIS LINE
Dim finalstring As String = Nothing
For Each bt As Byte In bytestring ' ERROR 3 IS ON THIS LINE
finalstring &= bt.ToString("x2")
Next
Return finalstring.ToUpper()
End Function
#End Region
Private Function createuser(ByVal user As String, ByVal pass As String) As String
If File.Exists(stringtomd4(user) & ",txt") = True Then
Try
My.Computer.FileSystem.WriteAllText(stringtomd4(user) & ".txt", stringtomd4(user) & _
Chr(32) & stringtomd4(pass), False)
File.SetAttributes(stringtomd4(user) & ".txt", FileAttributes.Hidden)
MsgBox("new user created")
Catch ex As Exception
MsgBox("something went wrong" & ex.Message)
End Try
Else
MsgBox("sorry !!! this username has already been taken..")
End If
Return user
Return pass
End Function
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Try
If stringtomd4(usernameTxtbox.Text) & Chr(32) & stringtomd4(passwordTxtbox.Text) = _
IO.File.ReadAllText(stringtomd4(usernameTxtbox.Text) & ".txt") Then
MsgBox("welcome")
Else
MsgBox("Wrong username/password")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Private Sub register_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles register.Click
createuser(usernameTxtbox.Text, passwordTxtbox.Text)
End Sub
End Class
ERRORS WHICH I AM GETTING:
1. Value of type '1-dimensional array of Byte' cannot be converted to 'Byte'.
2. Overload resolution failed because no accessible 'ComputeHash' can be called with these arguments:
'Public Function ComputeHash(buffer() As Byte) As Byte()': Value of type 'Byte' cannot be converted to '1-dimensional array of Byte'.
'Public Function ComputeHash(inputStream As System.IO.Stream) As Byte()': Value of type 'Byte' cannot be converted to 'System.IO.Stream'.
3.Expression is of type 'Byte', which is not a collection type.
