Created
October 29, 2019 02:23
-
-
Save mgd020/b31a1fbfc474114651c022ec6566aa24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fnv1a_128_prime = 309485009821345068724781371 | |
fnv1a_128_offset = 144066263297769815596495629667062367629 | |
fnv1a_128_mask = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | |
def fnv1a_128(bs): | |
h = fnv1a_offset | |
for b in bs: | |
h ^= b | |
h *= fnv1a_prime | |
h %= fnv1a_128_mask | |
return h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment