md5.go 370 B

1234567891011121314151617181920
  1. package encrypt
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. )
  6. func GetMD5Hash(text string) *string {
  7. hasher := md5.New()
  8. hasher.Write([]byte(text))
  9. result := hex.EncodeToString(hasher.Sum(nil))
  10. return &result
  11. }
  12. func GetMD5HashString(text string) string {
  13. hasher := md5.New()
  14. hasher.Write([]byte(text))
  15. result := hex.EncodeToString(hasher.Sum(nil))
  16. return result
  17. }