package util import ( "crypto/sha256" "encoding/hex" "fmt" "github.com/spf13/cast" ) func CutTail(str string, length int) string { if len(str) <= length { return str } return str[0:length] } func FloatCut(f float64) float64 { return cast.ToFloat64(fmt.Sprintf("%.2f", f)) } func Sha256(s string) string { hash := sha256.New() hash.Write([]byte(s)) hashValue := hash.Sum(nil) return hex.EncodeToString(hashValue) }