MD5-Hash in Listbox

Hi,

i want to write a MD5-Hash of a filename in a listbox, but i only get some wired characters. The output at my console (OS X) print the right hash-output for every file.

This is how my code looks like:

[code] Dim hashMeFolder As FolderItem = SpecialFolder.Desktop

If hashMeFolder Is Nil Then
Return
End If

Dim count As Integer = hashMeFolder.Count

For i As Integer = 1 to count
Dim f As FolderItem = hashMeFolder.Item(i)
If f <> Nil Then
ListBox1.AddRow(f.Name)
Listbox1.Cell(Listbox1.LastIndex, 1) = MD5(f.Name)
End If
Next[/code]

Whats my mistake?

istbox1.Cell(Listbox1.LastIndex, 1) = EncodeHex(MD5(f.Name))

To clarify, the result of a hash algorithm will be bytes (well, bits, really), not something meant to be human-readable. Convert the result to hex as Joachim suggested.

Thanks, works perfect.

Kem:

That is not what the example let us understand:

Dim s as String
s=MD5(“Hello world”)

A change in the example have to be done, so no one will even thing the result can be human readable.

Thank you for your answer.

I’ve updated the Language Reference.