Add password hashing function

This commit is contained in:
Александр Лазаренко 2025-05-20 21:53:09 +03:00
parent 6012bccf64
commit b4ec470e2f
Signed by: Kerblif
GPG Key ID: 5AFAD6640F4670C3

View File

@ -6,10 +6,18 @@ import (
"encoding/hex"
)
func GenerateVerifyKey(key string) string {
func generateHMAC(key string, data string) string {
mac := hmac.New(md5.New, []byte(key))
mac.Write([]byte(key))
mac.Write([]byte(data))
return hex.EncodeToString(mac.Sum(nil))
}
func GenerateVerifyKey(key string) string {
return generateHMAC(key, key)
}
func GeneratePasswordHash(password string) string {
return generateHMAC("streaming", password)
}