wangyi-fudan / wyhash

The FASTEST QUALITY hash function, random number generators (PRNG) and hash map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Q: When to use wyhash32 vs. wyhash?

snej opened this issue · comments

The README only talks about one wyhash function, but there are two defined in the source code. I'm unclear on the difference between wyhash32 and wyhash, besides the obvious difference in result size.

  • If I only need 32-bit hashes, is it better to use wyhash32, or use wyhash and cast to uint32_t?
  • Is wyhash32 faster than wyhash on 32-bit CPUs?

Thanks for any answers! Maybe you could add the info to the README too.

wyhash32 is a secondary hash function. Please use wyhash in most cases.
wyhash32 is not sexy. The reason of wyhash32 is to make a minimal hash function to achieve maximal compatibility and stability.
Because wyhash is actively developed, the hash changes during evolution.
In my personal code, if the speed is not the issue and I want a stable hash value years later, I may choose wyhash32.