Documentation
¶
Overview ¶
Package siphash implements the SipHash-64 and SipHash-128 pseudo-random-functions - with the recommended parameters: c = 2 and d = 4. SipHash computes a message authentication code (MAC) from a variable-length message and a 128 bit secret key. SipHash was designed to be efficient, even for short inputs, with performance comparable to non-cryptographic hash functions.
Security ¶
SipHash cannot be used as a cryptographic hash function. Neither SipHash-64 nor SipHash-128 are strong collision resistant.
Recommendations ¶
SipHash was designed to defend hash flooding DoS attacks. SipHash-64 can be used as hashing scheme within hash maps or other key-value data structures. SipHash-128 can be used to compute a 128 bit authentication tag for messages.
Index ¶
Constants ¶
const ( // KeySize is the size of the SipHash secret key in bytes. KeySize = 16 // BlockSize is the block size of SipHash in bytes. BlockSize = 8 )
Variables ¶
This section is empty.
Functions ¶
func New128 ¶
New128 returns a hash.Hash computing the SipHash-128 checksum. This function returns a non-nil error if len(key) != 16.
func New64 ¶
New64 returns a hash.Hash64 computing the SipHash-64 checksum. This function returns a non-nil error if len(key) != 16.
Types ¶
type KeySizeError ¶
type KeySizeError uint
func (KeySizeError) Error ¶
func (k KeySizeError) Error() string