flow-go-sdk icon indicating copy to clipboard operation
flow-go-sdk copied to clipboard

Consistent parsing hex values

Open sideninja opened this issue 3 years ago • 2 comments

It would be helpful if all hex values passed to parsing functions would handle 0x prefix. Currently flow.HexToAddress() handles 0x prefix.

Functions that currently don't:

  • flow.HexToID()
  • crypto.DecodePublicKeyHex() (not sure if it makes sense to handle prefix in this one)

sideninja avatar Mar 24 '21 13:03 sideninja

IMO IDs and public keys shouldn't be prefixed with 0x. But maybe these functions should be tolerant of the prefix?

psiemens avatar Apr 15 '21 05:04 psiemens

Feel free to close this it was just something I encountered when using SDK in CLI and I had to solve it by sanitizing input and removing prefix (similar to the problem with addresses being prefixed). Generally speaking 0x prefix denotes hex representation and I'm afraid it's really chaotic how IDs are represented in crypto, sometimes with 0x prefixes sometimes without.

sideninja avatar Apr 16 '21 10:04 sideninja