广告平台(站长下代理使用)
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.

crypto.go 296 B

2 kuukautta sitten
12345678910111213141516171819
  1. package utils
  2. import (
  3. "crypto/md5"
  4. "encoding/base64"
  5. "fmt"
  6. )
  7. func GetMd5(raw []byte) string {
  8. h := md5.New()
  9. h.Write(raw)
  10. return fmt.Sprintf("%x", h.Sum(nil))
  11. }
  12. func GetBase64Md5(raw []byte) string {
  13. h := md5.New()
  14. h.Write(raw)
  15. return base64.StdEncoding.EncodeToString(h.Sum(nil))
  16. }