On Tue 05 Dec 2006 06:16, "|/|/ Bendick" wbendick@gmail.com writes:
Anyone have (or know of) an efficient way of getting a sha1 digest of some data in gambit?
All I could find was http://www-pu.informatik.uni-tuebingen.de/users/knauel/sw/myscsh/sha1.scm which (after minor hacking) can do:
(time (sha1-hash-byte-vector (make-u8vector 1000000))) 301187 ms real time 135097 ms cpu time (130412 user, 4685 system) 25815 collections accounting for 108377 ms real time (46618 user, 1795 system) 3598449540 bytes allocated no minor faults no major faults 1090135108572819471271096978636225236080936489142
Way too slow for even moderately large data. Can anyone help?
Note that the SHA1 implementation you are referring to is intended for computing the digest of very small messages, i.e. MySQL password data (about 20 bytes), and not as a general purpose implementation of SHA1. There are lots of possibilites to improve the speed of this code (especially, when running it on Gambit). But I don't care; it just doesn't make a difference for the intended purpose (which is: access MySQL databases without having to link scsh against libmysqlclient).
However, if you are interested in a fast version of the SHA1 code I would recommend to change the code to use Gambit's homogeneous vectors (u32-vectors) and fixnums. This change would be very cheap and I would expect it to increase the speed considerably.
-Eric