rurban/smhasher

compilation metrohash64crc failder under MSVC9

Slach opened this issue · 7 comments

Slach commented

i use https://github.com/flier/pyfasthash
in my python code
it's use your great smhasher repository as git submodule
when i try compile this extension under MCVC9

i have following errors

src\smhasher\metrohash64crc.cpp(52) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(53) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(54) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(55) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(84) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(90) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(96) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(130) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(131) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(132) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(133) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(162) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(168) : error C3861: '_mm_crc32_u64': identifier not found
src\smhasher\metrohash64crc.cpp(174) : error C3861: '_mm_crc32_u64': identifier not found
error: Setup script exited with error: command 'C:\\Users\\nulluser\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

i don't know C++ ;) sorry
could you help me resolve this compilation issue?

You have to check how the 64bit crc builtin is called under MSVC

Slach commented

https://msdn.microsoft.com/en-us/library/bb514033(v=vs.120).aspx
it's defined for
#if defined(_M_X64)
extern unsigned __int64 _mm_crc32_u64(unsigned __int64 crc, unsigned __int64 v);
#endif

but i try compile for target 32bit architecture

ok. I will switch to Python27 64bit, thanks

it's the limit of cpu itself - crc command with 64-bit input is supported only in x64 mode. anyway, i don't recommend to use this crc-based hash (or any automatic selection of fastest hash as it's currently implemented in this package). while basic t1ha hashes (w/o crc/aes) look reasonable, crc-based hash is absolutely non-sense, made only for speed records rather than real work. in short, it computes 32-bit hash of each 64-bit input word, and then produces 64-bit hash based on these stripped numbers

@leo-yuriev, it will be great if you will finally remove this pseudo-hash from your package. Passing SMHasher doesn't guarantee that your hash is strong, you need also to understand how to change smhasher to make your hash fail. Your idea that users should understand CRC math and research each hash they are using yourself, is absolutely laughable - real users are much less educated even than you. And finally, idea to mix weak crc hash with reasonable main t1ha hash with automatic hash selection based solely on speed, deceives these users by pretending them that they are using reasomnnable main hash while automatic selection actually chooses crc hash in most cases. You are started with good idea, but then lost sense trying to setup meaningless records and relying on automatic smhasher testing rather than understanding of your own algorithms.

Slach commented

i solve my issue with compilation, thanks
flier/pyfasthash#8 (comment)

@Bulat-Ziganshin: The metro family is not supposed to be strong, just fast. Naturally it's in the same class as the xxHash family, suitable for digests of large blocks. And for these they do work very good. Esp. using fast hardware builtins.
Repeated again: All those hash function cannot be strong. It's their nature.

  1. my comment was about t1ha, and i will move it into right place
  2. what is the meaning of smhasher testing, in you opinion, if all non-crypto hashes are equally weak? t1ha-crc hash is weaker than xxhash and so on. essentially, it's a crc32 hash artifically widened to 64 bits, and you know that even crc32 can't pass half of smhasher tests
  3. t1ha-crc weakness can be detected by the various smhasher tests checking 40-64 bit keys IF these keys will be preceded by fixed 40-byte header

I moved this topic to erthink/t1ha#7 - please answer there

OTOH, this critics may also apply to MetroHash64crc too, unless they have used the same data twice.

Yes, my critics equally apply to MetroHash64crc too:

This pseudo-64bit hash is as weak as crc32. It will fail multiple tests checking 40-64 bit keys if these keys will be followed by fixed 32-byte footer.