蛋蛋星球-客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 rivejä
415 B

  1. package utils
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. "strings"
  6. )
  7. func Md5(str string) string {
  8. h := md5.New()
  9. h.Write([]byte(str))
  10. return hex.EncodeToString(h.Sum(nil))
  11. }
  12. func GenerateMD5Hash(input string) string {
  13. hasher := md5.New()
  14. hasher.Write([]byte(input))
  15. checksum := hasher.Sum(nil)
  16. hexString := hex.EncodeToString(checksum)
  17. upperHexString := strings.ToUpper(hexString)
  18. return upperHexString
  19. }