微信相关接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
427 B

  1. package wechat
  2. import (
  3. "crypto/md5"
  4. "encoding/hex"
  5. "strings"
  6. )
  7. //密码加密
  8. func Md5Str(str ...string) string {
  9. var build strings.Builder
  10. if len(str) > 0 {
  11. for _, v := range str {
  12. build.WriteString(v)
  13. }
  14. } else {
  15. return ""
  16. }
  17. h := md5.New()
  18. h.Write([]byte(build.String())) // 需要加密的字符串
  19. cipher2Str := h.Sum(nil)
  20. sMd5 := hex.EncodeToString(cipher2Str) // 输出加密结果
  21. return sMd5
  22. }