highwayhash
highwayhash copied to clipboard
Support for 128 or 256 bit hashes?
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.
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.
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.
Quick thought: perhaps we could use namespaced exports for this?
const { hh128 } = require('highwayhash');
hh128.asBuffer( ... );
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.
Commit a902c5f updates the HighwayHash source to latest so these improvements can now be exposed.