Wyhash
Wang Yi's compact, very fast hash based on 64x64-to-128-bit multiplication
Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About Wyhash
Wyhash is a checksum / non-cryptographic hash. It produces an 8-byte (64-bit) output. Its registry entry cites wyhash final3 (Wang Yi), NON-cryptographic. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
wyhash is a non-cryptographic hash function by Wang Yi, notable for its small code size and high speed. It is used in several language runtimes and libraries, including Zig's standard library. It provides no security against a deliberate attacker.
wyhash's core operation, called mum, multiplies two 64-bit values to a 128-bit product and XORs the high and low halves. Input is consumed 48 bytes at a time across three lanes, each mixing input words XORed with secret constants through mum, and the lanes are combined at the end. Short inputs use direct loads with no loop.
NextSSL includes wyhash final version 3 wired from source and not yet verified. wyhash has gone through several revisions with different outputs, so the version must be fixed. None of this provides security: the function has no secret key, and anyone can compute or deliberately collide its outputs. Seed it randomly.
History
2019–2019wyhash published by Wang Yi
Security notes
wyhash is not cryptographic. With a random secret seed it resists casual hash flooding better than unseeded hashes, but it makes no formal security claims and should not be used where an attacker can adaptively choose inputs against a known seed.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| out | 8 | Output |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'unverified' is reachable from the root API only
value = root.call("checksum", "wyhash", None, b"123456789")[0]
nextssl_root_checksum("wyhash", NULL, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_checksum_in(reg::all(), Policy::Any, "wyhash", &Params::new())?;
let value = alg.checksum(b"123456789")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?More checksums and non-cryptographic hashes
All 130Frequently asked questions
What is Wyhash?
Wyhash is a checksum in the wyhash family. wyhash is a non-cryptographic hash function by Wang Yi, notable for its small code size and high speed.
What are the Wyhash sizes?
In NextSSL, Wyhash uses: output 8 bytes.
Who designed Wyhash and when?
Wyhash belongs to the wyhash family, first published in 2019 by Wang Yi.
Which standards define Wyhash?
Wyhash is referenced by wyhash final3 (Wang Yi), NON-cryptographic.
Is Wyhash safe to use?
Wyhash is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).