@icedquinn I agree thats a shitty spec... IT does expose a very real problem with JSON though, that two equivelant pieces of JSON can hash to very different values.
It is the reason I have often in my projects (where hashed values representing unique JSON is needed) used canonical JSON, which is a standard that fixes that issue. Sadly it isnt well adopted so it generally needs to be used as an internal standard.
@icedquinn How does that give you a hash that is directly comparable? You would still wind up with different byte arrays and thus different signatures that are not directly comparable.
@icedquinn Yes but your missing the point. you have no way of verifying the two blackboxes are equivelant with that process, it does nothing to address that problem. The same JSON, simply reordered randomly will produce completely different hashes and signatures with no way of knowing they are the same thing.
Thus it isnt solving the underlying problem that would be solved by requiring a specific bit representation, that is, the ability to check for equality.
@icedquinn Yes except as I stated that does not solve the problem that canonical JSON solves.
If give the hash of some previously hashed payload, and the hash of some new payload, if the payloads arent canonical then you cant perform an equality check at all to verify if the payloads are equivelant. With canonical JSON you can.
@icedquinn Depends what you mean by "crypto code".. and what use the payload has in the overall system. But yea its something that needs be done all the time. I have had to implement canonical json in cryptocurrency code before, for example.
@icedquinn You have yet to suggest a way it can be accomplished otherwise... ill wait
This or solutions like it, are routinely used in every major cryptocurrency by the way.
@icedquinn Saying its the wrong way to do it, and then not actually providing a solution that has the same functional benefit is not solving the problem.
This is how virtually every bit encoded protocol has ever worked since the begining of time almost.. atleast ones that have any sort of checksumming... its a pretty solid approach. Even your TCP/IP connections are doing something like this (sans the JSON, but canonicalizing the data)