package murmur3import ()// Make sure interfaces are correctly implemented.var ( _ hash.Hash = new(digest64) _ hash.Hash64 = new(digest64) _ bmixer = new(digest64))// digest64 is half a digest128.type digest64 digest128// New64 returns a 64-bit hasherfunc () hash.Hash64 { returnNew64WithSeed(0) }// New64WithSeed returns a 64-bit hasher set with explicit seed valuefunc ( uint32) hash.Hash64 { := (*digest64)(New128WithSeed().(*digest128))return}func ( *digest64) ( []byte) []byte { := .Sum64()returnappend(,byte(>>56), byte(>>48), byte(>>40), byte(>>32),byte(>>24), byte(>>16), byte(>>8), byte())}func ( *digest64) () uint64 { , := (*digest128)().Sum128()return}// Sum64 returns the MurmurHash3 sum of data. It is equivalent to the// following sequence (without the extra burden and the extra allocation):// hasher := New64()// hasher.Write(data)// return hasher.Sum64()func ( []byte) uint64 { returnSum64WithSeed(, 0) }// Sum64WithSeed returns the MurmurHash3 sum of data. It is equivalent to the// following sequence (without the extra burden and the extra allocation):// hasher := New64WithSeed(seed)// hasher.Write(data)// return hasher.Sum64()func ( []byte, uint32) uint64 { := &digest128{h1: uint64(), h2: uint64()} .seed = .tail = .bmix() .clen = len() , := .Sum128()return}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.