{"name":"hash-base","version":"3.1.2","description":"abstract base class for hash-streams","keywords":["hash","stream"],"homepage":"https://github.com/crypto-browserify/hash-base","bugs":{"url":"https://github.com/crypto-browserify/hash-base/issues"},"license":"MIT","author":{"name":"Kirill Fomichev","email":"fanatid@ya.ru","url":"https://github.com/fanatid"},"main":"index.js","repository":{"type":"git","url":"git+https://github.com/crypto-browserify/hash-base.git"},"scripts":{"prepack":"npmignore --auto --commentLines=autogenerated","lint":"eslint --ext=js,mjs .","pretest":"npm run lint","test":"npm run tests-only","tests-only":"nyc tape \"test/**/*.js\"","posttest":"npx npm@\">=10.2\" audit --production","version":"auto-changelog && git add CHANGELOG.md","postversion":"auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""},"dependencies":{"inherits":"^2.0.4","readable-stream":"^2.3.8","safe-buffer":"^5.2.1","to-buffer":"^1.2.1"},"devDependencies":{"@ljharb/eslint-config":"^21.2.0","auto-changelog":"^2.5.0","encoding":"^0.1.13","eslint":"=8.8.0","npmignore":"^0.3.1","nyc":"^10.3.2","tape":"^5.9.0"},"engines":{"node":">= 0.8"},"publishConfig":{"ignore":[".github/workflows",".eslintrc",".nycrc","test"]},"auto-changelog":{"output":"CHANGELOG.md","template":"keepachangelog","unreleased":false,"commitLimit":false,"backfillLimit":false,"hideCredit":true},"_id":"hash-base@3.1.2","gitHead":"e6638b8e757ce1f140fb0c38a3deb18f8bfc7018","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg==","shasum":"79d72def7611c3f6e3c3b5730652638001b10a74","tarball":"http://registry-npm.ywwl.com/hash-base/download/hash-base-3.1.2.tgz","fileCount":7,"unpackedSize":19258,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCBbQaWPpVSzuNpuV86droBGMMNff8ZF7N3lxPrMbZoewIgdGbKVQlYV0+dmfayHy296OrYTNl7jwWDSqGOUEJg4G0="}],"size":6596,"noattachment":false,"key":"/hash-base/-/hash-base-3.1.2.tgz"},"_npmUser":{"name":"ljharb","email":"ljharb@gmail.com"},"directories":{},"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"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hash-base_3.1.2_1758585746408_0.4535819098151128"},"_hasShrinkwrap":false,"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":1758585746619,"_cnpm_publish_time":1758585746619,"dist-tags":{"3.0-latest":"3.0.5","latest":"3.1.2"}}