pysiphash
pysiphash copied to clipboard
Allow to construct a 128-bit key from two 64-bit halves
First of all thank you for the library, it saved me some time 👍🏼
What I found slightly inconvenient is that some other libraries implementing SipHash in other languages (guava hashing, go-siphasm, etc) construct 128-bit key from two 64-bit halves, so when you want to comply the code that uses them you're forced to do something like:
import struct
import siphash
...
hash = siphash.SipHash_2_4(struct.pack('<QQ', k0, k1)).hash()
...
Which is a bit annoying because you kind of have to learn the implementation details you don't want to know (encoding endian and format). I thought something like the following might be useful:
import siphash
...
hash = siphash.SipHash_2_4.fromkeyparts(k0, k1).hash()