Files
web/server/utils/password.go
2026-03-17 01:00:11 +08:00

13 lines
250 B
Go

package utils
import (
"crypto/sha256"
"encoding/hex"
)
// HashPassword 使用 SHA-256 哈希密码(与 Python 实现一致)
func HashPassword(password string) string {
h := sha256.Sum256([]byte(password))
return hex.EncodeToString(h[:])
}