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

..03-May-2022-

.travis.ymlH A D18-Aug-201875

README.mdH A D18-Aug-20181.9 KiB

blocks.goH A D18-Aug-20182.1 KiB

blocks_amd64.sH A D18-Aug-20181.7 KiB

blocks_arm.sH A D18-Aug-20182.6 KiB

blocks_asm.goH A D18-Aug-2018595

hash.goH A D18-Aug-20183.4 KiB

hash128.goH A D18-Aug-20184.7 KiB

hash128_amd64.sH A D18-Aug-20184.2 KiB

hash_amd64.sH A D18-Aug-20182.9 KiB

hash_arm.goH A D18-Aug-2018498

hash_asm.goH A D18-Aug-2018822

siphash.goH A D18-Aug-20185.8 KiB

siphash_test.goH A D18-Aug-201819.3 KiB

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