{"id":18458747,"url":"https://github.com/browserify/hash-base","last_synced_at":"2026-03-15T02:31:40.771Z","repository":{"id":55905189,"uuid":"55363879","full_name":"browserify/hash-base","owner":"browserify","description":"abstract base class for hash-streams","archived":false,"fork":false,"pushed_at":"2024-12-21T09:59:37.000Z","size":49,"stargazers_count":11,"open_issues_count":4,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T13:18:59.062Z","etag":null,"topics":["cipher","crypto","crypto-browserify","hash","javascript","stream"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browserify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/hash-base","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-04-03T19:10:33.000Z","updated_at":"2024-11-24T18:19:12.000Z","dependencies_parsed_at":"2025-01-25T22:16:21.760Z","dependency_job_id":"d80c167f-da5f-402d-8975-4f93ce44a3c5","html_url":"https://github.com/browserify/hash-base","commit_stats":null,"previous_names":["crypto-browserify/hash-base"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fhash-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserify","download_url":"https://codeload.github.com/browserify/hash-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247785919,"owners_count":20995641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cipher","crypto","crypto-browserify","hash","javascript","stream"],"created_at":"2024-11-06T08:19:53.614Z","updated_at":"2026-03-15T02:31:40.762Z","avatar_url":"https://github.com/browserify.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ljharb","https://tidelift.com/funding/github/npm/hash-base"],"categories":[],"sub_categories":[],"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\u0026style=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 \u003c 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); // =\u003e 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserify%2Fhash-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserify%2Fhash-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserify%2Fhash-base/lists"}