Private Function ObtenerMD5(ByVal fichero As String) As String
Dim cadenaMD5 As String = ""
Dim cadenaFichero As FileStream
Dim bytesFichero As [Byte]()
Dim MD5Crypto As New MD5CryptoServiceProvider
cadenaFichero = File.Open(fichero, FileMode.Open, FileAccess.Read)
bytesFichero = MD5Crypto.ComputeHash(cadenaFichero)
cadenaFichero.Close()
For Each datos As Byte In bytesFichero
If datos < 16 Then
cadenaMD5 &= "0" & datos.ToString("X")
Else
cadenaMD5 &= datos.ToString("X")
End If
Next
Return cadenaMD5
End Function