14 lines
242 B
Go
14 lines
242 B
Go
|
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
|
||
|
}
|