Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Hashing
//Title of this code #include <iostream> #include <cstring> using namespace std; int FNV1a_hash(const void *data, int length) { const char *p = static_cast<const char*>(data); int basis = 123456789; int prime = 12345; int hash = basis; for (int i = 0; i < length; ++i) hash = (hash ^ p[i]) * prime; return hash; } int main() { long num = 8; char* str = "helll1lo"; int size = strlen(str); cout << size << endl; cout << FNV1a_hash(str, size) << endl; }
run
|
edit
|
history
|
help
0
Shuffle algorithm
stl_sizeof
Iviewb
StackTel
GCC compiler bug (should output 0 1)
series
infections.cpp
cynb
congruence modulo equations (together with a simple BigInteger class)
Array Subset of another array