highwayhash icon indicating copy to clipboard operation
highwayhash copied to clipboard

Support for 128 or 256 bit hashes?

Open mceachen opened this issue 6 years ago • 5 comments

Thanks for this work!

Is there an API to switch the result buffer to render 128 bit or 256 bit hashes? Providing an HHResult128 or HHResult256 to the constructor should suffice. I looked but didn't find anything promising.

mceachen avatar Jan 07 '18 19:01 mceachen

Hello, the 128 and 256 bit hash functions were still under active upstream development until 4 days ago - see https://github.com/google/highwayhash/commit/eeea4463df1639c7ce271a1d0fdfa8ae5e81a49f - so we can now start to expose these.

PRs and thoughts/discussion about how to expose these are welcome.

lovell avatar Jan 07 '18 20:01 lovell

Wow, I didn't know it was so recent, I had just assumed they'd have produced those variants initially.

I've seen both additional methods, as well as arguments, support this sort of a switch. Exposing new high-level functions (say, asString128() and asString256()) might be more discoverable than asString(key, input, bits), but the API is a bit cleaner to just add the optional third arg.

mceachen avatar Jan 07 '18 20:01 mceachen

Quick thought: perhaps we could use namespaced exports for this?

const { hh128 } = require('highwayhash');
hh128.asBuffer( ... );

lovell avatar Jan 10 '18 23:01 lovell

Wow, I didn't know it was so recent, I had just assumed they'd have produced those variants initially.

Hi @mceachen , FYI 128 and 256 bit variants have been around a long time but we hadn't yet frozen them until the change lovell mentioned.

jan-wassenberg avatar Jan 11 '18 07:01 jan-wassenberg

Commit a902c5f updates the HighwayHash source to latest so these improvements can now be exposed.

lovell avatar Jan 29 '18 21:01 lovell