5a8b62a6f8
It was forgotten in #17 to apply this to siphash.c as well as halfsiphash.c. Note that as-is this does change to a single 16-hex-char string for v0/1/2/3 in debug output rather than having 8 then a space then 8. If preferred it can be changed back to having the space and using `PRIx32` twice instead of `PRIx64` once. |
||
---|---|---|
.gitignore | ||
LICENSE | ||
README.md | ||
halfsiphash.c | ||
makefile | ||
siphash.c | ||
test.c | ||
vectors.h |
README.md
SipHash
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.
Usage
Running
make
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
./test
verifies 64 test vectors, and
./debug
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.
References
The SipHash page includes
- a list of third-party implementations and modules
- a list of projects using SipHash
- references to cryptanalysis results