github.com/coreservice-io/utils@v0.3.0/hash_util/crc32.go (about) 1 package hash_util 2 3 import ( 4 "fmt" 5 "hash/crc32" 6 ) 7 8 func CRC32HashString(input string) string { 9 var crc32q = crc32.New(crc32.MakeTable(0xD5828281)) 10 crc32q.Write([]byte(input)) 11 return fmt.Sprint(crc32q.Sum32()) 12 } 13 14 // //combine all string elements and hash 15 func CRC32HashArrayString(input []string) string { 16 var merge string 17 for i := 0; i < len(input); i++ { 18 merge = merge + "_" + input[i] 19 } 20 return CRC32HashString(merge) 21 }