{"_id":"@bybrave/object-hash2","name":"@bybrave/object-hash2","dist-tags":{"latest":"4.0.0"},"versions":{"4.0.0":{"name":"@bybrave/object-hash2","version":"4.0.0","description":"Maintained fork of object-hash — generate hashes from javascript objects in node and the browser. Identical hashes in both, repeated references fixed, 2x faster, 2 KB browser bundle.","author":{"name":"bybrave","url":"https://github.com/bybraveHQ"},"contributors":[{"name":"Scott Puleo","url":"author of the original object-hash"}],"main":"./index.js","types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.mjs","require":"./index.js"},"./package.json":"./package.json","./dist/*":"./dist/*"},"browser":{"./lib/crypto-sink.js":"./lib/crypto-sink-browser.js"},"scripts":{"build":"esbuild index.js --bundle --format=iife --global-name=objectHash --outfile=dist/object_hash.js && esbuild index.js --bundle --minify --format=iife --global-name=objectHash --outfile=dist/object_hash.min.js","test":"npm run build && npm run test-node && npm run test-dist && npm run test-types","test-node":"node --test test/","test-dist":"node scripts/dist-smoke.js","test-types":"tsc","benchmark":"node scripts/benchmark.js","prepublishOnly":"npm test"},"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/object-hash2.git"},"bugs":{"url":"https://github.com/bybraveHQ/object-hash2/issues"},"homepage":"https://github.com/bybraveHQ/object-hash2#readme","keywords":["object","hash","sha1","md5","sha256","object-hash","esm","typescript"],"license":"MIT","funding":"https://ko-fi.com/bybrave","engines":{"node":">=18"},"devDependencies":{"@types/node":"^20.14.0","esbuild":"^0.25.0","typescript":"^5.5.0"},"_id":"@bybrave/object-hash2@4.0.0","gitHead":"59dded931aabf80bd4d6b7930ad22c4a5ffa564c","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-2gRWWhNSRcZG0ls/LuAUrTUxo6G8PohYfEsJrBs1l6Q5X4mSfbO2u5/J7xSY4NxTX4ES16k26viVfFgFeH11CQ==","shasum":"3c5b1efefa02d139eec18f69b98dd97592277216","tarball":"https://registry.npmjs.org/@bybrave/object-hash2/-/object-hash2-4.0.0.tgz","fileCount":10,"unpackedSize":76706,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC2TM/j29xIyoHSkbwZFTgHImqrCe02GPSgef4np844EgIhAI+QAgTJJuxk39rlnyo9l5jBXWC3ov40qG0JwVD9EE9L"}]},"_npmUser":{"name":"bybrave","email":"opmybrave@gmail.com"},"directories":{},"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/object-hash2_4.0.0_1783217403259_0.1847807763442877"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-05T02:10:03.034Z","4.0.0":"2026-07-05T02:10:03.419Z","modified":"2026-07-05T02:10:03.693Z"},"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"description":"Maintained fork of object-hash — generate hashes from javascript objects in node and the browser. Identical hashes in both, repeated references fixed, 2x faster, 2 KB browser bundle.","homepage":"https://github.com/bybraveHQ/object-hash2#readme","keywords":["object","hash","sha1","md5","sha256","object-hash","esm","typescript"],"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/object-hash2.git"},"contributors":[{"name":"Scott Puleo","url":"author of the original object-hash"}],"author":{"name":"bybrave","url":"https://github.com/bybraveHQ"},"bugs":{"url":"https://github.com/bybraveHQ/object-hash2/issues"},"license":"MIT","readme":"# @bybrave/object-hash2\n\n[![CI](https://github.com/bybraveHQ/object-hash2/actions/workflows/ci.yml/badge.svg)](https://github.com/bybraveHQ/object-hash2/actions)\n[![npm](https://img.shields.io/npm/v/%40bybrave%2Fobject-hash2)](https://www.npmjs.com/package/@bybrave/object-hash2)\n\nMaintained fork of [object-hash](https://github.com/puleos/object-hash) — generate hashes from any javascript value, in Node.js and the browser.\n\nThe original has ~320M downloads/month and no release since 2022. This fork keeps the same API and fixes what was broken underneath: repeated references, browser/node divergence, the prototype-graph walk that halved performance.\n\n```bash\nnpm install @bybrave/object-hash2\n```\n\n```js\n// CommonJS — drop-in\nconst hash = require(\"@bybrave/object-hash2\");\n\n// ESM\nimport hash from \"@bybrave/object-hash2\";\n\nhash({ foo: \"bar\" });                       // 'a02...'\nhash({ foo: \"bar\" }, { algorithm: \"md5\" }); // '132...'\nhash.keys({ foo: \"bar\" });                  // keys only\n```\n\nSame options as the original: `algorithm`, `encoding`, `excludeValues`, `excludeKeys`, `replacer`, `respectType`, `respectFunctionProperties`, `respectFunctionNames`, `unorderedArrays`, `unorderedSets`, `unorderedObjects`, `ignoreUnknown` — see the [original documentation](https://github.com/puleos/object-hash#hashvalue-options).\n\n## What's different from object-hash 3.0.0\n\n| Change | Original issue |\n|---|---|\n| Repeated (non-circular) references hash like copies: `hash([a, a]) === hash([[1,2], [1,2]])`. Real cycles are still detected | [#78](https://github.com/puleos/object-hash/issues/78) |\n| Identical hashes in Node.js and the browser, byte for byte — the browser build runs the same serializer with own md5/sha1/sha256 (fuzz-checked against `node:crypto`) | [#62](https://github.com/puleos/object-hash/issues/62) |\n| Browser bundle 4.5 KB gzipped instead of ~10 KB (no more `crypto-browserify`) | [#91](https://github.com/puleos/object-hash/issues/91) |\n| ~2x faster with default options: the `respectType` prototype-graph walk replaced with a compact type marker | perf reports |\n| `respectType` no longer reads `__proto__`/`constructor`/`prototype` of foreign objects — no more crashes on classes with throwing prototype getters (Mongo `ObjectID` & co) | [#49](https://github.com/puleos/object-hash/issues/49) |\n| `Buffer`, `Uint8Array`, `Uint8ClampedArray`, `ArrayBuffer` and `DataView` with the same bytes hash the same | — |\n| `DataView` hashes by content (the original hashed every `DataView` to the same constant) | — |\n| TypeScript definitions shipped with the package (compatible with `@types/object-hash`) | — |\n| ESM entry (`import hash from \"@bybrave/object-hash2\"`) + `exports` map | — |\n| Build: esbuild instead of gulp + browserify; CI on Node 18/20/22; zero runtime dependencies (as before) | — |\n\n## Hash compatibility with 3.x — read before upgrading\n\nThis is a major release and **some hashes change**. If you persist hashes (cache keys, deduplication), regenerate them on upgrade — the original did the same in its 2.x → 3.x major.\n\nUnchanged (byte-identical to 3.0.0, pinned by tests):\n\n- primitives, strings, dates, regexps, URLs, errors, symbols, bigints, numeric typed arrays — with any options;\n- **everything hashed with `respectType: false`**, as long as the value has no repeated references and no binary types listed below.\n\nChanged:\n\n- default-options hashes of values containing objects or functions (`respectType: true` used to serialize the whole prototype graph — that walk is now a compact marker);\n- values with repeated references (that's the [#78](https://github.com/puleos/object-hash/issues/78) fix);\n- `Buffer` / `Uint8Array` / `Uint8ClampedArray` / `ArrayBuffer` / `DataView` values (unified byte serialization, identical across platforms);\n- hashes produced in the browser (they now match Node.js — that's the point).\n\n## Compatibility\n\n- API is unchanged — drop-in replacement for `object-hash`: `hash()`, `hash.sha1()`, `hash.keys()`, `hash.MD5()`, `hash.keysMD5()`, `hash.writeToStream()`.\n- Node.js ≥ 18; modern browsers. Browser algorithms: `md5`, `sha1`, `sha256` (+ `passthrough`); in Node.js everything from `crypto.getHashes()`.\n- Browser `<script>` builds: `dist/object_hash.js` and `dist/object_hash.min.js` (global `objectHash`), shipped in the npm package.\n\n## Support\n\nIf this package saves you time, you can support maintenance:\n\n[![Ko-fi](https://img.shields.io/badge/Ko--fi-buy%20me%20a%20coffee-FF5E5B?logo=kofi&logoColor=white)](https://ko-fi.com/bybrave)\n[![Bitcoin](https://img.shields.io/badge/Bitcoin-BTC-F7931A?logo=bitcoin&logoColor=white)](#support)\n\nBitcoin (BTC): `bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q`\n\n## Credits & license\n\nMIT, same as the original — see [LICENSE](./LICENSE).\nBased on [object-hash](https://github.com/puleos/object-hash) by Scott Puleo and contributors.\n","readmeFilename":"README.md","_rev":"1-be9f7fec85e8e1129cbb7fcb1639f0bf"}