Documentation ¶
Overview ¶
Package farmhash64 implements the FarmHash64 and FarmHash32 hash functions for strings.
FarmHash is a family of hash functions.
FarmHash64 is a 64-bit fingerprint hash function that produces a hash value for a given string. It is designed to be fast and provide good hash distribution but is not suitable for cryptography applications.
The FarmHash32 function is also provided, which returns a 32-bit fingerprint hash for a string.
All members of the FarmHash family were designed with heavy reliance on previous work by Jyrki Alakuijala, Austin Appleby, Bob Jenkins, and others. This is a GO port of the Fingerprint64 (farmhashna::Hash64) code from Google's FarmHash (https://github.com/google/farmhash).
This code has been ported/translated by Nicola Asuni (Tecnick.com) to GO code.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FarmHash32 ¶
FarmHash32 returns a 32-bit fingerprint hash for a string. NOTE: This is NOT equivalent to the original Fingerprint32 function.
Example ¶
package main import ( "fmt" fh "github.com/tecnickcom/farmhash64/go/src" ) func main() { str := "Hello, World!" hash := fh.FarmHash32([]byte(str)) fmt.Println(hash) }
Output: 4101594851
func FarmHash64 ¶
FarmHash64 returns a 64-bit fingerprint hash for a string.
Example ¶
package main import ( "fmt" fh "github.com/tecnickcom/farmhash64/go/src" ) func main() { str := "Hello, World!" hash := fh.FarmHash64([]byte(str)) fmt.Println(hash) }
Output: 11358326526432651330
Types ¶
This section is empty.