Good Morning all,
I have got a MD5 has function that accepts a string and returns the hash in hex. I am comparing the result with 3 online hashers to ensure the value is correct however something very strange appears to be happening, They come back with the same code accept mine is missing a random 0. Exmaples:
String: test
My hash: 98F6BCD4621D373CADE4E832627B4F6
Online: 098f6bcd4621d373cade4e832627b4f6
String abcdef
My Hash: E8B501798950FC58AAD83C8C14978E
Online: e80b5017098950fc58aad83c8c14978e
String: 123
My Hash: 202CB962AC5975B964B7152D234B70
Online: 202cb962ac59075b964b07152d234b70
As you can see a random 0 is missing from all of mine not always the first one. I am completely baffled by this.
Here is the functions code:
Please does anyone have any ideas as to what is going wrong. As for calling form code:
tboMD5StringEncrypted.Text = Encryptor.MD5Hash(tboMD5StringOrginal.Text)
I have got a MD5 has function that accepts a string and returns the hash in hex. I am comparing the result with 3 online hashers to ensure the value is correct however something very strange appears to be happening, They come back with the same code accept mine is missing a random 0. Exmaples:
String: test
My hash: 98F6BCD4621D373CADE4E832627B4F6
Online: 098f6bcd4621d373cade4e832627b4f6
String abcdef
My Hash: E8B501798950FC58AAD83C8C14978E
Online: e80b5017098950fc58aad83c8c14978e
String: 123
My Hash: 202CB962AC5975B964B7152D234B70
Online: 202cb962ac59075b964b07152d234b70
As you can see a random 0 is missing from all of mine not always the first one. I am completely baffled by this.
Here is the functions code:
Code:
Public Function MD5Hash(ByVal Input As String)
Dim Inputbytes() As Byte = ASCIIEncoding.ASCII.GetBytes(Input)
Dim OutputHash() As Byte = New MD5CryptoServiceProvider().ComputeHash(Inputbytes)
Dim Output As New StringBuilder(Inputbytes.Length)
For Each b As Byte In OutputHash
Output.Append(Conversion.Hex(b))
Next
Return Output.ToString()
End FunctiontboMD5StringEncrypted.Text = Encryptor.MD5Hash(tboMD5StringOrginal.Text)