|Yawning Angel d185255157 Merge commit '1e6c13a0e470b42ddcbab8a0dd10d789b3839795' as 'vendor/github.com/dchest/siphash'||4 years ago|
|.travis.yml||4 years ago|
|README.md||4 years ago|
|blocks.go||4 years ago|
|blocks_amd64.s||4 years ago|
|blocks_arm.s||4 years ago|
|hash.go||4 years ago|
|hash128.go||4 years ago|
|hash128_amd64.s||4 years ago|
|hash128_arm.s||4 years ago|
|hash_amd64.s||4 years ago|
|hash_arm.s||4 years ago|
|hash_asm.go||4 years ago|
|siphash.go||4 years ago|
|siphash_test.go||4 years ago|
Go implementation of SipHash-2-4, a fast short-input PRF created by Jean-Philippe Aumasson and Daniel J. Bernstein (http://131002.net/siphash/).
$ go get github.com/dchest/siphash
Supported Go 1.1 and later.
There are two ways to use this package. The slower one is to use the standard hash.Hash64 interface:
h := siphash.New(key) h.Write(byte("Hello")) sum := h.Sum(nil) // returns 8-byte byte
sum64 := h.Sum64() // returns uint64
The faster one is to use Hash() function, which takes two uint64 parts of 16-byte key and a byte slice, and returns uint64 hash:
sum64 := siphash.Hash(key0, key1, byte("Hello"))
The keys and output are little-endian.
Hash returns the 64-bit SipHash-2-4 of the given byte slice with two 64-bit parts of 128-bit key: k0 and k1.
Hash128 returns the 128-bit SipHash-2-4 of the given byte slice with two 64-bit parts of 128-bit key: k0 and k1.
Note that 128-bit SipHash is considered experimental by SipHash authors at this time.
New returns a new hash.Hash64 computing SipHash-2-4 with 16-byte key.
New128 returns a new hash.Hash computing SipHash-2-4 with 16-byte key and 16-byte output.
Note that 16-byte output is considered experimental by SipHash authors at this time.
Written by Dmitry Chestnykh and Damian Gryski.
To the extent possible under law, the authors have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. http://creativecommons.org/publicdomain/zero/1.0/