14 lines
242 B
Go
14 lines
242 B
Go
package main
|
|
|
|
import (
|
|
"crypto/sha256"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func generateClientId(ip string, events []string, len int) string {
|
|
str := ip + strings.Join(events, "|")
|
|
id := sha256.Sum256([]byte(str))
|
|
|
|
return fmt.Sprintf("%X", id)[0:len]
|
|
}
|