Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to construct a 128-bit key from two 64-bit halves #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dkruchinin
Copy link

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant