{"name":"hasha","version":"5.2.1","description":"Hashing made simple. Get the hash of a buffer/string/stream/file.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/hasha.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["hash","hashing","crypto","hex","base64","md5","sha1","sha256","sha512","sum","stream","file","fs","buffer","string","text","rev","revving","simple","easy"],"dependencies":{"is-stream":"^2.0.0","type-fest":"^0.8.0"},"devDependencies":{"@types/node":"^12.7.5","ava":"^2.4.0","proxyquire":"^2.1.0","tsd":"^0.8.0","xo":"^0.24.0"},"xo":{"rules":{"import/no-unresolved":"off"}},"gitHead":"0184c7126d1ccf08ba8b28daa5355b634188bf90","bugs":{"url":"https://github.com/sindresorhus/hasha/issues"},"homepage":"https://github.com/sindresorhus/hasha#readme","_id":"hasha@5.2.1","_nodeVersion":"14.11.0","_npmVersion":"6.14.8","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-x15jnRSHTi3VmH+oHtVb9kgU/HuKOK8mjK8iCL3dPQXh4YJlUb9YSI8ZLiiqLAIvY2wuDIlZYZppy8vB2XISkQ==","shasum":"0e5b492aa40de3819e80955f221d2fccef55b5aa","tarball":"http://registry-npm.ywwl.com/hasha/download/hasha-5.2.1.tgz","fileCount":6,"unpackedSize":15978,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcIeXCRA9TVsSAnZWagAA4KEP/25glBpp4y6LPPQcWLxo\nisv/gw5SphiNtALv8ZfOTcpmLYWIH4009JAhbTh4pnKypxU4ZAwny8rqrhXV\nFpGpYa4tqDGekcuQFjMRszpxiWXDKvN1sT1smlCwHLBDfb0mfRAC0vkt/IrW\nYWdNxzK14hu60NZUqvlCMrTqIVJwEUXnRyx62LiuGxRbCTyYeEvEKmZELo01\nUEkRn5C0W+vqu0wBLRJiGnO7JwFEhl0PKGDtYrTBktVnMr42NbPSesx2/V2t\nMc9c0zC6IyAWba4DJrG8VKY90UMWugGLuEG0SwZuORNVCJnAS2QoVP/5DBJD\nnxUJwKk8fXTzXPt8jKR0NretOcf1eQy/XgbSiIy9VAUHEeG1FPZrdfgkYyYA\ntLcT3H71n16HQzNDVHeexk81xEz3ENzxSN/JxhSA5YIuUdGN2Vq6tCQ+HjCq\n1NaMx9Yz1IHAZvRzCu/BCz7TAoPGwwcuCMEF7262X02ttsiZqZ6X58VzyOmb\nlMC54Zik1glVNYhvvv+4MxABTjqBV4jiGYRnvTJwfnoVMzA1u25nlQvJ5fY6\ne/eDmXJeVdr85wbaJ9i4DGJOR3kGYipc/18uPw66pPmmtYgSHy75ESup5D6f\n5YWL6h6/Tt8ztWt0sAQmfp2NLQubCujB/btVr/U2ykOHbjqffyH+Awm4XPl5\nsyfp\r\n=GP6a\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAGTk/LDGYhBcl5RhgNGFbC5lqk0jGLtEA1UIF4bUO+yAiBOjbRu1FnjJtTjQVpE1ATwn52Y0B0IuYEzQgfeI/EP6A=="}],"size":4939,"noattachment":false,"key":"/hasha/-/hasha-5.2.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hasha_5.2.1_1601210262551_0.6942955914665843"},"_hasShrinkwrap":false,"readme":"<h1 align=\"center\">\n\t<br>\n\t<br>\n\t<br>\n\t<img width=\"380\" src=\"media/logo.svg\" alt=\"hasha\">\n\t<br>\n\t<br>\n\t<br>\n\t<br>\n\t<br>\n</h1>\n\n> Hashing made simple. Get the hash of a buffer/string/stream/file.\n\nConvenience wrapper around the core [`crypto` Hash class](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm) with simpler API and better defaults.\n\n## Install\n\n```sh\nnpm install hasha\n```\n\n## Usage\n\n```js\nimport {hash} from 'hasha';\n\nawait hash('unicorn');\n//=> 'e233b19aabc7d5e53826fb734d1222f1f0444c3a3fc67ff4af370a66e7cadd2cb24009f1bc86f0bed12ca5fcb226145ad10fc5f650f6ef0959f8aadc5a594b27'\n```\n\n## API\n\nSee the Node.js [`crypto` docs](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options) for more about hashing.\n\n### hash(input, options?)\n\nThe operation is executed using `worker_threads`. A thread is lazily spawned on the first operation and lives until the end of the program execution. It's unrefed, so it won't keep the process alive.\n\nReturns a hash asynchronously.\n\n### hashSync(input, options?)\n\nReturns a hash.\n\n#### input\n\nType: `Uint8Array | string | Array<Uint8Array | string> | NodeJS.ReadableStream` *(`NodeJS.ReadableStream` is not available in `hashSync`)*\n\nThe value to hash.\n\nWhile strings are supported you should prefer buffers as they're faster to hash. Although if you already have a string you should not convert it to a buffer.\n\nPass an array instead of concatenating strings and/or buffers. The output is the same, but arrays do not incur the overhead of concatenation.\n\n#### options\n\nType: `object`\n\n##### encoding\n\nType: `string`\\\nDefault: `'hex'`\\\nValues: `'hex' | 'base64' | 'buffer' | 'latin1'`\n\nThe encoding of the returned hash.\n\n##### algorithm\n\nType: `string`\\\nDefault: `'sha512'`\\\nValues: `'md5' | 'sha1' | 'sha256' | 'sha512'` *([Platform dependent](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options))*\n\n*The `md5` algorithm is good for [file revving](https://github.com/sindresorhus/rev-hash), but you should never use `md5` or `sha1` for anything sensitive. [They're insecure.](https://security.googleblog.com/2014/09/gradually-sunsetting-sha-1.html)*\n\n### hashFile(filePath, options?)\n\nThe operation is executed using `worker_threads`. A thread is lazily spawned on the first operation and lives until the end of the program execution. It's unrefed, so it won't keep the process alive.\n\nReturns a `Promise` for the calculated file hash.\n\n```js\nimport {hashFile} from 'hasha';\n\n// Get the MD5 hash of an image\nawait hashFile('unicorn.png', {algorithm: 'md5'});\n//=> '1abcb33beeb811dca15f0ac3e47b88d9'\n```\n\n### hashFileSync(filePath, options?)\n\nReturns the calculated file hash.\n\n```js\nimport {hashFileSync} from 'hasha';\n\n// Get the MD5 hash of an image\nhashFileSync('unicorn.png', {algorithm: 'md5'});\n//=> '1abcb33beeb811dca15f0ac3e47b88d9'\n```\n\n### hashingStream(options?)\n\nReturns a [hash transform stream](https://nodejs.org/api/crypto.html#crypto_class_hash).\n\n```js\nimport {hashingStream} from 'hasha';\n\n// Hash the process input and output the hash sum\nprocess.stdin.pipe(hashingStream()).pipe(process.stdout);\n```\n\n## Related\n\n- [hasha-cli](https://github.com/sindresorhus/hasha-cli) - CLI for this module\n- [crypto-hash](https://github.com/sindresorhus/crypto-hash) - Tiny hashing module that uses the native crypto API in Node.js and the browser\n- [hash-object](https://github.com/sindresorhus/hash-object) - Get the hash of an object\n- [md5-hex](https://github.com/sindresorhus/md5-hex) - Create a MD5 hash with hex encoding\n","publish_time":1601210262740,"_cnpm_publish_time":1601210262740,"dist-tags":{"latest":"7.0.0"}}