Add (experimental) Whirlpool support #7

Merged
merged 3 commits into from Oct 29, 2012

Conversation

Projects
None yet
1 participant
@ghost

ghost commented Aug 9, 2012

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

Owner

vincenthz commented Aug 10, 2012

Thanks, it's looking good !

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

  • removing more cruft (portability workaround from old stuff)
  • remove redefinitions of standard types (u32/u64 in favor of uint32_t uint64_t)
  • use optimised rot function (rotl32_be, ..) as defined in bitfn.h
@ghost

ghost commented Aug 11, 2012

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

ghost commented Aug 12, 2012

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

  • 256b: 18.3 us
  • 4Kib: 235.6 us
  • 1Mib: 58.8 ms

Benchmarks at cde446f:

  • 256b: 10.4 us
  • 4Kib: 138.6 us
  • 1Mib: 35.1 ms

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.

Owner

vincenthz commented Oct 24, 2012

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

@vincenthz vincenthz merged commit cde446f into vincenthz:master Oct 29, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment