12345678910111213141516171819 |
- package character
- import (
- "crypto/md5"
- "encoding/hex"
- "strconv"
- "time"
- )
- func Md5Content(data []byte) string {
- h := md5.New()
- h.Write(data)
- return hex.EncodeToString(h.Sum(nil))
- }
- func GenerateMsgId() string {
- content := strconv.FormatInt(time.Now().UnixNano(), 10)
- return Md5Content([]byte(content))
- }
|