3x-ui/util/crypto/crypto.go

13 lines
197 B
Go
Raw Normal View History

package crypto
import (
"crypto/sha256"
"encoding/hex"
)
func HashSHA256(text string) string {
hasher := sha256.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}