Created
May 26, 2013 13:52
-
-
Save vaiorabbit/5652864 to your computer and use it in GitHub Desktop.
FNV-1a Hash (http://isthe.com/chongo/tech/comp/fnv/) in C++.
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
typedef unsigned int uint32; | |
#define FNV1_32A_INIT 0x811c9dc5 | |
#define FNV_32_PRIME 0x01000193 | |
uint32 fnv32a( const char* str ) | |
{ | |
uint32 hval = FNV1_32A_INIT; | |
while ( *str ) | |
{ | |
hval ^= (uint32)*str++; | |
hval *= FNV_32_PRIME; | |
} | |
return hval; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment