MD5 hash for image

Hi,

I am trying to hash a jpg image in my documents directory. I have this but am not sure it is correct.

[lua]
local crypto = require “crypto”
local path= system.pathForFile( “image.jpg”, system.DocumentsDirectory )
local fh, errStr = io.open( path, “rb” )
if fh then
local contents = fh:read( “*a” )
md5 = crypto.digest( crypto.md5, contents)
print("hash= " … md5)
else
print("errStr: " … errStr)
end
[/lua]

I get a hash but it is not matching up with the MD5 the server is putting out.

Thanks for any help. [import]uid: 39370 topic_id: 36366 reply_id: 336366[/import]