Message authentication codes

SipHash-4-8

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

standard Safe API

About SipHash-4-8

SipHash-4-8 is one of 2 SipHash variants in the NextSSL registry, a message authentication code. It uses a 16-byte (128-bit) key and an 8–16-byte authentication tag. It takes the parameter out_len (default 8). Its registry entry cites SipHash (Aumasson, Bernstein), reference C. NextSSL lists it in the standard tier and exposes it through the safe API.

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

Sizes

FieldBytesMeaning
key16Secret key
tag8 – 16Authentication tag

Parameters

NameTypeRangeDefaultRequired
out_len u64 8 – 16 8 no

Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.

Use it

from nextssl_demo import NextSSL

ns = NextSSL()              # safe API: safe and standard tiers
key = ns.random(16)
tag = ns.call("mac", "siphash-4-8", None, key, b"message", 0)[0]
ok  = ns.check("mac_verify", "siphash-4-8", None, key, b"message", tag)

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Other SipHash variants

1

Similar names

Looking for something else?

Frequently asked questions

What is SipHash-4-8?

SipHash-4-8 is a MAC in the SipHash family. SipHash is a fast keyed pseudo-random function designed by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012.

What are the SipHash-4-8 sizes?

In NextSSL, SipHash-4-8 uses: key 16 bytes, tag 8 to 16 bytes.

Who designed SipHash-4-8 and when?

SipHash-4-8 belongs to the SipHash family, first published in 2012 by Jean-Philippe Aumasson, Daniel J. Bernstein. Its origin: SipHash reference specification.

Which standards define SipHash-4-8?

SipHash-4-8 is referenced by SipHash (Aumasson, Bernstein), reference C.

Is SipHash-4-8 safe to use?

SipHash-4-8 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.

What other SipHash variants are there?

NextSSL also registers siphash-2-4 in the SipHash family.