Source File
hasher128.go
Belonging Package
github.com/zeebo/xxh3
package xxh3import ()// Hasher128 implements the hash.Hash interface.// It will return hashes that are 128 bits.type Hasher128 struct {h Hasher}var (_ hash.Hash = (*Hasher128)(nil))// New128 returns a new 128 bit Hasher that implements the hash.Hash interface.func () *Hasher128 {return &Hasher128{}}// NewSeed128 returns a new Hasher128 that implements the hash.Hash interface.func ( uint64) *Hasher128 {var Hasher128.ResetSeed()return &}// Reset resets the Hash to its initial state.func ( *Hasher128) () {.h.Reset()}// ResetSeed will reset the hash and set a new seed.// This will change the original state used by Reset.func ( *Hasher128) ( uint64) {.h.ResetSeed()}// BlockSize returns the hash's underlying block size.// The Write method will accept any amount of data, but// it may operate more efficiently if all writes are a// multiple of the block size.func ( *Hasher128) () int { return _stripe }// Size returns the number of bytes Sum will return.func ( *Hasher128) () int { return 16 }// Sum appends the current hash to b and returns the resulting slice.// It does not change the underlying hash state.func ( *Hasher128) ( []byte) []byte {:= .h.Sum128().Bytes()return append(, [:]...)}// Write adds more data to the running hash.// It never returns an error.func ( *Hasher128) ( []byte) (int, error) {.h.update()return len(), nil}// WriteString adds more data to the running hash.// It never returns an error.func ( *Hasher128) ( string) (int, error) {.h.updateString()return len(), nil}// Sum128 returns the 128-bit hash of the written data.func ( *Hasher128) () Uint128 {return .h.Sum128()}
![]() |
The pages are generated with Golds v0.8.7. (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. |