Полная зачистка legacy + закрытие fix24.1/fix24.2 + обновление логотипа

This commit is contained in:
2026-05-08 23:16:25 +05:00
parent de4a65a959
commit 1bca73814e
85 changed files with 4119 additions and 1911 deletions
+21
View File
@@ -1,9 +1,11 @@
package util
import (
"crypto/hmac"
"crypto/sha256"
"errors"
"fmt"
"os"
"strings"
"golang.org/x/crypto/bcrypt"
@@ -42,3 +44,22 @@ func VerifyPassword(password string, storedHash string) (ok bool, legacy bool) {
}
return SHA224String(password) == storedHash, true
}
func HmacSHA256Hex(payload string, secret string) string {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(payload))
sum := mac.Sum(nil)
str := ""
for _, v := range sum {
str += fmt.Sprintf("%02x", v)
}
return str
}
func PeerSecretDigest(rawSecret string) string {
secretKey := strings.TrimSpace(os.Getenv("HY2XS_PEER_SECRET_KEY"))
if secretKey == "" {
secretKey = "hy2xs-peer-secret-key"
}
return HmacSHA256Hex(rawSecret, secretKey)
}