2024-10-14 13:49:16 +08:00

19 lines
347 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package md5_encrypt
import (
"crypto/md5"
"encoding/base64"
"encoding/hex"
)
// INFO 先base64然后MD5
func MD5(params string) string {
md5Ctx := md5.New()
md5Ctx.Write([]byte(params))
return hex.EncodeToString(md5Ctx.Sum(nil))
}
func Base64Md5(params string) string {
return MD5(base64.StdEncoding.EncodeToString([]byte(params)))
}