vincenthz / hs-cryptohash

efficient and practical cryptohashing in haskell. DEPRECATED in favor of cryptonite
Other
30 stars 24 forks source link

Add (experimental) Whirlpool support #7

Closed ghost closed 11 years ago

ghost commented 12 years ago

Hi,

I've just added experimental support for the Whirlpool hash. I copied the reference implementation (which is in the public domain), removed some cruft, and derived bindings. I hope it is good enough for inclusion in the cryptohash library.

Sincerely,

Stijn van Drongelen

vincenthz commented 12 years ago

Thanks, it's looking good !

i quite like to see a bit more cleanup on the C side before pulling this:

ghost commented 12 years ago

Done, done, and skipped for now. The rotation functions in whirlpool_nessie.h were unused. Optimizing Whirlpool would require more painful tricks than rotation functions, as far as I can see.

I also noticed that struct field alignment is a problem when trying to predict the context struct size (8 bit fields take up 32 bits, for faster access). This problem may deserve its own ticket.

ghost commented 12 years ago

I just finished some simple optimizations of Whirlpool. Benchmarks at b4f1814:

Benchmarks at cde446f:

The statistics from Criterion look borked (192 outliers among 100 samples?), but at least the means seem useful. I credit the performance gains to using array_copy64 and byte indices, instead of using per-element assignments and shifting 64-bit numbers to form indices.

vincenthz commented 11 years ago

sorry i completely forgot about this. I'll have a look soon.