tool.go 186 B

123456789101112
  1. package utils
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. )
  6. func Str2MD5(data []byte, salt string) string {
  7. m := md5.New()
  8. m.Write(data)
  9. return hex.EncodeToString(m.Sum([]byte(salt)))
  10. }