3 ms·
It sounds like base64 was unnecessary there since a JSON string can contain serialized JSON. Personally I'll just concatenate the values in a defined order and
by boomlinde 7y ago
It sounds like base64 was unnecessary there since a JSON string can contain serialized JSON.
Personally I'll just concatenate the values in a defined order and sign/hash that.
- sneak 7y agojsonrpc “args” can vary in name, number, and type.
- boomlinde 7y agoSure, but where you're doing {"msg": "eyJhIjogMTAsICJjIjogInRlc3RpbmciLCAiYiI6ICJoZWxsbyJ9", "h": "..."} you can as well be doing {"msg": "{\"a\": 10, \"c\": \"testing\", \"b\": \"hello\"}", "h": "..."} and skip base64 altogether. If you mean this as a point against the second part of my post, it's of course only in some limited circumstances you can simply dump the values in a defined order and be done with it. To make it general, you have to have delimiters for at least arrays, objects and numbers, canonicalize number representations, and probably output the keys as well, at which point you've invented your own complete serialization protocol.