Can someone please tell me what I am doing wrong? I try to hash a value with murmurhash, but I get different values every time:
std::string str = "some test string"; char out[32]; MurmurHash3_x86_32(str.c_str(), str.length(), 0, out); unsigned int hash = reinterpret_cast<unsigned int>(out);
It seems to me that it MurmurHash3_x86_32returns a 32-bit hash value. But you give it 32 bytes .
MurmurHash3_x86_32
You could simply:
std::string str = "some test string"; unsigned int hash; MurmurHash3_x86_32(str.c_str(), str.length(), 0, &hash);
The variable outis of type char []or array char. This acts as a pointer to charin most contexts. Here you throw out the value of the pointer, not the contents indicated on it.
out
char []
char
, API MurmurHash, out 32 . 32- ( , 32- ).
Source: https://habr.com/ru/post/1793320/More articles:Прочитать родительское местоположение из фрейма (разные домены) - javascriptProblem accessing function defined in Coffeescript - javascriptOpenGL-Android binding error - android.text () in jQuery doesn't work for xml element for any reason - javascriptSQL Spatial JOIN Nearest Neighbor - sqlCreating DLL and EXE project C # - c #Can you explain this behavior of Math.Log10 and BigInteger.Log10? - floating-pointCloud Instances Monitoring - amazon-ec2Прогнозирование значения стоимости: какой анализ (байесовский?) Может предсказать, насколько пользователь Twitter будет оценивать твит? - javaHTML5 Audio limitations on iOS 4? Playlist, background, etc. - javascriptAll Articles