{"name":"hasha","version":"4.0.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"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd-check"},"keywords":["hash","hashing","crypto","hex","base64","md5","sha1","sha256","sha512","sum","stream","file","fs","buffer","string","text","rev","revving","simple","easy"],"dependencies":{"is-stream":"^1.0.1"},"devDependencies":{"@types/node":"^11.10.5","ava":"^1.3.1","proxyquire":"^2.1.0","tsd-check":"^0.3.0","xo":"^0.24.0"},"gitHead":"d6d569112d01938a26275e285886474db2aa9b6d","bugs":{"url":"https://github.com/sindresorhus/hasha/issues"},"homepage":"https://github.com/sindresorhus/hasha#readme","_id":"hasha@4.0.1","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-+wnvroCn3pq0CAKWfItGPyl0DJOob2qs/2D/Rh0a/O90LBzmo5GaKHwIRb6FInVvmEl1mCIHL5RqlfTLvh6FoQ==","shasum":"1b0d97b5732127660f2e0b1371c2cc35962f17d0","tarball":"http://registry-npm.ywwl.com/hasha/download/hasha-4.0.1.tgz","fileCount":5,"unpackedSize":9784,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJciOkuCRA9TVsSAnZWagAAC3cP/iy7s9RaQ+Wx+qv9vqiZ\naBONGG32nAkaoUX6MXvHKo0bqnnuaotrR+zsRWDYs5+N2PQTKzNA13fIiF/z\nE2vK/EP75FrF/ccrqA29nR4PmOdSKQUxMb5ibRCnZ3hX9Oy0RV5g/gYoeA14\nDvfTxRdIfhdrlyuC0AJ89W7Y3yfdk2Qtup/rRtMj9JJkdFzqYtqIhzyyTthz\nSS1mbpwGsCDA11LtPeQKmapCcUlNx/1n9q0IKCKXjxlN5Aa9nvGCNNKc+PoP\nrwxrdvCCNKOZ7swqUIy5AnOcuv5VnBmjLcX8G8ToCzHHHZZTSXASwoA+2+8Q\nVZ8Q9XAU7iwnnHGMQyFwYgzyGiYaoYwHsjwkLipcIJ+Mh58a6lkOZ/GN+4cT\nabngz5Liy1kg3fqsWazUyjTbSHYEgKtbBmTitZCs+uXsUz0uTZKxFAwGWpCS\n2Kt+ubOD7Oz+/rG7ZIlv8k6O8ddrbrwivSJtXl78/ohim3ZnnyUz64Psegv1\nQALQkO5SYGrfICVr3eNZu+W21rUiETgFkfvUF1lg+QIxW/NendslulywHNQh\nPgoLz+LVP4wjrFT48CD2YdoNXsdm5eYecaMoql26X/ue4cpIUkCEuOWXl7tC\nlz4JO6oWE7ZO58aP5mLiICxDiWIcdU0qWbX6A3jwg7TGGeKN71V+HC6TBL6e\nw25S\r\n=amgf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCr7NSDyZde8n3q9zD2UsoFQQgkfea07job7QAFyJL7+gIhAMyYxgRLEdo7say80wJpm0HiVDvm321nSO1bWDs/9cpJ"}],"size":3657,"noattachment":false,"key":"/hasha/-/hasha-4.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hasha_4.0.1_1552476462238_0.2508379897893258"},"_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":1552476462345,"_cnpm_publish_time":1552476462345,"dist-tags":{"latest":"7.0.0"}}