-
Notifications
You must be signed in to change notification settings - Fork 0
/
siphash.go
34 lines (28 loc) · 916 Bytes
/
siphash.go
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
package siphash
import (
"hash"
)
// New returns a new hash.Hash computing the Siphash checksum.
func New(k []byte) hash.Hash {
h, _ := NewWithCDroundsAndHashSize(k, 0, 0, 0)
return h
}
// return 8 bytes
func New64(k []byte) hash.Hash {
h, _ := NewWithCDroundsAndHashSize(k, 0, 0, HashSize64)
return h
}
// New alias, return 16 bytes
func New128(k []byte) hash.Hash {
h, _ := NewWithCDroundsAndHashSize(k, 0, 0, HashSize128)
return h
}
// NewWithHashSize returns a new hash.Hash computing the Siphash checksum.
func NewWithHashSize(k []byte, hashSize int) hash.Hash {
h, _ := NewWithCDroundsAndHashSize(k, 0, 0, hashSize)
return h
}
// NewWithCDroundsAndHashSize returns a new hash.Hash computing the Siphash checksum.
func NewWithCDroundsAndHashSize(k []byte, crounds, drounds int32, hashSize int) (hash.Hash, error) {
return newDigest(k, crounds, drounds, hashSize)
}