mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 21:51:23 +08:00
18 lines
308 B
Go
18 lines
308 B
Go
package utils
|
|
|
|
import (
|
|
"hash/maphash"
|
|
"unsafe"
|
|
)
|
|
|
|
var globalSeed = maphash.MakeSeed()
|
|
|
|
func GlobalID(material string) (id [8]byte) {
|
|
*(*uint64)(unsafe.Pointer(&id[0])) = maphash.String(globalSeed, material)
|
|
return
|
|
}
|
|
|
|
func MapHash(material string) uint64 {
|
|
return maphash.String(globalSeed, material)
|
|
}
|