hikan.ru/tools/string.go

14 lines
242 B
Go
Raw Permalink Normal View History

2025-02-02 16:43:55 +03:00
package tools
import (
"crypto/sha256"
"encoding/hex"
)
func Sha256HashString(password string) (string, error) {
hasher := sha256.New()
hasher.Write([]byte(password))
hashed := hex.EncodeToString(hasher.Sum(nil))
return hashed, nil
}