另客网go项目公用的代码库

md5.go 195B

1234567891011121314
  1. package encrypt
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. )
  6. func Md5(src string) string {
  7. hash := md5.New()
  8. hash.Write([]byte(src))
  9. cipher := hash.Sum(nil)
  10. return hex.EncodeToString(cipher)
  11. }