You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
243 B
17 lines
243 B
6 months ago
|
package hashutil
|
||
|
|
||
|
import (
|
||
|
"crypto/md5"
|
||
|
"encoding/binary"
|
||
|
"encoding/json"
|
||
|
)
|
||
|
|
||
|
func IdHash(ids []string) uint64 {
|
||
|
if len(ids) == 0 {
|
||
|
return 0
|
||
|
}
|
||
|
data, _ := json.Marshal(ids)
|
||
|
sum := md5.Sum(data)
|
||
|
return binary.BigEndian.Uint64(sum[:])
|
||
|
}
|