You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/example/siphash/sharding.go

9 lines
151 B
Go

4 years ago
package sharding
import "github.com/dchest/siphash"
func sharding(token string) uint64 {
sum := siphash.Hash(0, 0, []byte(token))
return sum % 3
}