Stop generating labels with NUL bytes at the end
dmjones opened this issue · 2 comments
dmjones commented
If users don't pass a label or ID to the key generation functions, one is generated for them. This value will typically have ~20 NUL bytes at the end, which causes problems if users convert to/from strings using string(<some bytes>)
and []byte(<the string>)
. This kind of simple string conversions will discard NUL bytes, resulting in a different label or ID.
We should adjust this behaviour and return non-NUL data. I would suggest generating random bytes, converting to hexadecimal characters, then returning the bytes of that hexadecimal string.