support hashed credentials

This commit is contained in:
aler9
2020-12-31 19:27:41 +01:00
parent b2f56c9814
commit 9bd587e576
4 changed files with 178 additions and 50 deletions

View File

@@ -2,6 +2,8 @@ package auth
import (
"crypto/md5"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
)
@@ -10,3 +12,9 @@ func md5Hex(in string) string {
h.Write([]byte(in))
return hex.EncodeToString(h.Sum(nil))
}
func sha256Base64(in string) string {
h := sha256.New()
h.Write([]byte(in))
return base64.StdEncoding.EncodeToString(h.Sum(nil))
}