13 chars · 1 line
Waiting for input
13 chars · 1 line
Waiting for input
Structured text and hashes
The two example objects contain the same pairs, but their serialized character order differs. VetaTool hashes that serialization directly, so their SHA-256 values differ. This tool is free to use. No account or payment is required.
Last updated
Hashing occurs after serialization. The digest function sees a sequence of characters, not a JavaScript object, and therefore does not know that reordered pairs may be semantically equivalent.
Only the serialized property order changes.
{"a":1,"b":2}
{"b":2,"a":1}a,b order: 43258cff783fe7036d8a43033f830adfc60ec037382473548ac742b888292777
b,a order: 3fb75453225c732a76b7899ea2096dda1455189c89817239732182f73fe5a09fCommon questions
Yes, because it hashes the entered serialized text rather than parsing and sorting the object.
Define and use the same canonical serialization before hashing on every side.
Debugging a specific Hash issue? Browse Hash troubleshooting.