• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.travis.ymlH A D31-Aug-201650 86

README.mdH A D31-Aug-20161.9 KiB7039

blocks.goH A D31-Aug-20162.1 KiB149106

blocks_amd64.sH A D31-Aug-20161.7 KiB8778

blocks_arm.sH A D31-Aug-20162.6 KiB145138

hash.goH A D31-Aug-20163.4 KiB217153

hash128.goH A D31-Aug-20164.7 KiB303213

hash128_amd64.sH A D31-Aug-20164.2 KiB293252

hash128_arm.sH A D31-Aug-20162.9 KiB170167

hash_amd64.sH A D31-Aug-20162.9 KiB202184

hash_arm.sH A D31-Aug-20162.7 KiB161158

hash_asm.goH A D31-Aug-2016958 346

siphash.goH A D31-Aug-20165.8 KiB319239

siphash_test.goH A D31-Aug-201617.9 KiB592520

README.md

1SipHash (Go)
2============
3
4[![Build Status](https://travis-ci.org/dchest/siphash.svg)](https://travis-ci.org/dchest/siphash)
5
6Go implementation of SipHash-2-4, a fast short-input PRF created by
7Jean-Philippe Aumasson and Daniel J. Bernstein (http://131002.net/siphash/).
8
9
10## Installation
11
12    $ go get github.com/dchest/siphash
13
14## Usage
15
16    import "github.com/dchest/siphash"
17
18There are two ways to use this package.
19The slower one is to use the standard hash.Hash64 interface:
20
21    h := siphash.New(key)
22    h.Write([]byte("Hello"))
23    sum := h.Sum(nil) // returns 8-byte []byte
24
25or
26
27    sum64 := h.Sum64() // returns uint64
28
29The faster one is to use Hash() function, which takes two uint64 parts of
3016-byte key and a byte slice, and returns uint64 hash:
31
32    sum64 := siphash.Hash(key0, key1, []byte("Hello"))
33
34The keys and output are little-endian.
35
36
37## Functions
38
39### func Hash(k0, k1 uint64, p []byte) uint64
40
41Hash returns the 64-bit SipHash-2-4 of the given byte slice with two
4264-bit parts of 128-bit key: k0 and k1.
43
44### func Hash128(k0, k1 uint64, p []byte) (uint64, uint64)
45
46Hash128 returns the 128-bit SipHash-2-4 of the given byte slice with two
4764-bit parts of 128-bit key: k0 and k1.
48
49Note that 128-bit SipHash is considered experimental by SipHash authors at this time.
50
51### func New(key []byte) hash.Hash64
52
53New returns a new hash.Hash64 computing SipHash-2-4 with 16-byte key.
54
55### func New128(key []byte) hash.Hash
56
57New128 returns a new hash.Hash computing SipHash-2-4 with 16-byte key and 16-byte output.
58
59Note that 16-byte output is considered experimental by SipHash authors at this time.
60
61
62## Public domain dedication
63
64Written by Dmitry Chestnykh and Damian Gryski.
65
66To the extent possible under law, the authors have dedicated all copyright
67and related and neighboring rights to this software to the public domain
68worldwide. This software is distributed without any warranty.
69http://creativecommons.org/publicdomain/zero/1.0/
70