Documentation
¶
Overview ¶
Package xxhash implements the xxHash hash algorithm.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XXHash64 ¶
type XXHash64 struct {
// contains filtered or unexported fields
}
XXHash64 implements the 64-bit variant of the xxHash algorithm.
Example (Usage) ¶
Examples
package main import ( "fmt" "github.com/shivakar/xxhash" ) func main() { // Create a new instance of the hash engine with default seed h := xxhash.NewXXHash64() // Create a new instance of the hash engine with custom seed _ = xxhash.NewSeedXXHash64(uint64(10)) // Write some data to the hash h.Write([]byte("Hello, World!!")) // Write some more data to the hash h.Write([]byte("How are you doing?")) // Get the current hash as a byte array b := h.Sum(nil) fmt.Println(b) // Get the current hash as an integer (uint64) (little-endian) fmt.Println(h.Uint64()) // Get the current hash as a hexadecimal string (big-endian) fmt.Println(h.String()) // Reset the hash h.Reset() }
Output: [70 182 137 152 187 180 209 136] 5095411317493518728 46b68998bbb4d188
func NewSeedXXHash64 ¶
NewSeedXXHash64 returns an instance of XXHash64 with the specified seed.
func NewXXHash64 ¶
func NewXXHash64() *XXHash64
NewXXHash64 returns an instance of XXHash64 with seed set to 0.
func (*XXHash64) Sum ¶
Sum appends the current hash to b and returns the resulting slice. It does not change the underlying has state
Click to show internal directories.
Click to hide internal directories.