How to reliably hash JavaScript objects?

前端 未结 6 1849
天涯浪人
天涯浪人 2021-02-06 21:53

Is there a reliable way to JSON.stringify a JavaScript object that guarantees that the ceated JSON string is the same across all browsers, node.js and so on, given that the Java

6条回答
  •  遥遥无期
    2021-02-06 22:33

    This is an old question, but I thought I'd add a current solution to this question for any google referees.

    The best way to sign and hash JSON objects now is to use JSON Web Tokens. This allows for an object to be signed, hashed and then verified by others based on the signature. It's offered for a bunch of different technologies and has an active development group.

提交回复
热议问题