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

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -