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
replace_copy_if-30-Seconds-of-C++
ExceptionHandling4
1028D
Sekhejane link
Shuffle algorithm
MemCpySetChar
remove_30-Seconds-of-C++
char pointer in class
static_cast makes a copy
Test 13(2020)