kefu/tools/uuid.go

22 lines
308 B
Go
Raw Permalink Normal View History

2024-12-10 02:50:12 +00:00
package tools
import (
"crypto/md5"
"encoding/hex"
"github.com/satori/go.uuid"
)
//生成uuid
func Uuid() string {
u2 := uuid.NewV4()
return u2.String()
}
//生成uuid,并且md5一下
func Uuid2() string {
m := md5.New()
m.Write([]byte(Uuid()))
res := hex.EncodeToString(m.Sum(nil))
return res
}