[Haskell-cafe] MD5?

Andrew Coppin andrewcoppin at btinternet.com
Fri Nov 9 16:05:58 EST 2007

Neil Mitchell wrote:
> Hi
>> The final alternative is that I just call MD5SUM.EXE from my Haskell
>> program and try to parse the output. But that strikes me as rather messy.
> Messy, but I don't see any disadvantage to doing it this way - if you
> can control that the MD5SUM program is installed alongside your code.

Ooo... it's all coming back to me now...

The MD5SUM.EXE file I have chokes if you ask it to hash a file in 
another directory. It will hash from stdin, or from a file in the 
current directory, but point-blank refuses to hash anything else. So I'd 
have to write my Haskell code to open the file I want and *pipe* it to 
stdin on MD5SUM.EXE (making sure to not translate line ends or anything 
else that will alter the hash code). Then I have to parse the output and 
change it to actually match the UNIX md5sum program. [Because I want to 
make it compatible with that.] That also involves some fun with line ends...

> Of course, there is the standard Crypto library for Haskell,
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Crypto-3.0.3
> - either:
> 1) it goes fast enough
> 2) it goes too slow and someone should make it go faster
> Either way, it should go fast enough as soon as someone needs it to go faster.

I see. Well, I'll see if I can get that working, and then we'll see 
about making it faster! :-D

More information about the Haskell-Cafe mailing list