1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# 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](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).
## Usage
Running
```sh
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
```C
./test
```
verifies 64 test vectors, and
```C
./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.
```sh
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.
```sh
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](https://creativecommons.org/publicdomain/zero/1.0/), 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](https://131002.net/siphash) includes
* a list of third-party implementations and modules
* a list of projects using SipHash
* references to cryptanalysis results
|