diff --git a/token-validator/token.go b/token-validator/token.go index 168d6e7..e4fb91d 100644 --- a/token-validator/token.go +++ b/token-validator/token.go @@ -8,7 +8,10 @@ import ( func GenerateToken(pkey []byte, id int, a... []byte) ([]byte, error) { h := sha512.New() - h.Write([]byte(fmt.Sprintf("%x:%d", pkey, id))) + h.Write([]byte(fmt.Sprintf("%x", pkey))) + if id != 0 { + h.Write([]byte(fmt.Sprintf(":%d", id))) + } for _, v := range a { h.Write([]byte(":"))