Hash Lab

Non-cryptographic

SipHash

A small, fast, keyed pseudo-random function designed by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012. SipHash is the hash-table defender of choice: fast enough to use in hot inner loops, but secure enough that an attacker who can submit chosen keys cannot construct collisions without first stealing the per-table seed.

SipHash-c-d

At a glance

Output64 or 128 bits
Key128 bits (mandatory, randomized per table)
Throughput~2–3 GiB/s on a single core
ConstructionARX (add-rotate-XOR) over a 256-bit state
Year2012
StatusNon-cryptographic in the collision-resistance sense, but a PRF against chosen-input adversaries

The hash-flooding problem it solves

Throughout 2011–2013 it became clear that any web server using a non-keyed hash function as the back-end of a hash-table-keyed-by-user- input was DoS-able: an attacker who knows the hash function can submit thousands of inputs that all collide, forcing the hash table into worst-case O(n²) behavior. Murmur, FNV, and CRC32 were all affected. The standard fix is to seed the hash with a per-process random key. SipHash is designed precisely so that an attacker who does not know the key cannot find colliding inputs.

Where it is used

Internal structure

SipHash maintains four 64-bit words. The compression step does a couple of ARX rounds (typical mix of additions, rotations, XORs) across the four words, with the input absorbed via XOR before and after. Two final rounds use chosen rotation patterns to spread the last input’s influence over the entire state. Outputs are taken from the state at the end.

Try it

SipHash is not in the in-browser hasher (hash-wasm targets cryptographic and checksum algos); add it from any of the linked reference implementations to verify outputs.

References

Quick quiz

Test yourself on siphash

10 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.Who designed SipHash?

  2. Q2.What does the c-d in SipHash-c-d mean?

  3. Q3.What problem was SipHash designed to solve?

  4. Q4.Which language runtime uses SipHash by default for dict keys?

  5. Q5.SipHash's key size:

  6. Q6.SipHash's output size:

  7. Q7.What kind of operations does SipHash use internally?

  8. Q8.Is SipHash a cryptographic hash?

  9. Q9.Which kernel subsystem uses SipHash for flow lookups?

  10. Q10.SipHash versus MurmurHash3 in adversarial settings:

0 of 10 answered