{"name":"ohash","version":"0.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","require":"./dist/index.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","scripts":{"build":"unbuild","dev":"vitest dev","lint":"eslint --ext .ts,.js,.mjs,.cjs .","prepack":"unbuild","release":"pnpm test && standard-version && git push --follow-tags && pnpm publish","test":"pnpm lint && vitest run"},"devDependencies":{"@nuxtjs/eslint-config-typescript":"latest","@types/node":"^18.0.4","c8":"latest","eslint":"latest","standard-version":"latest","typescript":"latest","unbuild":"latest","vitest":"latest"},"packageManager":"pnpm@7.5.2","gitHead":"0043a7c960142223b15085edd08c08513f178572","bugs":{"url":"https://github.com/unjs/ohash/issues"},"homepage":"https://github.com/unjs/ohash#readme","_id":"ohash@0.1.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-pkdJpKCYKVwvjyy319Nf8fCecepJlpKkUiQilH6UfRyrHGA4tgF/pz+NvGTem1ETSEX6GLq/eIv7emKd1+HQHg==","shasum":"7fc865bee196174b15bc0795a8a66c80a865bfab","tarball":"http://registry-npm.ywwl.com/ohash/download/ohash-0.1.2.tgz","fileCount":6,"unpackedSize":37626,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFG8UtHLfc9juMDWl0m9xd0MNS6imZ3x5axjWpZwU2M6AiEA6SEzkVmbVd6BtlIXUzjZokrgFpZWTTdemTHNfaheY1Q="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0AsKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQaBAAgZkzGNMQKFlxM7OIgVfU5EZ2eloS6ZOxgOJ6KWldleW8NMoq\r\nVFGuoLh8w473ZlnFjtseVWT3ViVmEzmUiHFeRvTAXvrKAbLcevV0btPjHNr2\r\nDPOhT9Kp6otdyj9vCC0fifP3Nt1JQgW27Hp367imt4DRd89GVYjSdJ1EBQn2\r\nVeeAHW3T0foUr+QhzYwEvWi3/xCts8ptobuGOmcnJOAxGmQJ1VAJqdmBmjmC\r\nVcIojhX1J2yzYoz74bHKmwyaGLuSQwj8dNngvuzuIVvddce4m6ZWyvXZurfN\r\nGplEO6yXTlr1dbLF8mgQPqr1UP9JN4iELu+bfgj7x7VHd2jCrx/yNl+BuVID\r\nC66PuKqyyp/UQQ1v398DhnQmvX5orsTn587rfQL03gWvB1KVpkOhIHDabm1G\r\n81KKfAqqbJ3KAM4WojdxY+LuvXRLYmGDUKg8UmwG3EU/i9/Ewtye7QoW2+7u\r\nmKchlq0bBwD9e01050666487ok4cDvl59KnsIfE5/7bdKWFvEb8t4XnKmvPH\r\nEnAcmQrR7yRPhsQleflZyGzEqdIGf4AH38GrYPq+yd9bo7mxaSRL9nR+6PSh\r\nPTL2XPtkjLXKk5C5ik65GpnzY/WWfAf6VDTe2Uw6Q9DC/Tb1kyjsHCX3rcgJ\r\nwXLuVKk0spIHwq4cO2MnZ3ijq/PmMriAAUA=\r\n=xsfc\r\n-----END PGP SIGNATURE-----\r\n","size":7201,"noattachment":false,"key":"/ohash/-/ohash-0.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_0.1.2_1657801482393_0.7576554869672982"},"_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":1657801482542,"_cnpm_publish_time":1657801482542,"dist-tags":{"1x":"1.1.6","latest":"2.0.12"}}