github.com/qjfoidnh/BaiduPCS-Go@v0.0.0-20231011165705-caa18a3765f3/baidupcs/netdisksign/devuid.go (about) 1 package netdisksign 2 3 import ( 4 "bytes" 5 "crypto/md5" 6 "encoding/hex" 7 "github.com/qjfoidnh/BaiduPCS-Go/pcsutil/cachepool" 8 "github.com/qjfoidnh/BaiduPCS-Go/pcsutil/converter" 9 ) 10 11 func DevUID(feature string) string { 12 m := md5.New() 13 m.Write(converter.ToBytes(feature)) 14 res := m.Sum(nil) 15 resHex := cachepool.RawMallocByteSlice(34) 16 hex.Encode(resHex[:32], res) 17 resHex[32] = '|' 18 resHex[33] = '0' 19 return converter.ToString(bytes.ToUpper(resHex)) 20 }