SipHash
A short-input keyed PRF designed to protect hash tables from flooding attacks
Overview
SipHash is a fast keyed pseudo-random function designed by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012. It produces a 64-bit tag from a 128-bit key and is the default hash-table hash in Python, Rust, Ruby, Perl and the Linux kernel among others.
SipHash keeps four 64-bit words of state initialised from the key and constants. Each 64-bit message word is XORed into the state, mixed with c SipRounds of additions, rotations and XORs, and XORed out again. After the last word, which includes the message length, d finalisation rounds produce the output. SipHash-c-d denotes the round counts.
NextSSL includes SipHash-2-4, the recommended default, and SipHash-4-8, a more conservative variant. Because the key is secret, an attacker cannot predict which inputs collide in a hash table, which blocks hash-flooding denial-of-service attacks that work against unkeyed hashes such as MurmurHash. Its round counts have proved conservative. It is cheap to call per key.
History
2012–2012SipHash published by Jean-Philippe Aumasson, Daniel J. Bernstein
Security notes
SipHash is a secure PRF but its 64-bit output makes it unsuitable as a general MAC where forgery resistance beyond 2^64 work is required. Its intended domain is short inputs and hash-table keys.
Typical uses
Variants in NextSSL
2| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| SipHash-2-4 siphash-2-4 |
standard | key 16 · tag 8–16 | SipHash (Aumasson, Bernstein), reference C | safe |
| SipHash-4-8 siphash-4-8 |
standard | key 16 · tag 8–16 | SipHash (Aumasson, Bernstein), reference C | safe |
Frequently asked questions
Which SipHash variants does NextSSL include?
NextSSL registers 2 SipHash variants: siphash-2-4, siphash-4-8.
Families with similar names
Other message authentication codes
All 30Related
Austin Appleby's widely used multiply-rotate hash for hash tables
BLAKE2A fast, secure successor to BLAKE with built-in keying, salting and tree hashing
BLAKE2A fast, secure successor to BLAKE with built-in keying, salting and tree hashing
ChaskeyA lightweight ARX permutation-based MAC for 32-bit microcontrollers (ISO/IEC 29192-6)