一物一码
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

crypto.go 296 B

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. }