MAC family

SipHash

A short-input keyed PRF designed to protect hash tables from flooding attacks

standard 2 variants SipHash reference specification

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–2012
  1. SipHash 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

Hash-table keying against DoSShort-message authenticationLightweight keyed checksums

Variants in NextSSL

2
AlgorithmTierSizes (bytes)StandardsAPI
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.