util.go 212 B

1234567891011121314
  1. package utils
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. "fmt"
  6. )
  7. func Md5(s string) string {
  8. h := md5.New()
  9. h.Write([]byte(s))
  10. cipherStr := h.Sum(nil)
  11. return fmt.Sprintf("%s", hex.EncodeToString(cipherStr))
  12. }