support set gravatar as user avatar provider

This commit is contained in:
MaysWind
2023-07-01 00:51:45 +08:00
parent a8b76d5537
commit 652b3e1954
7 changed files with 61 additions and 2 deletions
+7
View File
@@ -7,6 +7,7 @@ import (
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"strings"
"unicode"
@@ -133,6 +134,12 @@ func MD5Encode(data []byte) []byte {
return m.Sum(nil)
}
// MD5EncodeToString returns a hashed string by md5
func MD5EncodeToString(data []byte) string {
hash := MD5Encode(data)
return hex.EncodeToString(hash)
}
// AESGCMEncrypt returns a encrypted string by aes-gcm
func AESGCMEncrypt(key []byte, plainText []byte) ([]byte, error) {
block, err := aes.NewCipher(key)