This is a maintenance fork of a C implementation of the SipHash algorithm
Go to file
Chris Babcock 2b8386885a Three days observation 2020-12-30 03:54:40 -07:00
.gitignore Added some common IDE folders to gitignore 2019-12-15 10:22:47 -05:00
LICENSE Initial commit 2014-03-23 02:51:00 -07:00 Three days observation 2020-12-30 03:54:40 -07:00
halfsiphash.c Merge pull request #17 from altendky/format_specifiers 2019-09-14 12:43:31 +02:00
makefile Separate test function and main() 2019-09-21 16:12:31 -04:00
siphash.c Correct \ alignment 2019-09-18 12:00:52 -04:00
test.c Initialize any_failed 2019-09-22 10:49:18 -04:00
testmain.c Separate test function and main() 2019-09-21 16:12:31 -04:00
vectors.h Update test vectors for HalfSipHash 2017-01-05 17:50:37 +01:00

This is a maintenance fork


Reference implementation of SipHash, a family of pseudorandom functions optimized for speed on short messages.

SipHash was designed as a mitigation to hash-flooding DoS attacks. It is now used in the hash tables implementation of Python, Ruby, Perl 5, etc.

SipHash was designed by Jean-Philippe Aumasson and Daniel J. Bernstein.




will build tests for

  • SipHash-2-4, the default version of SipHash returning 64-bit tags
  • SipHash-2-4 with doubled tag size, i.e. 128-bit tags
  • HalfSipHash-2-4, a version of SipHash working with 32-bit words and returning 32-bit tags by default
  • HalfSipHash-2-4 with doubled tag size, i.e. 64-bit tags

verifies 64 test vectors, and


does the same and prints intermediate values.

The code can be adapted to implement SipHash-c-d, the version of SipHash with c compression rounds and d finalization rounds, by defining cROUNDS or dROUNDS when compiling. This can be done with -D command line arguments to many compilers such as below.

gcc -Wall --std=c99 -DcROUNDS=2 -DdROUNDS=4 siphash.c halfsiphash.c test.c -o test

The makefile also takes c and d rounds values as parameters.

make cROUNDS=2 dROUNDS=4

Obviously, if the number of rounds is modified then the test vectors won't verify.

Intellectual property

The SipHash reference code is released under CC0 license, a public domain-like licence.

We aren't aware of any patents or patent applications relevant to SipHash, and we aren't planning to apply for any.


The SipHash page includes

  • a list of third-party implementations and modules
  • a list of projects using SipHash
  • references to cryptanalysis results