support set gravatar as user avatar provider
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user