fix:#65 added new UID generation for ical File

This commit is contained in:
masterelmar
2023-11-29 11:23:43 +01:00
parent fe4ba9e529
commit f1d178049e
3 changed files with 39 additions and 6 deletions

View File

@@ -1,6 +1,10 @@
package functions
import "strings"
import (
"crypto/sha256"
"encoding/hex"
"strings"
)
// check if string is empty or contains only whitespaces
func OnlyWhitespace(word string) bool {
@@ -25,3 +29,10 @@ func ReplaceEmptyString(word string, replacement string) string {
}
return word
}
func HashString(s string) string {
hash := sha256.New()
hash.Write([]byte(s))
hashInBytes := hash.Sum(nil)
return hex.EncodeToString(hashInBytes)
}