{"name":"ohash","version":"0.1.4","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","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","scripts":{"build":"unbuild","dev":"vitest dev","lint":"eslint --ext .ts,.js,.mjs,.cjs .","release":"pnpm test && standard-version && git push --follow-tags && pnpm publish","test":"pnpm lint && vitest run"},"bugs":{"url":"https://github.com/unjs/ohash/issues"},"homepage":"https://github.com/unjs/ohash#readme","_id":"ohash@0.1.4","_integrity":"sha512-imsZ/lYOvZldyO6clK9uu6t2PIMr3bxCPAi6jJyPezKLU5/42UwMfGIlZML6GlpUxmSHxRoDo7VMWqI8VGllQQ==","_resolved":"/tmp/7bf7ed08716c31ccf4957ce05139e3fb/ohash-0.1.4.tgz","_from":"file:ohash-0.1.4.tgz","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-imsZ/lYOvZldyO6clK9uu6t2PIMr3bxCPAi6jJyPezKLU5/42UwMfGIlZML6GlpUxmSHxRoDo7VMWqI8VGllQQ==","shasum":"e5b55740b6047b9b66a3b836b1c92cc747197c05","tarball":"http://registry-npm.ywwl.com/ohash/download/ohash-0.1.4.tgz","fileCount":6,"unpackedSize":40099,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC1dnccFEBzRoHoDO3soZTLQPguv1j5k38vCTecxiwmWAiEAuqh4HBxLVI2CH/1ZVgWs9bhunMDz2EaEdNO4pQlqS90="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0HKvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTOQ//dtiinoQZneuY4XtluJVdM/0ZEa0Zck/CzMWcKwpB4SJViZP8\r\nIKO2YGj097Y0VFuqIoFGnkEj6ATZZZFLf823K61I/HpYAL3zSiM+uvVP3DzN\r\nJ71E/7dKyUVCnpSv4N9H4EOP4HrNjIJJujxnha0xVowtrw9VVpTEUXQGa6sj\r\nAOXEXcIFAGPTCEy5Sof+iHRPWNlx7lDdKUoRUe4OWF2S7GELJTUegasKFwwJ\r\nToXwLdChEAAZN3Lr8PXthUPdvF0u5utt2v8u1IU/LaNKgPMh0aJKT+2KK+Z7\r\ne2aHZb7BjQYypD8AKmpOJJpUkLoXfqeSQjF1/DLr1vIJpEDQBzwIZS5G8b7E\r\n5nXmYRuiEqwWkCvIWzX94eUk9RXTDfnkGyD/Dwax+WUNjABW3zKfnFzD7xgc\r\nUgk9w+xS062v9EzDvRhavjwYIztTIonSpyYqcSgU9xv4XqlrYaTl6eRlQIRk\r\nUBLE9kDkvdr3C8kRONwOvaKUr5QHeIzpXSZ+58ajYzhKNRJT0DvWK9y3ItoJ\r\nf20S35GZen+ofQrrT8mf8b42mnnsEqumdJ8xWoRJse9zXcnOS2eIWuQ0EKAt\r\nqVkp8+B2GdB/NNmKVWfW9I/e5LajJ6kcreyGJqwg+NCGXfXjy5hnQamOWxZd\r\nN34fB8ydlQUy3LIFV7PUzKUBS1Ql56cDI9k=\r\n=aq2s\r\n-----END PGP SIGNATURE-----\r\n","size":7938,"noattachment":false,"key":"/ohash/-/ohash-0.1.4.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.4_1657828014753_0.8030335658527994"},"_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":1657828014972,"_cnpm_publish_time":1657828014972,"dist-tags":{"1x":"1.1.6","latest":"2.0.12"}}