md5.go 488 B

12345678910111213141516171819202122
  1. /**
  2. ******************************************************************************
  3. * @file md5.go
  4. * @author MakerYang
  5. ******************************************************************************
  6. */
  7. package Utils
  8. import (
  9. "crypto/md5"
  10. "encoding/hex"
  11. )
  12. func MD5Hash(text string) string {
  13. hash := md5.Sum([]byte(text))
  14. return hex.EncodeToString(hash[:])
  15. }
  16. func VerifyPassword(storedPassword, inputPassword string) bool {
  17. return MD5Hash(inputPassword) == storedPassword
  18. }