github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/unique_string.go (about) 1 package functions 2 3 import ( 4 "crypto/sha256" 5 "fmt" 6 "strings" 7 ) 8 9 func UniqueString(args ...interface{}) interface{} { 10 if len(args) == 0 { 11 return "" 12 } 13 14 hashParts := make([]string, len(args)) 15 for i, str := range args { 16 hashParts[i] = str.(string) 17 } 18 19 hash := sha256.New().Sum([]byte(strings.Join(hashParts, ""))) 20 return fmt.Sprintf("%x", hash)[:13] 21 }