{"name":"hash-base","version":"3.1.1","keywords":["hash","stream"],"author":{"url":"https://github.com/fanatid","name":"Kirill Fomichev","email":"fanatid@ya.ru"},"license":"MIT","_id":"hash-base@3.1.1","maintainers":[{"name":"ljharb","email":"ljharb@gmail.com"},{"name":"dcousens","email":"npm2025+dan@dcousens.com"},{"name":"cwmma","email":"calvin.metcalf@gmail.com"},{"name":"fanatid","email":"fanatid@ya.ru"}],"homepage":"https://github.com/crypto-browserify/hash-base","bugs":{"url":"https://github.com/crypto-browserify/hash-base/issues"},"dist":{"shasum":"a5a639d82978dcbb71acf2f0691ff372ce7e9805","tarball":"http://registry-npm.ywwl.com/hash-base/download/hash-base-3.1.1.tgz","fileCount":7,"integrity":"sha512-kKPWP4THVMjWxThSgzBNuDzZNQiZmYYzabCEZ+a6jsvKDbrXsiHtMd5CuWGrU28yBv2m0PFMXh4Zs3BQuxv1xQ==","signatures":[{"sig":"MEUCIQD1dH4XVr8uAzJ/aZe35XM+fb0ayvGpNyE527FBXHGeRgIgD3ExYZAN9EDSby+1RF38NBKjHFvA5/fm7fVPOo36Els=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18851,"size":6487,"noattachment":false,"key":"/hash-base/-/hash-base-3.1.1.tgz"},"main":"index.js","engines":{"node":">= 0.10"},"gitHead":"89c7bc0996c013b6a60b52bb8dc8fb2aeab332be","scripts":{"lint":"eslint --ext=js,mjs .","test":"npm run tests-only","prepack":"npmignore --auto --commentLines=autogenerated","pretest":"npm run lint","version":"auto-changelog && git add CHANGELOG.md","posttest":"npx npm@\">=10.2\" audit --production","tests-only":"nyc tape \"test/**/*.js\"","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"repository":{"url":"git+https://github.com/crypto-browserify/hash-base.git","type":"git"},"_npmVersion":"11.5.1","description":"abstract base class for hash-streams","directories":{},"_nodeVersion":"24.7.0","dependencies":{"inherits":"^2.0.4","to-buffer":"^1.2.1","safe-buffer":"^5.2.1","readable-stream":"^2.3.8"},"publishConfig":{"ignore":[".github/workflows",".eslintrc",".nycrc","test"]},"_hasShrinkwrap":false,"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","hideCredit":true,"unreleased":false,"commitLimit":false,"backfillLimit":false},"devDependencies":{"nyc":"^10.3.2","tape":"^5.9.0","eslint":"=8.8.0","npmignore":"^0.3.1","auto-changelog":"^2.5.0","@ljharb/eslint-config":"^21.2.0"},"_npmOperationalInternal":{"tmp":"tmp/hash-base_3.1.1_1758567430732_0.8323731419558689","host":"s3://npm-registry-packages-npm-production"},"readme":"# hash-base\n\n[![npm Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base)\n[![Build Status](https://img.shields.io/travis/crypto-browserify/hash-base.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/hash-base)\n[![Dependency status](https://img.shields.io/david/crypto-browserify/hash-base.svg?style=flat-square)](https://david-dm.org/crypto-browserify/hash-base#info=dependencies)\n\nAbstract base class to inherit from if you want to create streams implementing the same API as node crypto [Hash][1] (for [Cipher][2] / [Decipher][3] check [crypto-browserify/cipher-base][4]).\n\n## Example\n\n```js\nconst HashBase = require('hash-base');\nconst inherits = require('inherits');\n\n// our hash function is XOR sum of all bytes\nfunction MyHash () {\n\tHashBase.call(this, 1); // in bytes\n\n\tthis._sum = 0x00;\n};\n\ninherits(MyHash, HashBase)\n\nMyHash.prototype._update = function () {\n\tfor (let i = 0; i < this._block.length; ++i) {\n\t\tthis._sum ^= this._block[i];\n\t}\n};\n\nMyHash.prototype._digest = function () {\n\treturn this._sum;\n};\n\nconst data = Buffer.from([0x00, 0x42, 0x01]);\nconst hash = new MyHash().update(data).digest();\nconsole.log(hash); // => 67\n```\nYou also can check [source code](index.js) or [crypto-browserify/md5.js][5]\n\n## LICENSE\n\nMIT\n\n[1]: https://nodejs.org/api/crypto.html#crypto_class_hash\n[2]: https://nodejs.org/api/crypto.html#crypto_class_cipher\n[3]: https://nodejs.org/api/crypto.html#crypto_class_decipher\n[4]: https://github.com/crypto-browserify/cipher-base\n[5]: https://github.com/crypto-browserify/md5.js\n","publish_time":1758567430928,"_cnpm_publish_time":1758567430928,"dist-tags":{"3.0-latest":"3.0.5","latest":"3.1.2"}}