mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-27 12:35:39 +08:00
14 lines
221 B
Go
14 lines
221 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
|
||
|
}
|