Compute MD5 digest of file in Haskell -


using haskell, how can compute md5 digest of file without using external tools md5sum?

note: question intentionally shows no effort answered right away.

one option use puremd5 package, example if want compute hash of file foo.txt:

import qualified data.bytestring.lazy lb import data.digest.pure.md5  main :: io () main =     filecontent <- lb.readfile "foo.txt"     let md5digest = md5 filecontent     print md5digest 

this code prints the same md5 sum md5sum foo.txt.

if prefer one-liner, can use 1 (the imports same above):

lb.readfile "foo.txt" >>= print . md5 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

methods - python can't use function in submodule -

c# - ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) -