Skream Example Posted April 15, 2011 Report Posted April 15, 2011 Public Function MD5CalcFile(ByVal filepath As String) As String Using reader As New System.IO.FileStream(filepath, IO.FileMode.Open, IO.FileAccess.Read) Using md5 As New System.Security.Cryptography.MD5CryptoServiceProvider Dim hash() As Byte = md5.ComputeHash(reader) Return ByteArrayToString(hash) End Using End UsingEnd FunctionPrivate Function ByteArrayToString(ByVal arrInput() As Byte) As String Dim sb As New System.Text.StringBuilder(arrInput.Length * 2) For i As Integer = 0 To arrInput.Length - 1 sb.Append(arrInput(i).ToString("X2")) Next Return sb.ToString().ToLowerEnd FunctionFunction getMD5Hash(ByVal strToHash As String) As String Dim md5Obj As New Security.Cryptography.MD5CryptoServiceProvider Dim bytesToHash() As Byte = System.Text.Encoding.ASCII.GetBytes(strToHash) bytesToHash = md5Obj.ComputeHash(bytesToHash) Dim strResult As String = "" For Each b As Byte In bytesToHash strResult += b.ToString("x2") Next Return strResultEnd FunctionDump from my Visual Studio folder. Most likely I got it off the net, so credits to whoever originally created it. I use it a lotUsage:dim MD5Str as string = getMD5Hash("abc")dim FileMD5 as string = MD5CalcFile("c:\boot.ini") Quote