vikunja-api/pkg/utils/sha256.go
2018-11-03 15:05:45 +00:00

11 lines
206 B
Go

package utils
import (
"crypto/sha256"
"fmt"
)
// Sha256 calculates a sha256 hash from a string
func Sha256(cleartext string) string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(cleartext)))[:45]
}