[plt-scheme] Re: Message digests: md5, sha1, etc.

From: Kyle Smith (airfoil at bellsouth.net)
Date: Tue Feb 6 12:08:08 EST 2007

Jens Axel Søgaard <jensaxel at ...> writes:

> 
> Hi all,
> 
> Fresh of the press is set of bindings for the message digest
> algorithms of libcrypto:
> 
> <http://planet.plt-scheme.org/300/docs/soegaard/digest.plt/1/0/doc.txt>
> 

Hi Jens,

Here what I got on my fresh out of the box Mac Pro:
_____________________________________________________________________
Welcome to DrScheme, version 369.7-svn30jan2007 [3m].
Language: Textual (MzScheme, includes R5RS).
utils imported
Hi all,

Fresh of the press is set of bindings for the message digest
algorithms of libcrypto:

<http://planet.plt-scheme.org/300/docs/soegaard/digest.plt/1/0/doc.txt>

I have tested it on Windows, so I'd appreciate if a kind soul can
tell me, whether it works on OS X or Linux too. It ought to, but ...

Example: 
"900150983cd24fb0d6963f7d28e17f72"
¶=> 900150983cd24fb0d6963f7d28e17f72 
—————————————————————————————————————————————— 
"a9993e364706816aba3e25717850c26c9cd0d89d"
¶=> a9993e364706816aba3e25717850c26c9cd0d89d 
—————————————————————————————————————————————— 

Note that the libcrypto md5 is somewhat faster than (lib "md5.ss"): 
"311175294563b07db7ea80dee2e5b3c6"
¶=> 311175294563b07db7ea80dee2e5b3c6 
—————————————————————————————————————————————— 
#"311175294563b07db7ea80dee2e5b3c6"
¶=> 311175294563b07db7ea80dee2e5b3c6 
—————————————————————————————————————————————— 
cpu time: 24 real time: 25 gc time: 0
"311175294563b07db7ea80dee2e5b3c6"
¶=> cpu time: 16 real time: 15 gc time: 0 
¶=> 311175294563b07db7ea80dee2e5b3c6 
—————————————————————————————————————————————— 
cpu time: 7193 real time: 7253 gc time: 0
#"311175294563b07db7ea80dee2e5b3c6"
¶=> cpu time: 14734 real time: 15079 gc time: 0 
¶=> 311175294563b07db7ea80dee2e5b3c6 
—————————————————————————————————————————————— 
_____________________________________________________________________
I'd say quite a bit of a speed up (/ 7193 24) => 299.71
While you got (/ 14734 16) => 920.89
On my old XP box I got (/ 16641 31) => 536.81

Actually there is fairly good correlation between ratios of best times seen 
amonst machines: (/ 31 16) => 1.92 and (/ 16641 7193) => 2.31.  Although the 
same cardinality of best times seen for a machine doesn't hold for the two 
algorithms.  Well, I'm over analyzing this as usual, I was just trying to see 
how much you could trust the short run times of the faster algorithm, which 
are inherently less precise.

In short the functioning of the new bindings for libcrypto on both my XP Pro 
and Mac Pro boxes is nominal.

Much appreciated.

--kyle
airfoil at bellsouth dot com
schemekeys.blogspot.com
www.schemekeys.net




Posted on the users mailing list.