github.com/kelleygo/clashcore@v1.0.2/common/utils/global_id.go (about)

     1  package utils
     2  
     3  import (
     4  	"hash/maphash"
     5  	"unsafe"
     6  )
     7  
     8  var globalSeed = maphash.MakeSeed()
     9  
    10  func GlobalID(material string) (id [8]byte) {
    11  	*(*uint64)(unsafe.Pointer(&id[0])) = maphash.String(globalSeed, material)
    12  	return
    13  }
    14  
    15  func MapHash(material string) uint64 {
    16  	return maphash.String(globalSeed, material)
    17  }