github.com/Anderson-Lu/gobox@v0.0.0-20191127065433-3e6c4c2da420/hash/hash_util.go (about) 1 package hash 2 3 import "hash/crc32" 4 5 //根据key计算返回[0:limitSize)的散列随机值 6 func HashKey(key string, limitSize int) uint32 { 7 return crc32.ChecksumIEEE([]byte(key)) % uint32(limitSize) 8 }