github.com/OrigamiWang/msd/micro@v0.0.0-20240229032328-b62246268db9/auth/crypto/md5.go (about)

     1  package crypto
     2  
     3  import (
     4  	"crypto/md5"
     5  	"fmt"
     6  	"strings"
     7  )
     8  
     9  func Md5Encode(rawStr string) string {
    10  	hash := md5.Sum([]byte(rawStr))
    11  	md5str := fmt.Sprintf("%x", hash) //将[]byte转成16进制
    12  	// 32 bit result
    13  	return strings.ToUpper(md5str)
    14  }