2 Commits
v1.0 ... v1.1

Author SHA1 Message Date
68f6576663 + BuildWhitelistForStringSanitisation 2023-10-07 15:56:10 +02:00
9c4d3c851c fixed formating 2023-10-03 14:46:03 +02:00
2 changed files with 14 additions and 1 deletions

View File

@ -24,7 +24,8 @@ func GenerateNewSHA256Sum() string {
[]string{ []string{
fmt.Sprintf("%d", prime), fmt.Sprintf("%d", prime),
GenerateNewUUID(), GenerateNewUUID(),
timestamp}, timestamp,
},
"|", "|",
), ),
) )

View File

@ -6,6 +6,18 @@ import (
"strings" "strings"
) )
// BuildWhitelistForStringSanitisation transfroms a slice of whitelisted substrings into a hashtable
func BuildWhitelistForStringSanitisation(wl []string) map[string]string {
whitelist := map[string]string{}
for _, c := range wl {
whitelist[c] = c
}
return whitelist
}
// FirstCharacterToUppercase converts the first character of a string to uppercase // FirstCharacterToUppercase converts the first character of a string to uppercase
func FirstCharacterToUppercase(s string) string { func FirstCharacterToUppercase(s string) string {
if len(s) == 0 { if len(s) == 0 {