https://github.com/emschwartz/objecthash-js
JS implementation of Ben Laurie's objecthash
https://github.com/emschwartz/objecthash-js
hash json object-hash objecthash sha256
Last synced: about 1 year ago
JSON representation
JS implementation of Ben Laurie's objecthash
- Host: GitHub
- URL: https://github.com/emschwartz/objecthash-js
- Owner: emschwartz
- Created: 2017-02-09T22:43:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-09T23:16:32.000Z (over 9 years ago)
- Last Synced: 2025-06-05T21:41:52.044Z (about 1 year ago)
- Topics: hash, json, object-hash, objecthash, sha256
- Language: JavaScript
- Homepage: https://github.com/benlaurie/objecthash
- Size: 10.7 KB
- Stars: 7
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# objecthash
> Implementation of [Ben Laurie's objecthash](https://github.com/benlaurie/objecthash) in Javascript
## Installation
`npm install --save objecthash`
## Usage
Takes any JSON value and returns a `Buffer` with the SHA-256 `objecthash`, derived using Ben Laurie's algorithm.
## A note on (the inconsistency of) numbers
Different languages treat numbers parsed from JSON differently.
Javascript treats both `1` and `1.0` as an integer, whereas Go parses all JSON numbers as 64-bit floating point numbers.
In an effort to maintain compatibility with the other implementations, this library treats all numbers as floats by default.