mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-24 13:38:48 +02:00
fix:#65 added new UID generation for ical File
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user