Introduction
SipHash is a fast pseudorandom function designed by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012 to defend hash tables against hash-flooding denial-of-service attacks. Unlike cryptographic hashes such as SHA-256, SipHash is keyed: the output depends on a secret 128-bit key, so an attacker cannot precompute collisions without knowing it. SipHash-2-4 is the default hash function in Python's `dict`, Rust's `HashMap`, Perl, Ruby, Haskell, and Swift. This tool computes SipHash-2-4 and SipHash-1-3 from a 128-bit hex key and arbitrary text, entirely in your browser.
What this tool does
- Computes SipHash-2-4 and SipHash-1-3 64-bit hashes from any text input.
- Accepts a 128-bit key as a 32-character hex string (or generates a random one).
- Outputs the hash as an unsigned decimal, signed decimal, and hex string.
- Updates the result in real time as you type, with a copy-to-clipboard button.
- Processes all data locally in your browser with no network requests.
How this tool works
Type or paste text into the input field and provide a 128-bit key as 32 hex characters (use the Generate button for a cryptographically random key). The tool converts the text to UTF-8 bytes and runs the SipHash compression function with the chosen parameter set (2-4 or 1-3). The 64-bit result is displayed as an unsigned decimal, a signed two's-complement decimal, and a 16-character hex string. All computation runs client-side using a pure JavaScript implementation that uses BigInt for the 64-bit arithmetic.
How SipHash works
SipHash was presented at the 2012 IACR Fast Software Encryption workshop by Aumasson and Bernstein (paper: 'SipHash: a fast short-input PRF'). It is an ARX construction (add-rotate-XOR) built around a 256-bit state initialized from the 128-bit key. Each 64-bit message word is mixed into the state with `c` SipRounds, then a finalization phase runs `d` SipRounds with the message length folded in. SipHash-2-4 (2 rounds per word, 4 finalization rounds) is the recommended and most widely deployed variant; SipHash-1-3 trades a small security margin for higher throughput. Python adopted SipHash as the default string hash in 2012 (PEP 456) precisely because it makes hash-flooding attacks impractical: without the per-process key, an attacker cannot craft colliding inputs.
How to use this tool
- Enter a 32-character hex key, or click Generate to create a random one.
- Choose SipHash-2-4 (default, recommended) or SipHash-1-3 (faster, smaller margin).
- Type or paste the text you want to hash in the input field.
- The 64-bit hash appears instantly in three representations.
- Use Copy to copy any representation to your clipboard.
Real-world examples
Hashing with the reference test key
Key: `000102030405060708090a0b0c0d0e0f`, input: `0001020304050607`. The output matches the official SipHash-2-4 test vector `a129ca6149be45e5`, confirming the implementation is correct.
Hashing a string
Key: `00112233445566778899aabbccddeeff`, input: `hello`. The hash is a 64-bit value that changes completely if even one bit of the key or input changes — the avalanche effect.
Empty input
Key: any 128-bit value, input: empty string. SipHash still produces a valid 64-bit hash because the length byte (zero) is folded into the finalization.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| SipHash-2-4 | O(n) — 2 rounds per 8 bytes | Hash table keys, Python dict, Rust HashMap |
| SipHash-1-3 | O(n) — 1 round per 8 bytes | High-throughput hash tables with smaller margin |
| FNV-1a | O(n) — 1 multiply per byte | Non-keyed hash tables, bloom filters (no DoS defense) |
| MurmurHash3 | O(n) — 1 mix per 4 bytes | Non-keyed hash tables (no DoS defense) |
Limitations or considerations
SipHash is a pseudorandom function, not a cryptographic hash: it is keyed and not designed for collision resistance against an attacker who knows the key. The 64-bit output is too short for collision-resistant use in adversarial settings (birthday bound 2^32). SipHash-1-3 has a smaller security margin than SipHash-2-4 and should only be used when throughput is critical and the threat model tolerates it. This tool does not implement SipHash-128 (the 128-bit output variant).
Frequently asked questions
Why is SipHash keyed?
So that an attacker cannot precompute inputs that collide in your hash table without knowing the key. This defeats hash-flooding denial-of-service attacks that exploited predictable hash functions.
Is SipHash cryptographically secure?
It is a pseudorandom function with good diffusion, but it is not a cryptographic hash. It is keyed, the output is only 64 bits, and it has not been designed to resist collision attacks from an adversary who knows the key.
What is the difference between SipHash-2-4 and SipHash-1-3?
The numbers are (compression rounds, finalization rounds). SipHash-2-4 is the recommended default; SipHash-1-3 is faster but has a smaller security margin and is only suitable when throughput is critical.
Why does Python use SipHash?
Python adopted SipHash as the default string and bytes hash in 2012 (PEP 456) to prevent hash-flooding DoS attacks. Each Python process generates a fresh random key at startup so attackers cannot craft colliding inputs.
Conclusion
The SipHash calculator gives you a fast, keyed 64-bit hash that defends hash tables against flooding attacks. With SipHash-2-4 and SipHash-1-3 variants, a built-in key generator, and a fully client-side implementation, it is a handy reference for anyone studying modern non-cryptographic hash functions or debugging hash-table behavior.