Created animediff package
This commit is contained in:
17
utils/HashStrings.go
Normal file
17
utils/HashStrings.go
Normal file
@ -0,0 +1,17 @@
|
||||
package utils
|
||||
|
||||
import "github.com/OneOfOne/xxhash"
|
||||
|
||||
// HashStringsNoOrder returns a hash of the string slice contents, ignoring order.
|
||||
func HashStringsNoOrder(items []string) uint64 {
|
||||
sum := uint64(0)
|
||||
|
||||
for _, item := range items {
|
||||
h := xxhash.NewS64(0)
|
||||
h.Write([]byte(item))
|
||||
numHash := h.Sum64()
|
||||
sum += numHash
|
||||
}
|
||||
|
||||
return sum
|
||||
}
|
Reference in New Issue
Block a user