2016-12-16 08:04:05 +00:00
|
|
|
# SipHash
|
2014-03-23 09:51:00 +00:00
|
|
|
|
2014-03-23 10:53:31 +00:00
|
|
|
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](https://131002.net/siphash/siphashdos_29c3_slides.pdf).
|
|
|
|
It is now used in the hash tables implementation of Python, Ruby, Perl
|
|
|
|
5, etc.
|
|
|
|
|
|
|
|
SipHash was designed by [Jean-Philippe Aumasson](https://131002.net) and
|
|
|
|
[Daniel J. Bernstein](http://cr.yp.to).
|
|
|
|
|
|
|
|
|
2016-12-16 08:04:05 +00:00
|
|
|
## Usage
|
2014-03-23 10:53:31 +00:00
|
|
|
|
|
|
|
Running
|
|
|
|
|
|
|
|
```sh
|
2014-03-24 07:46:57 +00:00
|
|
|
make
|
2014-03-23 10:53:31 +00:00
|
|
|
```
|
|
|
|
|
2016-12-16 08:04:05 +00:00
|
|
|
will build tests for
|
|
|
|
|
|
|
|
* SipHash-2-4, the default version of SipHash returning 64-bit tags
|
2017-02-24 13:53:01 +00:00
|
|
|
* 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
|
2016-12-16 08:04:05 +00:00
|
|
|
* HalfSipHash-2-4 with doubled tag size, i.e. 64-bit tags
|
|
|
|
|
2014-03-23 13:01:33 +00:00
|
|
|
|
|
|
|
```C
|
2016-12-16 08:04:05 +00:00
|
|
|
./test
|
2014-03-23 13:01:33 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
verifies 64 test vectors, and
|
|
|
|
|
2014-11-08 17:43:13 +00:00
|
|
|
```C
|
2016-12-16 08:04:05 +00:00
|
|
|
./debug
|
2014-03-23 13:01:33 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
does the same and prints intermediate values.
|
2014-03-23 10:53:31 +00:00
|
|
|
|
|
|
|
The code can be adapted to implement SipHash-*c*-*d*, the version of SipHash
|
|
|
|
with *c* compression rounds and *d* finalization rounds, by tweaking the
|
|
|
|
lines
|
|
|
|
```C
|
|
|
|
#define cROUNDS 2
|
|
|
|
#define dROUNDS 4
|
|
|
|
```
|
|
|
|
|
2014-11-08 17:43:13 +00:00
|
|
|
Obviously, if the number of rounds is modified then the test vectors
|
|
|
|
won't verify.
|
|
|
|
|
|
|
|
|
2014-03-23 10:53:31 +00:00
|
|
|
|
2016-12-16 08:04:05 +00:00
|
|
|
## Intellectual property
|
2014-03-23 10:53:31 +00:00
|
|
|
|
2014-03-23 17:03:51 +00:00
|
|
|
The SipHash reference code is released under [CC0
|
|
|
|
license](https://creativecommons.org/publicdomain/zero/1.0/), a public
|
2014-03-23 10:53:31 +00:00
|
|
|
domain-like licence.
|
|
|
|
|
2014-05-02 06:08:27 +00:00
|
|
|
We aren't aware of any patents or patent applications relevant to
|
|
|
|
SipHash, and we aren't planning to apply for any.
|
|
|
|
|
2014-03-23 10:53:31 +00:00
|
|
|
|
2016-12-16 08:04:05 +00:00
|
|
|
## References
|
2014-03-23 10:53:31 +00:00
|
|
|
|
|
|
|
The [SipHash page](https://131002.net/siphash) includes
|
|
|
|
* a list of third-party implementations and modules
|
|
|
|
* a list of projects using SipHash
|
|
|
|
* references to cryptanalysis results
|