[Haskell-cafe] haskell crypto is reaaaaaaaaaally slow
Donald Bruce Stewart
dons at cse.unsw.edu.au
Tue Jun 19 23:24:00 EDT 2007
aeyakovenko:
> $ time ./md5sum ./md5sum
> [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132]
>
> real 0m4.790s
> user 0m3.688s
> sys 0m0.492s
>
> $ time md5sum ./md5sum
> 69fc348abbc0d811e17bb9037c655684 ./md5sum
>
> real 0m0.023s
> user 0m0.000s
> sys 0m0.008s
>
> this is my implementation using crypto
> (http://www.haskell.org/crypto/). Am I doing something wrong?
>
> module Main where
>
> import System
> import qualified Data.Digest.MD5 as MD5
> import qualified Data.ByteString as BS
>
> main = do
> args <- getArgs
> dt <- BS.readFile $ head args
> putStrLn $ show $ MD5.hash . BS.unpack $ dt
^^^^ ^^^^^^^^^
not a good idea.
You need an MD5 over bytestrings, not [Word8].
-- Don
More information about the Haskell-Cafe
mailing list