I've been playing with adding anti-spam hash-cash stamping support to Mozilla/Thuderbird, and it requires calling sha1 many, many times in a loop. I have a hacked-together version that works, but I'm struggling with the right way to call sha1. The stamping is extremely CPU intensive with respect to computing hashes, so I'd like the code to be near optimal. This is important because the spammers will have every incentive for their stamp code to be near optimal, and the whole system works best if the good-guy stamping is about as fast as the bad-guy stamping.

Anyway, the question is: what's the best way to call sha1 many times in a loop from Mozilla C++?

It seems like the best candidates are the HASH_Begin() etc.
functions in http://lxr.mozilla.org/seamonkey/source/security/nss/lib/cryptohi/sechash.h

But with my very primitive understanding of XPCOM and my makefile.in, I cannot get that to compile. I saw the new nsICryptoHash.idl, but I think that's too new for the mozilla 1.7.8 I'm targetting, and it also seems to create more overhead than makes sense in this case, forcing a re-init of the context for every hash.

Anyway, any help is much appreciated.

Thanks,

Nick

_______________________________________________
mozilla-crypto mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-crypto

Reply via email to