ghash

常用经典哈希函数Go语言实现,提供uint32uint64类型的哈希函数。

使用方式

  1. import "github.com/gogf/gf/g/encoding/ghash"

接口文档

https://godoc.org/github.com/gogf/gf/g/encoding/ghash

性能基准测试:

  1. goos: darwin
  2. goarch: amd64
  3. pkg: github.com/gogf/gf/g/encoding/ghash
  4. BenchmarkBKDRHash-4 50000000 30.2 ns/op
  5. BenchmarkBKDRHash64-4 50000000 27.2 ns/op
  6. BenchmarkSDBMHash-4 30000000 40.5 ns/op
  7. BenchmarkSDBMHash64-4 50000000 43.1 ns/op
  8. BenchmarkRSHash-4 30000000 37.8 ns/op
  9. BenchmarkSRSHash64-4 50000000 33.5 ns/op
  10. BenchmarkJSHash-4 50000000 37.1 ns/op
  11. BenchmarkJSHash64-4 30000000 38.2 ns/op
  12. BenchmarkPJWHash-4 50000000 33.7 ns/op
  13. BenchmarkPJWHash64-4 50000000 33.8 ns/op
  14. BenchmarkELFHash-4 50000000 35.8 ns/op
  15. BenchmarkELFHash64-4 50000000 32.4 ns/op
  16. BenchmarkDJBHash-4 50000000 26.9 ns/op
  17. BenchmarkDJBHash64-4 50000000 26.8 ns/op
  18. BenchmarkAPHash-4 30000000 49.1 ns/op
  19. BenchmarkAPHash64-4 30000000 49.8 ns/op