A native implementation of the excellent XXHash hashing algorithm.
|
2 years ago | |
---|---|---|
.vscode | 3 years ago | |
benchmarks | 4 years ago | |
cmd | 3 years ago | |
.gitignore | 5 years ago | |
.travis.yml | 2 years ago | |
LICENSE | 7 years ago | |
README.md | 3 years ago | |
bugs_test.go | 6 years ago | |
go.mod | 4 years ago | |
xxhash.go | 3 years ago | |
xxhash_go17.go | 5 years ago | |
xxhash_safe.go | 4 years ago | |
xxhash_test.go | 3 years ago | |
xxhash_unsafe.go | 3 years ago |
This is a native Go implementation of the excellent xxhash* algorithm, an extremely fast non-cryptographic Hash algorithm, working at speeds close to RAM limits.
go get github.com/OneOfOne/xxhash
-tags safe
.ff90f4af66
2017-08-19)➤ go test -bench '64' -count 5 -tags cespare | benchstat /dev/stdin
name time/op
# https://github.com/cespare/xxhash
XXSum64Cespare/Func-8 160ns ± 2%
XXSum64Cespare/Struct-8 173ns ± 1%
XXSum64ShortCespare/Func-8 6.78ns ± 1%
XXSum64ShortCespare/Struct-8 19.6ns ± 2%
# this package (default mode, using unsafe)
XXSum64/Func-8 170ns ± 1%
XXSum64/Struct-8 182ns ± 1%
XXSum64Short/Func-8 13.5ns ± 3%
XXSum64Short/Struct-8 20.4ns ± 0%
# this package (appengine, *not* using unsafe)
XXSum64/Func-8 241ns ± 5%
XXSum64/Struct-8 243ns ± 6%
XXSum64Short/Func-8 15.2ns ± 2%
XXSum64Short/Struct-8 23.7ns ± 5%
CRC64ISO-8 1.23µs ± 1%
CRC64ISOString-8 2.71µs ± 4%
CRC64ISOShort-8 22.2ns ± 3%
Fnv64-8 2.34µs ± 1%
Fnv64Short-8 74.7ns ± 8%
h := xxhash.New64()
// r, err := os.Open("......")
// defer f.Close()
r := strings.NewReader(F)
io.Copy(h, r)
fmt.Println("xxhash.Backend:", xxhash.Backend)
fmt.Println("File checksum:", h.Sum64())
This project is released under the Apache v2. license. See LICENSE for more details.