{"name":"ohash","version":"1.1.2","description":"Super fast hashing library based on murmurhash3 written in Vanilla JS","repository":{"type":"git","url":"git+https://github.com/unjs/ohash.git"},"license":"MIT","sideEffects":false,"type":"module","exports":{".":{"import":"./dist/index.mjs","types":"./dist/index.d.ts","require":"./dist/index.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","devDependencies":{"@types/node":"^18.15.11","@vitest/coverage-c8":"^0.30.1","c8":"^7.13.0","changelogen":"^0.5.3","eslint":"^8.38.0","eslint-config-unjs":"^0.1.0","prettier":"^2.8.7","typescript":"^5.0.4","unbuild":"^1.2.1","vitest":"^0.30.1"},"packageManager":"pnpm@8.3.0","scripts":{"build":"unbuild","dev":"vitest dev","lint":"eslint --ext .ts,.js,.mjs,.cjs . && prettier -c src test","lint:fix":"eslint --fix --ext .ts,.js,.mjs,.cjs . && prettier -w src test","release":"pnpm test && changelogen --release --push && pnpm publish","test":"pnpm lint && vitest run"},"bugs":{"url":"https://github.com/unjs/ohash/issues"},"homepage":"https://github.com/unjs/ohash#readme","_id":"ohash@1.1.2","_integrity":"sha512-9CIOSq5945rI045GFtcO3uudyOkYVY1nyfFxVQp+9BRgslr8jPNiSSrsFGg/BNTUFOLqx0P5tng6G32brIPw0w==","_resolved":"/private/var/folders/s0/k4lcb4b50bj9r4fch4_1h_l40000gn/T/0b55ef4974c5e850fbeb6502918cfcde/ohash-1.1.2.tgz","_from":"file:ohash-1.1.2.tgz","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-9CIOSq5945rI045GFtcO3uudyOkYVY1nyfFxVQp+9BRgslr8jPNiSSrsFGg/BNTUFOLqx0P5tng6G32brIPw0w==","shasum":"902dd01484f5573ef941d8f9e81105a2e13fd9ba","tarball":"http://registry-npm.ywwl.com/ohash/download/ohash-1.1.2.tgz","fileCount":7,"unpackedSize":68263,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC/KeEJ955cAO8PMcmQPDSznhg6CdswNafJ07aUejZohAiAgvTKBsLmHPXcRamaJK7E/ScgZPoc0H6VclKgBRQUZbg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQpPNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2wRAAlKNK5bMBRz2pEMdTdY3tfsVQJAqOmXD77Fp3koruxy9wPN+U\r\nIOiRDP6il4W1weC2lKQI+k/QxMkJU16+2AmTPj6RBGKnFkCEiTA0r8wvD7+g\r\nwoNnIfAg3CrGBYHentI9eXkDGmFrMQI9Ng/+7j21nyXv6q2HQQtjAkGl5NXC\r\nlT54Y82qBXbGQMwonQi24QK8ErkzI9LAwq34UJiWvz9bchs5YYoCoCKCAmtv\r\nHZBJrLK+1E42xPtZMaev7k+1f4e7QIL6GIhuMOC5jtRoH9oyH9ePIDIBR2wZ\r\nraYdszSpuqZai9GjE76G04+2VWN1lFhInCkKa63DuMZ81Ug65GWamorTRvb2\r\nVJCrK+31ONrCQWYo389cy1S4Yr5c7mURMRJCq+xd2CrxZ3Xe/zj4O0kLSq75\r\nMkerBVDHeo9CodZw2pP0SdL6gDWbRbhw359kirogDEF/f+3Hvw3Esge2BdST\r\nmmRMxBnVEl0AkAvb9vk6rT4MMUi4HluOa+RPJ2ANZXS1GLv9uwDgk6l80C6l\r\nwQ+2xB9hvDqWgm+IwQAtrU3gOXwkMUDI8N4A576zazJmno6vFoqJ5WRdv0AE\r\nbVgXSuo10of3NGk74z++UqLLKAOFzDdfOL+63BkKCxnXHlZiwnoiG+ZSkJhP\r\ntxY89XReQznHubKxQX8lFWshi/Pr8u0SD4E=\r\n=yZyb\r\n-----END PGP SIGNATURE-----\r\n","size":9819,"noattachment":false,"key":"/ohash/-/ohash-1.1.2.tgz"},"_npmUser":{"name":"pi0","email":"pyapar@gmail.com"},"directories":{},"maintainers":[{"name":"pi0","email":"pyapar@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ohash_1.1.2_1682084813739_0.9173077516877344"},"_hasShrinkwrap":false,"readme":"# ohash\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions][github-actions-src]][github-actions-href]\n[![Codecov][codecov-src]][codecov-href]\n[![bundle size][bundle-src]][bundle-href]\n\n> Super fast hashing library written in Vanilla JS\n\n## Usage\n\nInstall package:\n\n```sh\n# npm\nnpm install ohash\n\n# yarn\nyarn add ohash\n\n# pnpm\npnpm install ohash\n```\n\nImport:\n\n```js\n// ESM\nimport { hash, objectHash, murmurHash, sha256 } from \"ohash\";\n\n// CommonJS\nconst { hash, objectHash, murmurHash, sha256 } = require(\"ohash\");\n```\n\n### `hash(object, options?)`\n\nConverts object value into a string hash using `objectHash` and then applies `sha256` with Base64 encoding (trimmed by length of 10).\n\nUsage:\n\n```js\nimport { hash } from \"ohash\";\n\n// \"dZbtA7f0lK\"\nconsole.log(hash({ foo: \"bar\" }));\n```\n\n### `objectHash(object, options?)`\n\nConverts a nest object value into a stable and safe string for hashing.\n\nUsage:\n\n```js\nimport { objectHash } from \"ohash\";\n\n// \"object:1:string:3:foo:string:3:bar,\"\nconsole.log(objectHash({ foo: \"bar\" }));\n```\n\n### `isEqual(obj1, obj2, options?)`\n\nCompare two objects using reference equality and stable object hashing.\n\nUsage:\n\n```js\nimport { isEqual } from \"ohash\";\n\n// true\nconsole.log(isEqual({ a: 1, b: 2 }, { b: 2, a: 1 }));\n```\n\n### `diff(obj1, obj2, options?)`\n\nCompare two objects with nested hashing. Returns an array of changes.\n\nReturned value is an array of diff entries with `$key`, `$hash`, `$value` and `$props`. When logging, a string version of changelog is displayed.\n\nUsage:\n\n```js\nimport { diff } from \"ohash\";\n\nconst createObject = () => ({\n  foo: \"bar\",\n  nested: {\n    y: 123,\n    bar: {\n      baz: \"123\",\n    },\n  },\n});\n\nconst obj1 = createObject();\nconst obj2 = createObject();\n\nobj2.nested.x = 123;\ndelete obj2.nested.y;\nobj2.nested.bar.baz = 123;\n\nconst diff = diff(obj1, obj2);\n\n// [-] Removed nested.y\n// [~] Changed nested.bar.baz from \"123\" to 123\n// [+] Added   nested.x\nconsole.log(diff(obj1, obj2));\n```\n\n### `murmurHash(str)`\n\nConverts input string (of any length) into a 32-bit positive integer using [MurmurHash3](<(https://en.wikipedia.org/wiki/MurmurHash)>).\n\nUsage:\n\n```js\nimport { murmurHash } from \"ohash\";\n\n// \"2708020327\"\nconsole.log(murmurHash(\"Hello World\"));\n```\n\n### `sha256`\n\nCreate a secure [SHA 256](https://en.wikipedia.org/wiki/SHA-2) digest from input string.\n\n```js\nimport { sha256 } from \"ohash\";\n\n// \"a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e\"\nconsole.log(sha256(\"Hello World\"));\n```\n\n### `sha256base64`\n\nCreate a secure [SHA 256](https://en.wikipedia.org/wiki/SHA-2) digest in Base64 encoding from input string.\n\n```js\nimport { sha256base64 } from \"ohash\";\n\n// \"pZGm1Av0IEBKARczz7exkNYsZb8LzaMrV7J32a2fFG4\"\nconsole.log(sha256base64(\"Hello World\"));\n```\n\n## 💻 Development\n\n- Clone this repository\n- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)\n- Install dependencies using `pnpm install`\n- Run interactive tests using `pnpm dev`\n\n## License\n\nMade with 💛\n\nPublished under [MIT License](./LICENSE).\n\nBased on [puleos/object-hash](https://github.com/puleos/object-hash) by [Scott Puleo](https://github.com/puleos/), and implementations from [perezd/node-murmurhash](perezd/node-murmurhash) and\n[garycourt/murmurhash-js](https://github.com/garycourt/murmurhash-js) by [Gary Court](mailto:gary.court@gmail.com) and [Austin Appleby](mailto:aappleby@gmail.com) and [brix/crypto-js](https://github.com/brix/crypto-js).\n\n<!-- Badges -->\n\n[npm-version-src]: https://img.shields.io/npm/v/ohash?style=flat-square\n[npm-version-href]: https://npmjs.com/package/ohash\n[npm-downloads-src]: https://img.shields.io/npm/dm/ohash?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/ohash\n[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/ohash/ci/main?style=flat-square\n[github-actions-href]: https://github.com/unjs/ohash/actions?query=workflow%3Aci\n[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/ohash/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/unjs/ohash\n[bundle-src]: https://flat.badgen.net/bundlephobia/minzip/ohash\n[bundle-href]: https://bundlephobia.com/package/ohash\n","publish_time":1682084813937,"_cnpm_publish_time":1682084813937,"dist-tags":{"1x":"1.1.6","latest":"2.0.12"}}